The friendly Operating System for the Internet of Things
priority_pktqueue.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 Daniel Krebs
3  * 2016 INRIA
4  *
5  * This file is subject to the terms and conditions of the GNU Lesser
6  * General Public License v2.1. See the file LICENSE in the top level
7  * directory for more details.
8  */
9 
23 #ifndef GNRC_PRIORITY_PKTQUEUE_H
24 #define GNRC_PRIORITY_PKTQUEUE_H
25 
26 #include <stdint.h>
27 #include <priority_queue.h>
28 #include <net/gnrc/pkt.h>
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
39  uint32_t priority;
42 
47 
51 #define PRIORITY_PKTQUEUE_NODE_INIT(priority, pkt) { NULL, priority, pkt }
52 
56 #define PRIORITY_PKTQUEUE_INIT { NULL }
57 
69  uint32_t priority,
71 {
72  node->next = NULL;
73  node->priority = priority;
74  node->pkt = pkt;
75 }
76 
83 static inline void gnrc_priority_pktqueue_init(gnrc_priority_pktqueue_t *queue)
84 {
85  gnrc_priority_pktqueue_t qn = PRIORITY_PKTQUEUE_INIT;
86  *queue = qn;
87 }
88 
96 uint32_t gnrc_priority_pktqueue_length(gnrc_priority_pktqueue_t *queue);
97 
103 void gnrc_priority_pktqueue_flush(gnrc_priority_pktqueue_t* queue);
104 
112 gnrc_pktsnip_t* gnrc_priority_pktqueue_pop(gnrc_priority_pktqueue_t* queue);
113 
121 gnrc_pktsnip_t* gnrc_priority_pktqueue_head(gnrc_priority_pktqueue_t* queue);
122 
129 void gnrc_priority_pktqueue_push(gnrc_priority_pktqueue_t* queue,
131 
132 #ifdef __cplusplus
133 }
134 #endif
135 
136 #endif /* GNRC_PRIORITY_PKTQUEUE_H */
137 
void gnrc_priority_pktqueue_flush(gnrc_priority_pktqueue_t *queue)
flush the gnrc priority packet queue
data type for priority queues
General definitions for network packets and their helper functions.
static void gnrc_priority_pktqueue_node_init(gnrc_priority_pktqueue_node_t *node, uint32_t priority, gnrc_pktsnip_t *pkt)
Initialize a gnrc priority packet queue node object.
void gnrc_priority_pktqueue_push(gnrc_priority_pktqueue_t *queue, gnrc_priority_pktqueue_node_t *node)
add node into queue based on its priority
A simple priority queue.
static void gnrc_priority_pktqueue_init(gnrc_priority_pktqueue_t *queue)
Initialize a gnrc priority packet queue object.
uint32_t priority
queue node priority
struct gnrc_priority_pktqueue_node gnrc_priority_pktqueue_node_t
data type for gnrc priority packet queue nodes
gnrc_pktsnip_t * gnrc_priority_pktqueue_pop(gnrc_priority_pktqueue_t *queue)
Get first element and remove it from queue.
#define PRIORITY_PKTQUEUE_INIT
Static initializer for gnrc_priority_pktqueue_t.
Type to represent parts (either headers or payload) of a packet, called snips.
uint32_t gnrc_priority_pktqueue_length(gnrc_priority_pktqueue_t *queue)
Get the length information of a gnrc priority packet queue object.
priority_queue_t gnrc_priority_pktqueue_t
data type for gnrc priority packet queues
data type for gnrc priority packet queue nodes
struct gnrc_priority_pktqueue_node * next
next queue node
gnrc_pktsnip_t * gnrc_priority_pktqueue_head(gnrc_priority_pktqueue_t *queue)
Get first element from queue without removing.
gnrc_pktsnip_t * pkt
queue node data