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

Function dict_avp_dec_time

modules/aaa_diameter/dm_impl.c:2498–2513  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2496}
2497
2498static cJSON *dict_avp_dec_time(struct avp_hdr * h, struct dict_avp_data *avp)
2499{
2500 cJSON *obj;
2501 uint32_t dt;
2502 unsigned char *bytes;
2503
2504 if (avp->avp_basetype != AVP_TYPE_OCTETSTRING) {
2505 LM_ERR("invalid base type for TIME: %d\n", avp->avp_basetype);
2506 return NULL;
2507 }
2508 bytes = h->avp_value->os.data;
2509 dt = ((uint32_t)bytes[0] << 24) | ((uint32_t)bytes[1] << 16) |
2510 ((uint32_t)bytes[2] << 8) | ((uint32_t)bytes[3]);
2511 obj = cJSON_CreateNumber(dt - AAA_DIAM_TIME_OFFSET);
2512 return obj;
2513}

Callers

nothing calls this directly

Calls 1

cJSON_CreateNumberFunction · 0.50

Tested by

no test coverage detected