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

Function dict_avp_dec_ip

modules/aaa_diameter/dm_impl.c:2409–2425  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2407}
2408
2409static cJSON *dict_avp_dec_ip(struct avp_hdr * h, struct dict_avp_data *avp)
2410{
2411 int af;
2412 char buf[INET6_ADDRSTRLEN];
2413
2414 if (avp->avp_basetype != AVP_TYPE_OCTETSTRING) {
2415 LM_ERR("invalid base type for IP: %d\n", avp->avp_basetype);
2416 return NULL;
2417 }
2418
2419 af = (h->avp_value->os.len == INET6_ADDRSTRLEN?AF_INET6:AF_INET);
2420 if (inet_ntop(af, h->avp_value->os.data, buf, INET6_ADDRSTRLEN) == NULL) {
2421 LM_ERR("cannot convert to an IP\n");
2422 return NULL;
2423 }
2424 return cJSON_CreateString(buf);;
2425}
2426
2427static int dict_avp_enc_hex(cJSON *obj, struct dict_avp_data *avp, int _, str *ret)
2428{

Callers

nothing calls this directly

Calls 1

cJSON_CreateStringFunction · 0.50

Tested by

no test coverage detected