gprs_rlcmac: convert from C++ to C
Change-Id: I7260ad1a67ebdc09767a679e579fead262f1627a
diff --git a/src/Makefile.am b/src/Makefile.am
index 21c37a6..9df0caa 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -50,7 +50,7 @@
gsm_rlcmac.c \
gprs_bssgp_pcu.c \
gprs_bssgp_rim.c \
- gprs_rlcmac.cpp \
+ gprs_rlcmac.c \
gprs_rlcmac_sched.cpp \
gprs_rlcmac_meas.cpp \
gprs_ms.c \
diff --git a/src/encoding.cpp b/src/encoding.cpp
index 243c874..6b626cc 100644
--- a/src/encoding.cpp
+++ b/src/encoding.cpp
@@ -801,7 +801,7 @@
}
/* Generate paging request. See 44.018, sections 10 and 9.1.22 */
-int Encoding::write_paging_request(bitvec * dest, const struct osmo_mobile_identity *mi)
+int write_paging_request(struct bitvec *dest, const struct osmo_mobile_identity *mi)
{
uint8_t mi_buf[GSM48_MID_MAX_SIZE];
int mi_len;
diff --git a/src/encoding.h b/src/encoding.h
index 27ffe46..ae4d57f 100644
--- a/src/encoding.h
+++ b/src/encoding.h
@@ -61,8 +61,6 @@
static void encode_rbb(const char *show_rbb, bitvec *rbb);
- static int write_paging_request(bitvec * dest, const struct osmo_mobile_identity *mi);
-
static unsigned write_repeated_page_info(bitvec * dest, unsigned& wp, uint8_t len,
uint8_t *identity, uint8_t chan_needed);
@@ -98,6 +96,9 @@
#endif
void write_packet_access_reject(struct bitvec *dest, uint32_t tlli, unsigned long t3172_ms);
+
+int write_paging_request(struct bitvec *dest, const struct osmo_mobile_identity *mi);
+
void write_packet_uplink_assignment(RlcMacDownlink_t *block, uint8_t old_tfi,
uint8_t old_downlink, uint32_t tlli, uint8_t use_tlli,
const struct gprs_rlcmac_ul_tbf *tbf, uint8_t poll,
diff --git a/src/gprs_rlcmac.cpp b/src/gprs_rlcmac.c
similarity index 89%
rename from src/gprs_rlcmac.cpp
rename to src/gprs_rlcmac.c
index ea7fb9a..3163c32 100644
--- a/src/gprs_rlcmac.cpp
+++ b/src/gprs_rlcmac.c
@@ -1,8 +1,9 @@
-/* gprs_rlcmac.cpp
+/* gprs_rlcmac.c
*
* Copyright (C) 2012 Ivan Klyuchnikov
* Copyright (C) 2012 Andreas Eversberg <jolly@eversberg.eu>
* Copyright (C) 2013 by Holger Hans Peter Freyther
+ * Copyright (C) 2023 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
@@ -15,9 +16,7 @@
* GNU General Public License for more details.
*/
-extern "C" {
- #include <osmocom/gsm/gsm48.h>
-}
+#include <osmocom/gsm/gsm48.h>
#include <pcu_l1_if.h>
#include <gprs_rlcmac.h>
@@ -36,9 +35,9 @@
osmo_mobile_identity_to_str_buf(str, sizeof(str), mi);
LOGP(DRLCMAC, LOGL_NOTICE, "TX: [PCU -> BTS] Paging Request (CCCH) MI=%s\n", str);
}
- bitvec *paging_request = bitvec_alloc(22, tall_pcu_ctx);
+ struct bitvec *paging_request = bitvec_alloc(22, tall_pcu_ctx);
bitvec_unhex(paging_request, DUMMY_VEC);
- int plen = Encoding::write_paging_request(paging_request, mi);
+ int plen = write_paging_request(paging_request, mi);
if (plen <= 0) {
LOGP(DRLCMAC, LOGL_ERROR, "TX: [PCU -> BTS] Failed to encode Paging Request\n");
return -1;
diff --git a/src/gprs_rlcmac.h b/src/gprs_rlcmac.h
index 43f5095..70cf63e 100644
--- a/src/gprs_rlcmac.h
+++ b/src/gprs_rlcmac.h
@@ -2,6 +2,7 @@
*
* Copyright (C) 2012 Ivan Klyuchnikov
* Copyright (C) 2013 by Holger Hans Peter Freyther
+ * Copyright (C) 2023 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
@@ -14,8 +15,7 @@
* GNU General Public License for more details.
*/
-#ifndef GPRS_RLCMAC_H
-#define GPRS_RLCMAC_H
+#pragma once
#include <stdbool.h>
#include <stdint.h>
@@ -92,8 +92,6 @@
int gprs_rlcmac_tx_ul_ud(gprs_rlcmac_tbf *tbf);
-struct msgb *gprs_rlcmac_app_info_msg(const struct gsm_pcu_if_app_info_req *req);
-
int gprs_rlcmac_rcv_rts_block(struct gprs_rlcmac_bts *bts,
uint8_t trx, uint8_t ts,
uint32_t fn, uint8_t block_nr);
@@ -101,9 +99,7 @@
extern "C" {
#endif
int gprs_rlcmac_paging_request(struct gprs_rlcmac_bts *bts, const struct osmo_mobile_identity *mi, const char *imsi);
+struct msgb *gprs_rlcmac_app_info_msg(const struct gsm_pcu_if_app_info_req *req);
#ifdef __cplusplus
}
#endif
-
-
-#endif // GPRS_RLCMAC_H
diff --git a/src/pcu_l1_if.h b/src/pcu_l1_if.h
index 3865402..f787c40 100644
--- a/src/pcu_l1_if.h
+++ b/src/pcu_l1_if.h
@@ -148,7 +148,6 @@
uint8_t *data, size_t data_len);
void pcu_l1if_tx_agch(struct gprs_rlcmac_bts *bts, bitvec *block, int len);
-void pcu_l1if_tx_pch(struct gprs_rlcmac_bts *bts, bitvec *block, int plen, const char *imsi);
void pcu_l1if_tx_pch_dt(struct gprs_rlcmac_bts *bts, bitvec *block, int plen, const char *imsi, uint32_t tlli);
#endif
@@ -158,6 +157,7 @@
struct gprs_rlcmac_bts;
int pcu_tx_neigh_addr_res_req(struct gprs_rlcmac_bts *bts, const struct neigh_cache_entry_key *neigh_key);
+void pcu_l1if_tx_pch(struct gprs_rlcmac_bts *bts, struct bitvec *block, int plen, const char *imsi);
int pcu_rx(struct gsm_pcu_if *pcu_prim, size_t pcu_prim_length);
int pcu_l1if_open(void);