Skip to content

Commit

Permalink
tm: simplify API interface for t_relay and t_check_trans
Browse files Browse the repository at this point in the history
  • Loading branch information
razvancrainea committed Sep 14, 2023
1 parent c4032f9 commit 1bf83d6
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion modules/cpl_c/cpl_sig.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ int cpl_proxy_to_loc_set( struct sip_msg *msg, struct location **locs,
}

/* do t_forward */
if ((r = cpl_fct.tmb.t_relay(msg, 0, 0, 0, 0, 0, 0, 0, 0)) < 0) {
if ((r = cpl_fct.tmb.t_relay(msg, 0, 0)) < 0) {
LM_ERR("t_relay failed! error=%d\n",r);
goto error;
}
Expand Down
12 changes: 6 additions & 6 deletions modules/script_helper/script_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,9 @@ int run_helper_logic(struct sip_msg *msg, void *param)
msg->callid->body.len, msg->callid->body.s);

if (msg->REQ_METHOD == METHOD_ACK) {
rc = tm_api.t_check_trans(msg, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
rc = tm_api.t_check_trans(msg);
if (rc > 0)
tm_api.t_relay(msg, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
tm_api.t_relay(msg, NULL, NULL);

return SCB_RUN_POST_CBS;
}
Expand All @@ -197,14 +197,14 @@ int run_helper_logic(struct sip_msg *msg, void *param)
if (msg->REQ_METHOD == METHOD_CANCEL) {
seq_request = 1;

rc = tm_api.t_check_trans(msg, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
rc = tm_api.t_check_trans(msg);
if (rc > 0)
tm_api.t_relay(msg, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
tm_api.t_relay(msg, NULL, NULL);

return SCB_RUN_POST_CBS;
}

if (tm_api.t_check_trans(msg, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) == 0)
if (tm_api.t_check_trans(msg) == 0)
return SCB_RUN_POST_CBS;

/**
Expand All @@ -222,7 +222,7 @@ int run_helper_logic(struct sip_msg *msg, void *param)
}
}

if (tm_api.t_relay(msg, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
if (tm_api.t_relay(msg, NULL, NULL) < 0)
sl_api.reply(msg, 500, &status_500, NULL);

return SCB_RUN_POST_CBS;
Expand Down
2 changes: 2 additions & 0 deletions modules/tm/t_reply.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ typedef int (*treply_f)(struct sip_msg * , unsigned int , const str * );
typedef int (*treply_wb_f)( struct cell* trans, unsigned int code, str *text,
str *body, str *new_header, str *to_tag);
typedef int (*tgen_totag_f)(struct sip_msg * , str * );
typedef int (*tcheck_trans_f)(struct sip_msg *);
typedef int (*trelay_f)(struct sip_msg *p_msg , void *flags, struct proxy_l *proxy);

#define LOCK_REPLIES(_t) lock(&(_t)->reply_mutex )
#define UNLOCK_REPLIES(_t) unlock(&(_t)->reply_mutex )
Expand Down
4 changes: 2 additions & 2 deletions modules/tm/tm.c
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,7 @@ int load_tm( struct tm_binds *tmb)
tmb->register_tmcb = register_tmcb;

/* relay function */
tmb->t_relay = (cmd_function)w_t_relay;
tmb->t_relay = w_t_relay;

/* reply functions */
tmb->t_reply = (treply_f)w_t_reply;
Expand All @@ -698,7 +698,7 @@ int load_tm( struct tm_binds *tmb)
/* transaction location/status functions */
tmb->t_newtran = w_t_newtran;
tmb->t_is_local = t_is_local;
tmb->t_check_trans = (cmd_function)t_check_trans;
tmb->t_check_trans = t_check_trans;
tmb->t_get_trans_ident = t_get_trans_ident;
tmb->t_lookup_ident = t_lookup_ident;
tmb->t_gett = get_t;
Expand Down
4 changes: 2 additions & 2 deletions modules/tm/tm_load.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@

struct tm_binds {
register_tmcb_f register_tmcb;
cmd_function t_relay;
cmd_function t_check_trans;
trelay_f t_relay;
tcheck_trans_f t_check_trans;

/* Return:
* 1 (success)
Expand Down

0 comments on commit 1bf83d6

Please sign in to comment.