pktqueue.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014, 2015 Martine Lenders <mlenders@inf.fu-berlin.de>
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser General
5  * Public License v2.1. See the file LICENSE in the top level directory for
6  * more details.
7  */
8 
21 #ifndef NET_GNRC_PKTQUEUE_H
22 #define NET_GNRC_PKTQUEUE_H
23 
24 #include <stdint.h>
25 #include <stdlib.h>
26 
27 #include "net/gnrc/pkt.h"
28 #include "utlist.h"
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
37 typedef struct gnrc_pktqueue {
38  struct gnrc_pktqueue *next;
41 
48 static inline void gnrc_pktqueue_add(gnrc_pktqueue_t **queue, gnrc_pktqueue_t *node)
49 {
50  LL_APPEND(*queue, node);
51 }
52 
62 {
63  if (node) {
64  LL_DELETE(*queue, node);
65  node->next = NULL;
66  }
67 
68  return node;
69 }
70 
79 {
80  return gnrc_pktqueue_remove(queue, *queue);
81 }
82 
83 #ifdef __cplusplus
84 }
85 #endif
86 
87 #endif /* NET_GNRC_PKTQUEUE_H */
88 
gnrc_pktqueue::next
struct gnrc_pktqueue * next
next node in queue
Definition: pktqueue.h:38
gnrc_pktqueue
data type for packet queue nodes
Definition: pktqueue.h:37
gnrc_pktqueue_remove
static gnrc_pktqueue_t * gnrc_pktqueue_remove(gnrc_pktqueue_t **queue, gnrc_pktqueue_t *node)
remove node from queue
Definition: pktqueue.h:61
pkt.h
General definitions for network packets and their helper functions.
gnrc_pktqueue_remove_head
static gnrc_pktqueue_t * gnrc_pktqueue_remove_head(gnrc_pktqueue_t **queue)
remove the packet queue's head
Definition: pktqueue.h:78
utlist.h
Macros for basic linked list operations.
gnrc_pktqueue::pkt
gnrc_pktsnip_t * pkt
pointer to the packet
Definition: pktqueue.h:39
gnrc_pktqueue_add
static void gnrc_pktqueue_add(gnrc_pktqueue_t **queue, gnrc_pktqueue_t *node)
add node into queue.
Definition: pktqueue.h:48
LL_APPEND
#define LL_APPEND(head, add)
LL append to append element 'add' to list.
Definition: utlist.h:368
LL_DELETE
#define LL_DELETE(head, del)
LL delete element 'del' from list.
Definition: utlist.h:386
gnrc_pktsnip
Type to represent parts (either headers or payload) of a packet, called snips.
Definition: pkt.h:108
gnrc_pktqueue_t
struct gnrc_pktqueue gnrc_pktqueue_t
data type for packet queue nodes