pub unsafe extern "C" fn gnrc_pktbuf_mark(
pkt: *mut gnrc_pktsnip_t,
size: size_t,
type_: gnrc_nettype_t,
) -> *mut gnrc_pktsnip_t
Expand description
@brief Marks the first @p size bytes in a received packet with a new packet snip that is appended to the packet.
Graphically this can be represented as follows:
Before After
====== =====
(next)
pkt->data result->data <== pkt->data
v v v
+--------------------------------+ +----------------+---------------+
+--------------------------------+ +----------------+---------------+
\__________pkt->size___________/ \_result->size_/ \__pkt->size__/
If size == pkt->size
then the resulting snip will point to NULL in its
gnrc_pktsnip_t::data field and its gnrc_pktsnip_t::size field will be 0.
@pre @p pkt != NULL && @p size != 0
@param[in] pkt A received packet. @param[in] size The size of the new packet snip. @param[in] type The type of the new packet snip.
@note It’s not guaranteed that result->data
points to the same address
as the original pkt->data
.
@return The new packet snip in @p pkt on success. @return NULL, if pkt == NULL or size == 0 or size > pkt->size or pkt->data == NULL. @return NULL, if no space is left in the packet buffer.