tinydtls  0.8.6
Macros | Enumerations | Functions
dtls_debug.h File Reference
#include <stdlib.h>
#include "tinydtls.h"
#include "global.h"
#include "session.h"

Go to the source code of this file.

Macros

#define PRINTF(...)
 
#define dtls_emerg(...)   dsrv_log(DTLS_LOG_EMERG, __VA_ARGS__)
 
#define dtls_alert(...)   dsrv_log(DTLS_LOG_ALERT, __VA_ARGS__)
 
#define dtls_crit(...)   dsrv_log(DTLS_LOG_CRIT, __VA_ARGS__)
 
#define dtls_warn(...)   dsrv_log(DTLS_LOG_WARN, __VA_ARGS__)
 
#define dtls_notice(...)   dsrv_log(DTLS_LOG_NOTICE, __VA_ARGS__)
 
#define dtls_info(...)   dsrv_log(DTLS_LOG_INFO, __VA_ARGS__)
 
#define dtls_debug(...)   dsrv_log(DTLS_LOG_DEBUG, __VA_ARGS__)
 
#define dtls_debug_hexdump(name, buf, length)   dtls_dsrv_hexdump_log(DTLS_LOG_DEBUG, name, buf, length, 1)
 
#define dtls_debug_dump(name, buf, length)   dtls_dsrv_hexdump_log(DTLS_LOG_DEBUG, name, buf, length, 0)
 

Enumerations

enum  log_t {
  DTLS_LOG_EMERG =0, DTLS_LOG_ALERT, DTLS_LOG_CRIT, DTLS_LOG_WARN,
  DTLS_LOG_NOTICE, DTLS_LOG_INFO, DTLS_LOG_DEBUG
}
 

Functions

static void check_stack (void)
 
const char * dtls_package_name (void)
 
const char * dtls_package_version (void)
 
log_t dtls_get_log_level (void)
 
void dtls_set_log_level (log_t level)
 
void dsrv_log (log_t level, char *format,...)
 
void hexdump (const unsigned char *packet, int length)
 
void dump (unsigned char *buf, size_t len)
 
void dtls_dsrv_hexdump_log (log_t level, const char *name, const unsigned char *buf, size_t length, int extend)
 
void dtls_dsrv_log_addr (log_t level, const char *name, const session_t *addr)
 

Macro Definition Documentation

#define dtls_alert (   ...)    dsrv_log(DTLS_LOG_ALERT, __VA_ARGS__)

Definition at line 113 of file dtls_debug.h.

#define dtls_crit (   ...)    dsrv_log(DTLS_LOG_CRIT, __VA_ARGS__)

Definition at line 114 of file dtls_debug.h.

#define dtls_debug (   ...)    dsrv_log(DTLS_LOG_DEBUG, __VA_ARGS__)

Definition at line 118 of file dtls_debug.h.

#define dtls_debug_dump (   name,
  buf,
  length 
)    dtls_dsrv_hexdump_log(DTLS_LOG_DEBUG, name, buf, length, 0)

Definition at line 120 of file dtls_debug.h.

#define dtls_debug_hexdump (   name,
  buf,
  length 
)    dtls_dsrv_hexdump_log(DTLS_LOG_DEBUG, name, buf, length, 1)

Definition at line 119 of file dtls_debug.h.

#define dtls_emerg (   ...)    dsrv_log(DTLS_LOG_EMERG, __VA_ARGS__)

Definition at line 112 of file dtls_debug.h.

#define dtls_info (   ...)    dsrv_log(DTLS_LOG_INFO, __VA_ARGS__)

Definition at line 117 of file dtls_debug.h.

#define dtls_notice (   ...)    dsrv_log(DTLS_LOG_NOTICE, __VA_ARGS__)

Definition at line 116 of file dtls_debug.h.

#define dtls_warn (   ...)    dsrv_log(DTLS_LOG_WARN, __VA_ARGS__)

Definition at line 115 of file dtls_debug.h.

#define PRINTF (   ...)

Definition at line 49 of file dtls_debug.h.

Enumeration Type Documentation

enum log_t

Pre-defined log levels akin to what is used in syslog.

Enumerator
DTLS_LOG_EMERG 
DTLS_LOG_ALERT 
DTLS_LOG_CRIT 
DTLS_LOG_WARN 
DTLS_LOG_NOTICE 
DTLS_LOG_INFO 
DTLS_LOG_DEBUG 

Definition at line 56 of file dtls_debug.h.

Function Documentation

static void check_stack ( void  )
inlinestatic

Definition at line 51 of file dtls_debug.h.

void dsrv_log ( log_t  level,
char *  format,
  ... 
)

Writes the given text to stdout. The text is output only when level is below or equal to the log level that set by set_log_level().

Definition at line 209 of file dtls_debug.c.

void dtls_dsrv_hexdump_log ( log_t  level,
const char *  name,
const unsigned char *  buf,
size_t  length,
int  extend 
)

Definition at line 291 of file dtls_debug.c.

void dtls_dsrv_log_addr ( log_t  level,
const char *  name,
const session_t addr 
)

Definition at line 278 of file dtls_debug.c.

log_t dtls_get_log_level ( void  )

Returns the current log level.

Definition at line 53 of file dtls_debug.c.

const char* dtls_package_name ( void  )

Returns a zero-terminated string with the name of this library.

Definition at line 44 of file dtls_debug.c.

const char* dtls_package_version ( void  )

Returns a zero-terminated string with the library version.

Definition at line 48 of file dtls_debug.c.

void dtls_set_log_level ( log_t  level)

Sets the log level to the specified value.

Definition at line 58 of file dtls_debug.c.

void dump ( unsigned char *  buf,
size_t  len 
)

dump as narrow string of hex digits

Definition at line 273 of file dtls_debug.c.

void hexdump ( const unsigned char *  packet,
int  length 
)

dumps packets in usual hexdump format

Definition at line 253 of file dtls_debug.c.