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 
9 #pragma once
10 
23 #include <stdint.h>
24 #include <stdlib.h>
25 
26 #include "net/gnrc/pkt.h"
27 #include "utlist.h"
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
36 typedef struct gnrc_pktqueue {
37  struct gnrc_pktqueue *next;
40 
47 static inline void gnrc_pktqueue_add(gnrc_pktqueue_t **queue, gnrc_pktqueue_t *node)
48 {
49  LL_APPEND(*queue, node);
50 }
51 
61 {
62  if (node) {
63  LL_DELETE(*queue, node);
64  node->next = NULL;
65  }
66 
67  return node;
68 }
69 
78 {
79  return gnrc_pktqueue_remove(queue, *queue);
80 }
81 
82 #ifdef __cplusplus
83 }
84 #endif
85 
static void gnrc_pktqueue_add(gnrc_pktqueue_t **queue, gnrc_pktqueue_t *node)
add node into queue.
Definition: pktqueue.h:47
static gnrc_pktqueue_t * gnrc_pktqueue_remove_head(gnrc_pktqueue_t **queue)
remove the packet queue's head
Definition: pktqueue.h:77
static gnrc_pktqueue_t * gnrc_pktqueue_remove(gnrc_pktqueue_t **queue, gnrc_pktqueue_t *node)
remove node from queue
Definition: pktqueue.h:60
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:385
#define LL_APPEND(head, add)
LL append to append element 'add' to list.
Definition: utlist.h:367
General definitions for network packets and their helper functions.
data type for packet queue nodes
Definition: pktqueue.h:36
struct gnrc_pktqueue * next
next node in queue
Definition: pktqueue.h:37
gnrc_pktsnip_t * pkt
pointer to the packet
Definition: pktqueue.h:38
Type to represent parts (either headers or payload) of a packet, called snips.
Definition: pkt.h:108
Macros for basic linked list operations.