aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorPhilipp Maier <pmaier@sysmocom.de>2017-04-09 12:32:51 +0200
committerNeels Hofmeyr <neels@hofmeyr.de>2017-08-30 14:12:37 +0200
commitefe85d33d4948a20de1baec2e8956113714ec72e (patch)
tree144135f7b5ae2584ca71377c424024c9b535ed73 /include
parent868dd5d8d31f756e404a7bfb7896aed21d20f905 (diff)
Implement AoIP, port to M3UA SIGTRAN (large addition and refactoring)
This was originally a long series of commits converging to the final result seen in this patch. It does not make much sense to review the smaller steps' trial and error, we need to review this entire change as a whole. Implement AoIP in osmo-msc and osmo-bsc. Change over to the new libosmo-sigtran API with support for proper SCCP/M3UA/SCTP stacking, as mandated by 3GPP specifications for the IuCS and IuPS interfaces. From here on, a separate osmo-stp process is required for SCCP routing between OsmoBSC / OsmoHNBGW <-> OsmoMSC / OsmoSGSN jenkins.sh: build from libosmo-sccp and osmo-iuh master branches now for new M3UA SIGTRAN. Patch-by: pmaier, nhofmeyr, laforge Change-Id: I5ae4e05ee7c57cad341ea5e86af37c1f6b0ffa77
Diffstat (limited to 'include')
-rw-r--r--include/openbsc/Makefile.am4
-rw-r--r--include/openbsc/a_iface.h76
-rw-r--r--include/openbsc/a_iface_bssap.h41
-rw-r--r--include/openbsc/a_reset.h63
-rw-r--r--include/openbsc/bsc_msc.h12
-rw-r--r--include/openbsc/bsc_msc_data.h32
-rw-r--r--include/openbsc/debug.h1
-rw-r--r--include/openbsc/gsm_04_08.h2
-rw-r--r--include/openbsc/gsm_data.h39
-rw-r--r--include/openbsc/gsm_data_shared.h10
-rw-r--r--include/openbsc/iu.h13
-rw-r--r--include/openbsc/mgcpgw_client.h28
-rw-r--r--include/openbsc/msc_ifaces.h20
-rw-r--r--include/openbsc/osmo_bsc.h6
-rw-r--r--include/openbsc/osmo_bsc_reset.h34
-rw-r--r--include/openbsc/osmo_bsc_sigtran.h48
-rw-r--r--include/openbsc/osmo_msc.h7
-rw-r--r--include/openbsc/transaction.h10
18 files changed, 417 insertions, 29 deletions
diff --git a/include/openbsc/Makefile.am b/include/openbsc/Makefile.am
index 995f02d09..25709f1d2 100644
--- a/include/openbsc/Makefile.am
+++ b/include/openbsc/Makefile.am
@@ -2,6 +2,8 @@ noinst_HEADERS = \
abis_nm.h \
abis_om2000.h \
abis_rsl.h \
+ a_iface.h \
+ a_iface_bssap.h \
arfcn_range_encode.h \
auth.h \
bsc_msc.h \
@@ -66,8 +68,10 @@ noinst_HEADERS = \
openbscdefines.h \
osmo_bsc.h \
osmo_bsc_grace.h \
+ a_reset.h \
osmo_bsc_rf.h \
osmo_msc.h \
+ osmo_bsc_sigtran.h \
bsc_msc_data.h \
osmux.h \
paging.h \
diff --git a/include/openbsc/a_iface.h b/include/openbsc/a_iface.h
new file mode 100644
index 000000000..149f1c71e
--- /dev/null
+++ b/include/openbsc/a_iface.h
@@ -0,0 +1,76 @@
+/* (C) 2017 by Sysmocom s.f.m.c. GmbH
+ * All Rights Reserved
+ *
+ * Author: Philipp Maier
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation; either version 3 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#pragma once
+
+#include <openbsc/a_reset.h>
+
+/* A struct to keep a context information about the BSCs we are associated with */
+struct bsc_context {
+ struct llist_head list;
+
+ /* Holds a copy of the sccp address of the BSC,
+ * this address will become known as soon as
+ * a remote BSC tries to make a connection or
+ * sends a RESET request via UNIDATA */
+ struct osmo_sccp_addr bsc_addr;
+
+ /* Holds a copy of the our local MSC address,
+ * this will be the sccp-address that is associated
+ * with the A interface */
+ struct osmo_sccp_addr msc_addr;
+
+ /* A pointer to the reset handler FSM, the
+ * state machine is allocated when the BSC
+ * is registerd. */
+ struct a_reset_ctx *reset;
+
+ /* A pointer to the sccp_user that is associated
+ * with the A interface. We need this information
+ * to send the resets and to send paging requests */
+ struct osmo_sccp_user *sccp_user;
+};
+
+/* Initalize A interface connection between to MSC and BSC */
+int a_init(struct osmo_sccp_instance *sccp, struct gsm_network *network);
+
+/* Send DTAP message via A-interface */
+int a_iface_tx_dtap(struct msgb *msg);
+
+/* Send Cipher mode command via A-interface */
+int a_iface_tx_cipher_mode(const struct gsm_subscriber_connection *conn,
+ int cipher, const const uint8_t *key, int len, int include_imeisv);
+
+/* Page a subscriber via A-interface */
+int a_iface_tx_paging(const char *imsi, uint32_t tmsi, uint16_t lac);
+
+/* Send assignment request via A-interface */
+int a_iface_tx_assignment(const struct gsm_trans *trans);
+
+/* Send clear command via A-interface */
+int a_iface_tx_clear_cmd(struct gsm_subscriber_connection *conn);
+
+/* Clear all subscriber connections on a specified BSC
+ * (Helper function for a_iface_bssap.c) */
+void a_clear_all(struct osmo_sccp_user *scu, const struct osmo_sccp_addr *bsc_addr);
+
+/* Delete info of a closed connection from the active connection list
+ * (Helper function for a_iface_bssap.c) */
+void a_delete_bsc_con(uint32_t conn_id);
diff --git a/include/openbsc/a_iface_bssap.h b/include/openbsc/a_iface_bssap.h
new file mode 100644
index 000000000..237c618fd
--- /dev/null
+++ b/include/openbsc/a_iface_bssap.h
@@ -0,0 +1,41 @@
+/* (C) 2017 by sysmocom s.f.m.c. GmbH
+ * All Rights Reserved
+ *
+ * Author: Philipp Maier
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation; either version 3 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#pragma once
+
+/* Note: The structs and functions presented in this header file are intended
+ * to be used only by a_iface.c. */
+
+/* A structure to hold tha most basic information about a sigtran connection
+ * we use this struct internally here to pass connection data around */
+struct a_conn_info {
+ struct osmo_sccp_addr *msc_addr;
+ struct osmo_sccp_addr *bsc_addr;
+ uint32_t conn_id;
+ struct gsm_network *network;
+ struct a_reset_ctx *reset;
+};
+
+/* Receive incoming connection less data messages via sccp */
+void sccp_rx_udt(struct osmo_sccp_user *scu, const struct a_conn_info *a_conn_info, struct msgb *msg);
+
+/* Receive incoming connection oriented data messages via sccp */
+int sccp_rx_dt(struct osmo_sccp_user *scu, const struct a_conn_info *a_conn_info, struct msgb *msg);
+
diff --git a/include/openbsc/a_reset.h b/include/openbsc/a_reset.h
new file mode 100644
index 000000000..7aaab0620
--- /dev/null
+++ b/include/openbsc/a_reset.h
@@ -0,0 +1,63 @@
+/* (C) 2017 by sysmocom s.f.m.c. GmbH
+ * All Rights Reserved
+ *
+ * Author: Philipp Maier
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation; either version 3 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#pragma once
+
+
+
+/* Reset context data (callbacks, state machine etc...) */
+struct a_reset_ctx {
+
+ /* FSM instance, which handles the reset procedure */
+ struct osmo_fsm_inst *fsm;
+
+ /* Connection failure counter. When this counter
+ * reaches a certain threshold, the reset procedure
+ * will be triggered */
+ int conn_loss_counter;
+
+ /* A human readable name to display in the logs */
+ char name[256];
+
+ /* Callback function to be called when a connection
+ * failure is detected and a rest must occur */
+ void (*cb)(void *priv);
+
+ /* Privated data for the callback function */
+ void *priv;
+};
+
+/* Create and start state machine which handles the reset/reset-ack procedure */
+struct a_reset_ctx *a_reset_alloc(const void *ctx, const char *name, void *cb, void *priv);
+
+/* Tear down state machine */
+void a_reset_free(struct a_reset_ctx *reset);
+
+/* Confirm that we sucessfully received a reset acknowlege message */
+void a_reset_ack_confirm(struct a_reset_ctx *reset);
+
+/* Report a failed connection */
+void a_reset_conn_fail(struct a_reset_ctx *reset);
+
+/* Report a successful connection */
+void a_reset_conn_success(struct a_reset_ctx *reset);
+
+/* Check if we have a connection to a specified msc */
+bool a_reset_conn_ready(struct a_reset_ctx *reset);
diff --git a/include/openbsc/bsc_msc.h b/include/openbsc/bsc_msc.h
index 39258d364..380eb17c1 100644
--- a/include/openbsc/bsc_msc.h
+++ b/include/openbsc/bsc_msc.h
@@ -24,6 +24,8 @@
#include <osmocom/core/write_queue.h>
#include <osmocom/core/timer.h>
+#include <osmocom/sigtran/sccp_sap.h>
+#include <openbsc/a_reset.h>
#include <netinet/in.h>
@@ -37,6 +39,7 @@ struct bsc_msc_dest {
struct bsc_msc_connection {
+ /* FIXME: Remove stuff that is no longer needed! */
struct osmo_wqueue write_queue;
int is_connected;
int is_authenticated;
@@ -52,6 +55,15 @@ struct bsc_msc_connection {
struct osmo_timer_list timeout_timer;
struct msgb *pending_msg;
+
+ /* Sigtran connection data */
+ struct osmo_sccp_instance *sccp;
+ struct osmo_sccp_user *sccp_user;
+ struct osmo_sccp_addr g_calling_addr;
+ struct osmo_sccp_addr g_called_addr;
+ struct a_reset_ctx *reset;
+
+ int conn_id_counter;
};
struct bsc_msc_connection *bsc_msc_create(void *ctx, struct llist_head *dest);
diff --git a/include/openbsc/bsc_msc_data.h b/include/openbsc/bsc_msc_data.h
index 38e87cfb9..4a283d165 100644
--- a/include/openbsc/bsc_msc_data.h
+++ b/include/openbsc/bsc_msc_data.h
@@ -32,6 +32,14 @@
#include <osmocom/core/timer.h>
#include <osmocom/gsm/protocol/gsm_04_08.h>
+
+#include <osmocom/sigtran/osmo_ss7.h>
+#include <osmocom/sigtran/sccp_sap.h>
+#include <osmocom/sigtran/sccp_helpers.h>
+#include <osmocom/sigtran/protocol/sua.h>
+#include <osmocom/sigtran/protocol/m3ua.h>
+#include <osmocom/core/fsm.h>
+
#include <regex.h>
struct osmo_bsc_rf;
@@ -103,6 +111,30 @@ struct bsc_msc_data {
char *ussd_grace_txt;
char *acc_lst_name;
+
+ /* Sigtran connection data */
+ struct {
+ uint32_t cs7_instance;
+ bool cs7_instance_valid;
+ struct osmo_sccp_instance *sccp;
+ struct osmo_sccp_user *sccp_user;
+
+ /* Holds a copy of the our local MSC address,
+ * this will be the sccp-address that is associated
+ * with the A interface of this particular BSC,
+ * this address is filled up by the VTY interface */
+ struct osmo_sccp_addr bsc_addr;
+ char *bsc_addr_name;
+
+ /* Holds a copy of the MSC address. This is the
+ * address of the MSC that handles the calls of
+ * this BSC. The address is configured via the
+ * VTY interface */
+ struct osmo_sccp_addr msc_addr;
+ char *msc_addr_name;
+
+ struct a_reset_ctx *reset;
+ } a;
};
/*
diff --git a/include/openbsc/debug.h b/include/openbsc/debug.h
index de00b2930..65e197d52 100644
--- a/include/openbsc/debug.h
+++ b/include/openbsc/debug.h
@@ -40,6 +40,7 @@ enum {
DPCU,
DVLR,
DIUCS,
+ DSIGTRAN,
Debug_LastEntry,
};
diff --git a/include/openbsc/gsm_04_08.h b/include/openbsc/gsm_04_08.h
index 6d6ead183..ca251b00b 100644
--- a/include/openbsc/gsm_04_08.h
+++ b/include/openbsc/gsm_04_08.h
@@ -80,4 +80,6 @@ void allocate_security_operation(struct gsm_subscriber_connection *conn);
int gsm48_multirate_config(uint8_t *lv, const struct amr_multirate_conf *mr, const struct amr_mode *modes);
+int gsm48_tch_rtp_create(struct gsm_trans *trans);
+
#endif
diff --git a/include/openbsc/gsm_data.h b/include/openbsc/gsm_data.h
index f4de38105..43fc6d330 100644
--- a/include/openbsc/gsm_data.h
+++ b/include/openbsc/gsm_data.h
@@ -12,12 +12,14 @@
#include <osmocom/core/stats.h>
#include <osmocom/crypt/auth.h>
+#include <osmocom/sigtran/sccp_sap.h>
#include <openbsc/common.h>
#include <openbsc/rest_octets.h>
#include <openbsc/common_cs.h>
#include <openbsc/mgcpgw_client.h>
+
/** annotations for msgb ownership */
#define __uses
@@ -193,14 +195,33 @@ struct gsm_subscriber_connection {
uint16_t lac;
struct gsm_encr encr;
+ struct {
+ unsigned int mgcp_rtp_endpoint;
+ uint16_t port_subscr;
+ uint16_t port_cn;
+ } rtp;
+
/* which Iu-CS connection, if any. */
struct {
struct ue_conn_ctx *ue_ctx;
- unsigned int mgcp_rtp_endpoint;
- uint16_t mgcp_rtp_port_ue;
- uint16_t mgcp_rtp_port_cn;
uint8_t rab_id;
} iu;
+
+ struct {
+ /* A pointer to the SCCP user that handles
+ * the SCCP connections for this subscriber
+ * connection */
+ struct osmo_sccp_user *scu;
+
+ /* The address of the BSC that is associated
+ * with this subscriber connection */
+ struct osmo_sccp_addr bsc_addr;
+
+ /* The connection identifier that is used
+ * to reference the SCCP connection that is
+ * associated with this subscriber connection */
+ int conn_id;
+ } a;
};
@@ -470,8 +491,20 @@ struct gsm_network {
} mgcpgw;
struct {
+ /* CS7 instance id number (set via VTY) */
+ uint32_t cs7_instance;
enum nsap_addr_enc rab_assign_addr_enc;
+ struct osmo_sccp_instance *sccp;
} iu;
+
+ struct {
+ /* CS7 instance id number (set via VTY) */
+ uint32_t cs7_instance;
+ /* A list with the context information about
+ * all BSCs we have connections with */
+ struct llist_head bscs;
+ struct osmo_sccp_instance *sccp;
+ } a;
};
struct osmo_esme;
diff --git a/include/openbsc/gsm_data_shared.h b/include/openbsc/gsm_data_shared.h
index 60da2e5c0..bed46d254 100644
--- a/include/openbsc/gsm_data_shared.h
+++ b/include/openbsc/gsm_data_shared.h
@@ -252,6 +252,16 @@ struct gsm_lchan {
uint8_t speech_mode;
#ifdef ROLE_BSC
struct rtp_socket *rtp_socket;
+
+ /* info we need to postpone the AoIP
+ * assignment completed message */
+ struct {
+ uint8_t rr_cause;
+ uint8_t chosen_channel;
+ uint8_t encr_alg_id;
+ uint8_t speech_mode;
+ bool valid;
+ } ass_compl;
#else
struct osmo_rtp_socket *rtp_socket;
#endif
diff --git a/include/openbsc/iu.h b/include/openbsc/iu.h
index 5b298301d..08e4cd06b 100644
--- a/include/openbsc/iu.h
+++ b/include/openbsc/iu.h
@@ -5,13 +5,15 @@
#include <osmocom/core/linuxlist.h>
#include <osmocom/gsm/gsm48.h>
+#include <osmocom/sigtran/sccp_sap.h>
#include <openbsc/common.h>
struct sgsn_pdp_ctx;
struct msgb;
-struct osmo_sccp_link;
struct gsm_auth_tuple;
+struct osmo_sccp_addr;
+struct osmo_ss7_instance;
struct RANAP_RAB_SetupOrModifiedItemIEs_s;
struct RANAP_GlobalRNC_ID;
@@ -23,7 +25,10 @@ extern int asn1_xer_print;
struct ue_conn_ctx {
struct llist_head list;
- struct osmo_sccp_link *link;
+ /* TODO: It's not needed to store the full SCCP address for each
+ * UE. Rather than that, a pointer to the RNC should be far
+ * sufficient */
+ struct osmo_sccp_addr sccp_addr;
uint32_t conn_id;
int integrity_active;
struct gprs_ra_id ra_id;
@@ -53,11 +58,9 @@ typedef int (* iu_event_cb_t )(struct ue_conn_ctx *ue_ctx,
typedef int (* iu_rab_ass_resp_cb_t )(struct ue_conn_ctx *ue_ctx, uint8_t rab_id,
struct RANAP_RAB_SetupOrModifiedItemIEs_s *setup_ies);
-int iu_init(void *ctx, const char *listen_addr, uint16_t listen_port,
+int iu_init(void *ctx, struct osmo_sccp_instance *sccp,
iu_recv_cb_t iu_recv_cb, iu_event_cb_t iu_event_cb);
-void iu_link_del(struct osmo_sccp_link *link);
-
int iu_tx(struct msgb *msg, uint8_t sapi);
int iu_page_cs(const char *imsi, const uint32_t *tmsi, uint16_t lac);
diff --git a/include/openbsc/mgcpgw_client.h b/include/openbsc/mgcpgw_client.h
index b353db0a4..b1b5fd42b 100644
--- a/include/openbsc/mgcpgw_client.h
+++ b/include/openbsc/mgcpgw_client.h
@@ -3,11 +3,11 @@
#include <stdint.h>
#include <osmocom/core/linuxlist.h>
+#include <osmocom/core/write_queue.h>
enum mgcp_connection_mode;
struct msgb;
-struct mgcpgw_client;
struct vty;
#define MGCPGW_CLIENT_LOCAL_ADDR_DEFAULT "0.0.0.0"
@@ -24,6 +24,9 @@ struct mgcpgw_client_conf {
int local_port;
const char *remote_addr;
int remote_port;
+ uint16_t first_endpoint;
+ uint16_t last_endpoint;
+ uint16_t bts_base;
};
struct mgcp_response_head {
@@ -38,6 +41,20 @@ struct mgcp_response {
uint16_t audio_port;
};
+struct mgcpgw_client {
+ struct mgcpgw_client_conf actual;
+ uint32_t remote_addr;
+ struct osmo_wqueue wq;
+ mgcp_trans_id_t next_trans_id;
+ struct llist_head responses_pending;
+ struct llist_head inuse_endpoints;
+};
+
+struct mgcp_inuse_endpoint {
+ struct llist_head entry;
+ uint16_t id;
+};
+
/* Invoked when an MGCP response is received or sending failed. When the
* response is passed as NULL, this indicates failure during transmission. */
typedef void (* mgcp_response_cb_t )(struct mgcp_response *response, void *priv);
@@ -61,7 +78,11 @@ const char *mgcpgw_client_remote_addr_str(struct mgcpgw_client *mgcp);
uint16_t mgcpgw_client_remote_port(struct mgcpgw_client *mgcp);
uint32_t mgcpgw_client_remote_addr_n(struct mgcpgw_client *mgcp);
-unsigned int mgcpgw_client_next_endpoint(struct mgcpgw_client *client);
+/* Find and seize an unsused endpoint id */
+int mgcpgw_client_next_endpoint(struct mgcpgw_client *client);
+
+/* Release a seized endpoint id to make it available again for other calls */
+void mgcpgw_client_release_endpoint(uint16_t id, struct mgcpgw_client *client);
int mgcp_response_parse_params(struct mgcp_response *r);
@@ -76,6 +97,9 @@ struct msgb *mgcp_msg_mdcx(struct mgcpgw_client *mgcp,
uint16_t rtp_endpoint, const char *rtp_conn_addr,
uint16_t rtp_port, enum mgcp_connection_mode mode);
+struct msgb *mgcp_msg_dlcx(struct mgcpgw_client *mgcp, uint16_t rtp_endpoint,
+ unsigned int call_id);
+
void mgcpgw_client_vty_init(int node, struct mgcpgw_client_conf *conf);
int mgcpgw_client_config_write(struct vty *vty, const char *indent);
diff --git a/include/openbsc/msc_ifaces.h b/include/openbsc/msc_ifaces.h
index 2965c72c5..a1071ae9b 100644
--- a/include/openbsc/msc_ifaces.h
+++ b/include/openbsc/msc_ifaces.h
@@ -28,20 +28,6 @@
/* Each main linkage must implement this function (see comment above). */
extern int iu_tx(struct msgb *msg, uint8_t sapi);
-/* So far this is a dummy implemented in libmsc/a_iface.c. When A-interface
- * gets implemented, it should be in a separate lib (like libiu), this function
- * should move there, and the following comment should remain here: "
- * Each main linkage must implement this function (see comment above).
- * " */
-extern int a_tx(struct msgb *msg);
-
-/* So far this is a dummy implemented in libmsc/a_iface.c. When A-interface
- * gets implemented, it should be in a separate lib (like libiu), this function
- * should move there, and the following comment should remain here: "
- * Each main linkage must implement this function (see comment above).
- * " */
-extern int a_page(const char *imsi, uint32_t tmsi, uint16_t lac);
-
int msc_tx_dtap(struct gsm_subscriber_connection *conn,
struct msgb *msg);
@@ -49,10 +35,8 @@ int msc_gsm48_tx_mm_serv_ack(struct gsm_subscriber_connection *conn);
int msc_gsm48_tx_mm_serv_rej(struct gsm_subscriber_connection *conn,
enum gsm48_reject_value value);
-/* TODO: specific to A interface, move this away */
-int msc_gsm0808_tx_cipher_mode(struct gsm_subscriber_connection *conn, int cipher,
- const uint8_t *key, int len, int include_imeisv);
-
int msc_tx_common_id(struct gsm_subscriber_connection *conn);
int msc_call_assignment(struct gsm_trans *trans);
int msc_call_bridge(struct gsm_trans *trans1, struct gsm_trans *trans2);
+void msc_call_release(struct gsm_trans *trans);
+int msc_call_connect(struct gsm_trans *trans, uint16_t port, uint32_t ip);
diff --git a/include/openbsc/osmo_bsc.h b/include/openbsc/osmo_bsc.h
index 9e688fd59..5ebea5079 100644
--- a/include/openbsc/osmo_bsc.h
+++ b/include/openbsc/osmo_bsc.h
@@ -26,6 +26,7 @@ struct osmo_bsc_sccp_con {
/* for audio handling */
uint16_t cic;
+ uint32_t rtp_ip;
int rtp_port;
/* for advanced ping/pong */
@@ -44,6 +45,9 @@ struct osmo_bsc_sccp_con {
uint8_t new_subscriber;
struct bsc_filter_state filter_state;
+
+ /* Sigtran connection ID */
+ int conn_id;
};
struct bsc_api *osmo_bsc_api();
@@ -60,7 +64,7 @@ int bsc_scan_msc_msg(struct gsm_subscriber_connection *conn, struct msgb *msg);
int bsc_send_welcome_ussd(struct gsm_subscriber_connection *conn);
int bsc_handle_udt(struct bsc_msc_data *msc, struct msgb *msg, unsigned int length);
-int bsc_handle_dt1(struct osmo_bsc_sccp_con *conn, struct msgb *msg, unsigned int len);
+int bsc_handle_dt(struct osmo_bsc_sccp_con *conn, struct msgb *msg, unsigned int len);
int bsc_ctrl_cmds_install();
diff --git a/include/openbsc/osmo_bsc_reset.h b/include/openbsc/osmo_bsc_reset.h
new file mode 100644
index 000000000..578f763e6
--- /dev/null
+++ b/include/openbsc/osmo_bsc_reset.h
@@ -0,0 +1,34 @@
+/* (C) 2017 by sysmocom s.f.m.c. GmbH
+ * All Rights Reserved
+ *
+ * Author: Philipp Maier
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation; either version 3 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/* Create and start state machine which handles the reset/reset-ack procedure */
+void start_reset_fsm(struct bsc_msc_data *msc);
+
+/* Confirm that we sucessfully received a reset acknowlege message */
+void reset_ack_confirm(struct bsc_msc_data *msc);
+
+/* Report a failed connection */
+void report_conn_fail(struct bsc_msc_data *msc);
+
+/* Report a successful connection */
+void report_conn_success(struct bsc_msc_data *msc);
+
+/* Check if we have a connection to a specified msc */
+bool sccp_conn_ready(struct bsc_msc_data *msc);
diff --git a/include/openbsc/osmo_bsc_sigtran.h b/include/openbsc/osmo_bsc_sigtran.h
new file mode 100644
index 000000000..fbcfcb3fc
--- /dev/null
+++ b/include/openbsc/osmo_bsc_sigtran.h
@@ -0,0 +1,48 @@
+/* (C) 2017 by Sysmocom s.f.m.c. GmbH
+ * All Rights Reserved
+ *
+ * Author: Philipp Maier
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation; either version 3 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#pragma once
+
+#include <openbsc/gsm_data.h>
+#include <openbsc/bsc_msc_data.h>
+
+/* Allocate resources to make a new connection oriented sigtran connection
+ * (not the connection ittself!) */
+enum bsc_con osmo_bsc_sigtran_new_conn(struct gsm_subscriber_connection *conn, struct bsc_msc_data *msc);
+
+/* Open a new connection oriented sigtran connection */
+int osmo_bsc_sigtran_open_conn(const struct osmo_bsc_sccp_con *conn, struct msgb *msg);
+
+/* Send data to MSC */
+int osmo_bsc_sigtran_send(const struct osmo_bsc_sccp_con *conn, struct msgb *msg);
+
+/* Delete a connection from the list with open connections
+ * (called by osmo_bsc_api.c on failing open connections and
+ * locally, when a connection is closed by the MSC */
+int osmo_bsc_sigtran_del_conn(struct osmo_bsc_sccp_con *sccp);
+
+/* Initalize osmo sigtran backhaul */
+int osmo_bsc_sigtran_init(struct llist_head *mscs);
+
+/* Close all open sigtran connections and channels */
+void osmo_bsc_sigtran_reset(const struct bsc_msc_data *msc);
+
+/* Send reset-ack to MSC */
+void osmo_bsc_sigtran_tx_reset_ack(const struct bsc_msc_data *msc);
diff --git a/include/openbsc/osmo_msc.h b/include/openbsc/osmo_msc.h
index bc96f1d5a..cdfd27f11 100644
--- a/include/openbsc/osmo_msc.h
+++ b/include/openbsc/osmo_msc.h
@@ -63,6 +63,8 @@ int msc_create_conn_fsm(struct gsm_subscriber_connection *conn, const char *id);
int msc_vlr_alloc(struct gsm_network *net);
int msc_vlr_start(struct gsm_network *net);
+void msc_sapi_n_reject(struct gsm_subscriber_connection *conn, int dlci);
+int msc_clear_request(struct gsm_subscriber_connection *conn, uint32_t cause);
int msc_compl_l3(struct gsm_subscriber_connection *conn,
struct msgb *msg, uint16_t chosen_channel);
void msc_dtap(struct gsm_subscriber_connection *conn, uint8_t link_id,
@@ -70,6 +72,11 @@ void msc_dtap(struct gsm_subscriber_connection *conn, uint8_t link_id,
void msc_cipher_mode_compl(struct gsm_subscriber_connection *conn,
struct msgb *msg, uint8_t alg_id);
void msc_rx_sec_mode_compl(struct gsm_subscriber_connection *conn);
+void msc_classmark_chg(struct gsm_subscriber_connection *conn,
+ const uint8_t *cm2, uint8_t cm2_len,
+ const uint8_t *cm3, uint8_t cm3_len);
+void msc_assign_fail(struct gsm_subscriber_connection *conn,
+ uint8_t cause, uint8_t *rr_cause);
void msc_subscr_conn_init(void);
bool msc_subscr_conn_is_accepted(struct gsm_subscriber_connection *conn);
diff --git a/include/openbsc/transaction.h b/include/openbsc/transaction.h
index 713d878f3..4930fbd32 100644
--- a/include/openbsc/transaction.h
+++ b/include/openbsc/transaction.h
@@ -46,6 +46,16 @@ struct gsm_trans {
/* is thats one paging? */
struct subscr_request *paging_request;
+ /* bearer capabilities (rate and codec) */
+ struct gsm_mncc_bearer_cap bearer_cap;
+
+ /* status of the assignment, true when done */
+ bool assignment_done;
+
+ /* if true, TCH_RTP_CREATE is sent after the
+ * assignment is done */
+ bool tch_rtp_create;
+
union {
struct {