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

Improved usability of fd_dict_getlistof for vendors and apps

parent 9a12f8dd
......@@ -1968,7 +1968,7 @@ int fd_dict_init ( struct dictionary ** dict)
#define NO_VENDOR_NAME "(no vendor)"
new->dict_vendors.data.vendor.vendor_name = NO_VENDOR_NAME;
new->dict_vendors.datastr_len = CONSTSTRLEN(NO_VENDOR_NAME);
new->dict_vendors.list[0].o = NULL; /* overwrite since element is also sentinel for this list. */
/* new->dict_vendors.list[0].o = NULL; *//* overwrite since element is also sentinel for this list. */
new->dict_vendors.dico = new;
/* Initialize the sentinel for applications */
......@@ -1976,7 +1976,7 @@ int fd_dict_init ( struct dictionary ** dict)
#define APPLICATION_0_NAME "Diameter Common Messages"
new->dict_applications.data.application.application_name = APPLICATION_0_NAME;
new->dict_applications.datastr_len = CONSTSTRLEN(APPLICATION_0_NAME);
new->dict_applications.list[0].o = NULL; /* overwrite since since element is also sentinel for this list. */
/* new->dict_applications.list[0].o = NULL; *//* overwrite since since element is also sentinel for this list. */
new->dict_applications.dico = new;
/* Initialize the sentinel for types */
......
......@@ -136,12 +136,19 @@ int main(int argc, char *argv[])
enum dict_object_type type;
struct dict_object * defvnd=NULL;
vendor_id_t vid = 0;
int first = 1;
CHECK( 0, fd_dict_getlistof(VENDOR_BY_ID, fd_g_config->cnf_dict, &sentinel));
for (li = sentinel->next; li != sentinel; li = li->next) {
for (li = sentinel; (li != sentinel) || (first != 0); li = li->next) {
first = 0;
CHECK(0, fd_dict_gettype(li->o, &type));
CHECK(DICT_VENDOR, type);
#if 0
struct dict_vendor_data data;
CHECK( 0, fd_dict_getval(li->o, &data) );
printf("%d : %s\n", data.vendor_id, data.vendor_name);
#endif
}
CHECK( 0, fd_dict_search(fd_g_config->cnf_dict, DICT_VENDOR, VENDOR_BY_ID, &vid, &defvnd, ENOENT) );
......
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