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
This commit is contained in:
Pau Espin 2021-01-18 17:54:30 +01:00
parent 906aafc9e2
commit e91c4c72b1
6 changed files with 17 additions and 15 deletions

View File

@ -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 \

View File

@ -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]);

View File

@ -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,

View File

@ -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();
}

View File

@ -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

View File

@ -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;
}