Added function for obtaining packet queue length

This commit is contained in:
adamdunkels 2010-02-28 09:20:32 +00:00
parent 8fe15f7b45
commit f95a6cce85
2 changed files with 19 additions and 2 deletions

View file

@ -32,7 +32,7 @@
*
* This file is part of the Contiki operating system.
*
* $Id: packetqueue.c,v 1.1 2009/04/29 20:47:30 adamdunkels Exp $
* $Id: packetqueue.c,v 1.2 2010/02/28 09:20:32 adamdunkels Exp $
*/
/**
@ -123,6 +123,12 @@ packetqueue_dequeue(struct packetqueue *q)
}
}
/*---------------------------------------------------------------------------*/
int
packetqueue_len(struct packetqueue *q)
{
return list_length(*q->list);
}
/*---------------------------------------------------------------------------*/
struct queuebuf *
packetqueue_queuebuf(struct packetqueue_item *i)
{

View file

@ -41,7 +41,7 @@
*
* This file is part of the Contiki operating system.
*
* $Id: packetqueue.h,v 1.3 2009/05/26 13:58:53 nvt-se Exp $
* $Id: packetqueue.h,v 1.4 2010/02/28 09:20:32 adamdunkels Exp $
*/
/**
@ -177,6 +177,17 @@ struct packetqueue_item *packetqueue_first(struct packetqueue *q);
*/
void packetqueue_dequeue(struct packetqueue *q);
/**
* \brief Get the length of the packet queue
* \param q A pointer to a struct packetqueue.
* \return The number of packets queued on the packet queue
*
* This function returns the number of packets that are
* queued on the packet queue.
*
*/
int packetqueue_len(struct packetqueue *q);
/**
* @}
*/