jolly has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/libosmocore/+/32930 )


Change subject: ASCI: Add 3GPP TS 44.068 and 44.069 protocol definitions
......................................................................

ASCI: Add 3GPP TS 44.068 and 44.069 protocol definitions

Change-Id: I3554cea47e714c8fca18c3e9c0e6e80695915a90
---
M include/osmocom/gsm/protocol/Makefile.am
A include/osmocom/gsm/protocol/gsm_44_068.h
M src/gsm/Makefile.am
A src/gsm/gsm44068.c
M src/gsm/libosmogsm.map
5 files changed, 251 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/30/32930/1

diff --git a/include/osmocom/gsm/protocol/Makefile.am 
b/include/osmocom/gsm/protocol/Makefile.am
index 5c8e2a6..23429dc 100644
--- a/include/osmocom/gsm/protocol/Makefile.am
+++ b/include/osmocom/gsm/protocol/Makefile.am
@@ -18,6 +18,7 @@
        gsm_29_118.h \
        gsm_44_004.h \
        gsm_44_060.h \
+       gsm_44_068.h \
        gsm_44_318.h \
        gsm_48_049.h \
        gsm_48_071.h \
diff --git a/include/osmocom/gsm/protocol/gsm_44_068.h 
b/include/osmocom/gsm/protocol/gsm_44_068.h
new file mode 100644
index 0000000..751b6b2
--- /dev/null
+++ b/include/osmocom/gsm/protocol/gsm_44_068.h
@@ -0,0 +1,124 @@
+#pragma once
+#include <stdint.h>
+#include <osmocom/core/utils.h>
+
+/* Group Call Control (GCC) is an ETSI/3GPP standard protocol used between
+ * MS (Mobile Station) and MSC (Mobile Switchting Center) in 2G/GSM-R network.
+ * It is specified in 3GPP TS 44.068.
+ *
+ * (C) 2023 by Andreas Eversberg <[email protected]>
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ *
+ * Released under the terms of the GNU General Public License, Version 2 or
+ * (at your option) any later version.
+ */
+
+/* 9 Information Element Identifiers */
+enum gcc_iei {
+       GCC_IEI_MOBILE_IDENTITY         = 0x17,
+       GCC_IEI_USER_USER               = 0x7E,
+       GCC_IEI_CALL_STATE              = 0xA0,
+       GCC_IEI_STATE_ATTRIBUTES        = 0xB0,
+       GCC_IEI_TALKER_PRIORITY         = 0xC0,
+       GCC_IEI_SMS_INDICATIONS         = 0xD0,
+};
+
+/* 9.3 Message Type */
+enum gcc_msg_type {
+       GCC_MSGT_IMMEDIATE_SETUP        = 0x31,
+       GCC_MSGT_SETUP                  = 0x32,
+       GCC_MSGT_CONNECT                = 0x33,
+       GCC_MSGT_TERMINATION            = 0x34,
+       GCC_MSGT_TERMINATION_REQUEST    = 0x35,
+       GCC_MSGT_TERMINATION_REJECT     = 0x36,
+       GCC_MSGT_STATUS                 = 0x38,
+       GCC_MSGT_GET_STATUS             = 0x39,
+       GCC_MSGT_SET_PARAMETER          = 0x3a,
+       GCC_MSGT_IMMEDIATE_SETUP_2      = 0x3b,
+};
+
+/* Table 9.2 priority */
+enum gcc_priority_level {
+       GCC_PRIO_LEVEL_4                = 0x1,
+       GCC_PRIO_LEVEL_3                = 0x2,
+       GCC_PRIO_LEVEL_2                = 0x3,
+       GCC_PRIO_LEVEL_1                = 0x4,
+       GCC_PRIO_LEVEL_0                = 0x5,
+       GCC_PRIO_LEVEL_B                = 0x6,
+       GCC_PRIO_LEVEL_A                = 0x7,
+};
+
+/* 9.4.2 Call State */
+enum gcc_call_state {
+       GCC_CSTATE_U0                   = 0x0,
+       GCC_CSTATE_U1                   = 0x1,
+       GCC_CSTATE_U2sl                 = 0x2,
+       GCC_CSTATE_U3                   = 0x3,
+       GCC_CSTATE_U4                   = 0x4,
+       GCC_CSTATE_U5                   = 0x5,
+       GCC_CSTATE_U0p                  = 0x6,
+       GCC_CSTATE_Uwr                  = 0x7,
+       GCC_CSTATE_U2r                  = 0x8,
+       GCC_CSTATE_U2ws                 = 0x9,
+       GCC_CSTATE_U2sr                 = 0xa,
+       GCC_CSTATE_U2nc                 = 0xb,
+};
+
+/* 9.4.3 Cause */
+enum gcc_cause {
+       GCC_CAUSE_ILLEGAL_MS                            = 0x03,
+       GCC_CAUSE_IMEI_NOT_ACCEPTED                     = 0x05,
+       GCC_CAUSE_ILLEGAL_ME                            = 0x06,
+       GCC_CAUSE_SERVICE_NOT_AUTHORIZED                = 0x08,
+       GCC_CAUSE_APP_NOT_SUPPORTED_ON_PROTO            = 0x09,
+       GCC_CAUSE_RR_CONNECTION_ABORTED                 = 0x0a,
+       GCC_CAUSE_NORMAL_CALL_CLEARING                  = 0x10,
+       GCC_CAUSE_NETWORK_FAILURE                       = 0x11,
+       GCC_CAUSE_BUSY                                  = 0x14,
+       GCC_CAUSE_CONGESTION                            = 0x16,
+       GCC_CAUSE_USER_NOT_ORIGINATOR                   = 0x17,
+       GCC_CAUSE_NET_WANTS_TO_MAINTAIN_CALL            = 0x18,
+       GCC_CAUSE_RESPONSE_TO_GET_STATUS                = 0x1e,
+       GCC_CAUSE_SERVICE_OPTION_NOT_SUBSCR             = 0x20,
+       GCC_CAUSE_REQUESTED_SERVICE_NOT_SUB             = 0x21,
+       GCC_CAUSE_SERVICE_OPTION_OOO                    = 0x22,
+       GCC_CAUSE_CALL_CANNOT_BE_IDENTIFIED             = 0x26,
+       GCC_CAUSE_RETRY_UPON_ENTRY_NEW_CALL             = 0x30, /* up to 0x3f */
+       GCC_CAUSE_INVALID_TRANSACTION_ID                = 0x51,
+       GCC_CAUSE_SEMANTICALLY_INCORRECT_MSG            = 0x5f,
+       GCC_CAUSE_INVALID_MANDATORY_INFO                = 0x60,
+       GCC_CAUSE_MESSAGE_TYPE_NON_EXISTENT             = 0x61,
+       GCC_CAUSE_MESSAGE_TYPE_NOT_COMPAT               = 0x62,
+       GCC_CAUSE_IE_NON_EXISTENT                       = 0x63,
+       GCC_CAUSE_IE_NOT_COMPAT                         = 0x64,
+       GCC_CAUSE_PROTOCOL_ERROR                        = 0x70,
+};
+
+/* 9.4.4 Originator Indication */
+#define GCC_OI_MS_IS_ORIGINATOR                0x01
+
+/* 9.4.7 State Attributes */
+#define GCC_DA_DOWNLINK_ATTACHED       0x08
+#define GCC_UA_UPLINK_ATTACHED         0x04
+#define GCC_COMM_T                     0x02
+
+/* 9.4.9 Talker Priority */
+enum gcc_talker_priority {
+       GCC_PRIO_NORMAL                 = 0x0,
+       GCC_PRIO_PRIVILEGED             = 0x1,
+       GCC_PRIO_EMERGENCY              = 0x2,
+};
+
+/* 9.4.10 SMS Indications */
+#define GCC_DC_DATA_CONFIDENTALLY_RQD  0x02
+#define GCC_GP_GUARANTEED_PRIVACY_RQD  0x01
+
+extern const struct value_string gcc_msg_type_names[];
+extern const struct value_string gcc_priority_level_names[];
+extern const struct value_string gcc_cause_names[];
+extern const struct value_string gcc_call_state_names[];
+extern const struct value_string gcc_talker_priority_names[];
+
+extern const struct tlv_definition gcc_att_tlvdef;
diff --git a/src/gsm/Makefile.am b/src/gsm/Makefile.am
index ce0b1f4..ca850d2 100644
--- a/src/gsm/Makefile.am
+++ b/src/gsm/Makefile.am
@@ -33,7 +33,7 @@
                        gsup.c gsup_sms.c gprs_gea.c gsm0503_conv.c oap.c 
