27RCSIDH(server_log_h, 
"$Id: f39be8007fba9f919edfb6e060c60cbd8acd0773 $")
 
   46#include <freeradius-devel/server/request.h> 
   47#include <freeradius-devel/util/log.h> 
   48#include <freeradius-devel/util/event.h> 
   49#include <freeradius-devel/util/pair.h> 
   68                           char const *
fmt, va_list ap, 
void *uctx);
 
   95                                   char const *
fmt, ...);
 
  104#define debug_enabled(_type, _lvl) (((_type & L_DBG) != 0) && (_lvl <= fr_debug_lvl)) 
  110                     char const *
fmt, va_list ap, 
void *uctx)
 
  111        CC_HINT(format (printf, 6, 0)) CC_HINT(
nonnull (3, 4));
 
  115                    char const *
fmt, ...)
 
  116                    CC_HINT(format (printf, 6, 7)) CC_HINT(
nonnull (3, 6));
 
  120                          char const *
fmt, ...)
 
  121        CC_HINT(format (printf, 6, 7)) CC_HINT(
nonnull (3, 6));
 
  125        CC_HINT(format (printf, 6, 7)) CC_HINT(
nonnull (3));
 
  140                           char const *str, 
size_t str_len,
 
  141                           ssize_t marker_idx, 
