Project Alice
Loading...
Searching...
No Matches
pcp_logger.h File Reference
#include "pcp.h"
Include dependency graph for pcp_logger.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define ERR_BUF_LEN   256
 
#define PCP_MAX_LOG_LEVEL   PCP_LOGLVL_INFO
 
#define PCP_LOG(level, fmt, ...)
 
#define PCP_LOG_END(level)
 
#define PCP_LOG_BEGIN(level)
 
#define PCP_LOG_DEBUG(fmt, ...)   PCP_LOG(PCP_LOGLVL_DEBUG, fmt, __VA_ARGS__)
 
#define PCP_LOG_FLOW(f, msg)
 

Functions

void pcp_logger_init (void)
 
void pcp_logger (pcp_loglvl_e log_level, const char *fmt,...) __attribute__((format(printf
 
void pcp_strerror (int errnum, char *buf, size_t buflen)
 

Macro Definition Documentation

◆ ERR_BUF_LEN

#define ERR_BUF_LEN   256

Definition at line 29 of file pcp_logger.h.

◆ PCP_LOG

#define PCP_LOG (   level,
  fmt,
  ... 
)

Definition at line 71 of file pcp_logger.h.

◆ PCP_LOG_BEGIN

#define PCP_LOG_BEGIN (   level)

Definition at line 75 of file pcp_logger.h.

◆ PCP_LOG_DEBUG

#define PCP_LOG_DEBUG (   fmt,
  ... 
)    PCP_LOG(PCP_LOGLVL_DEBUG, fmt, __VA_ARGS__)

Definition at line 79 of file pcp_logger.h.

◆ PCP_LOG_END

#define PCP_LOG_END (   level)

Definition at line 73 of file pcp_logger.h.

◆ PCP_LOG_FLOW

#define PCP_LOG_FLOW (   f,
  msg 
)
Value:
do { \
char src_buf[INET6_ADDRSTRLEN]="Unknown"; \
char dst_buf[INET6_ADDRSTRLEN]="Unknown"; \
char pcp_buf[INET6_ADDRSTRLEN]="Unknown"; \
\
inet_ntop(AF_INET6, &f->kd.src_ip, src_buf, sizeof(src_buf)); \
inet_ntop(AF_INET6, &f->kd.map_peer.dst_ip, dst_buf, \
sizeof(dst_buf)); \
inet_ntop(AF_INET6, &f->kd.pcp_server_ip, pcp_buf, sizeof(pcp_buf)); \
PCP_LOG(PCP_LOGLVL_INFO, \
"%s(PCP server: %s; Int. addr: [%s]:%d; Dest. addr: [%s]:%d; Key bucket: %d)", \
msg, pcp_buf, src_buf, ntohs(f->kd.map_peer.src_port), dst_buf, ntohs(f->kd.map_peer.dst_port), f->key_bucket); \
} \
} while(0)
pcp_loglvl_e pcp_log_level
Definition: pcp_logger.c:48
@ PCP_LOGLVL_INFO
Definition: pcp.h:88

Definition at line 85 of file pcp_logger.h.

◆ PCP_MAX_LOG_LEVEL

#define PCP_MAX_LOG_LEVEL   PCP_LOGLVL_INFO

Definition at line 68 of file pcp_logger.h.

Function Documentation

◆ pcp_logger()

void pcp_logger ( pcp_loglvl_e  log_level,
const char *  fmt,
  ... 
)

◆ pcp_logger_init()

void pcp_logger_init ( void  )

Definition at line 50 of file pcp_logger.c.

Here is the caller graph for this function:

◆ pcp_strerror()

void pcp_strerror ( int  errnum,
char *  buf,
size_t  buflen 
)

Definition at line 165 of file pcp_logger.c.

Here is the caller graph for this function: