Priority packet queue for GNRC

Wrapper for priority_queue that holds gnrc_pktsnip_t*.

struct gnrc_priority_pktqueue_node gnrc_priority_pktqueue_node_t

data type for gnrc priority packet queue nodes

priority_queue_t gnrc_priority_pktqueue_t

data type for gnrc priority packet queues

void gnrc_priority_pktqueue_node_init(priority_pktqueue.h::gnrc_priority_pktqueue_node_t * node, uint32_t priority, include/net/gnrc/pkt.h::gnrc_pktsnip_t * pkt)

Initialize a gnrc priority packet queue node object.

Parameters

node:pre-allocated gnrc_priority_pktqueue_node_t object. Must not be NULL.
priority:the priority of the gnrc packet snip
pkt:the gnrc packet snip

void gnrc_priority_pktqueue_init(priority_pktqueue.h::gnrc_priority_pktqueue_t * queue)

Initialize a gnrc priority packet queue object.

Parameters

queue:pre-allocated gnrc_priority_pktqueue_t object. Must not be NULL.

uint32_t gnrc_priority_pktqueue_length(priority_pktqueue.h::gnrc_priority_pktqueue_t * queue)

Get the length information of a gnrc priority packet queue object.

Parameters

queue:pre-allocated gnrc_priority_pktqueue_t object. Must not be NULL.

Return values

  • the length of queue
void gnrc_priority_pktqueue_flush(priority_pktqueue.h::gnrc_priority_pktqueue_t * queue)

flush the gnrc priority packet queue

Parameters

queue:the gnrc priority packet queue. Must not be NULL

include/net/gnrc/pkt.h::gnrc_pktsnip_t * gnrc_priority_pktqueue_pop(priority_pktqueue.h::gnrc_priority_pktqueue_t * queue)

Get first element and remove it from queue.

Parameters

queue:the gnrc priority packet queue. Must not be NULL

Return values

  • the old head
include/net/gnrc/pkt.h::gnrc_pktsnip_t * gnrc_priority_pktqueue_head(priority_pktqueue.h::gnrc_priority_pktqueue_t * queue)

Get first element from queue without removing.

Parameters

queue:the gnrc priority packet queue. Must not be NULL

Return values

  • the head of queue
void gnrc_priority_pktqueue_push(priority_pktqueue.h::gnrc_priority_pktqueue_t * queue, priority_pktqueue.h::gnrc_priority_pktqueue_node_t * node)

add node into queue based on its priority

Parameters

queue:the gnrc priority packet queue. Must not be NULL
node:the node to add.

PRIORITY_PKTQUEUE_NODE_INIT( priority, pkt)

Static initializer for gnrc_priority_pktqueue_node_t.

1
{ NULL, priority, pkt }
PRIORITY_PKTQUEUE_INIT

Static initializer for gnrc_priority_pktqueue_t.

1
{ NULL }
struct gnrc_priority_pktqueue_node

data type for gnrc priority packet queue nodes

struct gnrc_priority_pktqueue_node * next

next queue node

uint32_t priority

queue node priority

include/net/gnrc/pkt.h::gnrc_pktsnip_t * pkt

queue node data