tm: Rename run_onsend_callbacks[2]; update, and extend
authorTimo Reimann <timo.reimann@1und1.de>
Wed, 5 Oct 2011 08:57:13 +0000 (10:57 +0200)
committerTimo Reimann <timo.reimann@1und1.de>
Mon, 17 Oct 2011 18:05:47 +0000 (20:05 +0200)
documentation.

- run_onsend_callbacks -> run_trans_callbacks_with_buf.
- run_onsend_callbacks2 -> run_trans_callbacks_off_params.

modules/tm/t_cancel.c
modules/tm/t_fwd.c
modules/tm/t_hooks.c
modules/tm/t_hooks.h
modules/tm/t_reply.c
modules/tm/timer.c
modules/tm/uac.c

index 6ee8774..8057ae4 100644 (file)
@@ -328,7 +328,7 @@ int cancel_branch( struct cell *t, int branch,
        DBG("DEBUG: cancel_branch: sending cancel...\n");
        if (SEND_BUFFER( crb )>=0){
                if (unlikely (has_tran_tmcbs(t, TMCB_REQUEST_SENT)))
-                       run_onsend_callbacks(TMCB_REQUEST_SENT, crb, 0, 0, TMCB_LOCAL_F);
+                       run_trans_callbacks_with_buf(TMCB_REQUEST_SENT, crb, 0, 0, TMCB_LOCAL_F);
        }
        /*sets and starts the FINAL RESPONSE timer */
        if (start_retr( crb )!=0)
index 1fb9cf7..819c831 100644 (file)
@@ -1190,9 +1190,9 @@ void e2e_cancel( struct sip_msg *cancel_msg,
                                }
                                else{
                                        if (unlikely(has_tran_tmcbs(t_cancel, TMCB_REQUEST_SENT)))
-                                               run_onsend_callbacks(TMCB_REQUEST_SENT, 
-                                                                                               &t_cancel->uac[i].request,
-                                                                                               cancel_msg, 0, TMCB_LOCAL_F);
+                                               run_trans_callbacks_with_buf(TMCB_REQUEST_SENT,
+                                                                            &t_cancel->uac[i].request,
+                                                                            cancel_msg, 0, TMCB_LOCAL_F);
                                }
                                if (start_retr( &t_cancel->uac[i].request )!=0)
                                        LOG(L_CRIT, "BUG: e2e_cancel: failed to start retr."
@@ -1381,7 +1381,7 @@ int t_send_branch( struct cell *t, int branch, struct sip_msg* p_msg ,
                return -2;
        } else {
                if (unlikely(has_tran_tmcbs(t, TMCB_REQUEST_SENT)))
-                       run_onsend_callbacks(TMCB_REQUEST_SENT, &uac->request, p_msg, 0,0);
+                       run_trans_callbacks_with_buf(TMCB_REQUEST_SENT, &uac->request, p_msg, 0,0);
                /* start retr. only if the send succeeded */
                if (start_retr( &uac->request )!=0){
                        LOG(L_CRIT, "BUG: t_send_branch: retr. already started for %p\n",
index f996586..dd17da4 100644 (file)
@@ -319,8 +319,9 @@ void run_trans_callbacks( int type , struct cell *trans,
 
 
 
-void run_onsend_callbacks(int type, struct retr_buf* rbuf,
-                                       struct sip_msg* req, struct sip_msg* repl, short flags)
+void run_trans_callbacks_with_buf(int type, struct retr_buf* rbuf,
+                                  struct sip_msg* req, struct sip_msg* repl,
+                                  short flags)
 {
        struct tmcb_params params;
        struct cell * trans;
@@ -336,7 +337,8 @@ void run_onsend_callbacks(int type, struct retr_buf* rbuf,
 }
 
 
-void run_onsend_callbacks2(int type, struct cell* trans, struct tmcb_params* p)
+void run_trans_callbacks_off_params(int type, struct cell* trans,
+                                    struct tmcb_params* p)
 {
 
        if (p->t_rbuf==0) return;
index 0432aa6..6f4dc08 100644 (file)
@@ -294,7 +294,7 @@ struct cell;
  *           you really know what you're doing).
  *
  *  TMCB_REQUEST_SENT -- called each time a request was sent (even for
- *  retransmissions), it includes *  local and forwarded request, ser generated
+ *  retransmissions), it includes local and forwarded request, ser generated
  *  CANCELs and ACKs. The tmcb_params structure will have the t_rbuf, dst,
  *  send_buf and is_retr members filled.
  *  This callback is "read-only", the message was already sent and no changes
@@ -444,9 +444,12 @@ void run_reqin_callbacks( struct cell *trans, struct sip_msg *req, int code );
 void run_local_reqin_callbacks( struct cell *trans, struct sip_msg *req, 
                int code );
 
-/* TBD: explanation */
-void run_onsend_callbacks(int type, struct retr_buf* rbuf, struct sip_msg* req,
-                                                                       struct sip_msg* repl, short flags);
-void run_onsend_callbacks2(int type, struct cell* t, struct tmcb_params* p);
+/* like run_trans_callbacks but provide outgoing buffer (i.e., the
+ * processed message) to callback */
+void run_trans_callbacks_with_buf(int type, struct retr_buf* rbuf, struct sip_msg* req,
+                                                                 struct sip_msg* repl, short flags);
+
+/* like run_trans_callbacks but tmcb_params assumed to contain data already */
+void run_trans_callbacks_off_params(int type, struct cell* t, struct tmcb_params* p);
 
 #endif
index b4ee307..50ef8c9 100644 (file)
@@ -655,8 +655,8 @@ static int _reply_light( struct cell *trans, char* buf, unsigned int len,
                                INIT_TMCB_ONSEND_PARAMS(onsend_params, trans->uas.request,
                                                                FAKED_REPLY, rb, &rb->dst, 
                                                                buf, len, TMCB_LOCAL_F, rb->branch, code);
-                               run_onsend_callbacks2(TMCB_RESPONSE_SENT, trans,
-                                                                               &onsend_params);
+                               run_trans_callbacks_off_params(TMCB_RESPONSE_SENT, trans,
+                                                              &onsend_params);
                        }
                }
                DBG("DEBUG: reply sent out. buf=%p: %.20s..., shmem=%p: %.20s\n",
@@ -1443,8 +1443,8 @@ int t_retransmit_reply( struct cell *t )
        if (unlikely(has_tran_tmcbs(t, TMCB_RESPONSE_SENT))){ 
                /* we don't know if it's a retransmission of a local reply or a 
                 * forwarded reply */
-               run_onsend_callbacks(TMCB_RESPONSE_SENT, &t->uas.response, 0, 0,
-                                                               TMCB_RETR_F);
+               run_trans_callbacks_with_buf(TMCB_RESPONSE_SENT, &t->uas.response, 0, 0,
+                                            TMCB_RETR_F);
        }
        DBG("DEBUG: reply retransmitted. buf=%p: %.9s..., shmem=%p: %.9s\n",
                b, b, t->uas.response.buffer, t->uas.response.buffer );
@@ -1829,7 +1829,7 @@ enum rps relay_reply( struct cell *t, struct sip_msg *p_msg, int branch,
                                                                        res_len,
                                                                        (relayed_msg==FAKED_REPLY)?TMCB_LOCAL_F:0,
                                                                        uas_rb->branch, relayed_code);
-                               run_onsend_callbacks2(TMCB_RESPONSE_SENT, t, &onsend_params);
+                               run_trans_callbacks_off_params(TMCB_RESPONSE_SENT, t, &onsend_params);
                        }
                } else if (unlikely(uas_rb->dst.send_sock == 0))
                        ERR("no resolved dst to send reply to\n");
@@ -2068,8 +2068,8 @@ int reply_received( struct sip_msg  *p_msg )
                                                                        t->uas.request, p_msg, &uac->request,
                                                                        &uac->request.dst, ack, ack_len,
                                                                        TMCB_LOCAL_F, branch, TYPE_LOCAL_ACK);
-                                                       run_onsend_callbacks2(TMCB_REQUEST_SENT, t,
-                                                                                                       &onsend_params);
+                                                       run_trans_callbacks_off_params(TMCB_REQUEST_SENT, t,
+                                                                                      &onsend_params);
                                                }
                                        shm_free(ack);
                                }
@@ -2083,8 +2083,8 @@ int reply_received( struct sip_msg  *p_msg )
                                                                        t->uas.request, p_msg, &uac->request,
                                                                        &lack_dst, ack, ack_len, TMCB_LOCAL_F,
                                                                        branch, TYPE_LOCAL_ACK);
-                                                       run_onsend_callbacks2(TMCB_REQUEST_SENT, t,
-                                                                                                       &onsend_params);
+                                                       run_trans_callbacks_off_params(TMCB_REQUEST_SENT, t,
+                                                                                      &onsend_params);
                                        }
 #ifndef WITH_AS_SUPPORT
                                        shm_free(ack);
