aboutsummaryrefslogtreecommitdiffstats
path: root/src/sccp_lbcs.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2021-02-06 23:21:55 +0100
committerHarald Welte <laforge@osmocom.org>2021-02-08 18:00:56 +0100
commit943affdd48151dfeca009976dd78db79fb77ca55 (patch)
treea23bf7616ca06d3c964efbcdf0dec9aab0e6a9e0 /src/sccp_lbcs.c
parent6cb841b92bf1457dd11cba02fca25ce74836d2e5 (diff)
sccp: Notify users of point code available/unavailable
* add N-PCSTATE.ind and N-STATE.ind definitions to SCCP user SAP * add minimal SCMG (SCCP Management) and LBCS (Local Broadcast) * generate MTP-PAUSE.ind/MTP-RESUME.ind based on received xUA DUNA/DAVA * generate N-PCSTATE.ind towards the local SCCP users Change-Id: Idb799f7d7ab329ad12f07b7cbe6336da0891ae92 Related: OS#2623, OS#3403, OS#4701
Diffstat (limited to 'src/sccp_lbcs.c')
-rw-r--r--src/sccp_lbcs.c68
1 files changed, 68 insertions, 0 deletions
diff --git a/src/sccp_lbcs.c b/src/sccp_lbcs.c
new file mode 100644
index 0000000..3aa4f7a
--- /dev/null
+++ b/src/sccp_lbcs.c
@@ -0,0 +1,68 @@
+/* SCCP Local Broadcast (LBCS) according to ITU-T Q.713/Q.714 */
+
+/* (C) 2021 by Harald Welte <laforge@gnumonks.org>
+ * All Rights reserved
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <string.h>
+
+#include <osmocom/core/utils.h>
+#include <osmocom/core/linuxlist.h>
+#include <osmocom/core/logging.h>
+#include <osmocom/core/timer.h>
+#include <osmocom/core/fsm.h>
+
+#include <osmocom/sigtran/sccp_sap.h>
+#include <osmocom/sigtran/protocol/sua.h>
+#include <osmocom/sccp/sccp_types.h>
+
+#include "xua_internal.h"
+#include "sccp_internal.h"
+
+/* perform a "local broadcast" of a N-PCSTATE.ind */
+void sccp_lbcs_local_bcast_pcstate(struct osmo_sccp_instance *inst,
+ const struct osmo_scu_pcstate_param *pcstate)
+{
+ struct osmo_sccp_user *scu;
+
+ llist_for_each_entry(scu, &inst->users, list) {
+ struct msgb *upmsg = sccp_msgb_alloc(__func__);
+ struct osmo_scu_prim *prim = (struct osmo_scu_prim *) msgb_put(upmsg, sizeof(*prim));
+ osmo_prim_init(&prim->oph, SCCP_SAP_USER, OSMO_SCU_PRIM_N_PCSTATE,
+ PRIM_OP_INDICATION, upmsg);
+ prim->u.pcstate = *pcstate;
+ sccp_user_prim_up(scu, prim);
+ }
+}
+
+/* perform a "local broadcast" of a N-STATE.ind */
+void sccp_lbcs_local_bcast_state(struct osmo_sccp_instance *inst,
+ const struct osmo_scu_state_param *state)
+{
+ struct osmo_sccp_user *scu;
+
+ llist_for_each_entry(scu, &inst->users, list) {
+ struct msgb *upmsg = sccp_msgb_alloc(__func__);
+ struct osmo_scu_prim *prim = (struct osmo_scu_prim *) msgb_put(upmsg, sizeof(*prim));
+ osmo_prim_init(&prim->oph, SCCP_SAP_USER, OSMO_SCU_PRIM_N_STATE,
+ PRIM_OP_INDICATION, upmsg);
+ prim->u.state = *state;
+ sccp_user_prim_up(scu, prim);
+ }
+}