Skip to content

Commit

Permalink
function params interface: add flag that forces use of static strings
Browse files Browse the repository at this point in the history
  • Loading branch information
rvlad-patrascu committed Apr 12, 2019
1 parent ff98be9 commit 2251fae
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions mod_fix.c
Expand Up @@ -165,10 +165,20 @@ int fix_cmd(struct cmd_param *params, action_elem_t *elems)
goto error;
}
} else {
if (param->flags & CMD_PARAM_STATIC) {
LM_ERR("Param [%d] does not support formatted strings\n",i);
return E_CFG;
}

gp->pval = pve;
gp->type = GPARAM_TYPE_PVE;
}
} else if (elems[i].type == SCRIPTVAR_ST) {
if (param->flags & CMD_PARAM_STATIC) {
LM_ERR("Param [%d] does not support variables\n",i);
return E_CFG;
}

gp->pval = elems[i].u.data;
gp->type = GPARAM_TYPE_PVS;
} else {
Expand Down
1 change: 1 addition & 0 deletions sr_module.h
Expand Up @@ -118,6 +118,7 @@ typedef int (*mod_proc_wrapper)();
#define CMD_PARAM_OPT (1<<4) /* optional parameter */
#define CMD_PARAM_FIX_NULL (1<<5) /* run fixup even if optional parameter is omitted */
#define CMD_PARAM_NO_EXPAND (1<<6) /* TMPHACK: do not pv-expand strings */
#define CMD_PARAM_STATIC (1<<7) /* don't accept variables or formatted string */

struct cmd_param {
int flags; /* parameter flags */
Expand Down

0 comments on commit 2251fae

Please sign in to comment.