aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/Makefile.am5
-rw-r--r--src/bts.h4
-rw-r--r--src/csn1.h15
-rw-r--r--src/decoding.h5
-rw-r--r--src/encoding.h2
-rw-r--r--src/gprs_rlcmac.h2
-rw-r--r--src/gsm_rlcmac.c (renamed from src/gsm_rlcmac.cpp)7
-rw-r--r--src/gsm_rlcmac.h8
-rw-r--r--src/pdch.cpp3
-rw-r--r--src/pdch.h2
-rw-r--r--src/tbf.cpp3
-rw-r--r--src/wireshark_compat.h38
-rw-r--r--tests/rlcmac/RLCMACTest.cpp4
13 files changed, 62 insertions, 36 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index eb1e3894..54c6f1b1 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -41,7 +41,7 @@ noinst_LTLIBRARIES = libgprs.la
libgprs_la_SOURCES = \
gprs_debug.cpp \
csn1.c \
- gsm_rlcmac.cpp \
+ gsm_rlcmac.c \
gprs_bssgp_pcu.cpp \
gprs_rlcmac.cpp \
gprs_rlcmac_sched.cpp \
@@ -106,7 +106,8 @@ noinst_HEADERS = \
gprs_codel.h \
gprs_coding_scheme.h \
coding_scheme.h \
- egprs_rlc_compression.h
+ egprs_rlc_compression.h \
+ wireshark_compat.h
osmo_pcu_SOURCES = pcu_main.cpp
diff --git a/src/bts.h b/src/bts.h
index 823138bb..4fddc0bb 100644
--- a/src/bts.h
+++ b/src/bts.h
@@ -29,10 +29,10 @@ extern "C" {
#include <osmocom/core/tdef.h>
#include <osmocom/gsm/l1sap.h>
#include <osmocom/gsm/protocol/gsm_04_08.h>
- #include <mslot_class.h>
+#include "mslot_class.h"
+#include "gsm_rlcmac.h"
}
-#include <gsm_rlcmac.h>
#include "poll_controller.h"
#include "sba.h"
#include "tbf.h"
diff --git a/src/csn1.h b/src/csn1.h
index 50cd9ef6..a637d575 100644
--- a/src/csn1.h
+++ b/src/csn1.h
@@ -29,9 +29,7 @@
#define _PACKET_CSN1_H_
#include <osmocom/core/bitvec.h>
-
-#define MIN(a,b) (((a)<(b))?(a):(b))
-//#define max(a,b) (((a)>(b))?(a):(b))
+#include "wireshark_compat.h"
/* Error codes */
#define CSN_OK 0
@@ -46,17 +44,6 @@
#define CSN_ERROR_MESSAGE_TOO_LONG -9
#define CSN_ERROR_ -10
-#define FALSE (0)
-#define TRUE (1)
-typedef signed int gint32;
-typedef signed short gint16;
-typedef int gint;
-typedef unsigned int guint;
-typedef gint gboolean;
-typedef unsigned char guint8;
-typedef unsigned short guint16;
-typedef unsigned int guint32;
-typedef unsigned long guint64;
/* CallBack return status */
typedef gint16 CSN_CallBackStatus_t;
diff --git a/src/decoding.h b/src/decoding.h
index d1371d53..cadb80ce 100644
--- a/src/decoding.h
+++ b/src/decoding.h
@@ -19,7 +19,10 @@
*/
#pragma once
-#include <gsm_rlcmac.h>
+extern "C" {
+#include "gsm_rlcmac.h"
+}
+
#include "rlc.h"
#include <stdint.h>
diff --git a/src/encoding.h b/src/encoding.h
index 31f74d13..2365f078 100644
--- a/src/encoding.h
+++ b/src/encoding.h
@@ -21,10 +21,10 @@
#pragma once
#include <stdint.h>
-#include <gsm_rlcmac.h>
#include <gprs_coding_scheme.h>
extern "C" {
#include <osmocom/gsm/l1sap.h>
+#include "gsm_rlcmac.h"
}
struct gprs_rlcmac_tbf;
diff --git a/src/gprs_rlcmac.h b/src/gprs_rlcmac.h
index 6d871078..789b8dbd 100644
--- a/src/gprs_rlcmac.h
+++ b/src/gprs_rlcmac.h
@@ -24,7 +24,6 @@
#include <stdbool.h>
#ifdef __cplusplus
-#include <gsm_rlcmac.h>
#include <gsm_timer.h>
#include <pcu_l1_if.h>
@@ -33,6 +32,7 @@ extern "C" {
#include <osmocom/core/timer.h>
#include <osmocom/core/bitvec.h>
#include <osmocom/pcu/pcuif_proto.h>
+#include "gsm_rlcmac.h"
}
#endif
diff --git a/src/gsm_rlcmac.cpp b/src/gsm_rlcmac.c
index 5db8bbd2..5a6634c6 100644
--- a/src/gsm_rlcmac.cpp
+++ b/src/gsm_rlcmac.c
@@ -29,18 +29,15 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-extern "C" {
#include <osmocom/core/utils.h>
-}
+#include <osmocom/core/bitvec.h>
#include "gsm_rlcmac.h"
+#include "csn1.h"
/* Initialize the protocol and registered fields
*/
-#include <iostream>
-#include <cstdlib>
#include <assert.h>
#include <gprs_debug.h>
-using namespace std;
/* Payload type as defined in TS 44.060 / 10.4.7 */
#define PAYLOAD_TYPE_DATA 0
diff --git a/src/gsm_rlcmac.h b/src/gsm_rlcmac.h
index 1a448e48..48abac09 100644
--- a/src/gsm_rlcmac.h
+++ b/src/gsm_rlcmac.h
@@ -32,12 +32,8 @@
#ifndef __PACKET_GSM_RLCMAC_H__
#define __PACKET_GSM_RLCMAC_H__
-extern "C" {
-#include "csn1.h"
-}
-
-#include <iostream>
-#include <cstdlib>
+#include <osmocom/core/bitvec.h>
+#include "wireshark_compat.h"
#ifndef PRE_PACKED
#define PRE_PACKED
diff --git a/src/pdch.cpp b/src/pdch.cpp
index 9b4d89ba..f46acc87 100644
--- a/src/pdch.cpp
+++ b/src/pdch.cpp
@@ -34,7 +34,6 @@
#include <tbf.h>
#include <tbf_ul.h>
#include <cxx_linuxlist.h>
-#include <gsm_rlcmac.h>
extern "C" {
#include <osmocom/core/talloc.h>
@@ -45,7 +44,9 @@ extern "C" {
#include <osmocom/core/gsmtap.h>
#include <osmocom/core/logging.h>
#include <osmocom/core/utils.h>
+
#include "coding_scheme.h"
+#include "gsm_rlcmac.h"
}
#include <errno.h>
diff --git a/src/pdch.h b/src/pdch.h
index 821fb901..97b4b236 100644
--- a/src/pdch.h
+++ b/src/pdch.h
@@ -24,9 +24,9 @@
#ifdef __cplusplus
extern "C" {
#include <osmocom/core/linuxlist.h>
+#include "gsm_rlcmac.h"
}
-#include <gsm_rlcmac.h>
#include <gprs_coding_scheme.h>
#include <bts.h>
#endif
diff --git a/src/tbf.cpp b/src/tbf.cpp
index 9cba354a..73d7ea92 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -32,7 +32,6 @@
#include <gprs_ms.h>
#include <pcu_utils.h>
#include <gprs_ms_storage.h>
-#include <gsm_rlcmac.h>
#include <sba.h>
#include <gprs_coding_scheme.h>
#include <gsm_timer.h>
@@ -48,6 +47,8 @@ extern "C" {
#include <osmocom/core/bitvec.h>
#include <osmocom/core/rate_ctr.h>
#include <osmocom/gsm/protocol/gsm_04_08.h>
+
+#include "gsm_rlcmac.h"
}
#include <errno.h>
diff --git a/src/wireshark_compat.h b/src/wireshark_compat.h
new file mode 100644
index 00000000..13b165a0
--- /dev/null
+++ b/src/wireshark_compat.h
@@ -0,0 +1,38 @@
+/* wireshark_compat.h
+ * Copyright (C) 2020 by sysmocom - s.f.m.c. GmbH <info@sysmocom.de>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+/* This header contains a few definitions required by rlcmac and csn1 files
+ * originally imported from wireshark packet-gsm_rlcmac.* and package-csn1.*,
+ * in order to keep code as similar as possible to ease maintainability and port
+ * of patches.
+*/
+#pragma once
+
+#define MIN(a,b) (((a)<(b))?(a):(b))
+
+#define FALSE (0)
+#define TRUE (1)
+typedef signed int gint32;
+typedef signed short gint16;
+typedef int gint;
+typedef unsigned int guint;
+typedef gint gboolean;
+typedef unsigned char guint8;
+typedef unsigned short guint16;
+typedef unsigned int guint32;
+typedef unsigned long guint64;
diff --git a/tests/rlcmac/RLCMACTest.cpp b/tests/rlcmac/RLCMACTest.cpp
index a21c22de..0215cc8d 100644
--- a/tests/rlcmac/RLCMACTest.cpp
+++ b/tests/rlcmac/RLCMACTest.cpp
@@ -24,7 +24,6 @@
#include <cstdlib>
#include <cstring>
#include <assert.h>
-#include "gsm_rlcmac.h"
#include "gprs_rlcmac.h"
#include "decoding.h"
@@ -38,6 +37,7 @@ extern const struct log_info gprs_log_info;
#include <osmocom/core/application.h>
#include "csn1.h"
+#include "gsm_rlcmac.h"
}
using namespace std;
@@ -215,7 +215,9 @@ void testCsnLeftAlignedVarBmpBounds(void *test_ctx)
msgb_free(m);
}
+extern "C" {
int encode_gsm_ra_cap(struct bitvec *vector, MS_Radio_Access_capability_t * data);
+}
void testRAcap(void *test_ctx)
{