libcoap
4.3.0
|
#include <strings.h>
#include <stdint.h>
Go to the source code of this file.
Functions | |
int | coap_fls (unsigned int i) |
int | coap_flsll (long long i) |
unsigned int | coap_decode_var_bytes (const uint8_t *buf, size_t length) |
Decodes multiple-length byte sequences. More... | |
uint64_t | coap_decode_var_bytes8 (const uint8_t *buf, size_t length) |
Decodes multiple-length byte sequences. More... | |
unsigned int | coap_encode_var_safe (uint8_t *buf, size_t length, unsigned int value) |
Encodes multiple-length byte sequences. More... | |
unsigned int | coap_encode_var_safe8 (uint8_t *buf, size_t length, uint64_t value) |
Encodes multiple-length byte sequences. More... | |
COAP_STATIC_INLINE COAP_DEPRECATED int | coap_encode_var_bytes (uint8_t *buf, unsigned int value) |
COAP_STATIC_INLINE COAP_DEPRECATED int coap_encode_var_bytes | ( | uint8_t * | buf, |
unsigned int | value | ||
) |
Provided for backward compatibility. As value
has a maximum value of 0xffffffff, and buf is usually defined as an array, it is unsafe to continue to use this variant if buf[] is less than buf[4].
For example char buf[1],oops; .. coap_encode_var_bytes(buf, 0xfff); would cause oops to get overwritten. This error can only be found by code inspection. coap_encode_var_safe(buf, sizeof(buf), 0xfff); would catch this error at run-time and should be used instead.
Definition at line 115 of file encode.h.
int coap_fls | ( | unsigned int | i | ) |