@@ -2103,9 +2103,9 @@ int reply_received( struct sip_msg  *p_msg )
                                DBG("tm: reply_received: branch CANCEL retransmit\n");
                                if (SEND_BUFFER( &uac->local_cancel)>=0){
                                        if (unlikely (has_tran_tmcbs(t, TMCB_REQUEST_SENT)))
-                                               run_onsend_callbacks(TMCB_REQUEST_SENT,
-                                                                                       &uac->local_cancel,
-                                                                                       0, 0, TMCB_LOCAL_F);
+                                               run_trans_callbacks_with_buf(TMCB_REQUEST_SENT,
+                                                                            &uac->local_cancel,
+                                                                            0, 0, TMCB_LOCAL_F);
                                }
                                /* retrs. should be already started so do nothing */
                        }else if (atomic_cmpxchg_long((void*)&uac->local_cancel.buffer, 0,
index 0280ba3..22356c8 100644 (file)
@@ -393,8 +393,8 @@ inline static ticks_t retransmission_handler( struct retr_buf *r_buf )
                                return (ticks_t)-1;
                        }
                        if (unlikely(has_tran_tmcbs(r_buf->my_T, TMCB_REQUEST_SENT))) 
-                               run_onsend_callbacks(TMCB_REQUEST_SENT, r_buf, 
-                                                                               0, 0, TMCB_RETR_F);
+                               run_trans_callbacks_with_buf(TMCB_REQUEST_SENT, r_buf, 
+                               0, 0, TMCB_RETR_F);
        } else {
 #ifdef EXTRA_DEBUG
                        DBG("DEBUG: retransmission_handler : "
index 857c82f..525ca0d 100644 (file)
@@ -497,8 +497,8 @@ static inline void send_prepared_request_impl(struct retr_buf *request, int retr
        }
        else if (unlikely(has_tran_tmcbs(request->my_T, TMCB_REQUEST_SENT)))
                /* we don't know the method here */
-                       run_onsend_callbacks(TMCB_REQUEST_SENT, request, 0, 0,
-                                                                       TMCB_LOCAL_F);
+                       run_trans_callbacks_with_buf(TMCB_REQUEST_SENT, request, 0, 0,
+                       TMCB_LOCAL_F);
        
        if (retransmit && (start_retr(request)!=0))
                LOG(L_CRIT, "BUG: t_uac: failed to start retr. for %p\n", request);
@@ -662,7 +662,7 @@ int ack_local_uac(struct cell *trans, str *hdrs, str *body)
                                                                &local_ack->dst,
                                                                local_ack->buffer, local_ack->buffer_len,
                                                                TMCB_LOCAL_F, 0 /* branch */, TYPE_LOCAL_ACK);
-               run_onsend_callbacks2(TMCB_REQUEST_SENT, trans, &onsend_params);
+               run_trans_callbacks_off_params(TMCB_REQUEST_SENT, trans, &onsend_params);
        }
 
        ret = 0;