FD.io VPP  v21.10.1-2-g0a485f517
Vector Packet Processing
log.h File Reference

NAT port/address allocation lib. More...

+ Include dependency graph for log.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define foreach_nat_log_level
 
#define nat_elog(_pm, _level, _str)
 
#define nat_elog_addr(_pm, _level, _str, _addr)
 
#define nat_elog_debug_handoff(_pm, _str, _tid, _fib, _src, _dst)
 
#define nat_elog_debug_handoff_v2(_pm, _str, _prt, _fib, _src, _dst)
 
#define nat_elog_X1(_pm, _level, _fmt, _arg, _val1)
 
#define nat_elog_notice(_pm, nat_elog_str)   nat_elog (_pm, NAT_LOG_INFO, "[notice] " nat_elog_str)
 
#define nat_elog_warn(_pm, nat_elog_str)   nat_elog (_pm, NAT_LOG_WARNING, "[warning] " nat_elog_str)
 
#define nat_elog_err(_pm, nat_elog_str)   nat_elog (_pm, NAT_LOG_ERROR, "[error] " nat_elog_str)
 
#define nat_elog_debug(_pm, nat_elog_str)   nat_elog (_pm, NAT_LOG_DEBUG, "[debug] " nat_elog_str)
 
#define nat_elog_info(_pm, nat_elog_str)   nat_elog (_pm, NAT_LOG_INFO, "[info] " nat_elog_str)
 
#define nat_elog_notice_X1(_pm, nat_elog_fmt_str, nat_elog_fmt_arg, nat_elog_val1)
 
#define nat_elog_warn_X1(_pm, nat_elog_fmt_str, nat_elog_fmt_arg, nat_elog_val1)
 
#define nat_elog_err_X1(_pm, nat_elog_fmt_str, nat_elog_fmt_arg, nat_elog_val1)
 
#define nat_elog_debug_X1(_pm, nat_elog_fmt_str, nat_elog_fmt_arg, nat_elog_val1)
 
#define nat_elog_info_X1(_pm, nat_elog_fmt_str, nat_elog_fmt_arg, nat_elog_val1)
 

Typedefs

typedef enum nat_log_level_t_ nat_log_level_t
 

Enumerations

enum  nat_log_level_t_ { foreach_nat_log_level }
 

Detailed Description

NAT port/address allocation lib.

Definition in file log.h.

Macro Definition Documentation

◆ foreach_nat_log_level

#define foreach_nat_log_level
Value:
_ (0x00, LOG_NONE) \
_ (0x01, LOG_ERROR) \
_ (0x02, LOG_WARNING) \
_ (0x03, LOG_NOTICE) \
_ (0x04, LOG_INFO) \
_ (0x05, LOG_DEBUG)

Definition at line 24 of file log.h.

◆ nat_elog

#define nat_elog (   _pm,
  _level,
  _str 
)
Value:
do \
{ \
if (PREDICT_FALSE (_pm->log_level >= _level)) \
{ \
ELOG_TYPE_DECLARE (e) = { \
.format = "nat-msg " _str, \
.format_args = "", \
}; \
ELOG_DATA (&vlib_global_main.elog_main, e); \
} \
} \
while (0);

Definition at line 39 of file log.h.

◆ nat_elog_addr

#define nat_elog_addr (   _pm,
  _level,
  _str,
  _addr 
)
Value:
do \
{ \
if (PREDICT_FALSE (_pm->log_level >= _level)) \
{ \
ELOG_TYPE_DECLARE (e) = { \
.format = "nat-msg " _str " %d.%d.%d.%d", \
.format_args = "i1i1i1i1", \
}; \
CLIB_PACKED (struct { \
u8 oct1; \
u8 oct2; \
u8 oct3; \
u8 oct4; \
}) * \
ed; \
ed->oct4 = _addr >> 24; \
ed->oct3 = _addr >> 16; \
ed->oct2 = _addr >> 8; \
ed->oct1 = _addr; \
} \
} \
while (0);

Definition at line 53 of file log.h.

◆ nat_elog_debug

