Mercurial > hg > freeDiameter
comparison freeDiameter/p_ce.c @ 233:87ca7b66a90c
Make the CEA broadcast optional
author | Sebastien Decugis <sdecugis@nict.go.jp> |
---|---|
date | Thu, 04 Mar 2010 17:24:31 +0900 |
parents | 5b17534180f1 |
children | 5df55136361b |
comparison
equal
deleted
inserted
replaced
232:c07f9692b537 | 233:87ca7b66a90c |
---|---|
35 | 35 |
36 #include "fD.h" | 36 #include "fD.h" |
37 | 37 |
38 /* This file contains code to handle Capabilities Exchange messages (CER and CEA) and election process */ | 38 /* This file contains code to handle Capabilities Exchange messages (CER and CEA) and election process */ |
39 | 39 |
40 /* Compilation option: | |
41 USE_CEA_BROADCAST | |
42 Define this to enable sending multiple copies of the CEA in case of SCTP connection. | |
43 This avoids a race condition when sending an application message over a different stream | |
44 than the CEA, it might be delivered first and thus ignored. | |
45 */ | |
46 | |
40 /* Save a connection as peer's principal */ | 47 /* Save a connection as peer's principal */ |
41 static int set_peer_cnx(struct fd_peer * peer, struct cnxctx **cnx) | 48 static int set_peer_cnx(struct fd_peer * peer, struct cnxctx **cnx) |
42 { | 49 { |
43 CHECK_PARAMS( peer->p_cnxctx == NULL ); | 50 CHECK_PARAMS( peer->p_cnxctx == NULL ); |
44 | 51 |
810 | 817 |
811 /* Reply a CEA */ | 818 /* Reply a CEA */ |
812 CHECK_FCT( fd_msg_new_answer_from_req ( fd_g_config->cnf_dict, &msg, 0 ) ); | 819 CHECK_FCT( fd_msg_new_answer_from_req ( fd_g_config->cnf_dict, &msg, 0 ) ); |
813 CHECK_FCT( fd_msg_rescode_set(msg, "DIAMETER_SUCCESS", NULL, NULL, 0 ) ); | 820 CHECK_FCT( fd_msg_rescode_set(msg, "DIAMETER_SUCCESS", NULL, NULL, 0 ) ); |
814 CHECK_FCT( add_CE_info(msg, peer->p_cnxctx, isi & PI_SEC_TLS_OLD, isi & PI_SEC_NONE) ); | 821 CHECK_FCT( add_CE_info(msg, peer->p_cnxctx, isi & PI_SEC_TLS_OLD, isi & PI_SEC_NONE) ); |
822 #ifdef USE_CEA_BROADCAST | |
815 CHECK_FCT( fd_out_send(&msg, peer->p_cnxctx, peer, (isi & PI_SEC_TLS_OLD) ? FD_CNX_ORDERED : FD_CNX_BROADCAST) ); /* Broadcast in order to avoid further messages sent over a different stream be delivered first... */ | 823 CHECK_FCT( fd_out_send(&msg, peer->p_cnxctx, peer, (isi & PI_SEC_TLS_OLD) ? FD_CNX_ORDERED : FD_CNX_BROADCAST) ); /* Broadcast in order to avoid further messages sent over a different stream be delivered first... */ |
824 #else /* USE_CEA_BROADCAST */ | |
825 CHECK_FCT( fd_out_send(&msg, peer->p_cnxctx, peer, FD_CNX_ORDERED ) ); | |
826 #endif /* USE_CEA_BROADCAST */ | |
816 | 827 |
817 /* Handshake if needed */ | 828 /* Handshake if needed */ |
818 if (isi & PI_SEC_TLS_OLD) { | 829 if (isi & PI_SEC_TLS_OLD) { |
819 fd_psm_change_state(peer, STATE_OPEN_HANDSHAKE); | 830 fd_psm_change_state(peer, STATE_OPEN_HANDSHAKE); |
820 CHECK_FCT_DO( fd_cnx_handshake(peer->p_cnxctx, GNUTLS_SERVER, peer->p_hdr.info.config.pic_priority, NULL), | 831 CHECK_FCT_DO( fd_cnx_handshake(peer->p_cnxctx, GNUTLS_SERVER, peer->p_hdr.info.config.pic_priority, NULL), |