aboutsummaryrefslogtreecommitdiffstats
path: root/src/msgb.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2008-12-25 23:28:35 +0000
committerHarald Welte <laforge@gnumonks.org>2008-12-25 23:28:35 +0000
commit8470bf200de094ec362f3f7565ab3ccdf26ee664 (patch)
tree9a4d95be83b5f727f4ae4e3ab7b2cd4a6be7f72b /src/msgb.c
parentde729a139ecdb3b1d88cd5c50738749e8b1c9dcd (diff)
no reasonable commit message possible. tons of changes of the last 2 days
Diffstat (limited to 'src/msgb.c')
-rw-r--r--src/msgb.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/msgb.c b/src/msgb.c
index ab356de95..f5330c38b 100644
--- a/src/msgb.c
+++ b/src/msgb.c
@@ -22,7 +22,7 @@
#include <stdlib.h>
#include <sys/types.h>
-#include "msgb.h"
+#include <openbsc/msgb.h>
struct msgb *msgb_alloc(u_int16_t size)
{
@@ -38,7 +38,7 @@ struct msgb *msgb_alloc(u_int16_t size)
msg->head = msg->data;
msg->data = msg->data;
/* reset tail pointer */
- msg->tail = msg->data - msg->head;
+ msg->tail = msg->data;
//msg->end = msg->tail + size;
return msg;
@@ -48,3 +48,20 @@ void msgb_free(struct msgb *m)
{
free(m);
}
+
+void msgb_enqueue(struct llist_head *queue, struct msgb *msg)
+{
+ llist_add_tail(&msg->list, queue);
+}
+
+struct msgb *msgb_dequeue(struct llist_head *queue)
+{
+ struct llist_head *lh;
+
+ if (llist_empty(queue))
+ return NULL;
+
+ lh = queue->next;
+
+ return llist_entry(lh, struct msgb, list);
+}