Skip to content

Commit

Permalink
core: unified module exports interface
Browse files Browse the repository at this point in the history
- have a single module interface by merging the ser and kamailio ones
  • Loading branch information
miconda authored and linuxmaniac committed Sep 28, 2018
1 parent 9ccc072 commit 1f70d06
Show file tree
Hide file tree
Showing 5 changed files with 139 additions and 369 deletions.
13 changes: 3 additions & 10 deletions src/core/action.c
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ int do_action(struct run_act_ctx* h, struct action* a, struct sip_msg* msg)
struct dest_info dst;
char* tmp;
char *new_uri, *end, *crt;
sr31_cmd_export_t* cmd;
ksr_cmd_export_t* cmd;
int len;
int user;
struct sip_uri uri, next_hop;
Expand Down Expand Up @@ -1574,7 +1574,7 @@ int run_actions(struct run_act_ctx* h, struct action* a, struct sip_msg* msg)
"alert - action [%s (%d)]"
" cfg [%s:%d] took too long [%u ms]\n",
is_mod_func(t) ?
((cmd_export_common_t*)(t->val[0].u.data))->name
((cmd_export_t*)(t->val[0].u.data))->name
: "corefunc",
t->type, (t->cfile)?t->cfile:"", t->cline, ms);
}
Expand All @@ -1596,13 +1596,6 @@ int run_actions(struct run_act_ctx* h, struct action* a, struct sip_msg* msg)

h->rec_lev--;
end:
/* process module onbreak handlers if present */
if (unlikely(h->rec_lev==0 && ret==0 &&
!(h->run_flags & IGNORE_ON_BREAK_R_F)))
for (mod=modules;mod;mod=mod->next)
if (unlikely(mod->exports.onbreak_f)) {
mod->exports.onbreak_f( msg );
}
return ret;


Expand All @@ -1624,7 +1617,7 @@ int run_actions_safe(struct run_act_ctx* h, struct action* a,
struct run_act_ctx ctx;
int ret;
int ign_on_break;

/* start with a fresh action context */
init_run_actions_ctx(&ctx);
ctx.last_retcode = h->last_retcode;
Expand Down
8 changes: 3 additions & 5 deletions src/core/cfg.y
Original file line number Diff line number Diff line change
Expand Up @@ -3340,11 +3340,9 @@ cmd:
| ID {mod_func_action = mk_action(MODULE0_T, 2, MODEXP_ST, NULL, NUMBER_ST,
0); } LPAREN func_params RPAREN {
mod_func_action->val[0].u.data =
find_export_record($1, mod_func_action->val[1].u.number, rt,
&u_tmp);
find_export_record($1, mod_func_action->val[1].u.number, rt);
if (mod_func_action->val[0].u.data == 0) {
if (find_export_record($1, mod_func_action->val[1].u.number, 0,
&u_tmp) ) {
if (find_export_record($1, mod_func_action->val[1].u.number, 0) ) {
LM_ERR("misused command %s\n", $1);
yyerror("Command cannot be used in the block\n");
} else {
Expand Down Expand Up @@ -3841,7 +3839,7 @@ static int case_check_default(struct case_stms* stms)
*/
static int mod_f_params_pre_fixup(struct action* a)
{
sr31_cmd_export_t* cmd_exp;
ksr_cmd_export_t* cmd_exp;
action_u_t* params;
int param_no;
struct rval_expr* rve;
Expand Down
2 changes: 1 addition & 1 deletion src/core/route.c
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ int fix_actions(struct action* a)
void *tmp_p;
int ret;
int i;
sr31_cmd_export_t* cmd;
ksr_cmd_export_t* cmd;
str s;
struct hostent* he;
struct ip_addr ip;
Expand Down
Loading

0 comments on commit 1f70d06

Please sign in to comment.