pdu.[hc]: Export coap_pdu_resize()

This commit is contained in:
Olaf Bergmann committed 2017-12-22 13:55:37 +01:00
1 parent 8ee4bb2586
commit d3b5535960
2 files changed
+13 -1

No files matched your search

+11
View File
@@ -343,6 +343,17 @@ typedef uint8_t coap_proto_t;
coap_pdu_t *
coap_pdu_init(uint8_t type, uint8_t code, uint16_t tid, size_t size);
/**
* Dynamically grows the size of @p pdu to @p new_size. The new size
* must not exceed the PDU's configure maximum size. On success, this
* function returns 1, otherwise 0.
*
* @param pdu The PDU to resize.
* @param new_size The new size in bytes.
* @return 1 if the operation succeeded, 0 otherwise.
*/
int coap_pdu_resize(coap_pdu_t *pdu, size_t new_size);
/**
* Clears any contents from @p pdu and resets @c used_size,
* and @c data pointers. @c max_size is set to @p size, any
+2 -1
View File
@@ -150,7 +150,8 @@ coap_delete_pdu(coap_pdu_t *pdu) {
}
}
static int coap_pdu_resize(coap_pdu_t *pdu, size_t new_size) {
int
coap_pdu_resize(coap_pdu_t *pdu, size_t new_size) {
if (new_size > pdu->alloc_size) {
uint8_t *new_hdr;
size_t offset;