/* (C) 2008 by Harald Welte <laforge@gnumonks.org>
+ * (C) 2010 by Holger Hans Peter Freyther <zecke@selfish.org>
* All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
-#include <sys/types.h>
-#include <osmocore/msgb.h>
+#include <osmocom/core/msgb.h>
//#include <openbsc/gsm_data.h>
-#include <osmocore/talloc.h>
+#include <osmocom/core/talloc.h>
//#include <openbsc/debug.h>
void *tall_msgb_ctx;
msg->data_len = size;
msg->len = 0;
msg->data = msg->_data;
-
- msg->head = msg->data;
- msg->data = msg->data;
- /* reset tail pointer */
- msg->tail = msg->data;
- //msg->end = msg->tail + size;
+ msg->head = msg->_data;
+ msg->tail = msg->_data;
return msg;
}
void msgb_reset(struct msgb *msg)
{
- msg->len = 0;
msg->len = 0;
msg->data = msg->_data;
+ msg->head = msg->_data;
+ msg->tail = msg->_data;
- msg->head = msg->data;
- msg->data = msg->data;
- /* reset tail pointer */
- msg->tail = msg->data;
-
- /* reset pointers */
- msg->bts_link = NULL;
msg->trx = NULL;
msg->lchan = NULL;
msg->l2h = NULL;
msg->l3h = NULL;
- msg->smsh = NULL;
+ msg->l4h = NULL;
+
+ memset(&msg->cb, 0, sizeof(msg->cb));
+}
+
+uint8_t *msgb_data(const struct msgb *msg)
+{
+ return msg->data;
+}
+
+uint16_t msgb_length(const struct msgb *msg)
+{
+ return msg->len;
+}
+
+void msgb_set_talloc_ctx(void *ctx)
+{
+ tall_msgb_ctx = ctx;
}