|
libcoap 4.3.5-develop-13abce9
|
Debug utilities. More...
#include "coap3/coap_libcoap_build.h"#include <stdarg.h>#include <stdio.h>#include <string.h>#include <ctype.h>
Include dependency graph for coap_debug.c:Go to the source code of this file.
Data Structures | |
| struct | packet_num_interval |
Macros | |
| #define | min(a, b) ((a) < (b) ? (a) : (b)) |
| #define | INET6_ADDRSTRLEN 46 |
| #define | COAP_DO_SHOW_OUTPUT_LINE |
Functions | |
| const char * | coap_package_name (void) |
| Get the library package name. | |
| const char * | coap_package_version (void) |
| Get the library package version. | |
| const char * | coap_package_build (void) |
| Get the library package build. | |
| void | coap_set_show_pdu_output (int use_fprintf) |
| Defines the output mode for the coap_show_pdu() function. | |
| void | coap_enable_pdu_data_output (int enable_data) |
| Defines whether the data is to be output or not for the coap_show_pdu() function. | |
| coap_log_t | coap_get_log_level (void) |
| Get the current logging level. | |
| void | coap_set_log_level (coap_log_t level) |
| Sets the log level to the specified value. | |
| const char * | coap_log_level_desc (coap_log_t level) |
| Get the current logging description. | |
| COAP_STATIC_INLINE size_t | print_timestamp (char *s, size_t len, coap_tick_t t) |
| static size_t | strnlen (const char *s, size_t maxlen) |
| A length-safe strlen() fake. | |
| static size_t | print_readable (const uint8_t *data, size_t len, unsigned char *result, size_t buflen, int encode_always) |
| size_t | coap_print_addr (const coap_address_t *addr, unsigned char *buf, size_t len) |
| Print the address into the defined buffer. | |
| const char * | coap_print_ip_addr (const coap_address_t *addr, char *buf, size_t len) |
| Print the IP address into the defined buffer. | |
| static const char * | msg_type_string (uint16_t t) |
Returns a textual description of the message type t. | |
| static const char * | msg_code_string (uint16_t c) |
| Returns a textual description of the method or response code. | |
| static const char * | msg_option_string (uint8_t code, uint16_t option_type) |
| Returns a textual description of the option name. | |
| static unsigned int | print_content_format (unsigned int format_type, unsigned char *result, unsigned int buflen) |
| COAP_STATIC_INLINE int | is_binary (int content_format) |
Returns 1 if the given content_format is either unknown or known to carry binary data. | |
| void | coap_show_pdu (coap_log_t level, const coap_pdu_t *pdu) |
Display the contents of the specified pdu. | |
| void | coap_show_tls_version (coap_log_t level) |
| Display the current (D)TLS library linked with and built for version. | |
| 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. | |
| char * | coap_string_tls_support (char *buffer, size_t bufsize) |
| Build a string containing the current (D)TLS library support. | |
| void | coap_set_log_handler (coap_log_handler_t handler) |
| Add a custom log callback handler. | |
| void | coap_log_impl (coap_log_t level, const char *format,...) |
Writes the given text to COAP_ERR_FD (for level <= COAP_LOG_CRIT) or COAP_DEBUG_FD (for level >= COAP_LOG_ERR). | |
| int | coap_debug_set_packet_loss (const char *loss_level) |
| Set the packet loss level for testing. | |
| int | coap_debug_send_packet (void) |
| Check to see whether a packet should be sent or not. | |
| void | coap_debug_reset (void) |
| Reset all the defined logging parameters. | |
Variables | |
| static coap_log_t | maxlog = COAP_LOG_WARN |
| static int | use_fprintf_for_show_pdu = 1 |
| static int | enable_data_for_show_pdu = 1 |
| static const char * | loglevels [] |
| static coap_log_handler_t | log_handler = NULL |
| static struct packet_num_interval | packet_loss_intervals [10] |
| static int | num_packet_loss_intervals = 0 |
| static uint16_t | packet_loss_level = 0 |
| static int | send_packet_count = 0 |
Debug utilities.
Definition in file coap_debug.c.
| #define COAP_DO_SHOW_OUTPUT_LINE |
Definition at line 759 of file coap_debug.c.
| #define INET6_ADDRSTRLEN 46 |
Definition at line 234 of file coap_debug.c.
| #define min | ( | a, | |
| b | |||
| ) | ((a) < (b) ? (a) : (b)) |
Definition at line 230 of file coap_debug.c.
| void coap_debug_reset | ( | void | ) |
Reset all the defined logging parameters.
Internal function
Definition at line 1436 of file coap_debug.c.
Here is the caller graph for this function:| int coap_debug_send_packet | ( | void | ) |
Check to see whether a packet should be sent or not.
Internal function
1 if packet is to be sent, 0 if packet is to be dropped. Definition at line 1412 of file coap_debug.c.
Here is the call graph for this function:
Here is the caller graph for this function:| int coap_debug_set_packet_loss | ( | const char * | loss_level | ) |
Set the packet loss level for testing.
This can be in one of two forms.
Percentage : 0% to 100%. Use the specified probability. 0% is send all packets, 100% is drop all packets.
List: A comma separated list of numbers or number ranges that are the packets to drop.
| loss_level | The defined loss level (percentage or list). |
1 If loss level set, 0 if there is an error. Definition at line 1371 of file coap_debug.c.
| COAP_STATIC_INLINE int is_binary | ( | int | content_format | ) |
Returns 1 if the given content_format is either unknown or known to carry binary data.
The return value 0 hence indicates printable data which is also assumed if content_format is 01.
Definition at line 751 of file coap_debug.c.
Here is the caller graph for this function:
|
static |
Returns a textual description of the method or response code.
Definition at line 575 of file coap_debug.c.
Here is the caller graph for this function:
|
static |
Returns a textual description of the option name.
Definition at line 596 of file coap_debug.c.
Here is the caller graph for this function:
|
static |
Returns a textual description of the message type t.
Definition at line 567 of file coap_debug.c.
Here is the caller graph for this function:
|
static |
|
static |
| COAP_STATIC_INLINE size_t print_timestamp | ( | char * | s, |
| size_t | len, | ||
| coap_tick_t | t | ||
| ) |
Definition at line 160 of file coap_debug.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
inlinestatic |
A length-safe strlen() fake.
| s | The string to count characters != 0. |
| maxlen | The maximum length of s. |
s. Definition at line 183 of file coap_debug.c.
|
static |
Definition at line 71 of file coap_debug.c.
|
static |
Definition at line 1286 of file coap_debug.c.
|
static |
Definition at line 116 of file coap_debug.c.
|
static |
Definition at line 63 of file coap_debug.c.
|
static |
Definition at line 1366 of file coap_debug.c.
|
static |
|
static |
Definition at line 1367 of file coap_debug.c.
|
static |
Definition at line 1368 of file coap_debug.c.
|
static |
Definition at line 70 of file coap_debug.c.