Browse code

- updated to the modified dns api

Andrei Pelinescu-Onciul authored on 18/06/2007 21:23:54
Showing 1 changed files
... ...
@@ -68,8 +68,8 @@ inline static enum sip_protos get_proto(enum sip_protos force_proto,
68 68
 	switch(force_proto) {
69 69
 		case PROTO_NONE: /* no protocol has been forced -- look at proto */
70 70
 			switch(proto) {
71
-				case PROTO_NONE: /* uri default to UDP */
72
-						return PROTO_UDP;
71
+				case PROTO_NONE: /* leave it to dns */
72
+						return PROTO_NONE;
73 73
 				case PROTO_UDP:/* transport specified explicitly */
74 74
 #ifdef USE_TCP
75 75
 				case PROTO_TCP:
... ...
@@ -162,7 +162,7 @@ inline static struct proxy_l *uri2proxy( str *uri, int proto )
162 162
  * returns 0 on success, < 0 on error
163 163
  */
164 164
 inline static int get_uri_send_info(str* uri, str* host, unsigned short* port,
165
-									short* proto, short* comp)
165
+									char* proto, short* comp)
166 166
 {
167 167
 	struct sip_uri parsed_uri;
168 168
 	enum sip_protos uri_proto;
... ...
@@ -216,7 +216,8 @@ inline static int get_uri_send_info(str* uri, str* host, unsigned short* port,
216 216
  *                 (see get_send_socket()) 
217 217
  *         uri   - uri in str form
218 218
  *         proto - if != PROTO_NONE, this protocol will be forced over the
219
- *                 uri_proto, otherwise the uri proto will be used
219
+ *                 uri_proto, otherwise the uri proto will be used if set or
220
+ *                 the proto obtained from the dns lookup
220 221
  * returns 0 on error, dst on success
221 222
  */
222 223
 #ifdef USE_DNS_FAILOVER
... ...
@@ -274,7 +275,7 @@ inline static struct dest_info *uri2dst(struct dest_info* dst,
274 275
 		do{
275 276
 			/* try all the ips until we find a good send socket */
276 277
 			err=dns_sip_resolve2su(dns_h, &to, host,
277
-									parsed_uri.port_no, dst->proto, dns_flags);
278
+								parsed_uri.port_no, &dst->proto, dns_flags);
278 279
 			if (err!=0){
279 280
 				if (ip_found==0){
280 281
 					LOG(L_ERR, "ERROR: uri2dst: failed to resolve \"%.*s\" :"
... ...
@@ -300,7 +301,7 @@ inline static struct dest_info *uri2dst(struct dest_info* dst,
300 301
 		return dst;
301 302
 	}
302 303
 #endif
303
-	if (sip_hostport2su(&dst->to, host, parsed_uri.port_no, dst->proto)!=0){
304
+	if (sip_hostport2su(&dst->to, host, parsed_uri.port_no, &dst->proto)!=0){
304 305
 		LOG(L_ERR, "ERROR: uri2dst: failed to resolve \"%.*s\"\n",
305 306
 					host->len, ZSW(host->s));
306 307
 		return 0;