18 if (size >= MEMP_LEN_COAPSTRING) {
20 "coap_new_string: size too large (%zu +1 > MEMP_LEN_COAPSTRING)\n",
48 memcpy (s->
s, data, size);
62 var[ofs].
length = strlen(
string);
63 var[ofs].
s = (
const uint8_t *)
string;
72 #if defined(RIOT_VERSION) || defined(WITH_CONTIKI) || defined(WITH_LWIP)
76 memcpy(new->s, s->
s, s->
length);
99 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
coap_string_t * coap_new_string(size_t size)
Returns a new string object with at least size+1 bytes storage allocated.
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.
void coap_delete_binary(coap_binary_t *s)
Deletes the given coap_binary_t object and releases any memory allocated.
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_new_binary(size_t size)
Returns a new binary object with at least size bytes storage allocated.
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...
struct coap_string_t coap_string_t
CoAP string data definition.
void coap_delete_string(coap_string_t *s)
Deletes the given string and releases any memory allocated.
coap_binary_t * coap_resize_binary(coap_binary_t *s, size_t size)
Resizes the given coap_binary_t object.
coap_str_const_t * coap_make_str_const(const char *string)
Take the specified byte array (text) and create a coap_str_const_t *.
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_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_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