Changeset 903:4382d7420e65 in freeDiameter
- Timestamp:
- Dec 15, 2012, 5:24:34 AM (11 years ago)
- Branch:
- default
- Phase:
- public
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
include/freeDiameter/libfdproto.h
r899 r903 1331 1331 AVP_BY_CODE = 50, /* "what" points to an avp_code_t, vendor is always 0 */ 1332 1332 AVP_BY_NAME, /* "what" points to a char *, vendor is always 0 */ 1333 AVP_BY_NAME_ALL_VENDORS,/* "what" points to a string. Might be quite slow... */ 1334 AVP_BY_STRUCT, /* "what" points to a struct dict_avp_request_ex (see bellow) */ 1335 1336 /* kept for backward compatibility, better use AVP_BY_STRUCT above instead */ 1333 1337 AVP_BY_CODE_AND_VENDOR, /* "what" points to a struct dict_avp_request (see bellow), where avp_vendor and avp_code are set */ 1334 AVP_BY_NAME_AND_VENDOR, /* "what" points to a struct dict_avp_request (see bellow), where avp_vendor and avp_name are set */ 1335 AVP_BY_NAME_ALL_VENDORS /* "what" points to a string. Might be quite slow... */ 1338 AVP_BY_NAME_AND_VENDOR /* "what" points to a struct dict_avp_request (see bellow), where avp_vendor and avp_name are set */ 1336 1339 }; 1337 1340 1338 1341 /* Struct used for some researchs */ 1342 struct dict_avp_request_ex { 1343 struct { 1344 /* Only one of the following fields must be set. */ 1345 struct dict_object * vendor; /* most efficient if already known, set to NULL to ignore */ 1346 vendor_id_t vendor_id; /* set to 0 to ignore -- prefer AVP_BY_CODE or AVP_BY_NAME for vendor 0 */ 1347 char * vendor_name; /* set to NULL to ignore */ 1348 } avp_vendor; 1349 1350 struct { 1351 /* Only one of the following fields must be set */ 1352 avp_code_t avp_code; /* set to 0 to ignore */ 1353 char * avp_name; /* set to NULL to ignore */ 1354 } avp_data; 1355 }; 1356 1339 1357 struct dict_avp_request { 1340 1358 vendor_id_t avp_vendor; … … 1342 1360 char * avp_name; 1343 1361 }; 1362 1344 1363 1345 1364 -
libfdproto/dictionary.c
r834 r903 977 977 break; 978 978 979 case AVP_BY_STRUCT: 980 { 981 struct dict_avp_request_ex * _what = (struct dict_avp_request_ex *) what; 982 struct dict_object * vendor = NULL; 983 984 CHECK_PARAMS( _what->avp_vendor.vendor || _what->avp_vendor.vendor_id || _what->avp_vendor.vendor_name ); 985 CHECK_PARAMS( _what->avp_data.avp_code || _what->avp_data.avp_name ); 986 987 /* Now look for the vendor first */ 988 if (_what->avp_vendor.vendor) { 989 CHECK_PARAMS( ! _what->avp_vendor.vendor_id && ! _what->avp_vendor.vendor_name ); 990 vendor = _what->avp_vendor.vendor; 991 } else if (_what->avp_vendor.vendor_id) { 992 CHECK_PARAMS( ! _what->avp_vendor.vendor_name ); 993 CHECK_FCT( search_vendor( dict, VENDOR_BY_ID, &_what->avp_vendor.vendor_id, &vendor ) ); 994 } else { 995 CHECK_FCT( search_vendor( dict, VENDOR_BY_NAME, &_what->avp_vendor.vendor_name, &vendor ) ); 996 } 997 998 if (vendor == NULL) { 999 if (result) 1000 *result = NULL; 1001 else 1002 ret = ENOENT; 1003 goto end; 1004 } 1005 1006 /* We now have our vendor = head of the appropriate avp list */ 1007 if (_what->avp_data.avp_code) { 1008 CHECK_PARAMS( ! _what->avp_data.avp_name ); 1009 SEARCH_scalar( _what->avp_data.avp_code, &vendor->list[1], avp.avp_code, 1, (struct dict_object *)NULL ); 1010 } else { 1011 SEARCH_os0( _what->avp_data.avp_name, &vendor->list[2], avp.avp_name, 1); 1012 } 1013 } 1014 break; 1015 979 1016 case AVP_BY_NAME_ALL_VENDORS: 980 1017 { -
libfdproto/messages.c
r895 r903 1791 1791 /* Now try and resolve the model from the avp code and vendor */ 1792 1792 if (avp->avp_public.avp_flags & AVP_FLAG_VENDOR) { 1793 struct dict_avp_request avpreq; 1794 avpreq.avp_vendor = avp->avp_public.avp_vendor; 1795 avpreq.avp_code = avp->avp_public.avp_code; 1796 CHECK_FCT( fd_dict_search ( dict, DICT_AVP, AVP_BY_CODE_AND_VENDOR, &avpreq, &avp->avp_model, 0)); 1793 struct dict_avp_request_ex avpreq; 1794 memset(&avpreq, 0, sizeof(avpreq)); 1795 avpreq.avp_vendor.vendor_id = avp->avp_public.avp_vendor; 1796 avpreq.avp_data.avp_code = avp->avp_public.avp_code; 1797 CHECK_FCT( fd_dict_search ( dict, DICT_AVP, AVP_BY_STRUCT, &avpreq, &avp->avp_model, 0)); 1797 1798 } else { 1798 1799 /* no vendor */
Note: See TracChangeset
for help on using the changeset viewer.