Gets (in a SIP wise manner) the SIP port from a SIP URI ; if the port is not explicitly set in the URI, it returns the default port corresponding to the used transport protocol (if protocol misses, we assume the default protos according to the URI schema) */
| 102 | to the used transport protocol (if protocol misses, we assume the default |
| 103 | protos according to the URI schema) */ |
| 104 | static inline unsigned short get_uri_port(struct sip_uri* _uri, |
| 105 | unsigned short *_proto) |
| 106 | { |
| 107 | unsigned short port; |
| 108 | unsigned short proto; |
| 109 | |
| 110 | /* known protocol? */ |
| 111 | if ((proto=_uri->proto)==PROTO_NONE) { |
| 112 | /* use UDP as default proto, but TLS for secure schemas */ |
| 113 | proto = (_uri->type==SIPS_URI_T || _uri->type==TELS_URI_T)? |
| 114 | PROTO_TLS : PROTO_UDP ; |
| 115 | } |
| 116 | |
| 117 | /* known port? */ |
| 118 | if ((port=_uri->port_no)==0) |
| 119 | port = protos[proto].default_rfc_port; |
| 120 | |
| 121 | if (_proto) *_proto = proto; |
| 122 | |
| 123 | return port; |
| 124 | } |
| 125 | |
| 126 | |
| 127 | /** |
no outgoing calls
no test coverage detected