Navigation


Changeset 687:026802543f57 in freeDiameter for include/freeDiameter/libfdproto.h


Ignore:
Timestamp:
Jan 19, 2011, 5:08:21 PM (13 years ago)
Author:
Sebastien Decugis <sdecugis@nict.go.jp>
Branch:
default
Phase:
public
Message:

Prepare for new message log facility

File:
1 edited

Legend:

Unmodified
Added
Removed
  • include/freeDiameter/libfdproto.h

    r658 r687  
    9595
    9696/*
    97  * FUNCTION:    fd_log_debug
    98  *
    99  * PARAMETERS:
     97 * FUNCTION:    fd_log_debug_fstr
     98 * MACRO:       fd_log_debug
     99 *
     100 * PARAMETERS:
     101 *  fstr        : Stream where the text will be sent (default: stdout)
    100102 *  format      : Same format string as in the printf function
    101103 *  ...         : Same list as printf
     
    112114 *  None.
    113115 */
    114 void fd_log_debug ( const char * format, ... );
     116void fd_log_debug_fstr ( FILE * fstr, const char * format, ... );
     117#define fd_log_debug(format,args...) fd_log_debug_fstr(NULL, format, ## args)
     118
    115119extern pthread_mutex_t  fd_log_lock;
    116120extern char * fd_debug_one_function;
     
    10101014        dict_avpdata_interpret   type_interpret;/* cb to convert the AVP value in more comprehensive format (or NULL) */
    10111015        dict_avpdata_encode      type_encode;   /* cb to convert formatted data into an AVP value (or NULL) */
    1012         void                    (*type_dump)(union avp_value * val);    /* cb called by fd_msg_dump_one for this type of data (if != NULL), to dump the AVP value in debug */
     1016        void                    (*type_dump)(union avp_value * val, FILE * fstr);       /* cb called by fd_msg_dump_one for this type of data (if != NULL), to dump the AVP value in fstr */
    10131017};
    10141018
     
    20332037void fd_msg_dump_one  ( int level, msg_or_avp *obj );
    20342038
     2039/*
     2040 * FUNCTION:    fd_msg_log
     2041 *
     2042 * PARAMETERS:
     2043 *  cause        : Context for calling this function. This allows the log facility to be configured precisely.
     2044 *  msg          : The message to log.
     2045 *  prefix_format: Printf-style format message that is printed ahead of the message. Might be reason for drop or so.
     2046 *
     2047 * DESCRIPTION:
     2048 *   This function is called when a Diameter message reaches some particular points in the fD framework.
     2049 * The actual effect is configurable: log in a separate file, dump in the debug log, etc.
     2050 *
     2051 * RETURN VALUE:
     2052 *   -
     2053 */
     2054enum fd_msg_log_cause {
     2055        FD_MSG_LOG_DROPPED = 0,  /* message has been dropped by the framework */
     2056        FD_MSG_LOG_RECEIVED,     /* message received from the network */
     2057        FD_MSG_LOG_SENT          /* message sent to another peer */
     2058};
     2059#define FD_MSG_LOG_MAX FD_MSG_LOG_SENT
     2060void fd_msg_log( enum fd_msg_log_cause cause, struct msg * msg, const char * prefix_format, ... );
     2061
     2062/* configure the msg_log facility */
     2063enum fd_msg_log_method {
     2064        FD_MSG_LOGTO_DEBUGONLY = 0, /* Simply log the message with other debug information, at the INFO level. This is default */
     2065        FD_MSG_LOGTO_FILE,    /* Messages are dumped in a single file, defined in arg */
     2066        FD_MSG_LOGTO_DIR    /* Messages are dumped in different files within one directory defined in arg. */
     2067};
     2068int fd_msg_log_config(enum fd_msg_log_cause cause, enum fd_msg_log_method method, const char * arg);
    20352069
    20362070/*********************************************/
Note: See TracChangeset for help on using the changeset viewer.