#include "tinydtls.h"
#include "dtls_config.h"
#include <assert.h>
#include <stdarg.h>
#include <stdio.h>
#include <arpa/inet.h>
#include <time.h>
#include "global.h"
#include "debug.h"
Go to the source code of this file.
|
#define | min(a, b) ((a) < (b) ? (a) : (b)) |
|
|
const char * | dtls_package_name () |
|
const char * | dtls_package_version () |
|
log_t | dtls_get_log_level () |
|
void | dtls_set_log_level (log_t level) |
|
static size_t | print_timestamp (char *s, size_t len, time_t t) |
|
static size_t | dtls_strnlen (const char *s, size_t maxlen) |
|
static size_t | dsrv_print_addr (const session_t *addr, char *buf, size_t len) |
|
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_log_addr (log_t level, const char *name, const session_t *addr) |
|
void | dtls_dsrv_hexdump_log (log_t level, const char *name, const unsigned char *buf, size_t length, int extend) |
|
#define min |
( |
|
a, |
|
|
|
b |
|
) |
| ((a) < (b) ? (a) : (b)) |
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.
static size_t dsrv_print_addr |
( |
const session_t * |
addr, |
|
|
char * |
buf, |
|
|
size_t |
len |
|
) |
| |
|
static |
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 |
|
) |
| |
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.
static size_t dtls_strnlen |
( |
const char * |
s, |
|
|
size_t |
maxlen |
|
) |
| |
|
inlinestatic |
A length-safe strlen() fake.
- Parameters
-
s | The string to count characters != 0. |
maxlen | The maximum length of s . |
- Returns
- The length of
s
.
Definition at line 106 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.
static size_t print_timestamp |
( |
char * |
s, |
|
|
size_t |
len, |
|
|
time_t |
t |
|
) |
| |
|
inlinestatic |
Initial value:= {
"EMRG", "ALRT", "CRIT", "WARN", "NOTE", "INFO", "DEBG"
}
Definition at line 68 of file debug.c.