Changeset 24:bd83ce9328ed in freeDiameter for freeDiameter/config.c
- Timestamp:
- Oct 21, 2009, 6:42:45 PM (15 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
freeDiameter/config.c
r23 r24 272 272 return 0; 273 273 } 274 275 /* Add an endpoint information in a list */276 int fd_ep_add_merge( struct fd_list * list, sSA * sa, socklen_t sl, int conf, int disc, int adv, int ll )277 {278 struct fd_endpoint * ep;279 struct fd_list * li;280 int cmp = -1;281 282 TRACE_ENTRY("%p %p %u %i %i %i %i", list, sa, sl, conf, disc, adv, ll);283 CHECK_PARAMS( list && sa && (sl <= sizeof(sSS)) && (conf || disc || adv || ll) );284 285 /* Search place in the list */286 for (li = list->next; li != list; li = li->next) {287 ep = (struct fd_endpoint *)li;288 289 cmp = memcmp(&ep->ss, sa, sl);290 if (cmp >= 0)291 break;292 }293 294 if (cmp) {295 /* new item to be added */296 CHECK_MALLOC( ep = malloc(sizeof(struct fd_endpoint)) );297 memset(ep, 0, sizeof(struct fd_endpoint));298 fd_list_init(&ep->chain, NULL);299 memcpy(&ep->ss, sa, sl);300 301 /* Insert in the list */302 fd_list_insert_before(li, &ep->chain);303 }304 305 /* Merge the flags */306 ep->meta.conf = conf || ep->meta.conf;307 ep->meta.disc = disc || ep->meta.disc;308 ep->meta.adv = adv || ep->meta.adv;309 ep->meta.ll = ll || ep->meta.ll;310 311 return 0;312 }313
Note: See TracChangeset
for help on using the changeset viewer.