- updated to latest avp api
authorJan Janak <jan@iptel.org>
Thu, 1 Dec 2005 10:56:48 +0000 (10:56 +0000)
committerJan Janak <jan@iptel.org>
Thu, 1 Dec 2005 10:56:48 +0000 (10:56 +0000)
modules/tm/h_table.c
modules/tm/t_fifo.c
modules/tm/t_funcs.c
modules/tm/t_funcs.h
modules/tm/t_hooks.c
modules/tm/t_lookup.c
modules/tm/t_reply.c
modules/tm/uac.c

index 3891b25..832e9f9 100644 (file)
@@ -226,7 +226,7 @@ struct cell*  build_cell( struct sip_msg* p_msg )
 {
        struct cell* new_cell;
        int          sip_msg_len;
-       struct usr_avp **old;
+       avp_list_t* old;
 
        /* allocs a new cell */
        new_cell = (struct cell*)shm_malloc( sizeof( struct cell ) );
@@ -246,7 +246,7 @@ struct cell*  build_cell( struct sip_msg* p_msg )
        new_cell->uas.response.my_T=new_cell;
 
        /* move the current avp list to transaction -bogdan */
-       old = set_user_avp_list( &new_cell->user_avps );
+       old = set_avp_list(AVP_TRACK_FROM | AVP_CLASS_USER,  &new_cell->user_avps );
        new_cell->user_avps = *old;
        *old = 0;
 
@@ -283,7 +283,7 @@ error:
        destroy_avp_list(&new_cell->user_avps);
        shm_free(new_cell);
        /* unlink transaction AVP list and link back the global AVP list (bogdan)*/
-       reset_user_avps();
+       reset_avps();
        return NULL;
 }
 
