From f3b7effbc169b9bdf91828c1557dcab06aaabb44 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Wed, 12 Jan 2011 11:20:32 +0100 Subject: m2ua: Add parsing and creation of m2ua packages --- include/m2ua/Makefile.am | 2 +- include/m2ua/m2ua_msg.h | 54 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 include/m2ua/m2ua_msg.h (limited to 'include') 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 + * + * 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 . + * + */ + + +#ifndef m2ua_msg_h +#define m2ua_msg_h + +#include "m2ua_types.h" + +#include + +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 -- cgit v1.2.3