Mercurial > hg > freeDiameter
comparison include/freeDiameter/freeDiameter.h @ 12:418d2ce80dc8
Added support in configuration file for peers declaration
author | Sebastien Decugis <sdecugis@nict.go.jp> |
---|---|
date | Mon, 28 Sep 2009 17:29:25 +0900 |
parents | 6576ef5e01eb |
children | ef9ef3bf4752 |
comparison
equal
deleted
inserted
replaced
11:6576ef5e01eb | 12:418d2ce80dc8 |
---|---|
122 return 0; | 122 return 0; |
123 } | 123 } |
124 | 124 |
125 /* Events codespace for fd_g_config->cnf_main_ev */ | 125 /* Events codespace for fd_g_config->cnf_main_ev */ |
126 enum { | 126 enum { |
127 FDEV_TERMINATE = 1000, /* request to terminate */ | 127 FDEV_TERMINATE = 1000 /* request to terminate */ |
128 FDEV_DUMP_DICT, /* Dump the content of the dictionary */ | 128 ,FDEV_DUMP_DICT /* Dump the content of the dictionary */ |
129 FDEV_DUMP_EXT, /* Dump state of extensions */ | 129 ,FDEV_DUMP_EXT /* Dump state of extensions */ |
130 FDEV_DUMP_QUEUES, /* Dump the message queues */ | 130 ,FDEV_DUMP_QUEUES /* Dump the message queues */ |
131 FDEV_DUMP_CONFIG, /* Dump the configuration */ | 131 ,FDEV_DUMP_CONFIG /* Dump the configuration */ |
132 FDEV_DUMP_PEERS /* Dump the list of peers */ | 132 ,FDEV_DUMP_PEERS /* Dump the list of peers */ |
133 }; | 133 }; |
134 | 134 |
135 | 135 |
136 | 136 |
137 /***************************************/ | 137 /***************************************/ |
158 /* Failover state machine */ | 158 /* Failover state machine */ |
159 STATE_SUSPECT, /* A DWR was sent and not answered within TwTime. Failover in progress. */ | 159 STATE_SUSPECT, /* A DWR was sent and not answered within TwTime. Failover in progress. */ |
160 STATE_REOPEN /* Connection has been re-established, waiting for 3 DWR/DWA exchanges before putting back to service */ | 160 STATE_REOPEN /* Connection has been re-established, waiting for 3 DWR/DWA exchanges before putting back to service */ |
161 }; | 161 }; |
162 extern const char *peer_state_str[]; | 162 extern const char *peer_state_str[]; |
163 #define STATE_STR(state) \ | |
164 peer_state_str[ ((unsigned)(state)) <= STATE_REOPEN ? ((unsigned)(state)) : 0 ] | |
163 | 165 |
164 /* Information about a remote peer, used both for query and for creating a new entry */ | 166 /* Information about a remote peer, used both for query and for creating a new entry */ |
165 struct peer_info { | 167 struct peer_info { |
166 | 168 |
167 /* This information is always there */ | |
168 char * pi_diamid; /* UTF-8, \0 terminated. The Diameter Identity of the remote peer */ | 169 char * pi_diamid; /* UTF-8, \0 terminated. The Diameter Identity of the remote peer */ |
169 char * pi_realm; /* idem, its realm. */ | 170 char * pi_realm; /* idem, its realm. */ |
170 | 171 |
171 /* Flags */ | |
172 struct { | 172 struct { |
173 #define PI_PROT_DEFAULT 0 /* Use the default algorithm configured for the host */ | 173 #define PI_P3_DEFAULT 0 /* Use the default L3 protocol configured for the host */ |
174 #define PI_PROT_TCP 1 | 174 #define PI_P3_IP 1 /* Use only IP to connect to this peer */ |
175 #define PI_PROT_SCTP 2 | 175 #define PI_P3_IPv6 2 /* resp, IPv6 */ |
176 unsigned proto :2; | 176 unsigned pro3 :2; |
177 | 177 |
178 #define PI_SEC_DEFAULT 0 /* The default behavior configured for the host */ | 178 #define PI_P4_DEFAULT 0 /* Use the default L4 proto configured for the host */ |
179 #define PI_P4_TCP 1 /* Only use TCP */ | |
180 #define PI_P4_SCTP 2 /* Only use SCTP */ | |
181 unsigned pro4 :2; | |
182 | |
183 #define PI_ALGPREF_SCTP 0 /* SCTP is initially attempted */ | |
184 #define PI_ALGPREF_TCP 1 /* TCP is initially attempted */ | |
185 unsigned alg :1; | |
186 | |
187 #define PI_SEC_DEFAULT 0 /* New TLS security (dedicated port protecting also CER/CEA) */ | |
179 #define PI_SEC_NONE 1 /* Transparent security with this peer (IPsec) */ | 188 #define PI_SEC_NONE 1 /* Transparent security with this peer (IPsec) */ |
180 #define PI_SEC_TLS_NEW 2 /* New TLS security (dedicated port protecting also CER/CEA) */ | 189 #define PI_SEC_TLS_OLD 2 /* Old TLS security (inband on default port) */ |
181 #define PI_SEC_TLS_OLD 3 /* Old TLS security (inband on default port) */ | |
182 unsigned sec :2; | 190 unsigned sec :2; |
183 | 191 |
184 #define PI_EXP_DEFAULT 0 | 192 #define PI_EXP_NONE 0 /* the peer entry does not expire */ |
185 #define PI_EXP_NONE 1 /* the peer entry does not expire */ | 193 #define PI_EXP_INACTIVE 1 /* the peer entry expires after pi_lft seconds without activity */ |
186 #define PI_EXP_INACTIVE 2 /* the peer entry expires after pi_lft seconds without activity */ | 194 unsigned exp :1; |
187 #define PI_EXP_LIFETIME 3 /* the peer SA information is destroyed after lft seconds (example: DNS timeout) */ | |
188 unsigned exp :2; | |
189 | 195 |
190 /* Following flags are read-only and received from remote peer */ | 196 /* Following flags are read-only and received from remote peer */ |
191 #define PI_INB_NONE 1 /* Remote peer advertised inband-sec-id 0 (None) */ | 197 #define PI_INB_NONE 1 /* Remote peer advertised inband-sec-id 0 (None) */ |
192 #define PI_INB_TLS 2 /* Remote peer advertised inband-sec-id 1 (TLS) */ | 198 #define PI_INB_TLS 2 /* Remote peer advertised inband-sec-id 1 (TLS) */ |
193 unsigned inband :2; /* This is only meaningful with pi_flags.sec == 3 */ | 199 unsigned inband :2; /* This is only meaningful with pi_flags.sec == 3 */ |
229 /* | 235 /* |
230 * FUNCTION: fd_peer_add | 236 * FUNCTION: fd_peer_add |
231 * | 237 * |
232 * PARAMETERS: | 238 * PARAMETERS: |
233 * info : Information to create the peer. | 239 * info : Information to create the peer. |
240 * orig_dbg : A string indicating the origin of the peer information, for debug (ex: conf, redirect, ...) | |
234 * cb : optional, a callback to call (once) when the peer connection is established or failed | 241 * cb : optional, a callback to call (once) when the peer connection is established or failed |
235 * cb_data : opaque data to pass to the callback. | 242 * cb_data : opaque data to pass to the callback. |
236 * | 243 * |
237 * DESCRIPTION: | 244 * DESCRIPTION: |
238 * Add a peer to the list of peers to which the daemon must maintain a connexion. | 245 * Add a peer to the list of peers to which the daemon must maintain a connexion. |
245 * EINVAL : A parameter is invalid. | 252 * EINVAL : A parameter is invalid. |
246 * EEXIST : A peer with the same Diameter-Id is already in the list. | 253 * EEXIST : A peer with the same Diameter-Id is already in the list. |
247 * (other standard errors may be returned, too, with their standard meaning. Example: | 254 * (other standard errors may be returned, too, with their standard meaning. Example: |
248 * ENOMEM : Memory allocation for the new object element failed.) | 255 * ENOMEM : Memory allocation for the new object element failed.) |
249 */ | 256 */ |
250 int fd_peer_add ( struct peer_info * info, void (*cb)(struct peer_info *, void *), void * cb_data ); | 257 int fd_peer_add ( struct peer_info * info, char * orig_dbg, void (*cb)(struct peer_info *, void *), void * cb_data ); |
251 | 258 |
252 /* | 259 /* |
253 * FUNCTION: peer_validate_register | 260 * FUNCTION: peer_validate_register |
254 * | 261 * |
255 * PARAMETERS: | 262 * PARAMETERS: |