char const *marker, ...) CC_HINT(format (printf, 9, 10)) CC_HINT(
nonnull);
 
  150        CC_HINT(format (printf, 4, 5)) CC_HINT(noreturn);
 
  165#  define LOG_DST &default_log 
  167#define _FR_LOG_DST(_lvl, _fmt, ...) fr_log(LOG_DST, _lvl, __FILE__, __LINE__, _fmt, ## __VA_ARGS__) 
  168#define _FR_LOG_DST_PERROR(_lvl, _fmt, ...) fr_log_perror(LOG_DST, _lvl, __FILE__, __LINE__, NULL, _fmt, ## __VA_ARGS__) 
  169#define _FR_LOG_DST_FATAL(_fmt, ...) log_fatal(LOG_DST, __FILE__, __LINE__, _fmt, ## __VA_ARGS__) 
  181#define _FR_LOG_DST_MARKER(_lvl, _str, _str_len, _marker_idx, _line_prefix_fmt, ...) \ 
  182        fr_log_marker(LOG_DST, _lvl, __FILE__, __LINE__, _str, _str_len, _marker_idx, _line_prefix_fmt, ## __VA_ARGS__) 
 
  191#  define _FR_LOG_PREFIX(_lvl, _fmt, ...) _FR_LOG_DST(_lvl, "%s - " _fmt, LOG_PREFIX, ## __VA_ARGS__) 
  192#  define _FR_LOG_PREFIX_PERROR(_lvl, _fmt, ...) _FR_LOG_DST_PERROR(_lvl, "%s - " _fmt, LOG_PREFIX, ## __VA_ARGS__) 
  193#  define _FR_LOG_PREFIX_FATAL(_fmt, ...) _FR_LOG_DST_FATAL("%s - " _fmt, LOG_PREFIX, ## __VA_ARGS__) 
  194#  define _FR_LOG_PREFIX_MARKER(_lvl, _str, _str_len, _marker_idx, _marker) _FR_LOG_DST_MARKER(_lvl, _str, _str_len, _marker_idx, _marker, "%s - ", LOG_PREFIX) 
  196#  define _FR_LOG_PREFIX(_lvl, _fmt, ...) _FR_LOG_DST(_lvl, _fmt, ## __VA_ARGS__) 
  197#  define _FR_LOG_PREFIX_PERROR(_lvl, _fmt, ...) _FR_LOG_DST_PERROR(_lvl, _fmt, ## __VA_ARGS__) 
  198#  define _FR_LOG_PREFIX_FATAL(_fmt, ...) _FR_LOG_DST_FATAL(_fmt, ## __VA_ARGS__) 
  199#  define _FR_LOG_PREFIX_MARKER(_lvl, _str, _str_len, _marker_idx, _marker) _FR_LOG_DST_MARKER(_lvl, _str, _str_len, _marker_idx, _marker, "") 
  221#define INFO(_fmt, ...)         _FR_LOG_PREFIX(L_INFO, _fmt, ## __VA_ARGS__) 
  222#define WARN(_fmt, ...)         _FR_LOG_PREFIX(L_WARN, _fmt, ## __VA_ARGS__) 
  223#define ERROR(_fmt, ...)        _FR_LOG_PREFIX(L_ERR, _fmt, ## __VA_ARGS__) 
  224#define FATAL(_fmt, ...)        _FR_LOG_PREFIX_FATAL(_fmt, ## __VA_ARGS__) 
  226#define PINFO(_fmt, ...)        _FR_LOG_PREFIX_PERROR(L_INFO, _fmt, ## __VA_ARGS__) 
  227#define PWARN(_fmt, ...)        _FR_LOG_PREFIX_PERROR(L_WARN, _fmt, ## __VA_ARGS__) 
  228#define PERROR(_fmt, ...)       _FR_LOG_PREFIX_PERROR(L_ERR, _fmt, ## __VA_ARGS__) 
  230#define IMARKER(_str, _marker_idx, _marker)     _FR_LOG_PREFIX_MARKER(L_INFO, _str, SIZE_MAX, _marker_idx, _marker) 
  231#define WMARKER(_str, _marker_idx, _marker)     _FR_LOG_PREFIX_MARKER(L_WARN, _str, SIZE_MAX, _marker_idx, _marker) 
  232#define EMARKER(_str, _marker_idx, _marker)     _FR_LOG_PREFIX_MARKER(L_ERR, _str, SIZE_MAX, _marker_idx, _marker) 
  257#define DEBUG_ENABLED           debug_enabled(L_DBG, L_DBG_LVL_1)                        
  258#define DEBUG_ENABLED2          debug_enabled(L_DBG, L_DBG_LVL_2)                        
  259#define DEBUG_ENABLED3          debug_enabled(L_DBG, L_DBG_LVL_3)                        
  260#define DEBUG_ENABLED4          debug_enabled(L_DBG, L_DBG_LVL_4)                        
  261#define DEBUG_ENABLED5          debug_enabled(L_DBG, L_DBG_LVL_MAX)                      
  263#define _DEBUG_LOG(_type, _lvl, _fmt, ...)      if (fr_debug_lvl >= _lvl) _FR_LOG_PREFIX(_type, _fmt, ## __VA_ARGS__) 
  264#define DEBUG(_fmt, ...)                _DEBUG_LOG(L_DBG, L_DBG_LVL_1, _fmt, ## __VA_ARGS__) 
  265#define DEBUG2(_fmt, ...)               _DEBUG_LOG(L_DBG, L_DBG_LVL_2, _fmt, ## __VA_ARGS__) 
  266#define DEBUG3(_fmt, ...)               _DEBUG_LOG(L_DBG, L_DBG_LVL_3, _fmt, ## __VA_ARGS__) 
  267#define DEBUG4(_fmt, ...)               _DEBUG_LOG(L_DBG, L_DBG_LVL_MAX, _fmt, ## __VA_ARGS__) 
  268#define DEBUGX(_lvl, _fmt, ...)         _DEBUG_LOG(L_DBG, _lvl, _fmt, ## __VA_ARGS__) 
  270#define _PDEBUG_LOG(_type, _lvl, _fmt, ...)     if (fr_debug_lvl >= _lvl) _FR_LOG_PREFIX_PERROR(_type, _fmt, ## __VA_ARGS__) 
  271#define PDEBUG(_fmt, ...)               _PDEBUG_LOG(L_DBG, L_DBG_LVL_1, _fmt, ## __VA_ARGS__) 
  272#define PDEBUG2(_fmt, ...)              _PDEBUG_LOG(L_DBG, L_DBG_LVL_2, _fmt, ## __VA_ARGS__) 
  273#define PDEBUG3(_fmt, ...)              _PDEBUG_LOG(L_DBG, L_DBG_LVL_3, _fmt, ## __VA_ARGS__) 
  274#define PDEBUG4(_fmt, ...)              _PDEBUG_LOG(L_DBG, L_DBG_LVL_MAX, _fmt, ## __VA_ARGS__) 
  275#define PDEBUGX(_lvl, _fmt, ...)        _PDEBUG_LOG(L_DBG, _lvl, _fmt, ## __VA_ARGS__) 
  296#define RINFO(fmt, ...)         log_request(L_INFO, L_DBG_LVL_OFF, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__) 
  297#define RWARN(fmt, ...)         log_request(L_DBG_WARN, L_DBG_LVL_OFF, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__) 
  298#define RERROR(fmt, ...)        log_request_error(L_DBG_ERR, L_DBG_LVL_OFF, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__) 
  300#define RPINFO(fmt, ...)        log_request_perror(L_DBG_INFO, L_DBG_LVL_OFF, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__) 
  301#define RPWARN(fmt, ...)        log_request_perror(L_DBG_WARN, L_DBG_LVL_OFF, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__) 
  302#define RPERROR(fmt, ...)       log_request_perror(L_DBG_ERR, L_DBG_LVL_OFF, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__) 
  333#define RDEBUG_ENABLED          log_rdebug_enabled(L_DBG_LVL_1, request)                 
  334#define RDEBUG_ENABLED2         log_rdebug_enabled(L_DBG_LVL_2, request)                 
  335#define RDEBUG_ENABLED3         log_rdebug_enabled(L_DBG_LVL_3, request)                 
  336#define RDEBUG_ENABLED4         log_rdebug_enabled(L_DBG_LVL_4, request)                 
  337#define RDEBUG_ENABLED5         log_rdebug_enabled(L_DBG_LVL_MAX, request)               
  338#define RDEBUG_ENABLEDX(_x)     log_rdebug_enabled(_x, request)                          
  340#define RDEBUGX(_l, fmt, ...)   do { if (request->log.lvl) log_request(L_DBG, _l, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__); } while(0) 
  341#define RDEBUG(fmt, ...)        do { if (request->log.lvl) log_request(L_DBG, L_DBG_LVL_1, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__); } while(0) 
  342#define RDEBUG2(fmt, ...)       do { if (request->log.lvl) log_request(L_DBG, L_DBG_LVL_2, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__); } while(0) 
  343#define RDEBUG3(fmt, ...)       do { if (request->log.lvl) log_request(L_DBG, L_DBG_LVL_3, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__); } while(0) 
  344#define RDEBUG4(fmt, ...)       do { if (request->log.lvl) log_request(L_DBG, L_DBG_LVL_4, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__); } while(0) 
  346#define RPDEBUG(fmt, ...)       do { if (request->log.lvl) log_request_perror(L_DBG, L_DBG_LVL_1, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__); } while(0) 
  347#define RPDEBUG2(fmt, ...)      do { if (request->log.lvl) log_request_perror(L_DBG, L_DBG_LVL_2, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__); } while(0) 
  348#define RPDEBUG3(fmt, ...)      do { if (request->log.lvl) log_request_perror(L_DBG, L_DBG_LVL_3, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__); } while(0) 
  349#define RPDEBUG4(fmt, ...)      do { if (request->log.lvl) log_request_perror(L_DBG, L_DBG_LVL_4, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__); } while(0) 
  351#define RIDEBUG(fmt, ...)       do { if (request->log.lvl) log_request(L_DBG_INFO, L_DBG_LVL_1, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__); } while(0) 
  352#define RIDEBUG2(fmt, ...)      do { if (request->log.lvl) log_request(L_DBG_INFO, L_DBG_LVL_2, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__); } while(0) 
  353#define RIDEBUG3(fmt, ...)      do { if (request->log.lvl) log_request(L_DBG_INFO, L_DBG_LVL_3, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__); } while(0) 
  354#define RIDEBUG4(fmt, ...)      do { if (request->log.lvl) log_request(L_DBG_INFO, L_DBG_LVL_4, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__); } while(0) 
  356#define RPIDEBUG(fmt, ...)      do { if (request->log.lvl) log_request_perror(L_DBG_INFO, L_DBG_LVL_1, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__); } while(0) 
  357#define RPIDEBUG2(fmt, ...)     do { if (request->log.lvl) log_request_perror(L_DBG_INFO, L_DBG_LVL_2, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__); } while(0) 
  358#define RPIDEBUG3(fmt, ...)     do { if (request->log.lvl) log_request_perror(L_DBG_INFO, L_DBG_LVL_3, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__); } while(0) 
  359#define RPIDEBUG4(fmt, ...)     do { if (request->log.lvl) log_request_perror(L_DBG_INFO, L_DBG_LVL_4, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__); } while(0) 
  361#define RWDEBUG(fmt, ...)       do { if (request->log.lvl) log_request(L_DBG_WARN, L_DBG_LVL_1, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__); } while(0) 
  362#define RWDEBUG2(fmt, ...)      do { if (request->log.lvl) log_request(L_DBG_WARN, L_DBG_LVL_2, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__); } while(0) 
  363#define RWDEBUG3(fmt, ...)      do { if (request->log.lvl) log_request(L_DBG_WARN, L_DBG_LVL_3, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__); } while(0) 
  364#define RWDEBUG4(fmt, ...)      do { if (request->log.lvl) log_request(L_DBG_WARN, L_DBG_LVL_4, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__); } while(0) 
  366#define RPWDEBUG(fmt, ...)      do { if (request->log.lvl) log_request_perror(L_DBG_WARN, L_DBG_LVL_1, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__); } while(0) 
  367#define RPWDEBUG2(fmt, ...)     do { if (request->log.lvl) log_request_perror(L_DBG_WARN, L_DBG_LVL_2, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__); } while(0) 
  368#define RPWDEBUG3(fmt, ...)     do { if (request->log.lvl) log_request_perror(L_DBG_WARN, L_DBG_LVL_3, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__); } while(0) 
  369#define RPWDEBUG4(fmt, ...)     do { if (request->log.lvl) log_request_perror(L_DBG_WARN, L_DBG_LVL_4, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__); } while(0) 
  371#define REDEBUG(fmt, ...)       log_request_error(L_DBG_ERR, L_DBG_LVL_1, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__) 
  372#define REDEBUG2(fmt, ...)      log_request_error(L_DBG_ERR, L_DBG_LVL_2, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__) 
  373#define REDEBUG3(fmt, ...)      log_request_error(L_DBG_ERR, L_DBG_LVL_3,request,  __FILE__, __LINE__, fmt, ## __VA_ARGS__) 
  374#define REDEBUG4(fmt, ...)      log_request_error(L_DBG_ERR, L_DBG_LVL_MAX, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__) 
  376#define RPEDEBUG(fmt, ...)      log_request_perror(L_DBG_ERR, L_DBG_LVL_1, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__) 
  377#define RPEDEBUG2(fmt, ...)     log_request_perror(L_DBG_ERR, L_DBG_LVL_2, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__) 
  378#define RPEDEBUG3(fmt, ...)     log_request_perror(L_DBG_ERR, L_DBG_LVL_3, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__) 
  379#define RPEDEBUG4(fmt, ...)     log_request_perror(L_DBG_ERR, L_DBG_LVL_MAX, request, __FILE__, __LINE__, fmt, ## __VA_ARGS__) 
  388#define RINDENT_SAVE(_x, _request) do { \ 
  389                (_x)->indent = request->log.indent; \ 
 
  392#define RINDENT_RESTORE(_request, _x) do { \ 
  393                request->log.indent = (_x)->indent; \ 
 
  402#  define RINDENT() do {\ 
  403        if (request->module) {\ 
  404                request->log.module_indent += 2;\ 
  406                request->log.unlang_indent += 2;\ 
  408        RDEBUG4(">> (%i) %s[%u]", request->log.unlang_indent, __FILE__, __LINE__); \ 
  416#  define REXDENT() do {\ 
  417        RDEBUG4("<< (%i) %s[%u]", request->log.unlang_indent, __FILE__, __LINE__); \ 
  418        if (request->module) {\ 
  419                request->log.module_indent -= 2;\ 
  421                request->log.unlang_indent -= 2;\ 
  430#  define RINDENT() do {\ 
  431        if (request->module) {\ 
  432                request->log.indent.unlang += 2;\ 
  434                request->log.indent.unlang += 2;\ 
 
  443#  define REXDENT() do {\ 
  444        if (request->module) {\ 
  445                request->log.indent.unlang -= 2;\ 
  447                request->log.indent.unlang -= 2;\ 
 
  469#define RMARKER(_type, _lvl, _str, _marker_idx, _marker, ...) \ 
  470        log_request_marker(_type, _lvl, request, \ 
  471                           __FILE__, __LINE__, \ 
  472                           _str, SIZE_MAX, _marker_idx, _marker, ## __VA_ARGS__) 
 
  474#define RMARKER(_type, _lvl, _str, _marker_idx, _marker, ...) do { \ 
  475                RDEBUG4("== (0) at %s[%u]", __FILE__, __LINE__); \ 
  476                log_request_marker(_type, _lvl, request, \ 
  477                                   __FILE__, __LINE__, \ 
  478                                   _str, SIZE_MAX, _marker_idx, _marker, ## __VA_ARGS__); \ 
  498#define REMARKER(_str, _marker_idx, _marker, ...)       RMARKER(L_DBG_ERR, L_DBG_LVL_1, _str, _marker_idx, _marker, ## __VA_ARGS__) 
  516#define RDMARKER(_str, _marker_idx, _marker, ...)       RMARKER(L_DBG, L_DBG_LVL_1, _str, _marker_idx, _marker, ## __VA_ARGS__) 
  528#define ROPTIONAL(_l_request, _l_global, _fmt, ...) \ 
  531                _l_request(_fmt, ## __VA_ARGS__);\ 
  533                _l_global(_fmt, ## __VA_ARGS__);\ 
 
  542#define ROPTIONAL_ENABLED(_e_request, _e_global) ((request && _e_request) || _e_global) 
  569#define RATE_LIMIT_LOCAL(_entry, _log, _fmt, ...) \ 
  571        if (fr_rate_limit_enabled()) {\ 
  572                (_entry)->now = fr_time();\ 
  573                if (fr_time_to_sec((_entry)->now) != fr_time_to_sec((_entry)->last_complained)) {\ 
  574                        (_entry)->last_complained = (_entry)->now;\ 
  575                        if (((_entry)->repeated > 0) && (fr_time_delta_to_sec(fr_time_sub((_entry)->now, (_entry)->last_complained)) == 1)) { \ 
  576                                _log(_fmt " - repeated %u time(s)", ##__VA_ARGS__, (_entry)->repeated); \ 
  578                                _log(_fmt, ##__VA_ARGS__); \ 
  580                        (_entry)->repeated = 0; \ 
  582                        (_entry)->repeated++; \ 
  584        } else (_log(_fmt, ##__VA_ARGS__));\ 
 
  606#define RATE_LIMIT_LOCAL_ROPTIONAL(_entry, _l_request, _l_global, _fmt, ...) \ 
  608        if (fr_rate_limit_enabled()) {\ 
  609                (_entry)->now = fr_time();\ 
  610                if (fr_time_to_sec((_entry)->now) != fr_time_to_sec((_entry)->last_complained)) {\ 
  611                        (_entry)->last_complained = (_entry)->now;\ 
  612                        if (((_entry)->repeated > 0) && (fr_time_delta_to_sec(fr_time_sub((_entry)->now, (_entry)->last_complained)) == 1)) { \ 
  613                                ROPTIONAL(_l_request, _l_global, _fmt " - repeated %u time(s)", ##__VA_ARGS__, (_entry)->repeated); \ 
  615                                ROPTIONAL(_l_request, _l_global, _fmt, ##__VA_ARGS__); \ 
  617                        (_entry)->repeated = 0; \ 
  619                        (_entry)->repeated++; \ 
  622                ROPTIONAL(_l_request, _l_global, _fmt, ##__VA_ARGS__);\ 
 
  641#define RATE_LIMIT_GLOBAL(_log, _fmt, ...) \ 
  643        static fr_rate_limit_t  _rate_limit; \ 
  644        RATE_LIMIT_LOCAL(&_rate_limit, _log, _fmt, ##__VA_ARGS__); \ 
 
  663#define RATE_LIMIT_GLOBAL_ROPTIONAL(_l_request, _l_global, _fmt, ...) \ 
  665        static fr_rate_limit_t _rate_limit; \ 
  666        RATE_LIMIT_LOCAL_ROPTIONAL(&_rate_limit, _l_request, _l_global, _fmt, ##__VA_ARGS__); \ 
 
  679#define _RHEXDUMP_INLINE(_lvl, _data, _len, _fmt, ...) \ 
  680        if (log_rdebug_enabled(_lvl, request)) do { \ 
  681                log_request(L_DBG, _lvl, request, __FILE__, __LINE__, _fmt " 0x%pH", ## __VA_ARGS__, fr_box_octets(_data, _len)); \ 
 
  684#define RHEXDUMP_INLINE1(_data, _len, _fmt, ...) _RHEXDUMP_INLINE(L_DBG_LVL_1, _data, _len, _fmt, ## __VA_ARGS__) 
  685#define RHEXDUMP_INLINE2(_data, _len, _fmt, ...) _RHEXDUMP_INLINE(L_DBG_LVL_2, _data, _len, _fmt, ## __VA_ARGS__) 
  686#define RHEXDUMP_INLINE3(_data, _len, _fmt, ...) _RHEXDUMP_INLINE(L_DBG_LVL_3, _data, _len, _fmt, ## __VA_ARGS__) 
  687#define RHEXDUMP_INLINE4(_data, _len, _fmt, ...) _RHEXDUMP_INLINE(L_DBG_LVL_4, _data, _len, _fmt, ## __VA_ARGS__) 
  697#define _RHEXDUMP(_lvl, _data, _len, _fmt, ...) \ 
  698        if (log_rdebug_enabled(_lvl, request)) do { \ 
  699                log_request(L_DBG, _lvl, request, __FILE__, __LINE__, _fmt, ## __VA_ARGS__); \ 
  700                log_request_hex(L_DBG, _lvl, request, __FILE__, __LINE__, _data, _len); \ 
 
  703#define RHEXDUMP1(_data, _len, _fmt, ...) _RHEXDUMP(L_DBG_LVL_1, _data, _len, _fmt, ## __VA_ARGS__) 
  704#define RHEXDUMP2(_data, _len, _fmt, ...) _RHEXDUMP(L_DBG_LVL_2, _data, _len, _fmt, ## __VA_ARGS__) 
  705#define RHEXDUMP3(_data, _len, _fmt, ...) _RHEXDUMP(L_DBG_LVL_3, _data, _len, _fmt, ## __VA_ARGS__) 
  706#define RHEXDUMP4(_data, _len, _fmt, ...) _RHEXDUMP(L_DBG_LVL_4, _data, _len, _fmt, ## __VA_ARGS__) 
  716#define _HEXDUMP(_lvl, _data, _len, _fmt, ...) \ 
  717        if (debug_enabled(L_DBG, _lvl)) do { \ 
  718                fr_log_hex(LOG_DST, L_DBG, __FILE__, __LINE__, _data, _len, _fmt, ## __VA_ARGS__); \ 
 
  721#define HEXDUMP1(_data, _len, _fmt, ...) _HEXDUMP(L_DBG_LVL_1, _data, _len, _fmt, ## __VA_ARGS__) 
  722#define HEXDUMP2(_data, _len, _fmt, ...) _HEXDUMP(L_DBG_LVL_2, _data, _len, _fmt, ## __VA_ARGS__) 
  723#define HEXDUMP3(_data, _len, _fmt, ...) _HEXDUMP(L_DBG_LVL_3, _data, _len, _fmt, ## __VA_ARGS__) 
  724#define HEXDUMP4(_data, _len, _fmt, ...) _HEXDUMP(L_DBG_LVL_4, _data, _len, _fmt, ## __VA_ARGS__) 
  736#define _HEX_MARKER(_lvl, _data, _len, _slen, _error, _fmt, ...) \ 
  737        if (debug_enabled(L_DBG, _lvl)) do { \ 
  738                fr_log_hex_marker(LOG_DST, L_DBG, __FILE__, __LINE__, _data, _len, _slen, _error, _fmt, ## __VA_ARGS__); \ 
 
  741#define HEX_MARKER1(_data, _len, _slen, _error, _fmt, ...) _HEX_MARKER(L_DBG_LVL_1, _data, _len, _slen, _error, _fmt, ## __VA_ARGS__) 
  742#define HEX_MARKER2(_data, _len, _slen, _error, _fmt, ...) _HEX_MARKER(L_DBG_LVL_2, _data, _len, _slen, _error, _fmt, ## __VA_ARGS__) 
  743#define HEX_MARKER3(_data, _len, _slen, _error, _fmt, ...) _HEX_MARKER(L_DBG_LVL_3, _data, _len, _slen, _error, _fmt, ## __VA_ARGS__) 
  744#define HEX_MARKER4(_data, _len, _slen, _error, _fmt, ...) _HEX_MARKER(L_DBG_LVL_4, _data, _len, _slen, _error, _fmt, ## __VA_ARGS__) 
static int const char * fmt
A section grouping multiple CONF_PAIR.
void log_request_hex(fr_log_type_t type, fr_log_lvl_t lvl, request_t *request, char const *file, int line, uint8_t const *data, size_t data_len)
fr_log_lvl_t lvl
Log messages with lvl >= to this should be logged.
request_t * request
request to log messages in the context of.
void(* log_request_func_t)(fr_log_type_t type, fr_log_lvl_t lvl, request_t *request, char const *file, int line, char const *fmt,...)
Function signature for log_request functions.
fr_table_num_sorted_t const log_destination_table[]
void log_request_pair_list(fr_log_lvl_t lvl, request_t *request, fr_pair_t const *parent, fr_pair_list_t const *vps, char const *prefix))
Print a fr_pair_list_t.
int log_global_init(fr_log_t *log, bool daemonize)
Initialises the server logging functionality, and the underlying libfreeradius log.
size_t log_destination_table_len
bool log_rdebug_enabled(fr_log_lvl_t lvl, request_t const *request)
Whether a request specific debug message should be logged.
void log_request_marker(fr_log_type_t type, fr_log_lvl_t lvl, request_t *request, char const *file, int line, char const *str, size_t str_len, ssize_t marker_idx, char const *marker,...))
Write the string being parsed, and a marker showing where the parse error occurred.
void log_request_error(fr_log_type_t type, fr_log_lvl_t lvl, request_t *request, char const *file, int line, char const *fmt,...))
Marshal variadic log arguments into a va_list and pass to error logging functions.
fr_log_lvl_t lvl
Priority of the message.
unsigned int repeated
Number of "skipped" messages.
void log_fatal(fr_log_t const *log, char const *file, int line, char const *fmt,...))
Log a fatal error, then exit.
struct rindent_s rindent_t
void log_request_proto_pair_list(fr_log_lvl_t lvl, request_t *request, fr_pair_t const *parent, fr_pair_list_t const *vp, char const *prefix))
Print a list of protocol fr_pair_ts.
void * uctx
Context to pass to the logging function.
int log_parse_section(CONF_SECTION *cs)
Parse a named logging section.
void(* log_func_t)(fr_log_type_t type, fr_log_lvl_t lvl, request_t *request, char const *file, int line, char const *fmt, va_list ap, void *uctx)
Logging callback to write log messages to a destination.
fr_table_num_sorted_t const syslog_severity_table[]
Syslog severity table.
fr_log_t * log_dst_by_name(char const *name)
Get a logging destination by name.
void vlog_request(fr_log_type_t type, fr_log_lvl_t lvl, request_t *request, char const *file, int line, char const *fmt, va_list ap, void *uctx))
Send a log message to its destination, possibly including fields from the request.
fr_time_t now
Current time - Here because it avoids repeated stack allocation.
log_dst_t * next
Next logging destination.
void log_request_pair(fr_log_lvl_t lvl, request_t *request, fr_pair_t const *parent, fr_pair_t const *vp, char const *prefix))
Print a fr_pair_t.
fr_time_t last_complained
Last time we emitted a log message.
void log_request_fd_event(UNUSED fr_event_list_t *el, int fd, UNUSED int flags, void *uctx)
Function to provide as the readable callback to the event loop.
size_t syslog_facility_table_len
void log_request_perror(fr_log_type_t type, fr_log_lvl_t lvl, request_t *request, char const *file, int line, char const *fmt,...))
Drain any outstanding messages from the fr_strerror buffers.
size_t syslog_severity_table_len
void log_request(fr_log_type_t type, fr_log_lvl_t lvl, request_t *request, char const *file, int line, char const *fmt,...))
Marshal variadic log arguments into a va_list and pass to normal logging functions.
char const  * prefix
To add to log messages.
fr_log_type_t type
What type of log message it is.
log_func_t func
Function to call to log to this destination.
uint8_t unlang
By how much to indent log messages.
fr_table_num_sorted_t const syslog_facility_table[]
Syslog facility table.
void log_global_free(void)
Track when a log message was last repeated.
Context structure for the log fd event function.
Stores all information relating to an event list.
fr_aka_sim_id_type_t type
Stores an attribute, a value and various bits of other data.
An element in a lexicographically sorted array of name to num mappings.
static fr_event_list_t * el