libcoap  4.1.1
 All Data Structures Files Functions Variables Typedefs Macros Groups Pages
str.h
Go to the documentation of this file.
1 /* str.h -- strings to be used in the CoAP library
2  *
3  * Copyright (C) 2010,2011 Olaf Bergmann <bergmann@tzi.org>
4  *
5  * This file is part of the CoAP library libcoap. Please see
6  * README for terms of use.
7  */
8 
9 #ifndef _COAP_STR_H_
10 #define _COAP_STR_H_
11 
12 #include <string.h>
13 
14 typedef struct {
15  size_t length; /* length of string */
16  unsigned char *s; /* string data */
17 } str;
18 
19 #define COAP_SET_STR(st,l,v) { (st)->length = (l), (st)->s = (v); }
20 
25 str *coap_new_string(size_t size);
26 
28 void coap_delete_string(str *);
29 
30 #endif /* _COAP_STR_H_ */
str * coap_new_string(size_t size)
Returns a new string object with at least size bytes storage allocated.
Definition: str.c:17
size_t length
Definition: str.h:15
void coap_delete_string(str *)
Deletes the given string and releases any memory allocated.
Definition: str.c:31
Definition: str.h:14
unsigned char * s
Definition: str.h:16