| 1291 | } |
| 1292 | |
| 1293 | static 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 | |
| 1320 | static int w_cache_add(struct sip_msg *msg, str *id, str *attr, |
| 1321 | int *inc, int *expire, pv_spec_t *new_val) |
nothing calls this directly
no test coverage detected