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

Function ops_sql_avp_load

modules/sqlops/sqlops_impl.c:228–406  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

226
227
228int ops_sql_avp_load (struct sip_msg* msg, struct fis_param *sp,
229 struct db_param *dbp, struct db_url *url, int use_domain, str *prefix)
230{
231 struct sip_uri uri;
232 db_res_t *res = NULL;
233 str uuid;
234 int i, n, sh_flg;
235 str *s0, *s1, *s2;
236 int avp_name;
237 int avp_type = 0;
238 pv_value_t xvalue;
239
240 s0 = s1 = s2 = NULL;
241 if (!((sp->opd&SQLOPS_VAL_PVAR)||(sp->opd&SQLOPS_VAL_STR))) {
242 LM_CRIT("invalid flag combination (%d/%d)\n", sp->opd, sp->ops);
243 goto error;
244 }
245
246 /* get uuid from avp */
247 if (sp->opd&SQLOPS_VAL_PVAR)
248 {
249 if(pv_get_spec_value(msg, &(sp->u.sval), &xvalue)!=0)
250 {
251 LM_CRIT("failed to get PVAR value (%d/%d)\n", sp->opd, sp->ops);
252 goto error;
253 }
254 if(xvalue.flags&(PV_VAL_NULL|PV_VAL_EMPTY))
255 {
256 LM_ERR("no value for first param\n");
257 goto error;
258 }
259 uuid = xvalue.rs;
260 } else {
261 uuid.s = sp->u.s.s;
262 uuid.len = sp->u.s.len;
263 }
264
265 if(sp->opd&SQLOPS_FLAG_UUID0)
266 {
267 s0 = &uuid;
268 } else {
269 /* parse uri */
270 if (parse_uri(uuid.s, uuid.len, &uri)<0)
271 {
272 LM_ERR("failed to parse uri\n");
273 goto error;
274 }
275
276 if((sp->opd&SQLOPS_FLAG_URI0)||(sp->opd&SQLOPS_FLAG_USER0))
277 {
278 /* check that uri contains user part */
279 if(!uri.user.s|| !uri.user.len)
280 {
281 LM_ERR("incomplete uri <%.*s> missing user\n", uuid.len, uuid.s);
282 goto error;
283 }
284 else
285 {

Callers 1

w_sql_avp_loadFunction · 0.85

Calls 7

pv_get_spec_valueFunction · 0.85
parse_uriFunction · 0.85
pv_get_spec_nameFunction · 0.85
sql_avp_loadFunction · 0.85
get_avp_idFunction · 0.85
dbrow2avpFunction · 0.85
db_close_queryFunction · 0.85

Tested by

no test coverage detected