Changeset 11:6576ef5e01eb in freeDiameter
- Timestamp:
- Sep 25, 2009, 6:05:06 PM (15 years ago)
- Branch:
- default
- Phase:
- public
- Files:
-
- 1 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/dbg_monitor/monitor.c
r10 r11 71 71 /* Loop */ 72 72 while (1) { 73 sleep(60); 73 #ifdef DEBUG 74 sleep(30); 75 #else /* DEBUG */ 76 sleep(3600); /* 1 hour */ 77 #endif /* DEBUG */ 74 78 TRACE_DEBUG(NONE, "Monitor information"); 75 79 CHECK_FCT_DO(fd_event_send(fd_g_config->cnf_main_ev, FDEV_DUMP_QUEUES, NULL), /* continue */); -
freeDiameter/CMakeLists.txt
r10 r11 15 15 dict_base_proto.c 16 16 messages.c 17 peers.c 17 18 queues.c 18 19 ) -
freeDiameter/fD.h
r10 r11 69 69 int fd_dict_base_protocol(struct dictionary * dict); 70 70 71 /* Peers */ 72 struct fd_peer { /* The "real" definition of the peer structure */ 73 74 struct peer_hdr p_hdr; /* contains all public data */ 75 76 int p_eyec; /* Eye catcher, EYEC_PEER */ 77 #define EYEC_PEER 0x373C9336 78 79 /* threads, message queues, socket & callbacks */ 80 81 }; 82 83 int fd_peer_init(); 84 void fd_peer_dump(int details); 85 int fd_peer_start(); 86 int fd_peer_waitstart(); 87 71 88 #endif /* _FD_H */ -
freeDiameter/main.c
r10 r11 80 80 CHECK_FCT( fd_queues_init() ); 81 81 CHECK_FCT( fd_msg_init() ); 82 CHECK_FCT( fd_peer_init() ); 82 83 83 84 /* Parse the configuration file */ … … 88 89 89 90 /* Start the peer state machines */ 90 91 CHECK_FCT( fd_peer_start() ); 91 92 92 93 /* Now, just wait for events */ … … 115 116 break; 116 117 118 case FDEV_DUMP_PEERS: 119 fd_peer_dump(FULL); 120 break; 117 121 118 122 case FDEV_TERMINATE: -
include/freeDiameter/freeDiameter.h
r10 r11 160 160 STATE_REOPEN /* Connection has been re-established, waiting for 3 DWR/DWA exchanges before putting back to service */ 161 161 }; 162 extern c har *peer_state_str[];162 extern const char *peer_state_str[]; 163 163 164 164 /* Information about a remote peer, used both for query and for creating a new entry */ … … 214 214 }; 215 215 216 struct peer_hdr { 217 struct fd_list chain; /* List of all the peers, ordered by their Diameter Id */ 218 struct peer_info info; /* The public data */ 219 220 /* This header is followed by more data in the private peer structure definition */ 221 }; 222 223 /* the global list of peers. 224 Since we are not expecting so many connections, we don't use a hash, but it might be changed. 225 The list items are peer_hdr structures (actually, fd_peer, but the cast is OK) */ 226 extern struct fd_list fd_g_peers; 227 extern pthread_rwlock_t fd_g_peers_rw; /* protect the list */ 228 229 /* 230 * FUNCTION: fd_peer_add 231 * 232 * PARAMETERS: 233 * info : Information to create the peer. 234 * 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. 236 * 237 * DESCRIPTION: 238 * Add a peer to the list of peers to which the daemon must maintain a connexion. 239 * If cb is not null, the callback is called when the connection is in OPEN state or 240 * when an error has occurred. The callback should use the pi_state information to 241 * determine which one it is. 242 * 243 * RETURN VALUE: 244 * 0 : The peer is added. 245 * EINVAL : A parameter is invalid. 246 * 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: 248 * ENOMEM : Memory allocation for the new object element failed.) 249 */ 250 int fd_peer_add ( struct peer_info * info, void (*cb)(struct peer_info *, void *), void * cb_data ); 251 252 /* 253 * FUNCTION: peer_validate_register 254 * 255 * PARAMETERS: 256 * peer_validate : Callback as defined bellow. 257 * 258 * DESCRIPTION: 259 * Add a callback to authorize / reject incoming peer connections. 260 * All registered callbacks are called until a callback sets auth = -1 or auth = 1. 261 * If no callback returns a clear decision, the default behavior is applied (reject unknown connections) 262 * 263 * RETURN VALUE: 264 * 0 : The callback is added. 265 * !0 : An error occurred. 266 */ 267 int fd_peer_validate_register ( int (*peer_validate)(struct peer_info * /* info */, int * /* auth */) ); 268 /* 269 * CALLBACK: peer_validate 270 * 271 * PARAMETERS: 272 * info : Structure containing information about the peer attempting the connection. 273 * auth : Store there the result if the peer is accepted (1), rejected (-1), or unknown (0). 274 * 275 * DESCRIPTION: 276 * This callback is called when a new connection is being established from an unknown peer, 277 * after the CER is received. An extension must register such callback with peer_validate_register. 278 * 279 * RETURN VALUE: 280 * 0 : The authorization decision has been written in the location pointed by auth. 281 * !0 : An error occurred. 282 */ 216 283 217 284 /***************************************/ -
libfreeDiameter/fifo.c
r10 r11 117 117 118 118 CHECK_POSIX_DO( pthread_mutex_lock( &queue->mtx ), /* continue */ ); 119 fd_log_debug(" %d elements in queue\n", queue->count); 120 fd_log_debug(" %d threads waiting\n", queue->thrs); 121 fd_log_debug(" thresholds: %d / %d, cb: %p / %p (%p), highest: %d\n", 119 fd_log_debug(" %d elements in queue / %d threads waiting\n", queue->count, queue->thrs); 120 fd_log_debug(" thresholds: %d / %d, cb: %p / %p (%p), highest: %d\n", 122 121 queue->high, queue->low, 123 122 queue->h_cb, queue->l_cb, queue->data,
Note: See TracChangeset
for help on using the changeset viewer.