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

Function ops_sql_avp_store

modules/sqlops/sqlops_impl.c:534–751  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

532
533
534int ops_sql_avp_store(struct sip_msg* msg, struct fis_param *sp,
535 struct db_param *dbp, struct db_url *url, int use_domain)
536{
537 struct sip_uri uri;
538 struct usr_avp **avp_list;
539 struct usr_avp *avp;
540 int avp_name;
541 int_str i_s;
542 str uuid;
543 int keys_nr;
544 int n;
545 pv_value_t xvalue;
546 str *s0, *s1, *s2;
547 str *sn;
548
549 s0 = s1 = s2 = NULL;
550 if (!((sp->opd&SQLOPS_VAL_PVAR)||(sp->opd&SQLOPS_VAL_STR))) {
551 LM_CRIT("invalid flag combination (%d/%d)\n", sp->opd, sp->ops);
552 goto error;
553 }
554
555 keys_nr = 6; /* uuid, avp name, avp val, avp type, user, domain */
556
557 /* get uuid from avp */
558 if (sp->opd&SQLOPS_VAL_PVAR)
559 {
560 if(pv_get_spec_value(msg, &(sp->u.sval), &xvalue)!=0)
561 {
562 LM_CRIT("failed to get PVAR value (%d/%d)\n", sp->opd, sp->ops);
563 goto error;
564 }
565 if(xvalue.flags&(PV_VAL_NULL|PV_VAL_EMPTY))
566 {
567 LM_ERR("no value for first param\n");
568 goto error;
569 }
570 uuid = xvalue.rs;
571 } else {
572 uuid.s = sp->u.s.s;
573 uuid.len = sp->u.s.len;
574 }
575
576 if(sp->opd&SQLOPS_FLAG_UUID0)
577 {
578 s0 = &uuid;
579 } else {
580 /* parse uri */
581 if (parse_uri(uuid.s, uuid.len, &uri)<0)
582 {
583 LM_ERR("failed to parse uri\n");
584 goto error;
585 }
586
587 if((sp->opd&SQLOPS_FLAG_URI0)||(sp->opd&SQLOPS_FLAG_USER0))
588 {
589 /* check tha uri contains user part */
590 if(!uri.user.s|| !uri.user.len)
591 {

Callers 1

w_sql_avp_storeFunction · 0.85

Calls 10

pv_get_spec_valueFunction · 0.85
parse_uriFunction · 0.85
pv_get_spec_nameFunction · 0.85
get_avp_idFunction · 0.85
search_first_avpFunction · 0.85
int_str2db_valFunction · 0.85
sql_avp_storeFunction · 0.85
get_avp_listFunction · 0.85
get_avp_nameFunction · 0.85
get_avp_valFunction · 0.85

Tested by

no test coverage detected