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

Function w_cache_add

core_cmds.c:1320–1346  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1318}
1319
1320static int w_cache_add(struct sip_msg *msg, str *id, str *attr,
1321 int *inc, int *expire, pv_spec_t *new_val)
1322{
1323 int ret;
1324 pv_value_t val;
1325 int aux_counter;
1326
1327 if (!attr->s || !attr->len) {
1328 LM_ERR("attribute cannot be empty\n");
1329 return E_UNSPEC;
1330 }
1331
1332 ret = cachedb_add(id, attr, *inc, *expire, &aux_counter);
1333
1334 /* Return the new value */
1335 if (ret > 0 && new_val) {
1336 val.ri = aux_counter;
1337 val.flags = PV_TYPE_INT|PV_VAL_INT;
1338
1339 if (pv_set_value(msg, new_val, 0, &val) < 0) {
1340 LM_ERR("cannot set the variable value\n");
1341 return -1;
1342 }
1343 }
1344
1345 return ret;
1346}
1347
1348static int w_cache_sub(struct sip_msg *msg, str *id, str *attr,
1349 int *dec, int *expire, pv_spec_t *new_val)

Callers

nothing calls this directly

Calls 2

cachedb_addFunction · 0.85
pv_set_valueFunction · 0.85

Tested by

no test coverage detected