Update header includes

Many files include unnecessary headers and don't include headers which
are actually used. Because of that combined with the fact that OsmoPCU
is a mixture of C and C++, it makes it hard to modularize code. Fix
this (using iwyu [1] tool):

* add missing headers
* remove unused headers

[1] https://include-what-you-use.org/

Related: OS#1539
Change-Id: I8c9f488a43b099c72b2d30d3245e7ba50872fc00
This commit is contained in:
Max 2018-01-26 13:31:42 +01:00 committed by Harald Welte
parent 910a387b0e
commit 1187a7719c
26 changed files with 118 additions and 30 deletions

View File

@ -25,9 +25,10 @@
#include <decoding.h>
#include <rlc.h>
#include <pcu_l1_if.h>
#include <gprs_ms.h>
#include <gprs_rlcmac.h>
#include <gprs_debug.h>
#include <cxx_linuxlist.h>
extern "C" {
#include <osmocom/core/talloc.h>
@ -37,10 +38,12 @@ extern "C" {
#include <osmocom/gsm/gsm_utils.h>
#include <osmocom/core/gsmtap_util.h>
#include <osmocom/core/application.h>
#include <osmocom/core/bitvec.h>
#include <osmocom/core/gsmtap.h>
#include <osmocom/core/logging.h>
#include <osmocom/core/utils.h>
}
#include <arpa/inet.h>
#include <errno.h>
#include <string.h>

View File

@ -26,17 +26,17 @@ extern "C" {
#include <osmocom/core/linuxlist.h>
#include <osmocom/core/rate_ctr.h>
#include <osmocom/core/stat_item.h>
#include <osmocom/core/timer.h>
#include <osmocom/core/gsmtap.h>
#include <osmocom/gsm/l1sap.h>
#include <osmocom/gsm/protocol/gsm_04_08.h>
}
#include <gsm_rlcmac.h>
#include "poll_controller.h"
#include "sba.h"
#include "tbf.h"
#include "gprs_ms_storage.h"
#include "gprs_coding_scheme.h"
#include <cxx_linuxlist.h>
#endif
#include <stdint.h>

View File

@ -21,8 +21,10 @@
#include <gprs_rlcmac.h>
#include <gprs_bssgp_pcu.h>
#include <pcu_l1_if.h>
#include <gprs_debug.h>
#include <bts.h>
#include <tbf.h>
#include <gprs_coding_scheme.h>
#define BSSGP_TIMER_T1 30 /* Guards the (un)blocking procedures */
#define BSSGP_TIMER_T2 30 /* Guards the reset procedure */

View File

@ -42,8 +42,6 @@ struct bssgp_bvc_ctx *btsctx_alloc(uint16_t bvci, uint16_t nsei);
#define NS_HDR_LEN 4
#define IE_LLC_PDU 14
struct gprs_rlcmac_bts;
struct gprs_bssgp_pcu {
struct gprs_nsvc *nsvc;
struct bssgp_bvc_ctx *bctx;

View File

@ -20,7 +20,7 @@
#include "gprs_ms.h"
#include <gprs_coding_scheme.h>
#include "bts.h"
#include "tbf.h"
#include "gprs_debug.h"
@ -33,6 +33,7 @@ extern "C" {
#include <osmocom/core/talloc.h>
#include <osmocom/core/utils.h>
#include <osmocom/gsm/protocol/gsm_04_08.h>
#include <osmocom/core/logging.h>
}
#define GPRS_CODEL_SLOW_INTERVAL_MS 4000

View File

@ -22,13 +22,16 @@
struct gprs_codel;
#include <gprs_coding_scheme.h>
#include "cxx_linuxlist.h"
#include "llc.h"
#include "tbf.h"
#include "pcu_l1_if.h"
#include <gprs_coding_scheme.h>
extern "C" {
#include <osmocom/core/timer.h>
#include <osmocom/core/linuxlist.h>
}
#include <stdint.h>

View File

@ -23,7 +23,10 @@
#include "tbf.h"
#include "bts.h"
#include "gprs_debug.h"
extern "C" {
#include <osmocom/core/linuxlist.h>
}
#define GPRS_UNDEFINED_IMSI "000"

View File

@ -24,7 +24,7 @@
#include <bts.h>
#include <encoding.h>
#include <tbf.h>
#include <gprs_debug.h>
extern void *tall_pcu_ctx;

View File

@ -22,9 +22,16 @@
#include <pcu_l1_if.h>
#include <bts.h>
#include <tbf.h>
#include <gprs_debug.h>
#include <gprs_ms.h>
#include <rlc.h>
#include <sba.h>
#include "pcu_utils.h"
extern "C" {
#include <osmocom/core/gsmtap.h>
}
static uint32_t sched_poll(BTS *bts,
uint8_t trx, uint8_t ts, uint32_t fn, uint8_t block_nr,
struct gprs_rlcmac_tbf **poll_tbf,

View File

@ -31,6 +31,9 @@
extern "C" {
#include "mslot_class.h"
#include <osmocom/core/linuxlist.h>
#include <osmocom/core/logging.h>
#include <osmocom/core/utils.h>
}
/* Consider a PDCH as idle if has at most this number of TBFs assigned to it */

View File

@ -29,7 +29,6 @@ extern "C" {
#define LLC_MAX_LEN 1543
struct BTS;
struct msgb;
/**
* I represent the LLC data to a MS

View File

@ -29,9 +29,11 @@ extern "C" {
#include <osmocom/core/talloc.h>
#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 <gprs_rlcmac.h>
#include <pcu_l1_if.h>
#include <gprs_debug.h>
#include <gprs_bssgp_pcu.h>

View File

@ -26,12 +26,18 @@
#include <sys/socket.h>
#include <sys/un.h>
#include <arpa/inet.h>
extern "C" {
#include <osmocom/core/talloc.h>
#include <osmocom/core/select.h>
#include <osmocom/core/msgb.h>
#include <osmocom/core/gsmtap_util.h>
#include <osmocom/core/gsmtap.h>
#include <osmocom/core/bitvec.h>
#include <osmocom/core/logging.h>
#include <osmocom/core/utils.h>
#include <osmocom/gsm/l1sap.h>
#include <osmocom/gsm/protocol/gsm_04_08.h>
}
#include <gprs_rlcmac.h>
@ -40,7 +46,6 @@ extern "C" {
#include <gprs_bssgp_pcu.h>
#include <osmocom/pcu/pcuif_proto.h>
#include <bts.h>
#include <tbf.h>
// FIXME: move this, when changed from c++ to c.
extern "C" {

View File

@ -17,22 +17,34 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <gprs_bssgp_pcu.h>
#include <arpa/inet.h>
#include <pcu_l1_if.h>
#include <gprs_rlcmac.h>
#include <gsm_timer.h>
#include <gprs_debug.h>
#include <unistd.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <getopt.h>
#include <signal.h>
#include <sched.h>
#include <bts.h>
#include <gprs_coding_scheme.h>
#include <osmocom/pcu/pcuif_proto.h>
extern "C" {
#include "pcu_vty.h"
#include <osmocom/gprs/gprs_bssgp.h>
#include <osmocom/gprs/gprs_ns.h>
#include <osmocom/vty/telnet_interface.h>
#include <osmocom/vty/logging.h>
#include <osmocom/vty/command.h>
#include <osmocom/vty/vty.h>
#include <osmocom/vty/ports.h>
#include <osmocom/core/rate_ctr.h>
#include <osmocom/core/select.h>
#include <osmocom/core/application.h>
#include <osmocom/core/msgb.h>
#include <osmocom/core/stats.h>
#include <osmocom/core/gsmtap.h>
#include <osmocom/core/gsmtap_util.h>

View File

@ -27,11 +27,19 @@
#include "gprs_ms_storage.h"
#include "gprs_ms.h"
#include "cxx_linuxlist.h"
#include <gprs_coding_scheme.h>
#include <llc.h>
#include <pcu_l1_if.h>
#include <rlc.h>
#include <tbf.h>
extern "C" {
#include <osmocom/vty/command.h>
#include <osmocom/vty/logging.h>
#include <osmocom/vty/misc.h>
#include <osmocom/core/linuxlist.h>
#include <osmocom/core/utils.h>
#include <osmocom/vty/vty.h>
}
static void tbf_print_vty_info(struct vty *vty, gprs_rlcmac_tbf *tbf)

View File

@ -23,6 +23,13 @@
#include <poll_controller.h>
#include <bts.h>
#include <tbf.h>
#include <cxx_linuxlist.h>
#include <sba.h>
extern "C" {
#include <osmocom/core/linuxlist.h>
#include <osmocom/gsm/gsm_utils.h>
}
PollController::PollController(BTS& bts)
: m_bts(bts)

View File

@ -21,8 +21,6 @@
#pragma once
struct gprs_rlcmac_bts;
struct BTS;
/**

View File

@ -18,11 +18,17 @@
#include "bts.h"
#include "gprs_debug.h"
#include <gprs_coding_scheme.h>
#include <rlc.h>
#include <errno.h>
#include <stdbool.h>
#include <string.h>
#include <sys/types.h>
extern "C" {
#include <osmocom/core/utils.h>
#include <osmocom/core/bitvec.h>
#include <osmocom/core/logging.h>
}

View File

@ -20,14 +20,15 @@
*/
#include <sba.h>
#include <gprs_rlcmac.h>
#include <gprs_debug.h>
#include <bts.h>
#include <pcu_utils.h>
extern "C" {
#include <osmocom/core/logging.h>
#include <osmocom/core/talloc.h>
#include <osmocom/gsm/protocol/gsm_04_08.h>
#include <osmocom/gsm/gsm_utils.h>
}
#include <errno.h>

View File

@ -27,7 +27,6 @@ extern "C" {
}
struct BTS;
class PollController;
struct gprs_rlcmac_pdch;
/*

View File

@ -25,10 +25,13 @@
#include <encoding.h>
#include <gprs_rlcmac.h>
#include <gprs_debug.h>
#include <gprs_bssgp_pcu.h>
#include <gprs_ms.h>
#include <decoding.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>
extern "C" {
#include <osmocom/core/msgb.h>
@ -36,6 +39,9 @@ extern "C" {
#include <osmocom/core/talloc.h>
#include <osmocom/core/stats.h>
#include <osmocom/core/logging.h>
#include <osmocom/core/bitvec.h>
#include <osmocom/core/rate_ctr.h>
#include <osmocom/gsm/protocol/gsm_04_08.h>
}
#include <errno.h>

View File

@ -20,20 +20,23 @@
#ifdef __cplusplus
#include "gprs_rlcmac.h"
#include "llc.h"
#include "rlc.h"
#include "cxx_linuxlist.h"
#include <gprs_debug.h>
#include <gprs_coding_scheme.h>
#include <gsm_timer.h>
#include <stdint.h>
extern "C" {
#include <osmocom/core/utils.h>
#include <osmocom/core/linuxlist.h>
#include <osmocom/core/logging.h>
#include <osmocom/core/timer.h>
}
struct bssgp_bvc_ctx;
struct pcu_l1_meas;
class GprsMs;
struct gprs_rlcmac_bts;
/*
* TBF instance

View File

@ -28,18 +28,28 @@
#include <gprs_codel.h>
#include <decoding.h>
#include <encoding.h>
#include <gprs_coding_scheme.h>
#include <gprs_ms.h>
#include <gprs_ms_storage.h>
#include <llc.h>
#include "pcu_utils.h"
extern "C" {
#include <osmocom/core/msgb.h>
#include <osmocom/core/talloc.h>
#include <osmocom/gprs/gprs_bssgp_bss.h>
#include <osmocom/core/bitvec.h>
#include <osmocom/core/linuxlist.h>
#include <osmocom/core/logging.h>
#include <osmocom/core/rate_ctr.h>
#include <osmocom/core/timer.h>
#include <osmocom/core/utils.h>
#include <osmocom/gsm/gsm_utils.h>
#include <osmocom/gsm/protocol/gsm_04_08.h>
}
#include <errno.h>
#include <string.h>
#include <math.h>
/* After sending these frames, we poll for ack/nack. */
#define POLL_ACK_AFTER_FRAMES 20

View File

@ -28,12 +28,21 @@
#include <gprs_bssgp_pcu.h>
#include <decoding.h>
#include <pcu_l1_if.h>
#include <gprs_coding_scheme.h>
#include <gprs_ms.h>
#include <llc.h>
#include "pcu_utils.h"
extern "C" {
#include <osmocom/core/msgb.h>
#include <osmocom/core/talloc.h>
#include <osmocom/core/bitvec.h>
#include <osmocom/core/logging.h>
#include <osmocom/core/rate_ctr.h>
#include <osmocom/core/utils.h>
#include <osmocom/gprs/gprs_bssgp_bss.h>
#include <osmocom/gprs/protocol/gsm_08_18.h>
#include <osmocom/gsm/tlv.h>
}
#include <errno.h>

View File

@ -27,6 +27,8 @@
#include "rlc.h"
#include "llc.h"
#include "bts.h"
#include <gprs_rlcmac.h>
extern "C" {
#include "pcu_vty.h"

View File

@ -27,6 +27,7 @@
#include "gprs_bssgp_pcu.h"
#include "pcu_l1_if.h"
#include "decoding.h"
#include <gprs_rlcmac.h>
extern "C" {
#include "pcu_vty.h"