aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2021-01-18 17:54:30 +0100
committerPau Espin Pedrol <pespin@sysmocom.de>2021-01-19 16:28:13 +0100
commite91c4c72b17a1d77e23e4c1514db40307ff66a48 (patch)
tree8b49d4016157548d5ea33479839df1c633813ae9
parent906aafc9e28d7f4114024e449ef5b010abeb86f7 (diff)
Convert osmo_bts_sock.cpp to C
There's no real point in using C++ there, and using C++ makes the compiler fail to use llist_head in multi-bts patches added later due to: """ 'offsetof' within non-standard-layout type is conditionally-supported """ Change-Id: I8965b5cc5a713e64788b5b6aa183d3035341ddbb
-rw-r--r--src/Makefile.am2
-rw-r--r--src/osmobts_sock.c (renamed from src/osmobts_sock.cpp)8
-rw-r--r--src/pcu_l1_if.h15
-rw-r--r--src/pdch.cpp4
-rw-r--r--src/pdch.h1
-rw-r--r--tests/tbf/TbfTest.cpp2
6 files changed, 17 insertions, 15 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 60f05a54..de924a68 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -65,7 +65,7 @@ libgprs_la_SOURCES = \
decoding.cpp \
llc.cpp \
rlc.cpp \
- osmobts_sock.cpp \
+ osmobts_sock.c \
gprs_codel.c \
coding_scheme.c \
egprs_rlc_compression.cpp \
diff --git a/src/osmobts_sock.cpp b/src/osmobts_sock.c
index c68b7b9c..ec9d7ceb 100644
--- a/src/osmobts_sock.cpp
+++ b/src/osmobts_sock.c
@@ -25,13 +25,13 @@
#include <assert.h>
#include <sys/socket.h>
#include <sys/un.h>
-extern "C" {
+
#include <osmocom/core/select.h>
#include <osmocom/core/msgb.h>
#include <osmocom/core/linuxlist.h>
#include <osmocom/core/logging.h>
#include <osmocom/core/timer.h>
-}
+
#include <pcu_l1_if.h>
#include <gprs_debug.h>
@@ -41,9 +41,7 @@ extern "C" {
#include <tbf.h>
#include <pdch.h>
-extern "C" {
int l1if_close_pdch(void *obj);
-}
/*
* osmo-bts PCU socket functions
@@ -115,7 +113,7 @@ static void pcu_sock_close(int lost)
}
#endif
for (ts = 0; ts < 8; ts++)
- bts->trx[trx].pdch[ts].disable();
+ pdch_disable(&bts->trx[trx].pdch[ts]);
/* FIXME: NOT ALL RESOURCES are freed in this case... inconsistent with the other code. Share the code with pcu_l1if.c
for the reset. */
bts_trx_free_all_tbf(&bts->trx[trx]);
diff --git a/src/pcu_l1_if.h b/src/pcu_l1_if.h
index 674cccaa..8ef262cf 100644
--- a/src/pcu_l1_if.h
+++ b/src/pcu_l1_if.h
@@ -150,19 +150,18 @@ void pcu_l1if_tx_ptcch(struct gprs_rlcmac_bts *bts,
void pcu_l1if_tx_agch(bitvec * block, int len);
void pcu_l1if_tx_pch(bitvec * block, int plen, uint16_t pgroup);
-
-int pcu_tx_txt_ind(enum gsm_pcu_if_text_type t, const char *fmt, ...);
-
-int pcu_l1if_open(void);
-void pcu_l1if_close(void);
-
-int pcu_rx(uint8_t msg_type, struct gsm_pcu_if *pcu_prim);
-int pcu_sock_send(struct msgb *msg);
#endif
#ifdef __cplusplus
extern "C" {
#endif
+int pcu_rx(uint8_t msg_type, struct gsm_pcu_if *pcu_prim);
+int pcu_l1if_open(void);
+void pcu_l1if_close(void);
+int pcu_sock_send(struct msgb *msg);
+
+int pcu_tx_txt_ind(enum gsm_pcu_if_text_type t, const char *fmt, ...);
+
int pcu_rx_rts_req_pdtch(uint8_t trx, uint8_t ts,
uint32_t fn, uint8_t block_nr);
int pcu_rx_rts_req_ptcch(uint8_t trx, uint8_t ts,
diff --git a/src/pdch.cpp b/src/pdch.cpp
index 15fd139d..5a329f3d 100644
--- a/src/pdch.cpp
+++ b/src/pdch.cpp
@@ -1031,3 +1031,7 @@ void pdch_free_all_tbf(struct gprs_rlcmac_pdch *pdch)
tbf_free(tbf);
}
}
+
+void pdch_disable(struct gprs_rlcmac_pdch *pdch) {
+ pdch->disable();
+}
diff --git a/src/pdch.h b/src/pdch.h
index 57e0f437..8871986f 100644
--- a/src/pdch.h
+++ b/src/pdch.h
@@ -188,6 +188,7 @@ inline bool gprs_rlcmac_pdch::is_enabled() const
extern "C" {
#endif
void pdch_free_all_tbf(struct gprs_rlcmac_pdch *pdch);
+void pdch_disable(struct gprs_rlcmac_pdch *pdch);
#ifdef __cplusplus
}
#endif
diff --git a/tests/tbf/TbfTest.cpp b/tests/tbf/TbfTest.cpp
index fbcb503c..798dc3c1 100644
--- a/tests/tbf/TbfTest.cpp
+++ b/tests/tbf/TbfTest.cpp
@@ -166,7 +166,7 @@ static uint8_t llc_data[200];
/* override, requires '-Wl,--wrap=pcu_sock_send' */
int __real_pcu_sock_send(struct msgb *msg);
-int __wrap_pcu_sock_send(struct msgb *msg)
+extern "C" int __wrap_pcu_sock_send(struct msgb *msg)
{
return 0;
}