tm: updated to the new snd_flags_t structure
authorAndrei Pelinescu-Onciul <andrei@iptel.org>
Thu, 17 Dec 2009 12:29:50 +0000 (13:29 +0100)
committerAndrei Pelinescu-Onciul <andrei@iptel.org>
Thu, 17 Dec 2009 12:29:50 +0000 (13:29 +0100)
modules/tm/t_fwd.c
modules/tm/t_reply.c
modules/tm/uac.c
modules/tm/ut.h

index 1e9644d..af7ab47 100644 (file)
@@ -659,8 +659,10 @@ static int add_uac( struct cell *t, struct sip_msg *request, str *uri,
                t->uac[branch].request.dst.send_sock =
                get_send_socket( request, &t->uac[branch].request.dst.to,
                                                                t->uac[branch].request.dst.proto);
-               t->uac[branch].request.dst.send_flags=request?
-                                                                                               request->fwd_send_flags:0;
+               if (request)
+                       t->uac[branch].request.dst.send_flags=request->fwd_send_flags;
+               else
+                       SND_FLAGS_INIT(&t->uac[branch].request.dst.send_flags);
                next_hop=0;
        }else {
                next_hop= next_hop?next_hop:uri;
@@ -845,7 +847,7 @@ int add_uac_dns_fallback(struct cell *t, struct sip_msg* msg,
                                 * in the rest of the message, only in the VIA HF (Miklos) */
                                ret=add_uac_from_buf(t,  msg, &old_uac->uri,
                                                        &old_uac->path,
-                                                        (old_uac->request.dst.send_flags &
+                                                        (old_uac->request.dst.send_flags.f &
                                                                SND_F_FORCE_SOCKET)?
                                                                        old_uac->request.dst.send_sock:0,
                                                        old_uac->request.dst.send_flags,
@@ -858,7 +860,7 @@ int add_uac_dns_fallback(struct cell *t, struct sip_msg* msg,
                                 *  must be changed and the send_socket might be different =>
                                 *  re-create the whole uac */
                                ret=add_uac(t,  msg, &old_uac->uri, 0, &old_uac->path, 0,
-                                                        (old_uac->request.dst.send_flags &
+                                                        (old_uac->request.dst.send_flags.f &
                                                                SND_F_FORCE_SOCKET)?
                                                                        old_uac->request.dst.send_sock:0,
                                                        old_uac->request.dst.send_flags,
@@ -883,6 +885,7 @@ int e2e_cancel_branch( struct sip_msg *cancel_msg, struct cell *t_cancel,
        int ret;
        char *shbuf;
        unsigned int len;
+       snd_flags_t snd_flags;
 
        ret=-1;
        if (t_cancel->uac[branch].request.buffer) {
@@ -928,12 +931,13 @@ int e2e_cancel_branch( struct sip_msg *cancel_msg, struct cell *t_cancel,
                        cancel_msg->first_line.u.request.method.len+1;
                t_cancel->uac[branch].uri.len=t_invite->uac[branch].uri.len;
        } else {
+               SND_FLAGS_INIT(&snd_flags);
                /* buffer is constructed from the received CANCEL with lumps applied */
                /*  t_cancel...request.dst is already filled (see above) */
                if (unlikely((ret=prepare_new_uac( t_cancel, cancel_msg, branch,
                                                                        &t_invite->uac[branch].uri,
                                                                        &t_invite->uac[branch].path,
-                                                                       0, 0, 0, PROTO_NONE, 0)) <0)){
+                                                                       0, 0, snd_flags, PROTO_NONE, 0)) <0)){
                        ser_error=ret;
                        goto error;
                }
index 8dbd1d6..3dbe519 100644 (file)
@@ -1612,7 +1612,7 @@ enum rps relay_reply( struct cell *t, struct sip_msg *p_msg, int branch,
                                }
                                /* update send_flags with possible additions from the
                                   reply route */
-                               uas_rb->dst.send_flags|=relayed_msg->rpl_send_flags;
+                               uas_rb->dst.send_flags.f|=relayed_msg->rpl_send_flags.f;
                        }
                }
                update_reply_stats( relayed_code );
index 7565763..da30b0d 100644 (file)
@@ -215,6 +215,7 @@ static inline int t_uac_prepare(uac_req_t *uac_r,
        int sflag_bk;
        int backup_route_type;
 #endif
+       snd_flags_t snd_flags;
 
        ret=-1;
        hi=0; /* make gcc happy */
@@ -239,10 +240,11 @@ static inline int t_uac_prepare(uac_req_t *uac_r,
                        uac_r->dialog->hooks.next_hop->s);
        /* new message => take the dialog send_socket if set, or the default
          send_socket if not*/
+       SND_FLAGS_INIT(&snd_flags);
 #ifdef USE_DNS_FAILOVER
        if (cfg_get(core, core_cfg, use_dns_failover)){
                dns_srv_handle_init(&dns_h);
-               if ((uri2dst2(&dns_h, &dst, uac_r->dialog->send_sock, 0,
+               if ((uri2dst2(&dns_h, &dst, uac_r->dialog->send_sock, snd_flags,
                                                        uac_r->dialog->hooks.next_hop, PROTO_NONE)==0)
                                || (dst.send_sock==0)){
                        dns_srv_handle_put(&dns_h);
@@ -253,7 +255,7 @@ static inline int t_uac_prepare(uac_req_t *uac_r,
                }
                dns_srv_handle_put(&dns_h); /* not needed anymore */
        }else{
-               if ((uri2dst2(0, &dst, uac_r->dialog->send_sock, 0,
+               if ((uri2dst2(0, &dst, uac_r->dialog->send_sock, snd_flags,
                                                uac_r->dialog->hooks.next_hop, PROTO_NONE)==0) ||
                                (dst.send_sock==0)){
                        ser_error = E_NO_SOCKET;
@@ -263,7 +265,7 @@ static inline int t_uac_prepare(uac_req_t *uac_r,
                }
        }
 #else /* USE_DNS_FAILOVER */
-       if ((uri2dst2(&dst, uac_r->dialog->send_sock, 0,
+       if ((uri2dst2(&dst, uac_r->dialog->send_sock, snd_flags,
                                        uac_r->dialog->hooks.next_hop, PROTO_NONE)==0) ||
                        (dst.send_sock==0)){
                ser_error = E_NO_SOCKET;
index e0cabcf..fff774b 100644 (file)
@@ -356,16 +356,24 @@ inline static struct dest_info *uri2dst(struct dns_srv_handle* dns_h,
                                                                                struct sip_msg *msg, str *uri, 
                                                                                        int proto )
 {
-       return uri2dst2(dns_h, dst, msg?msg->force_send_socket:0,
-                                               msg?msg->fwd_send_flags:0, uri, proto);
+       snd_flags_t sflags;
+       if (msg)
+               return uri2dst2(dns_h, dst, msg->force_send_socket,
+                                                       msg->fwd_send_flags, uri, proto);
+       SND_FLAGS_INIT(&sflags);
+       return uri2dst2(dns_h, dst, 0, sflags, uri, proto);
 }
 #else
 inline static struct dest_info *uri2dst(struct dest_info* dst,
                                                                                struct sip_msg *msg, str *uri, 
                                                                                        int proto )
 {
-       return uri2dst2(dst, msg?msg->force_send_socket:0,
-                                               msg?msg->fwd_send_flags:0, uri, proto);
+       snd_flags_t sflags;
+       if (msg)
+               return uri2dst2(dst, msg->force_send_socket, msg->fwd_send_flags,
+                                               uri, proto);
+       SND_FLAGS_INIT(&sflags);
+       return uri2dst2(dst, 0, sflags, uri, proto);
 }
 #endif /* USE_DNS_FAILOVER */