#define nat_elog_debug (   _pm,
  nat_elog_str 
)    nat_elog (_pm, NAT_LOG_DEBUG, "[debug] " nat_elog_str)

Definition at line 181 of file log.h.

◆ nat_elog_debug_handoff

#define nat_elog_debug_handoff (   _pm,
  _str,
  _tid,
  _fib,
  _src,
  _dst 
)
Value:
do \
{ \
if (PREDICT_FALSE (_pm->log_level >= NAT_LOG_DEBUG)) \
{ \
ELOG_TYPE_DECLARE (e) = { \
.format = "nat-msg " _str " ip src: %d.%d.%d.%d dst: %d.%d.%d.%d" \
" tid from: %d to: %d fib: %d", \
.format_args = "i1i1i1i1i1i1i1i1i4i4i4", \
}; \
CLIB_PACKED (struct { \
u8 src_oct1; \
u8 src_oct2; \
u8 src_oct3; \
u8 src_oct4; \
u8 dst_oct1; \
u8 dst_oct2; \
u8 dst_oct3; \
u8 dst_oct4; \
u32 ftid; \
u32 ttid; \
u32 fib; \
}) * \
ed; \
ed->src_oct1 = _src >> 24; \
ed->src_oct2 = _src >> 16; \
ed->src_oct3 = _src >> 8; \
ed->src_oct4 = _src; \
ed->dst_oct1 = _dst >> 24; \
ed->dst_oct2 = _dst >> 16; \
ed->dst_oct3 = _dst >> 8; \
ed->dst_oct4 = _dst; \
ed->ftid = vlib_get_thread_index (); \
ed->ttid = _tid; \
ed->fib = _fib; \
} \
} \
while (0);

Definition at line 78 of file log.h.

◆ nat_elog_debug_handoff_v2

#define nat_elog_debug_handoff_v2 (   _pm,
  _str,
  _prt,
  _fib,
  _src,
  _dst 
)
Value:
do \
{ \
if (PREDICT_FALSE (_pm->log_level >= NAT_LOG_DEBUG)) \
{ \
ELOG_TYPE_DECLARE (e) = { \
.format = \
"nat-msg " _str " ip_src:%d.%d.%d.%d ip_dst:%d.%d.%d.%d" \
" tid:%d prt:%d fib:%d", \
.format_args = "i1i1i1i1i1i1i1i1i4i4i4", \
}; \
CLIB_PACKED (struct { \
u8 src_oct1; \
u8 src_oct2; \
u8 src_oct3; \
u8 src_oct4; \
u8 dst_oct1; \
u8 dst_oct2; \
u8 dst_oct3; \
u8 dst_oct4; \
u32 tid; \
u32 prt; \
u32 fib; \
}) * \
ed; \
ed->src_oct1 = _src >> 24; \
ed->src_oct2 = _src >> 16; \
ed->src_oct3 = _src >> 8; \
ed->src_oct4 = _src; \
ed->dst_oct1 = _dst >> 24; \
ed->dst_oct2 = _dst >> 16; \
ed->dst_oct3 = _dst >> 8; \
ed->dst_oct4 = _dst; \
ed->tid = vlib_get_thread_index (); \
ed->prt = _prt; \
ed->fib = _fib; \
} \
} \
while (0);

Definition at line 118 of file log.h.

◆ nat_elog_debug_X1

#define nat_elog_debug_X1 (   _pm,
  nat_elog_fmt_str,
  nat_elog_fmt_arg,
  nat_elog_val1 
)
Value:
nat_elog_X1 (_pm, NAT_LOG_DEBUG, "[debug] " nat_elog_fmt_str, \
nat_elog_fmt_arg, nat_elog_val1)

Definition at line 198 of file log.h.

◆ nat_elog_err

#define nat_elog_err (   _pm,
  nat_elog_str 
)    nat_elog (_pm, NAT_LOG_ERROR, "[error] " nat_elog_str)

Definition at line 179 of file log.h.

◆ nat_elog_err_X1

