path: root/include
diff options
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2017-07-03 16:49:43 +0200
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2017-07-05 13:04:15 +0200
commit0f88c110093935305143987638e46dc6db304a3e (patch)
tree1eb1f62c8c8e8d9ccbf37a24a84be57703ba65df /include
parent12ed975996f41fe1218c06fca3755047475084a6 (diff)
migrate osmo-hnbgw to libosmo-sigtran's SCCP/M3UA
libosmo-sigtran now has a "proper" SCCP/M3UA stack, so we can make our hnb-gw 3GPP compliant by switching from the old SUA code to the new universal SCCP user API with support for (currently) M3UA and SUA. Main changes: Use one cn_link to STP: We will connect to the core network using an (Osmo)STP instance that routes to MSC and SGSN, so we want one SCCP link instead of two. The only difference between IuCS and IuPS is a different remote osmo_sccp_addr. This has various effects through the messaging code; the patch is a bit larger than I would like, but it is hard to separate out truly independent smaller changes. CS or PS domain was previously flagged in the separate cn_link, as ctx pointer for two separate sccp_sap_up()s. Now there's just one such ctx, so determine is_ps from the RANAP Domain Indicator, or from the conn's hnbgw_context_map: - Add is_ps to context_map_alloc_by_hnb(). - To find a matching context, the RUA ID alone is no longer sufficient, also match is_ps (possible optimization todo: separate lists). We would send separate CS or PS Reset messages based on the cn_link, instead send both CS and PS Reset at the same time for the single cn_link. This could be adjusted to detect presence of MSC or SGSN instead. Pending: adjust the VTY config to reflect that there is only one remote address. Place a TODO comment for that. Smaller changes: rua_to_scu(): populate called and calling addresses for N_CONNECT and N_UNITDATA. Remove DSUA. Don't build dummy_cn, which is still implemented on SUA. Mark todo to maybe re-include it based on M3UA later. In hnbgw_cnlink, place sccp related items in a separate sub-struct. Do not keep an llist of cn_links, just have the one. Remove iteration and list management. Change jenkins script to build libosmo-sccp master. Patch-by: hwelte, nhofmeyr Change-Id: I8ac15fa2fd25bedb26297177e416976a5389b573
Diffstat (limited to 'include')
3 files changed, 18 insertions, 13 deletions
diff --git a/include/osmocom/iuh/context_map.h b/include/osmocom/iuh/context_map.h
index c1a4495..8d957d6 100644
--- a/include/osmocom/iuh/context_map.h
+++ b/include/osmocom/iuh/context_map.h
@@ -24,6 +24,8 @@ struct hnbgw_context_map {
struct hnbgw_cnlink *cn_link;
/* RUA contxt ID */
uint32_t rua_ctx_id;
+ /* False for CS, true for PS */
+ bool is_ps;
/* SCCP User SAP connection ID */
uint32_t scu_conn_id;
@@ -33,6 +35,7 @@ struct hnbgw_context_map {
struct hnbgw_context_map *
context_map_alloc_by_hnb(struct hnb_context *hnb, uint32_t rua_ctx_id,
+ bool is_ps,
struct hnbgw_cnlink *cn_if_new);
struct hnbgw_context_map *
diff --git a/include/osmocom/iuh/hnbgw.h b/include/osmocom/iuh/hnbgw.h
index 4880d48..db22d97 100644
--- a/include/osmocom/iuh/hnbgw.h
+++ b/include/osmocom/iuh/hnbgw.h
@@ -5,6 +5,7 @@
#include <osmocom/core/write_queue.h>
#include <osmocom/core/timer.h>
#include <osmocom/sigtran/sccp_sap.h>
+#include <osmocom/sigtran/osmo_ss7.h>
#define DEBUG
#include <osmocom/core/logging.h>
@@ -13,15 +14,16 @@
enum {
+/* TODO: CS and PS now both connect to OsmoSTP, i.e. that's always going to be the same address. Drop the
+ * duplicity. */
/* 25.467 Section 7.1 */
@@ -63,15 +65,11 @@ 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;
+ struct osmo_sccp_instance *sccp;
+ struct osmo_sccp_user *sccp_user;
uint32_t next_conn_id;
/* linked list of hnbgw_context_map */
@@ -131,14 +129,17 @@ struct hnb_gw {
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;
+ struct {
+ struct osmo_sccp_instance *instance;
+ struct hnbgw_cnlink *cnlink;
+ struct osmo_sccp_addr local_addr;
+ struct osmo_sccp_addr remote_addr_cs;
+ struct osmo_sccp_addr remote_addr_ps;
+ } sccp;
extern void *talloc_asn1_ctx;
diff --git a/include/osmocom/iuh/hnbgw_cn.h b/include/osmocom/iuh/hnbgw_cn.h
index d5bec04..93123f2 100644
--- a/include/osmocom/iuh/hnbgw_cn.h
+++ b/include/osmocom/iuh/hnbgw_cn.h
@@ -2,4 +2,5 @@
#include <osmocom/iuh/hnbgw.h>
-struct hnbgw_cnlink *hnbgw_cnlink_init(struct hnb_gw *gw, const char *host, uint16_t port, int is_ps);
+int hnbgw_cnlink_init(struct hnb_gw *gw, const char *stp_host, uint16_t stp_port,
+ const char *local_ip, uint32_t local_pc);