diff options
author | Neels Hofmeyr <neels@hofmeyr.de> | 2016-08-18 13:13:55 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2016-09-09 06:43:32 +0000 |
commit | df63de2e37af890f3abb11d4de2334c2b49ae13c (patch) | |
tree | fbba6d8566475df9e97b24fa0967de0f74029c97 /src | |
parent | 30e08f5b8e9ed4dbc12983d61eb1f1661eb91dd0 (diff) |
build: move headers to include/osmocom/*
This came up while fixing 'make distcheck'; this is certainly not the easiest
way but it makes sense to have the headers in include/, like we do in openbsc.
The easy alternative might be to add -I$(top_srcdir)/src to src/Makefile.am.
Remove -I$(top_srcdir)/src from src/tests/Makefile.am, no longer needed.
Change-Id: I5a82e029dcdc4df0a60a31271a4883393fe59234
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 3 | ||||
-rw-r--r-- | src/context_map.c | 4 | ||||
-rw-r--r-- | src/context_map.h | 43 | ||||
-rw-r--r-- | src/hnbap_common.c | 2 | ||||
-rw-r--r-- | src/hnbgw.c | 10 | ||||
-rw-r--r-- | src/hnbgw.h | 154 | ||||
-rw-r--r-- | src/hnbgw_cn.c | 6 | ||||
-rw-r--r-- | src/hnbgw_cn.h | 5 | ||||
-rw-r--r-- | src/hnbgw_hnbap.c | 2 | ||||
-rw-r--r-- | src/hnbgw_hnbap.h | 6 | ||||
-rw-r--r-- | src/hnbgw_ranap.c | 4 | ||||
-rw-r--r-- | src/hnbgw_ranap.h | 6 | ||||
-rw-r--r-- | src/hnbgw_rua.c | 6 | ||||
-rw-r--r-- | src/hnbgw_rua.h | 13 | ||||
-rw-r--r-- | src/hnbgw_vty.c | 4 | ||||
-rw-r--r-- | src/iu_common.h | 23 | ||||
-rw-r--r-- | src/ranap_common_cn.c | 2 | ||||
-rw-r--r-- | src/rua_common.c | 2 | ||||
-rw-r--r-- | src/rua_msg_factory.c | 4 | ||||
-rw-r--r-- | src/rua_msg_factory.h | 9 | ||||
-rw-r--r-- | src/tests/Makefile.am | 7 | ||||
-rw-r--r-- | src/tests/dummy_cn_sua.c | 2 | ||||
-rw-r--r-- | src/tests/hnb-test.c | 2 | ||||
-rw-r--r-- | src/tests/test-ranap.c | 2 | ||||
-rw-r--r-- | src/tests/test_common.c | 2 |
25 files changed, 33 insertions, 290 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 2779315..bb1ebbd 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -60,9 +60,6 @@ libosmo_ranap_la_SOURCES = ranap_common.c ranap_encoder.c ranap_decoder.c ranap_ # bin_PROGRAMS = osmo-hnbgw -noinst_HEADERS = context_map.h hnbgw.h hnbgw_cn.h \ - hnbgw_hnbap.h hnbgw_rua.h hnbgw_ranap.h - osmo_hnbgw_SOURCES = hnbap_encoder.c hnbap_decoder.c hnbap_common.c \ rua_encoder.c rua_decoder.c rua_common.c \ rua_msg_factory.c \ diff --git a/src/context_map.c b/src/context_map.c index 22eb605..052133c 100644 --- a/src/context_map.c +++ b/src/context_map.c @@ -24,8 +24,8 @@ #include <osmocom/core/timer.h> -#include "hnbgw.h" -#include "context_map.h" +#include <osmocom/iuh/hnbgw.h> +#include <osmocom/iuh/context_map.h> /* is a given SCCP USER SAP Connection ID in use for a given CN link? */ static int cn_id_in_use(struct hnbgw_cnlink *cn, uint32_t id) diff --git a/src/context_map.h b/src/context_map.h deleted file mode 100644 index c1a4495..0000000 --- a/src/context_map.h +++ /dev/null @@ -1,43 +0,0 @@ -#pragma once - -#include <stdint.h> -#include <osmocom/core/linuxlist.h> - -enum hnbgw_context_map_state { - MAP_S_NULL, - MAP_S_ACTIVE, /* currently active map */ - MAP_S_RESERVED1, /* just disconnected, still resrved */ - MAP_S_RESERVED2, /* still reserved */ -}; - -struct hnb_context; -struct hnbgw_cnlink; - -struct hnbgw_context_map { - /* entry in the per-CN list of mappings */ - struct llist_head cn_list; - /* entry in the per-HNB list of mappings */ - struct llist_head hnb_list; - /* pointer to HNB */ - struct hnb_context *hnb_ctx; - /* pointer to CN */ - struct hnbgw_cnlink *cn_link; - /* RUA contxt ID */ - uint32_t rua_ctx_id; - /* SCCP User SAP connection ID */ - uint32_t scu_conn_id; - - enum hnbgw_context_map_state state; -}; - - -struct hnbgw_context_map * -context_map_alloc_by_hnb(struct hnb_context *hnb, uint32_t rua_ctx_id, - struct hnbgw_cnlink *cn_if_new); - -struct hnbgw_context_map * -context_map_by_cn(struct hnbgw_cnlink *cn, uint32_t scu_conn_id); - -void context_map_deactivate(struct hnbgw_context_map *map); - -int context_map_init(struct hnb_gw *gw); diff --git a/src/hnbap_common.c b/src/hnbap_common.c index 2cd6519..f8cfb13 100644 --- a/src/hnbap_common.c +++ b/src/hnbap_common.c @@ -25,7 +25,7 @@ #include <osmocom/hnbap/HNBAP-PDU.h> #include <osmocom/hnbap/hnbap_common.h> -#include "hnbgw.h" +#include <osmocom/iuh/hnbgw.h> static const struct value_string hnbap_cause_radio_vals[] = { { CauseRadioNetwork_overload, "overload" }, diff --git a/src/hnbgw.c b/src/hnbgw.c index 4f23e8d..d50e622 100644 --- a/src/hnbgw.c +++ b/src/hnbgw.c @@ -51,11 +51,11 @@ #include <osmocom/sigtran/protocol/sua.h> #include <osmocom/sigtran/sccp_sap.h> -#include "hnbgw.h" -#include "hnbgw_hnbap.h" -#include "hnbgw_rua.h" -#include "hnbgw_cn.h" -#include "context_map.h" +#include <osmocom/iuh/hnbgw.h> +#include <osmocom/iuh/hnbgw_hnbap.h> +#include <osmocom/iuh/hnbgw_rua.h> +#include <osmocom/iuh/hnbgw_cn.h> +#include <osmocom/iuh/context_map.h> static const char * const osmo_hnbgw_copyright = "OsmoHNBGW - Osmocom Home Node B Gateway implementation\r\n" diff --git a/src/hnbgw.h b/src/hnbgw.h deleted file mode 100644 index 21a9602..0000000 --- a/src/hnbgw.h +++ /dev/null @@ -1,154 +0,0 @@ -#pragma once - -#include <osmocom/core/select.h> -#include <osmocom/core/linuxlist.h> -#include <osmocom/core/write_queue.h> -#include <osmocom/core/timer.h> -#include <osmocom/sigtran/sccp_sap.h> - -#define DEBUG -#include <osmocom/core/logging.h> - - -enum { - DMAIN, - DHNBAP, - DSUA, - DRUA, - DRANAP, -}; - - -/* 25.467 Section 7.1 */ -#define IUH_DEFAULT_SCTP_PORT 29169 -#define RNA_DEFAULT_SCTP_PORT 25471 - -#define IUH_PPI_RUA 19 -#define IUH_PPI_HNBAP 20 -#define IUH_PPI_SABP 31 -#define IUH_PPI_RNA 42 -#define IUH_PPI_PUA 55 - -#define IUH_MSGB_SIZE 2048 - -struct umts_cell_id { - uint16_t mcc; /*!< Mobile Country Code */ - uint16_t mnc; /*!< Mobile Network Code */ - uint16_t lac; /*!< Locaton Area Code */ - uint16_t rac; /*!< Routing Area Code */ - uint16_t sac; /*!< Service Area Code */ - uint32_t cid; /*!< Cell ID */ -}; - -struct hnb_gw; - -enum hnbgw_cnlink_state { - /* we have just been initialized or were disconnected */ - CNLINK_S_NULL, - /* establishment of the SUA/SCCP link is pending */ - CNLINK_S_EST_PEND, - /* establishment of the SUA/SCCP link was confirmed */ - CNLINK_S_EST_CONF, - /* we have esnt the RANAP RESET and wait for the ACK */ - CNLINK_S_EST_RST_TX_WAIT_ACK, - /* we have received the RANAP RESET ACK and are active */ - CNLINK_S_EST_ACTIVE, -}; - -struct hnbgw_cnlink { - struct llist_head list; - enum hnbgw_cnlink_state state; - struct hnb_gw *gw; - /* are we a PS connection (1) or CS (0) */ - int is_ps; - /* timer for re-transmitting the RANAP Reset */ - struct osmo_timer_list T_RafC; - /* reference to the SCCP User SAP by which we communicate */ - struct osmo_sccp_user *sua_user; - struct osmo_sccp_link *sua_link; - struct osmo_sccp_addr local_addr; - struct osmo_sccp_addr remote_addr; - uint32_t next_conn_id; - - /* linked list of hnbgw_context_map */ - struct llist_head map_list; -}; - -struct hnb_context { - /*! Entry in HNB-global list of HNB */ - struct llist_head list; - /*! HNB-GW we are part of */ - struct hnb_gw *gw; - /*! SCTP socket + write queue for Iuh to this specific HNB */ - struct osmo_stream_srv *conn; - /*! copied from HNB-Identity-Info IE */ - char identity_info[256]; - /*! copied from Cell Identity IE */ - struct umts_cell_id id; - - /*! SCTP stream ID for HNBAP */ - uint16_t hnbap_stream; - /*! SCTP stream ID for RUA */ - uint16_t rua_stream; - - /* linked list of hnbgw_context_map */ - struct llist_head map_list; -}; - -struct ue_context { - /*! Entry in the HNB-global list of UE */ - struct llist_head list; - /*! Unique Context ID for this UE */ - uint32_t context_id; - char imsi[16+1]; - /* TODO: track TMSI, for HNBAP UE Register Request with TMSI, - * seen with ip.access nano3G femto cell */ - /*! UE is serviced via this HNB */ - struct hnb_context *hnb; -}; - -#define HNBGW_IUH_BIND_ADDR_DEFAULT "0.0.0.0" - -struct hnb_gw { - struct { - const char *iuh_bind_addr; - /*! SCTP port for Iuh listening */ - uint16_t iuh_listen_port; - /*! The UDP port where we receive multiplexed CS user - * plane traffic from HNBs */ - uint16_t iuh_cs_mux_port; - uint16_t rnc_id; - } config; - /*! SCTP listen socket for incoming connections */ - struct osmo_stream_srv_link *iuh; - /* list of struct hnb_context */ - struct llist_head hnb_list; - /* list of struct ue_context */ - struct llist_head ue_list; - /* list of struct hnbgw_cnlink */ - struct llist_head cn_list; - /* next availble UE Context ID */ - uint32_t next_ue_ctx_id; - - /* currently active CN links for CS and PS */ - struct hnbgw_cnlink *cnlink_cs; - struct hnbgw_cnlink *cnlink_ps; -}; - -extern void *talloc_asn1_ctx; - -struct ue_context *ue_context_by_id(struct hnb_gw *gw, uint32_t id); -struct ue_context *ue_context_by_imsi(struct hnb_gw *gw, const char *imsi); -struct ue_context *ue_context_alloc(struct hnb_context *hnb, const char *imsi); -void ue_context_free(struct ue_context *ue); - -struct hnb_context *hnb_context_alloc(struct hnb_gw *gw, struct osmo_stream_srv_link *link, int new_fd); -void hnb_context_release(struct hnb_context *ctx); - -void hnbgw_vty_init(struct hnb_gw *gw, void *tall_ctx); - -/* - * Return IP address passed to the hnbgw/iuh/bind command, or - * IUH_BIND_ADDR_DEFAULT - */ -const char *hnbgw_get_iuh_bind_addr(struct hnb_gw *gw); diff --git a/src/hnbgw_cn.c b/src/hnbgw_cn.c index 09b2726..e41788d 100644 --- a/src/hnbgw_cn.c +++ b/src/hnbgw_cn.c @@ -29,11 +29,11 @@ #include <osmocom/sigtran/sccp_sap.h> #include <osmocom/sigtran/sccp_helpers.h> -#include "hnbgw.h" -#include "hnbgw_rua.h" +#include <osmocom/iuh/hnbgw.h> +#include <osmocom/iuh/hnbgw_rua.h> #include <osmocom/ranap/ranap_ies_defs.h> #include <osmocom/ranap/ranap_msg_factory.h> -#include "context_map.h" +#include <osmocom/iuh/context_map.h> /*********************************************************************** * Outbound RANAP RESET to CN diff --git a/src/hnbgw_cn.h b/src/hnbgw_cn.h deleted file mode 100644 index 469b3d4..0000000 --- a/src/hnbgw_cn.h +++ /dev/null @@ -1,5 +0,0 @@ -#pragma once - -#include "hnbgw.h" - -struct hnbgw_cnlink *hnbgw_cnlink_init(struct hnb_gw *gw, const char *host, uint16_t port, int is_ps); diff --git a/src/hnbgw_hnbap.c b/src/hnbgw_hnbap.c index c329fe4..7bf54c8 100644 --- a/src/hnbgw_hnbap.c +++ b/src/hnbgw_hnbap.c @@ -31,7 +31,7 @@ #include <osmocom/hnbap/hnbap_common.h> #include <osmocom/ranap/iu_helpers.h> -#include "hnbgw.h" +#include <osmocom/iuh/hnbgw.h> #include <osmocom/hnbap/hnbap_ies_defs.h> #define IU_MSG_NUM_IES 32 diff --git a/src/hnbgw_hnbap.h b/src/hnbgw_hnbap.h deleted file mode 100644 index 955e0aa..0000000 --- a/src/hnbgw_hnbap.h +++ /dev/null @@ -1,6 +0,0 @@ -#pragma once - -#include "hnbgw.h" - -int hnbgw_hnbap_rx(struct hnb_context *hnb, struct msgb *msg); -int hnbgw_hnbap_init(void); diff --git a/src/hnbgw_ranap.c b/src/hnbgw_ranap.c index dde1183..7a505a5 100644 --- a/src/hnbgw_ranap.c +++ b/src/hnbgw_ranap.c @@ -29,8 +29,8 @@ #include "asn1helpers.h" -#include "hnbgw.h" -#include "hnbgw_rua.h" +#include <osmocom/iuh/hnbgw.h> +#include <osmocom/iuh/hnbgw_rua.h> #include <osmocom/ranap/ranap_common.h> #include <osmocom/ranap/ranap_ies_defs.h> #include <osmocom/ranap/ranap_msg_factory.h> diff --git a/src/hnbgw_ranap.h b/src/hnbgw_ranap.h deleted file mode 100644 index 85a2f98..0000000 --- a/src/hnbgw_ranap.h +++ /dev/null @@ -1,6 +0,0 @@ -#pragma once - -#include "hnbgw.h" - -int hnbgw_ranap_rx(struct msgb *msg, uint8_t *data, size_t len); -int hnbgw_ranap_init(void); diff --git a/src/hnbgw_rua.c b/src/hnbgw_rua.c index fc22bfc..3f245b5 100644 --- a/src/hnbgw_rua.c +++ b/src/hnbgw_rua.c @@ -32,11 +32,11 @@ #include "asn1helpers.h" -#include "hnbgw.h" -#include "hnbgw_ranap.h" +#include <osmocom/iuh/hnbgw.h> +#include <osmocom/iuh/hnbgw_ranap.h> #include <osmocom/rua/rua_common.h> #include <osmocom/rua/rua_ies_defs.h> -#include "context_map.h" +#include <osmocom/iuh/context_map.h> static int hnbgw_rua_tx(struct hnb_context *ctx, struct msgb *msg) { diff --git a/src/hnbgw_rua.h b/src/hnbgw_rua.h deleted file mode 100644 index d170190..0000000 --- a/src/hnbgw_rua.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -#include "hnbgw.h" -#include <osmocom/rua/RUA_Cause.h> - -int hnbgw_rua_rx(struct hnb_context *hnb, struct msgb *msg); -int hnbgw_rua_init(void); - -int rua_tx_udt(struct hnb_context *hnb, const uint8_t *data, unsigned int len); -int rua_tx_dt(struct hnb_context *hnb, int is_ps, uint32_t context_id, - const uint8_t *data, unsigned int len); -int rua_tx_disc(struct hnb_context *hnb, int is_ps, uint32_t context_id, - const RUA_Cause_t *cause, const uint8_t *data, unsigned int len); diff --git a/src/hnbgw_vty.c b/src/hnbgw_vty.c index 1673c0c..2e3d1e9 100644 --- a/src/hnbgw_vty.c +++ b/src/hnbgw_vty.c @@ -22,8 +22,8 @@ #include <osmocom/iuh/vty.h> -#include "hnbgw.h" -#include "context_map.h" +#include <osmocom/iuh/hnbgw.h> +#include <osmocom/iuh/context_map.h> static void *tall_hnb_ctx = NULL; static struct hnb_gw *g_hnb_gw = NULL; diff --git a/src/iu_common.h b/src/iu_common.h deleted file mode 100644 index 11c2a79..0000000 --- a/src/iu_common.h +++ /dev/null @@ -1,23 +0,0 @@ -#pragma once - -/* A humble attempt of reading the Iu messages (RUA/RANAP/HNBAP) without an asn.1 parser. - * Not actually used anywhere (yet?) */ - -struct iu_common_hdr { - uint8_t msg_type; - uint8_t procedure_code; - uint8_t criticality; - uint8_t len; /* first byte of length field */ - uint8_t payload[0]; /* possible further length field + payload */ - /* extension? */ - /* ? */ - /* number of ProtocolIEs */ -} __attribute__ ((packed)); - -struct iu_common_ie { - uint16_t iei; - uint8_t criticality; - uint8_t len; /* first byte of length field */ - uint8_t payload[0]; /* possible further length field + payload */ -} __attribute__ ((packed)); - diff --git a/src/ranap_common_cn.c b/src/ranap_common_cn.c index 2c80dd0..3736dce 100644 --- a/src/ranap_common_cn.c +++ b/src/ranap_common_cn.c @@ -29,7 +29,7 @@ #include <osmocom/ranap/ranap_common_cn.h> #include <osmocom/ranap/ranap_ies_defs.h> -#include "hnbgw.h" +#include <osmocom/iuh/hnbgw.h> static int cn_ranap_rx_initiating_msg_co(void *ctx, RANAP_InitiatingMessage_t *imsg, ranap_message *message) diff --git a/src/rua_common.c b/src/rua_common.c index a5ab044..3c9d773 100644 --- a/src/rua_common.c +++ b/src/rua_common.c @@ -24,7 +24,7 @@ #include <osmocom/core/msgb.h> #include <osmocom/rua/rua_common.h> -#include "hnbgw.h" +#include <osmocom/iuh/hnbgw.h> extern int asn1_xer_print; diff --git a/src/rua_msg_factory.c b/src/rua_msg_factory.c index 0bce326..268f6ac 100644 --- a/src/rua_msg_factory.c +++ b/src/rua_msg_factory.c @@ -3,9 +3,9 @@ #include <osmocom/rua/rua_common.h> #include <osmocom/rua/rua_ies_defs.h> -#include "rua_msg_factory.h" +#include <osmocom/rua/rua_msg_factory.h> #include "asn1helpers.h" -#include "hnbgw.h" +#include <osmocom/iuh/hnbgw.h> struct msgb *rua_new_udt(struct msgb *inmsg) diff --git a/src/rua_msg_factory.h b/src/rua_msg_factory.h deleted file mode 100644 index ca2f4e8..0000000 --- a/src/rua_msg_factory.h +++ /dev/null @@ -1,9 +0,0 @@ -#pragma once - -#include <stdint.h> -#include <osmocom/core/msgb.h> - -struct msgb *rua_new_udt(struct msgb *inmsg); -struct msgb *rua_new_conn(int is_ps, uint32_t context_id, struct msgb *inmsg); -struct msgb *rua_new_dt(int is_ps, uint32_t context_id, struct msgb *inmsg); -struct msgb *rua_new_disc(int is_ps, uint32_t context_id, struct msgb *inmsg); diff --git a/src/tests/Makefile.am b/src/tests/Makefile.am index 2ba3e89..3a99681 100644 --- a/src/tests/Makefile.am +++ b/src/tests/Makefile.am @@ -1,9 +1,14 @@ -AM_CFLAGS = -g -I$(top_srcdir)/src -I$(top_srcdir)/include $(OSMOVTY_CFLAGS) $(OSMOCORE_CFLAGS) $(OSMOGSM_CFLAGS) $(OSMONETIF_CFLAGS) $(ASN1C_CFLAGS) $(OSMOSIGTRAN_CFLAGS) +AM_CFLAGS = -g -I$(top_srcdir)/src/tests \ + -I$(top_srcdir)/include -I$(top_builddir)/include \ + $(OSMOVTY_CFLAGS) $(OSMOCORE_CFLAGS) $(OSMOGSM_CFLAGS) \ + $(OSMONETIF_CFLAGS) $(ASN1C_CFLAGS) $(OSMOSIGTRAN_CFLAGS) COMMON_LIBS = $(OSMOVTY_LIBS) $(OSMOCORE_LIBS) $(OSMOGSM_LIBS) $(ASN1C_LIBS) $(OSMOSIGTRAN_LIBS) -lsctp check_PROGRAMS = test-ranap test-helpers test-hnbap hnb-test dummy-cn +noinst_HEADERS = test_common.h hnb-test.h hnb-test-layers.h + HNBAP_FILES = $(top_srcdir)/src/hnbap_common.c $(top_srcdir)/src/hnbap_decoder.c $(top_srcdir)/src/hnbap_encoder.c RUA_FILES = $(top_srcdir)/src/rua_common.c $(top_srcdir)/src/rua_decoder.c $(top_srcdir)/src/rua_encoder.c $(top_srcdir)/src/rua_msg_factory.c diff --git a/src/tests/dummy_cn_sua.c b/src/tests/dummy_cn_sua.c index c2fc712..f9b4244 100644 --- a/src/tests/dummy_cn_sua.c +++ b/src/tests/dummy_cn_sua.c @@ -24,7 +24,7 @@ #include <osmocom/ranap/ranap_ies_defs.h> #include <osmocom/ranap/ranap_common_cn.h> #include <osmocom/ranap/ranap_msg_factory.h> -#include "hnbgw.h" +#include <osmocom/iuh/hnbgw.h> int asn1_xer_print = 1; const char *cmdline_bind_addr = "127.0.0.1"; diff --git a/src/tests/hnb-test.c b/src/tests/hnb-test.c index 2c41199..d338077 100644 --- a/src/tests/hnb-test.c +++ b/src/tests/hnb-test.c @@ -54,7 +54,7 @@ #include "hnb-test-layers.h" #include <osmocom/hnbap/hnbap_common.h> #include <osmocom/hnbap/hnbap_ies_defs.h> -#include "rua_msg_factory.h" +#include <osmocom/rua/rua_msg_factory.h> #include "asn1helpers.h" #include <osmocom/ranap/iu_helpers.h> #include "test_common.h" diff --git a/src/tests/test-ranap.c b/src/tests/test-ranap.c index ce01b96..c70009b 100644 --- a/src/tests/test-ranap.c +++ b/src/tests/test-ranap.c @@ -32,7 +32,7 @@ #include "test_common.h" -#include "hnbgw.h" +#include <osmocom/iuh/hnbgw.h> int asn1_xer_print = 1; diff --git a/src/tests/test_common.c b/src/tests/test_common.c index a79d5f5..5a37e7e 100644 --- a/src/tests/test_common.c +++ b/src/tests/test_common.c @@ -37,7 +37,7 @@ #include <osmocom/core/talloc.h> #include <osmocom/core/logging.h> -#include "hnbgw.h" +#include <osmocom/iuh/hnbgw.h> void *talloc_asn1_ctx; |