pktqueue.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2014-2015 Martine Lenders <mlenders@inf.fu-berlin.de>
3  * SPDX-License-Identifier: LGPL-2.1-only
4  */
5 
6 #pragma once
7 
20 #include <stdint.h>
21 #include <stdlib.h>
22 
23 #include "net/gnrc/pkt.h"
24 #include "utlist.h"
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
33 typedef struct gnrc_pktqueue {
34  struct gnrc_pktqueue *next;
37 
44 static inline void gnrc_pktqueue_add(gnrc_pktqueue_t **queue, gnrc_pktqueue_t *node)
45 {
46  LL_APPEND(*queue, node);
47 }
48 
58 {
59  if (node) {
60  LL_DELETE(*queue, node);
61  node->next = NULL;
62  }
63 
64  return node;
65 }
66 
75 {
76  return gnrc_pktqueue_remove(queue, *queue);
77 }
78 
79 #ifdef __cplusplus
80 }
81 #endif
82 
static void gnrc_pktqueue_add(gnrc_pktqueue_t **queue, gnrc_pktqueue_t *node)
add node into queue.
Definition: pktqueue.h:44
static gnrc_pktqueue_t * gnrc_pktqueue_remove_head(gnrc_pktqueue_t **queue)
remove the packet queue's head
Definition: pktqueue.h:74
static gnrc_pktqueue_t * gnrc_pktqueue_remove(gnrc_pktqueue_t **queue, gnrc_pktqueue_t *node)
remove node from queue
Definition: pktqueue.h:57
struct gnrc_pktqueue gnrc_pktqueue_t
data type for packet queue nodes
#define LL_DELETE(head, del)
LL delete element 'del' from list.
Definition: utlist.h:367
#define LL_APPEND(head, add)
LL append to append element 'add' to list.
Definition: utlist.h:349
General definitions for network packets and their helper functions.
data type for packet queue nodes
Definition: pktqueue.h:33
struct gnrc_pktqueue * next
next node in queue
Definition: pktqueue.h:34
gnrc_pktsnip_t * pkt
pointer to the packet
Definition: pktqueue.h:35
Type to represent parts (either headers or payload) of a packet, called snips.
Definition: pkt.h:105
Macros for basic linked list operations.