Changeset 105:0d9c9e004be0 in freeDiameter
- Timestamp:
- Dec 8, 2009, 1:38:43 PM (14 years ago)
- Branch:
- default
- Phase:
- public
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
freeDiameter/apps.c
r87 r105 100 100 return 0; 101 101 } 102 103 /* Check if two lists have at least one common application */ 104 int fd_app_check_common(struct fd_list * list1, struct fd_list * list2, int * common_found) 105 { 106 struct fd_list * li1, *li2; 107 108 TRACE_ENTRY("%p %p %p", list1, list2, common_found); 109 CHECK_PARAMS( list1 && list2 && common_found ); 110 111 /* Both lists are ordered, so advance both pointers at the same time */ 112 for (li1 = list1->next, li2 = list2->next; (li1 != list1) && (li2 != list2); ) { 113 struct fd_app * a1 = (struct fd_app *)li1, *a2 = (struct fd_app *)li2; 114 if (a1->appid < a2->appid) { 115 li1 = li1->next; 116 continue; 117 } 118 if (a1->appid > a2->appid) { 119 li2 = li2->next; 120 continue; 121 } 122 /* They are equal, compare the applications */ 123 if ((a1->flags.auth && a2->flags.auth) || (a1->flags.acct && a2->flags.acct)) { 124 /* found! */ 125 *common_found = 1; 126 return 0; 127 } 128 129 /* This application is not common, advance both lists */ 130 li1 = li1->next; 131 li2 = li2->next; 132 } 133 134 /* We did not find a common app */ 135 *common_found = 0; 136 return 0; 137 } -
freeDiameter/config.c
r59 r105 111 111 app->flags.auth ? "Au" : "--", 112 112 app->flags.acct ? "Ac" : "--", 113 app->flags.common ? "C" : "-",114 113 app->vndid); 115 114 li = li->next; -
freeDiameter/p_ce.c
r87 r105 704 704 } 705 705 706 /* Handle the receiver side after winning an election (or timeout on initiator side) */706 /* Handle the receiver side to go to OPEN state (any election is resolved) */ 707 707 int fd_p_ce_process_receiver(struct fd_peer * peer) 708 708 { … … 710 710 struct msg * msg = NULL; 711 711 int isi = 0; 712 int fatal = 0; 712 713 713 714 TRACE_ENTRY("%p", peer); … … 731 732 732 733 /* Check if we have common applications */ 733 TODO("DIAMETER_NO_COMMON_APPLICATION ?"); 734 if ( fd_g_config->cnf_flags.no_fwd && (! peer->p_hdr.info.runtime.pir_relay) ) { 735 int got_common; 736 CHECK_FCT( fd_app_check_common( &fd_g_config->cnf_apps, &peer->p_hdr.info.runtime.pir_apps, &got_common) ); 737 if (!got_common) { 738 TRACE_DEBUG(INFO, "No common application with peer '%s', sending DIAMETER_NO_COMMON_APPLICATION", peer->p_hdr.info.pi_diamid); 739 ec = "DIAMETER_NO_COMMON_APPLICATION"; 740 fatal = 1; 741 goto error_abort; 742 } 743 } 734 744 735 745 /* Do we send ISI back ? */ … … 808 818 809 819 /* Send the error to the peer */ 810 CHECK_FCT( fd_event_send(peer->p_events, FDEVP_CNX_ERROR, 0, NULL) );820 CHECK_FCT( fd_event_send(peer->p_events, fatal ? FDEVP_TERMINATE : FDEVP_CNX_ERROR, 0, NULL) ); 811 821 812 822 return 0; -
include/freeDiameter/freeDiameter.h
r93 r105 699 699 unsigned auth : 1; 700 700 unsigned acct : 1; 701 unsigned common : 1;702 701 } flags; 703 702 vendor_id_t vndid; /* if not 0, Vendor-Specific-App-Id AVP will be used */ … … 707 706 int fd_app_merge(struct fd_list * list, application_id_t aid, vendor_id_t vid, int auth, int acct); 708 707 int fd_app_check(struct fd_list * list, application_id_t aid, struct fd_app **detail); 708 int fd_app_check_common(struct fd_list * list1, struct fd_list * list2, int * common_found); 709 709 710 710 #endif /* _FREEDIAMETER_H */
Note: See TracChangeset
for help on using the changeset viewer.