priority_pktqueue.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2015 Daniel Krebs
3  * SPDX-FileCopyrightText: 2016 INRIA
4  * SPDX-License-Identifier: LGPL-2.1-only
5  */
6 
7 #pragma once
8 
22 #include <stdint.h>
23 
24 #include "priority_queue.h"
25 #include "net/gnrc/pkt.h"
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
36  uint32_t priority;
39 
44 
48 #define PRIORITY_PKTQUEUE_NODE_INIT(priority, pkt) { NULL, priority, pkt }
49 
53 #define PRIORITY_PKTQUEUE_INIT { NULL }
54 
66  uint32_t priority,
68 {
69  node->next = NULL;
70  node->priority = priority;
71  node->pkt = pkt;
72 }
73 
81 {
83 
84  *queue = qn;
85 }
86 
95 
102 
111 
120 
129 
130 #ifdef __cplusplus
131 }
132 #endif
133 
priority_queue_t gnrc_priority_pktqueue_t
data type for gnrc priority packet queues
struct gnrc_priority_pktqueue_node gnrc_priority_pktqueue_node_t
data type for gnrc priority packet queue nodes
uint32_t gnrc_priority_pktqueue_length(gnrc_priority_pktqueue_t *queue)
Get the length information of a gnrc priority packet queue object.
void gnrc_priority_pktqueue_flush(gnrc_priority_pktqueue_t *queue)
flush the gnrc priority packet queue
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.
#define PRIORITY_PKTQUEUE_INIT
Static initializer for gnrc_priority_pktqueue_t.
static void gnrc_priority_pktqueue_init(gnrc_priority_pktqueue_t *queue)
Initialize a gnrc priority packet queue object.
gnrc_pktsnip_t * gnrc_priority_pktqueue_pop(gnrc_priority_pktqueue_t *queue)
Get first element and remove it from queue.
void gnrc_priority_pktqueue_push(gnrc_priority_pktqueue_t *queue, gnrc_priority_pktqueue_node_t *node)
add node into queue based on its priority
gnrc_pktsnip_t * gnrc_priority_pktqueue_head(gnrc_priority_pktqueue_t *queue)
Get first element from queue without removing.
General definitions for network packets and their helper functions.
A simple priority queue.
Type to represent parts (either headers or payload) of a packet, called snips.
Definition: pkt.h:105
data type for gnrc priority packet queue nodes
uint32_t priority
queue node priority
gnrc_pktsnip_t * pkt
queue node data
struct gnrc_priority_pktqueue_node * next
next queue node
data type for priority queues