gsm0808_utils.c \
                        gsm23003.c gsm23236.c mncc.c bts_features.c 
oap_client.c \
                        gsm29118.c gsm48_rest_octets.c cbsp.c gsm48049.c \
-                       gad.c bsslap.c bssmap_le.c kdf.c iuup.c gsm44021.c
+                       gad.c bsslap.c bssmap_le.c kdf.c iuup.c gsm44021.c 
gsm44068.c

 libgsmint_la_LDFLAGS = -no-undefined
 libgsmint_la_LIBADD = $(top_builddir)/src/core/libosmocore.la 
$(top_builddir)/src/isdn/libosmoisdn.la
diff --git a/src/gsm/gsm44068.c b/src/gsm/gsm44068.c
new file mode 100644
index 0000000..f846c27
--- /dev/null
+++ b/src/gsm/gsm44068.c
@@ -0,0 +1,109 @@
+/* Group Call Control (GCC) is an ETSI/3GPP standard protocol used between
+ * MS (Mobile Station) and MSC (Mobile Switchting Center) in 2G/GSM-R network.
+ * It is specified in 3GPP TS 44.068.
+ *
+ * (C) 2023 by Andreas Eversberg <[email protected]>
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ *
+ * Released under the terms of the GNU General Public License, Version 2 or
+ * (at your option) any later version.
+ */
+
+#include <stddef.h>
+#include <osmocom/gsm/tlv.h>
+#include <osmocom/gsm/protocol/gsm_44_068.h>
+
+/***********************************************************************
+ * Protocol Definitions
+ ***********************************************************************/
+
+const struct value_string gcc_msg_type_names[] = {
+       { GCC_MSGT_IMMEDIATE_SETUP,             "IMMEDIATE SETUP" },
+       { GCC_MSGT_SETUP,                       "SETUP" },
+       { GCC_MSGT_CONNECT,                     "CONNECT" },
+       { GCC_MSGT_TERMINATION,                 "TERMINATION" },
+       { GCC_MSGT_TERMINATION_REQUEST,         "TERMINATION REQUEST" },
+       { GCC_MSGT_TERMINATION_REJECT,          "TERMINATION REJECT" },
+       { GCC_MSGT_STATUS,                      "STATUS" },
+       { GCC_MSGT_GET_STATUS,                  "GET STATUS" },
+       { GCC_MSGT_SET_PARAMETER,               "SET PARAMETER" },
+       { GCC_MSGT_IMMEDIATE_SETUP_2,           "IMMEDIATE SETUP 2" },
+       { 0, NULL }
+};
+
+const struct value_string gcc_priority_level_names[] = {
+       { GCC_PRIO_LEVEL_4,                     "priority level 4" },
+       { GCC_PRIO_LEVEL_3,                     "priority level 3" },
+       { GCC_PRIO_LEVEL_2,                     "priority level 2" },
+       { GCC_PRIO_LEVEL_1,                     "priority level 1" },
+       { GCC_PRIO_LEVEL_0,                     "priority level 0" },
+       { GCC_PRIO_LEVEL_B,                     "priority level B" },
+       { GCC_PRIO_LEVEL_A,                     "priority level A" },
+       { 0, NULL }
+};
+
+const struct value_string gcc_cause_names[] = {
+       { GCC_CAUSE_ILLEGAL_MS,                 "Illegal MS" },
+       { GCC_CAUSE_IMEI_NOT_ACCEPTED,          "IMEI not accepted" },
+       { GCC_CAUSE_ILLEGAL_ME,                 "Illegal ME" },
+       { GCC_CAUSE_SERVICE_NOT_AUTHORIZED,     "Service not authorized" },
+       { GCC_CAUSE_APP_NOT_SUPPORTED_ON_PROTO, "Application not supported on 
the protocol" },
+       { GCC_CAUSE_RR_CONNECTION_ABORTED,      "RR connection aborted" },
+       { GCC_CAUSE_NORMAL_CALL_CLEARING,       "Normal call clearing" },
+       { GCC_CAUSE_NETWORK_FAILURE,            "Network failure" },
+       { GCC_CAUSE_BUSY,                       "Busy" },
+       { GCC_CAUSE_CONGESTION,                 "Congestion" },
+       { GCC_CAUSE_USER_NOT_ORIGINATOR,        "User not originator of call" },
+       { GCC_CAUSE_NET_WANTS_TO_MAINTAIN_CALL, "Network wants to maintain 
call" },
+       { GCC_CAUSE_RESPONSE_TO_GET_STATUS,     "Response to GET STATUS" },
+       { GCC_CAUSE_SERVICE_OPTION_NOT_SUBSCR,  "Service option not supported" 
},
+       { GCC_CAUSE_REQUESTED_SERVICE_NOT_SUB,  "Requested service option not 
subscribed" },
+       { GCC_CAUSE_SERVICE_OPTION_OOO,         "Service option temporarily out 
of order" },
+       { GCC_CAUSE_CALL_CANNOT_BE_IDENTIFIED,  "Call cannot be identified" },
+       { GCC_CAUSE_RETRY_UPON_ENTRY_NEW_CALL,  "retry upon entry into a new 
cell" },
+       { GCC_CAUSE_INVALID_TRANSACTION_ID,     "Invalid transaction identifier 
value" },
+       { GCC_CAUSE_SEMANTICALLY_INCORRECT_MSG, "Semantically incorrect 
message" },
+       { GCC_CAUSE_INVALID_MANDATORY_INFO,     "Invalid mandatory information" 
},
+       { GCC_CAUSE_MESSAGE_TYPE_NON_EXISTENT,  "Message type non-existent or 
not implemented" },
+       { GCC_CAUSE_MESSAGE_TYPE_NOT_COMPAT,    "Message type not compatible 
with the protocol state" },
+       { GCC_CAUSE_IE_NON_EXISTENT,            "Information element 
non-existent or not implemented" },
+       { GCC_CAUSE_IE_NOT_COMPAT,              "Message type not compatible 
with the protocol state" },
+       { GCC_CAUSE_PROTOCOL_ERROR,             "Protocol error, unspecified" },
+       { 0, NULL }
+};
+
+const struct value_string gcc_call_state_names[] = {
+       { GCC_CSTATE_U0,                        "U0" },
+       { GCC_CSTATE_U1,                        "U1" },
+       { GCC_CSTATE_U2sl,                      "U2sl/U2" },
+       { GCC_CSTATE_U3,                        "U3" },
+       { GCC_CSTATE_U4,                        "U4" },
+       { GCC_CSTATE_U5,                        "U5" },
+       { GCC_CSTATE_U0p,                       "U0.p" },
+       { GCC_CSTATE_Uwr,                       "Uwr" },
+       { GCC_CSTATE_U2r,                       "U2r" },
+       { GCC_CSTATE_U2ws,                      "U2ws" },
+       { GCC_CSTATE_U2sr,                      "U2sr" },
+       { GCC_CSTATE_U2nc,                      "U2nc" },
+       { 0, NULL }
+};
+
+const struct value_string gcc_talker_priority_names[] = {
+       { GCC_PRIO_NORMAL,                      "Normal" },
+       { GCC_PRIO_PRIVILEGED,                  "Privileged" },
+       { GCC_PRIO_EMERGENCY,                   "Emergency" },
+       { 0, NULL }
+};
+
+const struct tlv_definition gcc_att_tlvdef = {
+       .def = {
+               [GCC_IEI_MOBILE_IDENTITY] =             { TLV_TYPE_TLV },
+               [GCC_IEI_USER_USER] =                   { TLV_TYPE_TLV },
+               [GCC_IEI_CALL_STATE] =                  { TLV_TYPE_SINGLE_TV },
+               [GCC_IEI_STATE_ATTRIBUTES] =            { TLV_TYPE_SINGLE_TV },
+               [GCC_IEI_TALKER_PRIORITY] =             { TLV_TYPE_SINGLE_TV },
+               [GCC_IEI_SMS_INDICATIONS] =             { TLV_TYPE_SINGLE_TV },
+       },
+};
diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map
index 003d6e8..52cda4c 100644
--- a/src/gsm/libosmogsm.map
+++ b/src/gsm/libosmogsm.map
@@ -471,6 +471,13 @@
 gsm48_pdisc_msgtype_name_c;
 gsm48_reject_value_names;

+gcc_msg_type_names;
+gcc_priority_level_names;
+gcc_cause_names;
+gcc_call_state_names;
+gcc_talker_priority_names;
+gcc_att_tlvdef;
+
 gsm_7bit_decode;
 gsm_7bit_decode_ussd;
 gsm_7bit_encode;

--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/32930
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I3554cea47e714c8fca18c3e9c0e6e80695915a90
Gerrit-Change-Number: 32930
Gerrit-PatchSet: 1
Gerrit-Owner: jolly <[email protected]>
Gerrit-MessageType: newchange

Reply via email to