Move gsm_rlcmac.cpp -> .c

Original file from wireshark.git (packet-gsm_csn1.c) is being built and
maintained as a C file. There's no real need for us to maintain it as a
C++, and doing so will make both files derive over time (as already
happened). Let's keep it as a C compiler (which btw seems to be more
strict) to make it easier to port patches back and forth wireshark.git.

Take the chance to move some declarations we added to csn1.h to be able
to build it out of wireshark. Let's keep those in a separate header file
to ease looking for differences.

Change-Id: I818a8ae947f002d35142f9f5473454cfd80e1830
changes/27/17627/3
Pau Espin 3 years ago committed by laforge
parent 799cf8221a
commit b2653fe619
  1. 5
      src/Makefile.am
  2. 4
      src/bts.h
  3. 15
      src/csn1.h
  4. 5
      src/decoding.h
  5. 2
      src/encoding.h
  6. 2
      src/gprs_rlcmac.h
  7. 7
      src/gsm_rlcmac.c
  8. 8
      src/gsm_rlcmac.h
  9. 3
      src/pdch.cpp
  10. 2
      src/pdch.h
  11. 3
      src/tbf.cpp
  12. 38
      src/wireshark_compat.h
  13. 4
      tests/rlcmac/RLCMACTest.cpp

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

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

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

@ -19,7 +19,10 @@
*/
#pragma once
#include <gsm_rlcmac.h>
extern "C" {
#include "gsm_rlcmac.h"
}
#include "rlc.h"
#include <stdint.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;

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

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

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

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

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

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

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

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

Loading…
Cancel
Save