Commit adf54ab0 authored by Sebastien Decugis's avatar Sebastien Decugis
Browse files

Added new AVP search criteria in the dictionary: AVP_BY_NAME_ALL_VENDORS

parent 02381d33
......@@ -1209,7 +1209,8 @@ enum {
AVP_BY_CODE = 50, /* "what" points to an avp_code_t, vendor is always 0 */
AVP_BY_NAME, /* "what" points to a string, vendor is always 0 */
AVP_BY_CODE_AND_VENDOR, /* "what" points to a struct dict_avp_request (see bellow), where avp_vendor and avp_code are set */
AVP_BY_NAME_AND_VENDOR /* "what" points to a struct dict_avp_request (see bellow), where avp_vendor and avp_name are set */
AVP_BY_NAME_AND_VENDOR, /* "what" points to a struct dict_avp_request (see bellow), where avp_vendor and avp_name are set */
AVP_BY_NAME_ALL_VENDORS /* "what" points to a string. Might be quite slow... */
};
/* Struct used for some researchs */
......
......@@ -591,11 +591,11 @@ in the local context where they are called. They are meant to be called only fro
int __cmp; \
struct fd_list * __li; \
ret = 0; \
for (__li = (sentinel); __li->next != (sentinel); __li = __li->next) { \
__cmp = strcmp(__str, _O(__li->next->o)->data. datafield ); \
for (__li = (sentinel)->next; __li != (sentinel); __li = __li->next) { \
__cmp = strcmp(__str, _O(__li->o)->data. datafield ); \
if (__cmp == 0) { \
if (result) \
*result = _O(__li->next->o); \
*result = _O(__li->o); \
goto end; \
} \
if ((isindex) && (__cmp < 0)) \
......@@ -973,6 +973,20 @@ static int search_avp ( struct dictionary * dict, int criteria, void * what, str
}
break;
case AVP_BY_NAME_ALL_VENDORS:
{
struct fd_list * li;
/* First, search for vendor 0 */
SEARCH_string( what, &dict->dict_vendors.list[2], avp.avp_name, 1);
/* If not found, loop for all vendors, until found */
for (li = dict->dict_vendors.list[0].next; li != &dict->dict_vendors.list[0]; li = li->next) {
SEARCH_string( what, &_O(li->o)->list[2], avp.avp_name, 1);
}
}
break;
default:
/* Invalid criteria */
CHECK_PARAMS( criteria = 0 );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment