Navigation



Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • include/freeDiameter/libfdproto.h

    r1082 r1071  
    23402340void fd_msg_dump_walk ( int level, msg_or_avp *obj );
    23412341void fd_msg_dump_one  ( int level, msg_or_avp *obj );
    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 
     2342/* Dump full message to log */
     2343void 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 */
     2360enum 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
     2368void 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 */
     2371enum 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};
     2377int fd_msg_log_config(enum fd_msg_log_cause cause, enum fd_msg_log_method method, const char * arg);
     2378void fd_msg_log_init(struct dictionary *dict);
    23582379
    23592380/*********************************************/
     
    25072528int fd_msg_source_set( struct msg * msg, DiamId_t diamid, size_t diamidlen, int add_rr, struct dictionary * dict );
    25082529int 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_REALTIME
     2537 *
     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 */
     2547int fd_msg_ts_set_recv( struct msg * msg, struct timespec * ts );
     2548int fd_msg_ts_get_recv( struct msg * msg, struct timespec * ts );
     2549int fd_msg_ts_set_sent( struct msg * msg, struct timespec * ts );
     2550int fd_msg_ts_get_sent( struct msg * msg, struct timespec * ts );
     2551
    25092552
    25102553/*
Note: See TracChangeset for help on using the changeset viewer.