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
31extern "C" {
32#endif
33
37typedef struct gnrc_pktqueue {
41
48static 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 */
static void gnrc_pktqueue_add(gnrc_pktqueue_t **queue, gnrc_pktqueue_t *node)
add node into queue.
Definition: pktqueue.h:48
static gnrc_pktqueue_t * gnrc_pktqueue_remove_head(gnrc_pktqueue_t **queue)
remove the packet queue's head
Definition: pktqueue.h:78
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 gnrc_pktqueue_t
data type for packet queue nodes
#define LL_DELETE(head, del)
LL delete element 'del' from list.
Definition: utlist.h:386
#define LL_APPEND(head, add)
LL append to append element 'add' to list.
Definition: utlist.h:368
General definitions for network packets and their helper functions.
data type for packet queue nodes
Definition: pktqueue.h:37
struct gnrc_pktqueue * next
next node in queue
Definition: pktqueue.h:38
gnrc_pktsnip_t * pkt
pointer to the packet
Definition: pktqueue.h:39
Type to represent parts (either headers or payload) of a packet, called snips.
Definition: pkt.h:108
Macros for basic linked list operations.