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

Function dm_find

modules/aaa_diameter/dm_impl.c:1688–1748  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1686
1687
1688int dm_find(aaa_conn *_, aaa_map *map, int op)
1689{
1690 struct dict_object *obj;
1691
1692 if (!map) {
1693 LM_ERR("NULL map argument\n");
1694 return -1;
1695 }
1696
1697 switch (op) {
1698 case AAA_DICT_FIND_ATTR: {
1699 struct dict_avp_data avp;
1700
1701 if (map->type == 0) {
1702 FD_CHECK(fd_dict_search(fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME,
1703 map->name, &obj, ENOENT));
1704 FD_CHECK(fd_dict_getval(obj, &avp));
1705 } else {
1706 struct dict_avp_request_ex req;
1707
1708 memset(&req, 0, sizeof req);
1709 req.avp_data.avp_name = map->name;
1710 req.avp_vendor.vendor_id = map->type;
1711
1712 FD_CHECK(fd_dict_search(fd_g_config->cnf_dict, DICT_AVP, AVP_BY_STRUCT,
1713 &req, &obj, ENOENT));
1714 FD_CHECK(fd_dict_getval(obj, &avp));
1715 }
1716
1717 map->value = avp.avp_code;
1718 return 0;
1719 }
1720 case AAA_DICT_FIND_VAL: {
1721 unsigned int entry;
1722 int *value;
1723
1724 entry = hash_entry(osips_enumvals, *_str(map->name));
1725 value = (int *)hash_find(osips_enumvals, entry, *_str(map->name));
1726 if (!value) {
1727 LM_ERR("enum '%s' not found\n", map->name);
1728 return -1;
1729 }
1730
1731 map->value = *value;
1732 return 0;
1733 }
1734 case AAA_DICT_FIND_VEND: {
1735 struct dict_vendor_data vendor;
1736
1737 FD_CHECK(fd_dict_search(fd_g_config->cnf_dict, DICT_VENDOR, VENDOR_BY_NAME,
1738 map->name, &obj, ENOENT));
1739 FD_CHECK(fd_dict_getval(obj, &vendor));
1740
1741 map->value = vendor.vendor_id;
1742 LM_DBG("found vendor '%s', id: %d\n", map->name, map->value);
1743 return 0;
1744 }}
1745

Callers

nothing calls this directly

Calls 2

hash_entryClass · 0.85
_strClass · 0.85

Tested by

no test coverage detected