tinydtls  0.8.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
Macros | Enumerations | Functions
debug.h File Reference
#include <stdlib.h>
#include "dtls_config.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 ()
 
const char * dtls_package_name ()
 
const char * dtls_package_version ()
 
log_t dtls_get_log_level ()
 
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 134 of file debug.h.

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

Definition at line 135 of file debug.h.

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

Definition at line 139 of file debug.h.

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

Definition at line 141 of file debug.h.

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

Definition at line 140 of file debug.h.

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

Definition at line 133 of file debug.h.

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

Definition at line 138 of file debug.h.

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

Definition at line 137 of file debug.h.

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

Definition at line 136 of file debug.h.

#define PRINTF (   ...)

Definition at line 57 of file 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 66 of file debug.h.

Function Documentation

static void check_stack ( )
inlinestatic

Definition at line 59 of file 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 208 of file 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 290 of file debug.c.

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

Definition at line 277 of file debug.c.

log_t dtls_get_log_level ( )

Returns the current log level.

Definition at line 58 of file debug.c.

const char* dtls_package_name ( )

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

Definition at line 49 of file debug.c.

const char* dtls_package_version ( )

Returns a zero-terminated string with the library version.

Definition at line 53 of file debug.c.

void dtls_set_log_level ( log_t  level)

Sets the log level to the specified value.

Definition at line 63 of file debug.c.

void dump ( unsigned char *  buf,
size_t  len 
)

dump as narrow string of hex digits

Definition at line 272 of file debug.c.

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

dumps packets in usual hexdump format

Definition at line 252 of file debug.c.