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

Function w_cache_counter_fetch

core_cmds.c:1293–1318  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1291}
1292
1293static int w_cache_counter_fetch(struct sip_msg *msg, str *id, str *attr,
1294 pv_spec_t *res)
1295{
1296 int aux_counter;
1297 int ret;
1298 pv_value_t val;
1299
1300 if (!attr->s || !attr->len) {
1301 LM_ERR("attribute cannot be empty\n");
1302 return E_UNSPEC;
1303 }
1304
1305 ret = cachedb_counter_fetch(id, attr, &aux_counter);
1306 if(ret > 0)
1307 {
1308 val.ri = aux_counter;
1309 val.flags = PV_TYPE_INT|PV_VAL_INT;
1310
1311 if (pv_set_value(msg, res, 0, &val) < 0) {
1312 LM_ERR("cannot set the variable value\n");
1313 return -1;
1314 }
1315 }
1316
1317 return ret;
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)

Callers

nothing calls this directly

Calls 2

cachedb_counter_fetchFunction · 0.85
pv_set_valueFunction · 0.85

Tested by

no test coverage detected