Add WIP code for SCCP User Adaptation (SUA) and SCCP User SAP
The idea of this code is to
* provide a SCCP User SAP as boundary between the User of SCCP
or SCCP-like transport like SUA
* implement the minimum subset of SUA to transport RANAP messages
betweene HNB-GW and MSC/SGSN
At this point
* we don't yet implement the proper state machines and timer
* we don't imp[lement the SCCP RESET procedure
* we don't implement AS/ASP management
The code is full of FIXMEs whihc hopefully will get fixed gradually.
After some cleanup + verification, it should move to a library, possibly
either replacing/renaming libomo-sccp, or adding it to libosmo-netif?
diff --git a/sigtran/sccp_sap.c b/sigtran/sccp_sap.c
new file mode 100644
index 0000000..207d7ea
--- /dev/null
+++ b/sigtran/sccp_sap.c
@@ -0,0 +1,43 @@
+#include <string.h>
+#include <osmocom/core/utils.h>
+
+#include "sccp_sap.h"
+
+const struct value_string osmo_scu_prim_names[] = {
+ { OSMO_SCU_PRIM_N_CONNECT, "N-CONNECT" },
+ { OSMO_SCU_PRIM_N_DATA, "N-DATA" },
+ { OSMO_SCU_PRIM_N_EXPEDITED_DATA, "N-EXPEDITED-DATA" },
+ { OSMO_SCU_PRIM_N_DISCONNECT, "N-DISCONNECT" },
+ { OSMO_SCU_PRIM_N_RESET, "N-RESET" },
+ { OSMO_SCU_PRIM_N_INFORM, "N-INFORM" },
+ { OSMO_SCU_PRIM_N_UNITDATA, "N-UNITDATA" },
+ { OSMO_SCU_PRIM_N_NOTICE, "N-NOTICE" },
+ /* management */
+ { OSMO_SCU_PRIM_N_COORD, "N-COORD" },
+ { OSMO_SCU_PRIM_N_STATE, "N-STATE" },
+ { OSMO_SCU_PRIM_N_PCSTATE, "N-PCSATE" },
+ { 0, NULL }
+};
+
+const struct value_string osmo_prim_op_names[] = {
+ { PRIM_OP_REQUEST, "request" },
+ { PRIM_OP_RESPONSE, "response" },
+ { PRIM_OP_INDICATION, "indication" },
+ { PRIM_OP_CONFIRM, "confirm" },
+ { 0, NULL }
+};
+
+static char prim_name_buf[128];
+
+char *osmo_sccp_prim_name(struct osmo_prim_hdr *oph)
+{
+ const char *name = get_value_string(osmo_scu_prim_names, oph->primitive);
+
+ prim_name_buf[0] = '\0';
+ strncpy(prim_name_buf, name, sizeof(prim_name_buf)-1);
+ prim_name_buf[sizeof(prim_name_buf)-1] = '\0';
+ name = get_value_string(osmo_prim_op_names, oph->operation);
+ strncat(prim_name_buf, name, sizeof(prim_name_buf)-strlen(prim_name_buf)-2);
+
+ return prim_name_buf;
+}