| 1346 | } |
| 1347 | |
| 1348 | static int w_cache_sub(struct sip_msg *msg, str *id, str *attr, |
| 1349 | int *dec, int *expire, pv_spec_t *new_val) |
| 1350 | { |
| 1351 | int ret; |
| 1352 | pv_value_t val; |
| 1353 | int aux_counter; |
| 1354 | |
| 1355 | if (!attr->s || !attr->len) { |
| 1356 | LM_ERR("attribute cannot be empty\n"); |
| 1357 | return E_UNSPEC; |
| 1358 | } |
| 1359 | |
| 1360 | ret = cachedb_sub(id, attr, *dec, *expire, &aux_counter); |
| 1361 | |
| 1362 | /* Return the new value */ |
| 1363 | if (ret > 0 && new_val) { |
| 1364 | val.ri = aux_counter; |
| 1365 | val.flags = PV_TYPE_INT|PV_VAL_INT; |
| 1366 | |
| 1367 | if (pv_set_value(msg, new_val, 0, &val) < 0) { |
| 1368 | LM_ERR("cannot set the variable value\n"); |
| 1369 | return -1; |
| 1370 | } |
| 1371 | } |
| 1372 | |
| 1373 | return ret; |
| 1374 | } |
| 1375 | |
| 1376 | static int w_cache_raw_query(struct sip_msg *msg, str *id, str *raw_query_s, |
| 1377 | pvname_list_t *avp_list) |
nothing calls this directly
no test coverage detected