MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / fix_cmd

Function fix_cmd

mod_fix.c:149–332  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

147}
148
149int fix_cmd(const struct cmd_param *params, action_elem_t *elems)
150{
151 int i;
152 const struct cmd_param *param;
153 gparam_p gp = NULL;
154 int ret;
155 pv_elem_t *pve;
156 regex_t *re = NULL;
157 void *h;
158
159 for (param=params, i=1; param->flags; param++, i++) {
160 pve = NULL;
161 if ((elems[i].type == NOSUBTYPE) ||
162 (elems[i].type == NULLV_ST)) {
163 gp = NULL;
164 if (param->flags & CMD_PARAM_OPT) {
165 if (param->fixup && (param->flags & CMD_PARAM_FIX_NULL)) {
166 h = NULL;
167 if (param->fixup(&h) < 0) {
168 LM_ERR("Fixup failed for param [%d]\n", i);
169 ret = E_UNSPEC;
170 goto error;
171 }
172
173 if (h != NULL) {
174 if ((gp = alloc_gp()) == NULL)
175 return E_OUT_OF_MEM;
176
177 gp->type = GPARAM_TYPE_FIXUP;
178 gp->pval = h;
179 }
180 }
181
182 goto fill_elems;
183 } else {
184 LM_BUG("Mandatory parameter missing\n");
185 ret = E_BUG;
186 goto error;
187 }
188 }
189
190 if ((gp = alloc_gp()) == NULL)
191 return E_OUT_OF_MEM;
192
193 if (param->flags & CMD_PARAM_INT) {
194
195 if (elems[i].type == NUMBER_ST) {
196 gp->v.ival = elems[i].u.number;
197 gp->pval = &gp->v.ival;
198 gp->type = GPARAM_TYPE_VAL;
199
200 if (param->fixup) {
201 h = gp->pval;
202 if (param->fixup(&gp->pval) < 0) {
203 LM_ERR("Fixup failed for param [%d]\n", i);
204 ret = E_UNSPEC;
205 goto error;
206 }

Callers 3

fix_actionsFunction · 0.85
py_do_actionFunction · 0.85
lua_do_actionFunction · 0.85

Calls 4

alloc_gpFunction · 0.85
pv_parse_formatFunction · 0.85
pv_elem_free_allFunction · 0.85
fixup_regcompFunction · 0.85

Tested by

no test coverage detected