| 1261 | } |
| 1262 | |
| 1263 | static 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 | |
| 1293 | static int w_cache_counter_fetch(struct sip_msg *msg, str *id, str *attr, |
| 1294 | pv_spec_t *res) |
nothing calls this directly
no test coverage detected