10 #ifndef _COAP_DEBUG_H_ 11 #define _COAP_DEBUG_H_ 23 #define COAP_DEBUG_FD stdout 30 #define COAP_ERR_FD stderr 106 #if (defined(__GNUC__)) 108 const char *format, ...) __attribute__ ((format(printf, 2, 3)));
122 #define coap_log(level, ...) do { \ 123 if ((int)((level))<=(int)coap_get_log_level()) \ 124 coap_log_impl((level), __VA_ARGS__); \ 180 unsigned char *buffer,
size_t size);
void coap_show_pdu(coap_log_t level, const coap_pdu_t *pdu)
Display the contents of the specified pdu.
multi-purpose address abstraction
const char * coap_package_name(void)
Get the library package name.
size_t coap_print_addr(const struct coap_address_t *address, unsigned char *buffer, size_t size)
Print the address into the defined buffer.
char * coap_string_tls_version(char *buffer, size_t bufsize)
Build a string containing the current (D)TLS library linked with and built for version.
int coap_debug_set_packet_loss(const char *loss_level)
Set the packet loss level for testing.
void coap_set_log_level(coap_log_t level)
Sets the log level to the specified value.
void coap_log_impl(coap_log_t level, const char *format,...)
Writes the given text to COAP_ERR_FD (for level <= LOG_CRIT) or COAP_DEBUG_FD (for level >= LOG_ERR)...
void(* coap_log_handler_t)(coap_log_t level, const char *message)
Logging call-back handler definition.
structure for CoAP PDUs token, if any, follows the fixed size header, then options until payload mark...
void coap_set_show_pdu_output(int use_fprintf)
Defines the output mode for the coap_show_pdu() function.
void coap_show_tls_version(coap_log_t level)
Display the current (D)TLS library linked with and built for version.
Pre-defined constants that reflect defaults for CoAP.
coap_log_t
Pre-defined log levels akin to what is used in syslog.
const char * coap_package_version(void)
Get the library package version.
coap_log_t coap_get_log_level(void)
Get the current logging level.
socklen_t size
size of addr
void coap_set_log_handler(coap_log_handler_t handler)
Add a custom log callback handler.
int coap_debug_send_packet(void)
Check to see whether a packet should be sent or not.