Changeset 43:2db15632a63d in freeDiameter for freeDiameter/dispatch.c
- Timestamp:
- Nov 25, 2009, 7:07:09 PM (14 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
freeDiameter/dispatch.c
r10 r43 36 36 #include "fD.h" 37 37 38 /* Add an application into the peer's supported apps */ 38 39 int fd_disp_app_support ( struct dict_object * app, struct dict_object * vendor, int auth, int acct ) 39 40 { 41 application_id_t aid = 0; 40 42 vendor_id_t vid = 0; 41 application_id_t aid = 0;42 struct fd_list * li;43 int skip = 0;44 43 45 44 TRACE_ENTRY("%p %p %d %d", app, vendor, auth, acct); … … 54 53 aid = data.application_id; 55 54 } 56 57 58 /* Now insert in the list ordered by appid. Avoid duplicates */ 59 for (li = &fd_g_config->cnf_apps; li->next != &fd_g_config->cnf_apps; li = li->next) { 60 struct fd_app * na = (struct fd_app *)(li->next); 61 if (na->appid < aid) 62 continue; 63 64 if (na->appid > aid) 65 break; 66 67 /* Otherwise, we merge with existing entry -- ignore vendor id in this case */ 68 skip = 1; 69 70 if (auth) 71 na->flags.auth = 1; 72 if (acct) 73 na->flags.acct = 1; 74 break; 55 56 if (vendor) { 57 enum dict_object_type type = 0; 58 struct dict_vendor_data data; 59 CHECK_FCT( fd_dict_gettype(vendor, &type) ); 60 CHECK_PARAMS( type == DICT_VENDOR ); 61 CHECK_FCT( fd_dict_getval(vendor, &data) ); 62 vid = data.vendor_id; 75 63 } 76 64 77 if (!skip) { 78 struct fd_app * new = NULL; 79 80 if (vendor) { 81 enum dict_object_type type = 0; 82 struct dict_vendor_data data; 83 CHECK_FCT( fd_dict_gettype(vendor, &type) ); 84 CHECK_PARAMS( type == DICT_VENDOR ); 85 CHECK_FCT( fd_dict_getval(vendor, &data) ); 86 vid = data.vendor_id; 87 } 88 89 CHECK_MALLOC( new = malloc(sizeof(struct fd_app)) ); 90 memset(new, 0, sizeof(struct fd_app)); 91 fd_list_init(&new->chain, NULL); 92 new->flags.auth = (auth ? 1 : 0); 93 new->flags.acct = (acct ? 1 : 0); 94 new->vndid = vid; 95 new->appid = aid; 96 fd_list_insert_after(li, &new->chain); 97 } 98 99 return 0; 65 return fd_app_merge(&fd_g_config->cnf_apps, aid, vid, auth, acct); 100 66 }
Note: See TracChangeset
for help on using the changeset viewer.