#define nat_elog_err_X1 (   _pm,
  nat_elog_fmt_str,
  nat_elog_fmt_arg,
  nat_elog_val1 
)
Value:
nat_elog_X1 (_pm, NAT_LOG_ERROR, "[error] " nat_elog_fmt_str, \
nat_elog_fmt_arg, nat_elog_val1)

Definition at line 194 of file log.h.

◆ nat_elog_info

#define nat_elog_info (   _pm,
  nat_elog_str 
)    nat_elog (_pm, NAT_LOG_INFO, "[info] " nat_elog_str)

Definition at line 183 of file log.h.

◆ nat_elog_info_X1

#define nat_elog_info_X1 (   _pm,
  nat_elog_fmt_str,
  nat_elog_fmt_arg,
  nat_elog_val1 
)
Value:
nat_elog_X1 (_pm, NAT_LOG_INFO, "[info] " nat_elog_fmt_str, \
nat_elog_fmt_arg, nat_elog_val1)

Definition at line 202 of file log.h.

◆ nat_elog_notice

#define nat_elog_notice (   _pm,
  nat_elog_str 
)    nat_elog (_pm, NAT_LOG_INFO, "[notice] " nat_elog_str)

Definition at line 175 of file log.h.

◆ nat_elog_notice_X1

#define nat_elog_notice_X1 (   _pm,
  nat_elog_fmt_str,
  nat_elog_fmt_arg,
  nat_elog_val1 
)
Value:
nat_elog_X1 (_pm, NAT_LOG_NOTICE, "[notice] " nat_elog_fmt_str, \
nat_elog_fmt_arg, nat_elog_val1)

Definition at line 186 of file log.h.

◆ nat_elog_warn

#define nat_elog_warn (   _pm,
  nat_elog_str 
)    nat_elog (_pm, NAT_LOG_WARNING, "[warning] " nat_elog_str)

Definition at line 177 of file log.h.

◆ nat_elog_warn_X1

#define nat_elog_warn_X1 (   _pm,
  nat_elog_fmt_str,
  nat_elog_fmt_arg,
  nat_elog_val1 
)
Value:
nat_elog_X1 (_pm, NAT_LOG_WARNING, "[warning] " nat_elog_fmt_str, \
nat_elog_fmt_arg, nat_elog_val1)

Definition at line 190 of file log.h.

◆ nat_elog_X1

#define nat_elog_X1 (   _pm,
  _level,
  _fmt,
  _arg,
  _val1 
)
Value:
do \
{ \
if (PREDICT_FALSE (_pm->log_level >= _level)) \
{ \
ELOG_TYPE_DECLARE (e) = { \
.format = "nat-msg " _fmt, \
.format_args = _arg, \
}; \
CLIB_PACKED (struct { typeof (_val1) val1; }) * ed; \
ed->val1 = _val1; \
} \
} \
while (0);

Definition at line 159 of file log.h.

Typedef Documentation

◆ nat_log_level_t

Enumeration Type Documentation

◆ nat_log_level_t_

Enumerator
foreach_nat_log_level 

Definition at line 32 of file log.h.

NAT_LOG_INFO
@ NAT_LOG_INFO
Definition: nat_types.api:32
NAT_LOG_NOTICE
@ NAT_LOG_NOTICE
Definition: nat_types.api:31
PREDICT_FALSE
#define PREDICT_FALSE(x)
Definition: clib.h:124
vlib_get_thread_index
static_always_inline uword vlib_get_thread_index(void)
Definition: threads.h:187
vlib_global_main
vlib_global_main_t vlib_global_main
Definition: main.c:1786
NAT_LOG_DEBUG
@ NAT_LOG_DEBUG
Definition: nat_types.api:33
vlib_global_main_t::elog_main
elog_main_t elog_main
Definition: main.h:302
nat_elog_X1
#define nat_elog_X1(_pm, _level, _fmt, _arg, _val1)
Definition: log.h:159
NAT_LOG_ERROR
@ NAT_LOG_ERROR
Definition: nat_types.api:29
ELOG_DATA
#define ELOG_DATA(em, f)
Definition: elog.h:484
NAT_LOG_WARNING
@ NAT_LOG_WARNING
Definition: nat_types.api:30