mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-12-23 01:29:33 +00:00
Added functions for accessing the data and length of a queued buffer
This commit is contained in:
parent
a43c213ff2
commit
516f9316ab
@ -28,7 +28,7 @@
|
|||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* $Id: queuebuf.c,v 1.3 2007/03/15 09:56:39 adamdunkels Exp $
|
* $Id: queuebuf.c,v 1.4 2007/03/20 12:26:23 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -116,3 +116,23 @@ queuebuf_to_rimebuf(struct queuebuf *b)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
void *
|
||||||
|
queuebuf_dataptr(struct queuebuf *b)
|
||||||
|
{
|
||||||
|
struct queuebuf_ref *r;
|
||||||
|
|
||||||
|
if(memb_inmemb(&bufmem, b)) {
|
||||||
|
return b->data;
|
||||||
|
} else if(memb_inmemb(&refbufmem, b)) {
|
||||||
|
r = (struct queuebuf_ref *)b;
|
||||||
|
return r->ref;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
int
|
||||||
|
queuebuf_datalen(struct queuebuf *b)
|
||||||
|
{
|
||||||
|
return b->len;
|
||||||
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* $Id: queuebuf.h,v 1.1 2007/02/28 16:38:51 adamdunkels Exp $
|
* $Id: queuebuf.h,v 1.2 2007/03/20 12:26:23 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -52,4 +52,8 @@ void queuebuf_free(struct queuebuf *b);
|
|||||||
void queuebuf_from_rimebuf(struct queuebuf *b);
|
void queuebuf_from_rimebuf(struct queuebuf *b);
|
||||||
void queuebuf_to_rimebuf(struct queuebuf *b);
|
void queuebuf_to_rimebuf(struct queuebuf *b);
|
||||||
|
|
||||||
|
void *queuebuf_dataptr(struct queuebuf *b);
|
||||||
|
int queuebuf_datalen(struct queuebuf *b);
|
||||||
|
|
||||||
|
|
||||||
#endif /* __QUEUEBUF_H__ */
|
#endif /* __QUEUEBUF_H__ */
|
||||||
|
Loading…
Reference in New Issue
Block a user