net: buf: Add net_buf_simple_init_with_data

This adds net_bug_simple_init_with_data which can be used to initialize
a net_buf_simple pointer with an external data pointer.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This commit is contained in:
Luiz Augusto von Dentz 2019-11-10 17:07:20 +02:00 committed by Johan Hedberg
commit 53784479b3
2 changed files with 22 additions and 4 deletions

View file

@ -140,6 +140,18 @@ static inline void net_buf_simple_init(struct net_buf_simple *buf,
buf->len = 0U;
}
/**
* @brief Initialize a net_buf_simple object with data.
*
* Initialized buffer object with external data.
*
* @param buf Buffer to initialize.
* @param data External data pointer
* @param size Amount of data the pointed data buffer if able to fit.
*/
void net_buf_simple_init_with_data(struct net_buf_simple *buf,
void *data, size_t size);
/**
* @brief Reset buffer
*