Function riot_sys::gnrc_pktbuf_add

source ·
pub unsafe extern "C" fn gnrc_pktbuf_add(
    next: *mut gnrc_pktsnip_t,
    data: *const c_void,
    size: size_t,
    type_: gnrc_nettype_t
) -> *mut gnrc_pktsnip_t
Expand description

@brief Adds a new gnrc_pktsnip_t and its packet to the packet buffer.

@warning Do not change the fields of the gnrc_pktsnip_t created by this function externally. This will most likely create memory leaks or not allowed memory access.

@pre size < CONFIG_GNRC_PKTBUF_SIZE

@param[in] next Next gnrc_pktsnip_t in the packet. Leave NULL if you want to create a new packet. @param[in] data Data of the new gnrc_pktsnip_t. If @p data is NULL no data will be inserted into result. @param[in] size Length of @p data. If this value is 0 the gnrc_pktsnip::data field of the newly created snip will be NULL. @param[in] type Protocol type of the gnrc_pktsnip_t.

@return Pointer to the packet part that represents the new gnrc_pktsnip_t. @return NULL, if no space is left in the packet buffer.