aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/include
diff options
context:
space:
mode:
authorPhilipp Maier <pmaier@sysmocom.de>2017-06-12 17:40:01 +0200
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2017-06-18 17:50:09 +0200
commit738cc1106c0273a918350f495a6a746d06fc2e2a (patch)
tree2d887c4ffd9d6dbca354371875d68236f08d4d16 /openbsc/include
parent2abf6b020090788b03d0d1d9207acd62d6a6abcb (diff)
libcommon-cs: genralize a interface reset fsm
The AoIP standard also describes an MSC->BSC reset procedure. We currently do not implement it. However, the fsm that is used to issue the reset request from the bsc side is not generalized. This patch generalizes the code in order to be able to use the same code on the MSC side to perform a reset procedure from there.
Diffstat (limited to 'openbsc/include')
-rw-r--r--openbsc/include/openbsc/Makefile.am2
-rw-r--r--openbsc/include/openbsc/a_reset.h (renamed from openbsc/include/openbsc/osmo_bsc_reset.h)36
-rw-r--r--openbsc/include/openbsc/bsc_msc.h4
-rw-r--r--openbsc/include/openbsc/osmo_bsc_sigtran.h6
4 files changed, 34 insertions, 14 deletions
diff --git a/openbsc/include/openbsc/Makefile.am b/openbsc/include/openbsc/Makefile.am
index e1ae6d2d8..4a5223666 100644
--- a/openbsc/include/openbsc/Makefile.am
+++ b/openbsc/include/openbsc/Makefile.am
@@ -67,7 +67,7 @@ noinst_HEADERS = \
openbscdefines.h \
osmo_bsc.h \
osmo_bsc_grace.h \
- osmo_bsc_reset.h \
+ a_reset.h \
osmo_bsc_rf.h \
osmo_msc.h \
osmo_bsc_sigtran.h \
diff --git a/openbsc/include/openbsc/osmo_bsc_reset.h b/openbsc/include/openbsc/a_reset.h
index 578f763e6..124cf13f1 100644
--- a/openbsc/include/openbsc/osmo_bsc_reset.h
+++ b/openbsc/include/openbsc/a_reset.h
@@ -18,17 +18,43 @@
*
*/
+#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 */
-void start_reset_fsm(struct bsc_msc_data *msc);
+void a_reset_start(struct a_reset_ctx *reset);
/* Confirm that we sucessfully received a reset acknowlege message */
-void reset_ack_confirm(struct bsc_msc_data *msc);
+void a_reset_ack_confirm(struct a_reset_ctx *reset);
/* Report a failed connection */
-void report_conn_fail(struct bsc_msc_data *msc);
+void a_reset_conn_fail(struct a_reset_ctx *reset);
/* Report a successful connection */
-void report_conn_success(struct bsc_msc_data *msc);
+void a_reset_conn_success(struct a_reset_ctx *reset);
/* Check if we have a connection to a specified msc */
-bool sccp_conn_ready(struct bsc_msc_data *msc);
+bool a_reset_conn_ready(struct a_reset_ctx *reset);
diff --git a/openbsc/include/openbsc/bsc_msc.h b/openbsc/include/openbsc/bsc_msc.h
index b80729c3a..a7c881b84 100644
--- a/openbsc/include/openbsc/bsc_msc.h
+++ b/openbsc/include/openbsc/bsc_msc.h
@@ -25,6 +25,7 @@
#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>
@@ -60,8 +61,7 @@ struct bsc_msc_connection {
struct osmo_sccp_user *sccp_user;
struct osmo_sccp_addr g_calling_addr;
struct osmo_sccp_addr g_called_addr;
- struct osmo_fsm_inst *fsm_reset;
- unsigned int msc_conn_loss_count;
+ struct a_reset_ctx reset;
int conn_id_counter;
};
diff --git a/openbsc/include/openbsc/osmo_bsc_sigtran.h b/openbsc/include/openbsc/osmo_bsc_sigtran.h
index 92d8ba64e..caeea6092 100644
--- a/openbsc/include/openbsc/osmo_bsc_sigtran.h
+++ b/openbsc/include/openbsc/osmo_bsc_sigtran.h
@@ -38,11 +38,5 @@ int osmo_bsc_sigtran_send(struct osmo_bsc_sccp_con *conn, struct msgb *msg);
* locally, when a connection is closed by the MSC */
int osmo_bsc_sigtran_del_conn(struct osmo_bsc_sccp_con *sccp);
-/* Send reset to MSC */
-void osmo_bsc_sigtran_tx_reset(struct bsc_msc_data *msc);
-
-/* close all open connections */
-void osmo_bsc_sigtran_reset(struct bsc_msc_data *msc);
-
/* Initalize osmo sigtran backhaul */
int osmo_bsc_sigtran_init(struct llist_head *mscs);