net: ip: net_pkt: Implement net_pkt_shallow_clone
This commit implements net_pkt_shallow_clone. A shallow clone clones the net_pkt but not the buffers. The buffers are only referenced and therefor only freed when both copies of the net_pkt are freed. Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
This commit is contained in:
parent
7fe85170fc
commit
95863a73da
2 changed files with 76 additions and 22 deletions
|
@ -1553,6 +1553,16 @@ int net_pkt_copy(struct net_pkt *pkt_dst,
|
|||
*/
|
||||
struct net_pkt *net_pkt_clone(struct net_pkt *pkt, s32_t timeout);
|
||||
|
||||
/**
|
||||
* @brief Clone pkt and increase the refcount of its buffer.
|
||||
*
|
||||
* @param pkt Original pkt to be shallow cloned
|
||||
* @param timeout Timeout to wait for free packet
|
||||
*
|
||||
* @return NULL if error, cloned packet otherwise.
|
||||
*/
|
||||
struct net_pkt *net_pkt_shallow_clone(struct net_pkt *pkt, s32_t timeout);
|
||||
|
||||
/**
|
||||
* @brief Read some data from a net_pkt
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue