Module: sip-router Branch: andrei/blst_send_flags Commit: 1d777cdcf8462e2dc0d104ec16c19bf1a5e782d0 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=1d777cdc...
Author: Andrei Pelinescu-Onciul andrei@iptel.org Committer: Andrei Pelinescu-Onciul andrei@iptel.org Date: Thu Dec 17 13:29:50 2009 +0100
tm: updated to the new snd_flags_t structure
---
modules/tm/t_fwd.c | 14 +++++++++----- modules/tm/t_reply.c | 2 +- modules/tm/uac.c | 8 +++++--- modules/tm/ut.h | 16 ++++++++++++---- 4 files changed, 27 insertions(+), 13 deletions(-)
diff --git a/modules/tm/t_fwd.c b/modules/tm/t_fwd.c index 1e9644d..af7ab47 100644 --- a/modules/tm/t_fwd.c +++ b/modules/tm/t_fwd.c @@ -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; } diff --git a/modules/tm/t_reply.c b/modules/tm/t_reply.c index 8dbd1d6..3dbe519 100644 --- a/modules/tm/t_reply.c +++ b/modules/tm/t_reply.c @@ -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 ); diff --git a/modules/tm/uac.c b/modules/tm/uac.c index 7565763..da30b0d 100644 --- a/modules/tm/uac.c +++ b/modules/tm/uac.c @@ -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; diff --git a/modules/tm/ut.h b/modules/tm/ut.h index e0cabcf..fff774b 100644 --- a/modules/tm/ut.h +++ b/modules/tm/ut.h @@ -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 */