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

Function dict_avp_dec_hex

modules/aaa_diameter/dm_impl.c:2452–2471  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2450}
2451
2452static cJSON *dict_avp_dec_hex(struct avp_hdr * h, struct dict_avp_data *avp)
2453{
2454 char *buf;
2455 int len;
2456 cJSON *obj;
2457
2458 if (avp->avp_basetype != AVP_TYPE_OCTETSTRING) {
2459 LM_ERR("invalid base type for IP: %d\n", avp->avp_basetype);
2460 return NULL;
2461 }
2462 buf = pkg_malloc(h->avp_value->os.len * 2);
2463 if (!buf) {
2464 LM_ERR("oom for hex buffer\n");
2465 return NULL;
2466 }
2467 len = string2hex((const char *)h->avp_value->os.data, h->avp_value->os.len, buf);
2468 obj = cJSON_CreateStr(buf, len);
2469 pkg_free(buf);
2470 return obj;
2471}
2472
2473#define AAA_DIAM_TIME_OFFSET 2208988800U
2474

Callers

nothing calls this directly

Calls 2

string2hexFunction · 0.85
cJSON_CreateStrFunction · 0.85

Tested by

no test coverage detected