index bd28ee1..e52040f 100644 (file)
@@ -321,13 +321,13 @@ int parse_tw_append( modparam_t type, void* val)
                        }
                        if (n&AVP_NAME_STR) {
                                /* string name */
-                               ha->sval.s = (char*)pkg_malloc(avp_name.s->len+1);
+                               ha->sval.s = (char*)pkg_malloc(avp_name.s.len+1);
                                if (ha->sval.s==0) {
                                        LOG(L_ERR,"ERROR:tm:parse_tw_append: no more pkg mem\n");
                                        goto error;
                                }
-                               memcpy( ha->sval.s, avp_name.s->s, avp_name.s->len);
-                               ha->sval.len = avp_name.s->len;
+                               memcpy( ha->sval.s, avp_name.s.s, avp_name.s.len);
+                               ha->sval.len = avp_name.s.len;
                                ha->sval.s[ha->sval.len] = 0;
                                if (ha->title.s==0)
                                        ha->title = ha->sval;
@@ -597,9 +597,9 @@ static inline char* append2buf( char *buf, int len, struct sip_msg *req,
                if (ha->type==ELEM_IS_AVP) {
                        /* search for the AVP */
                        if (ha->sval.s) {
-                               avp_name.s=&ha->sval;
+                               avp_name.s=ha->sval;
                                avp = search_first_avp( AVP_NAME_STR, avp_name, &avp_val, 0);
-                               DBG("AVP <%.*s>: %p\n",avp_name.s->len,avp_name.s->s,avp);
+                               DBG("AVP <%.*s>: %p\n",avp_name.s.len, avp_name.s.s, avp);
                        } else {
                                avp_name.n=ha->ival;
                                avp = search_first_avp( 0, avp_name, &avp_val, 0);
@@ -608,7 +608,7 @@ static inline char* append2buf( char *buf, int len, struct sip_msg *req,
                        if (avp) {
                                if (avp->flags&AVP_VAL_STR) {
                                        buf=add2buf( buf, end, ha->title.s, ha->title.len,
-                                               avp_val.s->s , avp_val.s->len);
+                                               avp_val.s.s , avp_val.s.len);
                                        if (!buf)
                                                goto overflow_err;
                                } else {
index ff57109..f43a887 100644 (file)
@@ -73,7 +73,7 @@ static str     fr_inv_timer_str;
 /* ----------------------------------------------------- */
 int send_pr_buffer(    struct retr_buf *rb, void *buf, int len
 #ifdef EXTRA_DEBUG
-                                               , char* file, char *function, int line
+                                               , char* file, const char *function, int line
 #endif
                                        )
 {
@@ -326,7 +326,7 @@ static inline int avp2timer(unsigned int* timer, int type, int_str name)
        int_str val_istr;
        int err;
 
-       avp = search_first_avp( type, name, &val_istr, 0);
+       avp = search_first_avp( type | AVP_TRACK_TO, name, &val_istr, 0);
        if (!avp) {
                /*
                 DBG("avp2timer: AVP '%.*s' not found\n", param.s->len, ZSW(param.s->s));
@@ -335,7 +335,7 @@ static inline int avp2timer(unsigned int* timer, int type, int_str name)
        }
        
        if (avp->flags & AVP_VAL_STR) {
-               *timer = str2s(val_istr.s->s, val_istr.s->len, &err);
+               *timer = str2s(val_istr.s.s, val_istr.s.len, &err);
                if (err) {
                        LOG(L_ERR, "avp2timer: Error while converting string to integer\n");
                        return -1;
index d38ff41..1a3b3f2 100644 (file)
@@ -89,7 +89,7 @@ extern int noisy_ctimer;
 */
 #ifdef EXTRA_DEBUG
 int send_pr_buffer( struct retr_buf *rb,
-       void *buf, int len, char* file, char *function, int line );
+       void *buf, int len, char* file, const char *function, int line );
 #define SEND_PR_BUFFER(_rb,_bf,_le ) \
        send_pr_buffer( (_rb), (_bf), (_le), __FILE__,  __FUNCTION__, __LINE__ )
 #else
index f199dfa..44a24c6 100644 (file)
@@ -172,7 +172,7 @@ void run_trans_callbacks( int type , struct cell *trans,
 {
        static struct tmcb_params params = {0,0,0,0};
        struct tm_callback    *cbp;
-       struct usr_avp **backup;
+       avp_list_t* backup;
 
        params.req = req;
        params.rpl = rpl;
@@ -181,7 +181,7 @@ void run_trans_callbacks( int type , struct cell *trans,
        if (trans->tmcb_hl.first==0 || ((trans->tmcb_hl.reg_types)&type)==0 )
                return;
 
-       backup = set_user_avp_list( &trans->user_avps );
+       backup = set_avp_list(AVP_CLASS_USER | AVP_TRACK_FROM, &trans->user_avps );
        for (cbp=trans->tmcb_hl.first; cbp; cbp=cbp->next)  {
                if ( (cbp->types)&type ) {
                        DBG("DBG: trans=%p, callback type %d, id %d entered\n",
@@ -189,7 +189,7 @@ void run_trans_callbacks( int type , struct cell *trans,
                        params.param = &(cbp->param);
                        cbp->callback( trans, type, &params );
                }
-       set_user_avp_list( backup );
+       set_avp_list(AVP_CLASS_USER | AVP_TRACK_FROM, backup );
        }
 }
 
@@ -199,7 +199,7 @@ void run_reqin_callbacks( struct cell *trans, struct sip_msg *req, int code )
 {
        static struct tmcb_params params = {0,0,0,0};
        struct tm_callback    *cbp;
-       struct usr_avp **backup;
+        avp_list_t* backup;
 
        params.req = req;
        params.code = code;
@@ -207,13 +207,13 @@ void run_reqin_callbacks( struct cell *trans, struct sip_msg *req, int code )
        if (req_in_tmcb_hl->first==0)
                return;
 
-       backup = set_user_avp_list( &trans->user_avps );
+       backup = set_avp_list(AVP_CLASS_USER | AVP_TRACK_FROM, &trans->user_avps );
        for (cbp=req_in_tmcb_hl->first; cbp; cbp=cbp->next)  {
                DBG("DBG: trans=%p, callback type %d, id %d entered\n",
                        trans, cbp->types, cbp->id );
                params.param = &(cbp->param);
                cbp->callback( trans, cbp->types, &params );
        }
-       set_user_avp_list( backup );
+       set_avp_list(AVP_CLASS_USER | AVP_TRACK_FROM, backup );
 }
 
index 3619307..16192a9 100644 (file)
@@ -293,7 +293,7 @@ static int matching_3261( struct sip_msg *p_msg, struct cell **trans,
        struct via_body *via1;
        int is_ack;
        int dlg_parsed;
-       int ret;
+       int ret = 0;
        struct cell *e2e_ack_trans;
 
        e2e_ack_trans=0;
@@ -338,6 +338,7 @@ static int matching_3261( struct sip_msg *p_msg, struct cell **trans,
                        ret=ack_matching(p_cell /* t w/invite */, p_msg /* ack */);
                        if (ret>0) {
                                e2e_ack_trans=p_cell;
+                               break;
                        }
                        /* this ACK is neither local "negative" one, nor a proxied
                         * end-2-end one, nor an end-2-end one for a UAS transaction
@@ -360,7 +361,7 @@ static int matching_3261( struct sip_msg *p_msg, struct cell **trans,
        /* just check if it we found an e2e ACK previously */
        if (e2e_ack_trans) {
                *trans=e2e_ack_trans;
-               return 2;
+               return ret;
        }
        DBG("DEBUG: RFC3261 transaction matching failed\n");
        return 0;
index 55bb66b..bb7bb5c 100644 (file)
@@ -491,7 +491,7 @@ static inline void faked_env( struct cell *t,struct sip_msg *msg)
        static enum route_mode backup_mode;
        static struct cell *backup_t;
        static unsigned int backup_msgid;
-       static struct usr_avp **backup_list;
+       static avp_list_t* backup_list;
        static struct socket_info* backup_si;
 
        if (msg) {
@@ -514,7 +514,7 @@ static inline void faked_env( struct cell *t,struct sip_msg *msg)
                global_msg_id=msg->id;
                set_t(t);
                /* make available the avp list from transaction */
-               backup_list = set_user_avp_list( &t->user_avps );
+               backup_list = set_avp_list(AVP_TRACK_FROM | AVP_CLASS_USER, &t->user_avps );
                /* set default send address to the saved value */
                backup_si=bind_address;
                bind_address=t->uac[0].request.dst.send_sock;
@@ -524,7 +524,7 @@ static inline void faked_env( struct cell *t,struct sip_msg *msg)
                global_msg_id=backup_msgid;
                rmode=backup_mode;
                /* restore original avp list */
-               set_user_avp_list( backup_list );
+               set_avp_list(AVP_TRACK_FROM | AVP_CLASS_USER, backup_list );
                bind_address=backup_si;
        }
 }
@@ -1267,7 +1267,7 @@ int reply_received( struct sip_msg  *p_msg )
        struct ua_client *uac;
        struct cell *t;
        str next_hop;
-       struct usr_avp **backup_list;
+       avp_list_t* backup_list;
        unsigned int timer;
 
        /* make sure we know the associated transaction ... */
@@ -1334,13 +1334,13 @@ int reply_received( struct sip_msg  *p_msg )
                /* transfer transaction flag to message context */
                if (t->uas.request) p_msg->flags=t->uas.request->flags;
                /* set the as avp_list the one from transaction */
-               backup_list = set_user_avp_list( &t->user_avps );
+               backup_list = set_avp_list(AVP_TRACK_FROM | AVP_CLASS_USER, &t->user_avps );
                if (run_actions(onreply_rlist[t->on_reply], p_msg)<0)
                        LOG(L_ERR, "ERROR: on_reply processing failed\n");
                /* transfer current message context back to t */
                if (t->uas.request) t->uas.request->flags=p_msg->flags;
                /* restore original avp list */
-               set_user_avp_list( backup_list );
+               set_avp_list( AVP_TRACK_FROM | AVP_CLASS_USER, backup_list );
        }
        LOCK_REPLIES( t );
        if ( is_local(t) ) {
@@ -1382,7 +1382,7 @@ int reply_received( struct sip_msg  *p_msg )
                           attempt to restart retransmission any more
                        */
 
-                       backup_list = set_user_avp_list( &t->user_avps );
+                       backup_list = set_avp_list(AVP_TRACK_FROM | AVP_CLASS_USER,  &t->user_avps );
                        if (!fr_inv_avp2timer(&timer)) {
                                DBG("reply_received: FR_INV_TIMER = %d\n", timer);
                                set_timer( & uac->request.fr_timer,
@@ -1392,7 +1392,7 @@ int reply_received( struct sip_msg  *p_msg )
                                set_timer( & uac->request.fr_timer,
                                           FR_INV_TIMER_LIST, 0 );
                        }
-                       set_user_avp_list( backup_list );
+                       set_avp_list(AVP_TRACK_FROM | AVP_CLASS_USER,  backup_list );
                } else {
                             /* non-invite: restart retransmissions (slow now) */
                        uac->request.retr_list=RT_T2;
index bb5321d..e9e6595 100644 (file)
@@ -203,7 +203,7 @@ int t_uac(str* method, str* headers, str* body, dlg_t* dialog,
 
        /* better reset avp list now - anyhow, it's useless from
         * this point (bogdan) */
-       reset_user_avps();
+       reset_avps();
 
        /* add the callback the the transaction for LOCAL_COMPLETED event */