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

Function w_cache_fetch

core_cmds.c:1263–1291  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1261}
1262
1263static int w_cache_fetch(struct sip_msg *msg, str *id, str *attr,
1264 pv_spec_t *res)
1265{
1266 str aux = {0, 0};
1267 int ret;
1268 pv_value_t val;
1269
1270 if (!attr->s || !attr->len) {
1271 LM_ERR("attribute cannot be empty\n");
1272 return E_UNSPEC;
1273 }
1274
1275 ret = cachedb_fetch(id, attr, &aux);
1276 if(ret > 0)
1277 {
1278 val.rs = aux;
1279 val.flags = PV_VAL_STR;
1280 fix_val_str_flags(val);
1281
1282 if (pv_set_value(msg, res, 0, &val) < 0) {
1283 LM_ERR("cannot set the variable value\n");
1284 pkg_free(aux.s);
1285 return -1;
1286 }
1287 pkg_free(aux.s);
1288 }
1289
1290 return ret;
1291}
1292
1293static int w_cache_counter_fetch(struct sip_msg *msg, str *id, str *attr,
1294 pv_spec_t *res)

Callers

nothing calls this directly

Calls 2

cachedb_fetchFunction · 0.85
pv_set_valueFunction · 0.85

Tested by

no test coverage detected