Changeset 1082:b380c9f3be1e in freeDiameter for include/freeDiameter/libfdproto.h
- Timestamp:
- May 2, 2013, 5:09:50 PM (11 years ago)
- Branch:
- default
- Parents:
- 1081:758b21ae6c3e (diff), 1077:b36c81e52e9a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Phase:
- public
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
include/freeDiameter/libfdproto.h
r1071 r1082 2340 2340 void fd_msg_dump_walk ( int level, msg_or_avp *obj ); 2341 2341 void fd_msg_dump_one ( int level, msg_or_avp *obj ); 2342 /* Dump full message to log */ 2343 void fd_msg_dump_full ( int level, struct dictionary *dict, const char *prefix, msg_or_avp *obj ); 2344 2345 /* 2346 * FUNCTION: fd_msg_log 2347 * 2348 * PARAMETERS: 2349 * cause : Context for calling this function. This allows the log facility to be configured precisely. 2350 * msg : The message to log. 2351 * prefix_format: Printf-style format message that is printed ahead of the message. Might be reason for drop or so. 2352 * 2353 * DESCRIPTION: 2354 * This function is called when a Diameter message reaches some particular points in the fD framework. 2355 * The actual effect is configurable: log in a separate file, dump in the debug log, etc. 2356 * 2357 * RETURN VALUE: 2358 * - 2359 */ 2360 enum fd_msg_log_cause { 2361 FD_MSG_LOG_DROPPED = 1, /* message has been dropped by the framework */ 2362 FD_MSG_LOG_RECEIVED, /* message received from the network */ 2363 FD_MSG_LOG_SENT, /* message sent to another peer */ 2364 FD_MSG_LOG_NODELIVER, /* message could not be delivered to any peer */ 2365 FD_MSG_LOG_TIMING /* profiling messages */ 2366 }; 2367 #define FD_MSG_LOG_MAX FD_MSG_LOG_TIMING 2368 void fd_msg_log( enum fd_msg_log_cause cause, struct msg * msg, const char * prefix_format, ... ) _ATTRIBUTE_PRINTFLIKE_(3,4); 2369 2370 /* configure the msg_log facility */ 2371 enum fd_msg_log_method { 2372 FD_MSG_LOGTO_NONE = 0, /* The message is not dumped. This is the default. */ 2373 FD_MSG_LOGTO_DEBUGONLY, /* Simply log the message with other debug information, at the INFO level. */ 2374 FD_MSG_LOGTO_FILE, /* Messages are dumped in a single file, defined in arg */ 2375 FD_MSG_LOGTO_DIR /* Messages are dumped in different files within one directory defined in arg. */ 2376 }; 2377 int fd_msg_log_config(enum fd_msg_log_cause cause, enum fd_msg_log_method method, const char * arg); 2378 void fd_msg_log_init(struct dictionary *dict); 2342 2343 /* Helper functions to get a dump of an object in the logs. Several formats are available. 2344 * buf : a buffer that can be reallocated if needed. *buf==NULL is also accepted for first allocation 2345 * buflen: the length of the buffer buf. 2346 * dict : optional, the dictionary to use for resolving objects, if force_parsing != 0 2347 * obj : the message or AVP to dump. 2348 * 2349 * After use, the buf pointer should be freed. 2350 */ 2351 /* one-line dump with only short information */ 2352 void fd_msg_dump_summary( char ** buf, size_t buflen, struct dictionary *dict, msg_or_avp *obj, int force_parsing); 2353 /* one-line dump with all the contents of the message */ 2354 void fd_msg_dump_full( char ** buf, size_t buflen, struct dictionary *dict, msg_or_avp *obj, int force_parsing); 2355 /* multi-line human-readable dump similar to wireshark output */ 2356 void fd_msg_dump_treeview( char ** buf, size_t buflen, struct dictionary *dict, msg_or_avp *obj, int force_parsing); 2357 2379 2358 2380 2359 /*********************************************/ … … 2528 2507 int fd_msg_source_set( struct msg * msg, DiamId_t diamid, size_t diamidlen, int add_rr, struct dictionary * dict ); 2529 2508 int fd_msg_source_get( struct msg * msg, DiamId_t *diamid, size_t * diamidlen ); 2530 2531 /*2532 * FUNCTION: fd_msg_ts_*2533 *2534 * PARAMETERS:2535 * msg : A msg object.2536 * ts : A struct timespec pointer, indexed on CLOCK_REALTIME2537 *2538 * DESCRIPTION:2539 * Associate or retrieve timestamps meaningful for the message.2540 * A timestamp with a value of { 0, 0 } means: not set.2541 *2542 * RETURN VALUE:2543 * 0 : Operation complete.2544 * !0 : an error occurred.2545 */2546 /* when msg was received from network */2547 int fd_msg_ts_set_recv( struct msg * msg, struct timespec * ts );2548 int fd_msg_ts_get_recv( struct msg * msg, struct timespec * ts );2549 int fd_msg_ts_set_sent( struct msg * msg, struct timespec * ts );2550 int fd_msg_ts_get_sent( struct msg * msg, struct timespec * ts );2551 2552 2509 2553 2510 /* -
include/freeDiameter/libfdproto.h
r1078 r1082 2989 2989 2990 2990 /* 2991 * FUNCTION: fd_fifo_getstats 2992 * 2993 * PARAMETERS: 2994 * queue : The queue from which to retrieve the information. 2995 * current_count : How many items in the queue at the time of execution. This changes each time an item is pushed or poped. 2996 * limit_count : The maximum number of items allowed in this queue. This is specified during queue creation. 2997 * highest_count : The maximum number of items this queue has contained. This enables to see if limit_count count was reached. 2998 * total_count : the total number of items that went through the queue (already pop'd). Always increasing. 2999 * total : Cumulated time all items spent in this queue, including blocking time (always growing, use deltas for monitoring) 3000 * blocking : Cumulated time threads trying to post new items were blocked (queue full). 3001 * last : For the last element retrieved from the queue, how long it take between posting (including blocking) and poping 3002 * 3003 * DESCRIPTION: 3004 * Retrieve the timing information associated with a queue, for monitoring purpose. 3005 * 3006 * RETURN VALUE: 3007 * 0 : The statistics have been updated. 3008 * EINVAL : A parameter is invalid. 3009 */ 3010 int fd_fifo_getstats( struct fifo * queue, int * current_count, int * limit_count, int * highest_count, long long * total_count, 3011 struct timespec * total, struct timespec * blocking, struct timespec * last); 3012 3013 /* 2991 3014 * FUNCTION: fd_fifo_length 2992 3015 * 2993 3016 * PARAMETERS: 2994 3017 * queue : The queue from which to retrieve the number of elements. 2995 * length : Upon success, the current number of elements in the queue is stored here. 2996 * max : the maximum number of elements as specified during creation. Can be NULL. 2997 * 2998 * DESCRIPTION: 2999 * Retrieve the number of elements in a queue. 3000 * 3001 * RETURN VALUE: 3002 * 0 : The length of the queue has been written. 3003 * EINVAL : A parameter is invalid. 3004 */ 3005 int fd_fifo_length ( struct fifo * queue, int * length, int * max); 3006 int fd_fifo_length_noerr ( struct fifo * queue ); /* no error checking version */ 3007 3008 /* 3009 * FUNCTION: fd_fifo_getstats 3010 * 3011 * PARAMETERS: 3012 * queue : The queue from which to retrieve the timings information. 3013 * items : the total number of items that went through the queue (already pop'd). Always increasing. 3014 * total : Cumulated time all items spent in this queue, including blocking time (always growing, use deltas for monitoring) 3015 * blocking : Cumulated time threads trying to post new items were blocked (queue full). 3016 * last : For the last element retrieved from the queue, how long it take between posting (including blocking) and poping 3017 * 3018 * DESCRIPTION: 3019 * Retrieve the timing information associated with a queue, for monitoring purpose. 3020 * 3021 * RETURN VALUE: 3022 * 0 : The statistics have been updated. 3023 * EINVAL : A parameter is invalid. 3024 */ 3025 int fd_fifo_getstats( struct fifo * queue, long long *items, struct timespec * total, struct timespec * blocking, struct timespec * last); 3026 3018 * 3019 * DESCRIPTION: 3020 * Retrieve the number of elements in a queue, without error checking. 3021 * 3022 * RETURN VALUE: 3023 * The number of items currently queued. 3024 */ 3025 int fd_fifo_length ( struct fifo * queue ); 3027 3026 3028 3027 /*
Note: See TracChangeset
for help on using the changeset viewer.