aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2011-01-12 11:20:32 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2011-01-12 12:50:09 +0100
commitf3b7effbc169b9bdf91828c1557dcab06aaabb44 (patch)
tree0dd3df9342ce6394f9a989e5962bca34dd91d105 /include
parentb8962797a5bdbfbf69c294db455654edde8d0e70 (diff)
m2ua: Add parsing and creation of m2ua packages
Diffstat (limited to 'include')
-rw-r--r--include/m2ua/Makefile.am2
-rw-r--r--include/m2ua/m2ua_msg.h54
2 files changed, 55 insertions, 1 deletions
diff --git a/include/m2ua/Makefile.am b/include/m2ua/Makefile.am
index f52d610..d740a6c 100644
--- a/include/m2ua/Makefile.am
+++ b/include/m2ua/Makefile.am
@@ -1,2 +1,2 @@
-m2ua_HEADERS = m2ua_types.h
+m2ua_HEADERS = m2ua_types.h m2ua_msg.h
m2uadir = $(includedir)/osmocom/m2ua
diff --git a/include/m2ua/m2ua_msg.h b/include/m2ua/m2ua_msg.h
new file mode 100644
index 0000000..49fe8cc
--- /dev/null
+++ b/include/m2ua/m2ua_msg.h
@@ -0,0 +1,54 @@
+/* Routines for generating and parsing messages */
+/* (C) 2011 by Holger Hans Peter Freyther <zecke@selfish.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef m2ua_msg_h
+#define m2ua_msg_h
+
+#include "m2ua_types.h"
+
+#include <osmocore/linuxlist.h>
+
+struct msgb;
+
+struct m2ua_msg {
+ struct m2ua_common_hdr hdr;
+
+ struct llist_head headers;
+};
+
+struct m2ua_msg_part {
+ struct llist_head entry;
+
+ uint16_t tag;
+ uint16_t len;
+ uint8_t *dat;
+
+ /* TODO: keep small data in the struct for perf reasons */
+};
+
+
+struct m2ua_msg *m2ua_msg_alloc(void);
+void m2ua_msg_free(struct m2ua_msg *msg);
+
+int m2ua_msg_add_data(struct m2ua_msg *msg, uint16_t tag, uint16_t len, uint8_t *dat);
+
+struct m2ua_msg *m2ua_from_msg(uint16_t len, uint8_t *data);
+struct msgb *m2ua_to_msg(struct m2ua_msg *msg);
+
+#endif