23 if (size >= MEMP_LEN_COAPSTRING) {
25 "coap_new_string: size too large (%zu +1 > MEMP_LEN_COAPSTRING)\n",
53 memcpy (s->
s, data, size);
67 var[ofs].
length = strlen(
string);
68 var[ofs].
s = (
const uint8_t *)
string;
77#if defined(RIOT_VERSION) || defined(WITH_CONTIKI) || defined(WITH_LWIP)
81 memcpy(new->s, s->
s, s->
length);
104 memcpy (s->
s, data, size);
Pulls together all the internal only header files.
#define coap_log(level,...)
Logging function.
#define COAP_MAX_STR_CONST_FUNC
void coap_delete_bin_const(coap_bin_const_t *s)
Deletes the given const binary data and releases any memory allocated.
void coap_delete_str_const(coap_str_const_t *s)
Deletes the given const string and releases any memory allocated.
coap_binary_t * coap_new_binary(size_t size)
Returns a new binary object with at least size bytes storage allocated.
coap_str_const_t * coap_make_str_const(const char *string)
Take the specified byte array (text) and create a coap_str_const_t *.
coap_bin_const_t * coap_new_bin_const(const uint8_t *data, size_t size)
Take the specified byte array (text) and create a coap_bin_const_t * Returns a new const binary objec...
coap_binary_t * coap_resize_binary(coap_binary_t *s, size_t size)
Resizes the given coap_binary_t object.
void coap_delete_binary(coap_binary_t *s)
Deletes the given coap_binary_t object and releases any memory allocated.
coap_string_t * coap_new_string(size_t size)
Returns a new string object with at least size+1 bytes storage allocated.
struct coap_string_t coap_string_t
CoAP string data definition.
coap_str_const_t * coap_new_str_const(const uint8_t *data, size_t size)
Returns a new const string object with at least size+1 bytes storage allocated, and the provided data...
void coap_delete_string(coap_string_t *s)
Deletes the given string and releases any memory allocated.
void * coap_realloc_type(coap_memory_tag_t type, void *p, size_t size)
Reallocates a chunk p of bytes created by coap_malloc_type() or coap_realloc_type() and returns a poi...
void * coap_malloc_type(coap_memory_tag_t type, size_t size)
Allocates a chunk of size bytes and returns a pointer to the newly allocated memory.
void coap_free_type(coap_memory_tag_t type, void *p)
Releases the memory that was allocated by coap_malloc_type().
CoAP binary data definition with const data.
CoAP binary data definition.
size_t length
length of binary data
CoAP string data definition with const data.
const uint8_t * s
read-only string data
size_t length
length of string
CoAP string data definition.
size_t length
length of string