The friendly Operating System for the Internet of Things
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 GNRC_PKTQUEUE_H
22 #define 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 /* GNRC_PKTQUEUE_H */
88 
static void gnrc_pktqueue_add(gnrc_pktqueue_t **queue, gnrc_pktqueue_t *node)
add node into queue.
Definition: pktqueue.h:48
struct gnrc_pktqueue gnrc_pktqueue_t
data type for packet queue nodes
General definitions for network packets and their helper functions.
Macros for basic linked list operations.
static gnrc_pktqueue_t * gnrc_pktqueue_remove(gnrc_pktqueue_t **queue, gnrc_pktqueue_t *node)
remove node from queue
Definition: pktqueue.h:61
struct gnrc_pktqueue * next
next node in queue
Definition: pktqueue.h:38
data type for packet queue nodes
Definition: pktqueue.h:37
gnrc_pktsnip_t * pkt
pointer to the packet
Definition: pktqueue.h:39
#define LL_APPEND(head, add)
LL append to append element 'add' to list.
Definition: utlist.h:368
#define LL_DELETE(head, del)
LL delete element 'del' from list.
Definition: utlist.h:386
Type to represent parts (either headers or payload) of a packet, called snips.
static gnrc_pktqueue_t * gnrc_pktqueue_remove_head(gnrc_pktqueue_t **queue)
remove the packet queue's head
Definition: pktqueue.h:78
stdlib.h wrapper for MSP430