lists.osmocom.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

gerrit-log

Thread Start a new thread
Download
Threads by month
  • ----- 2026 -----
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2025 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
gerrit-log@lists.osmocom.org

May 2023

  • 1 participants
  • 2583 discussions
[S] Change in libosmocore[master]: Add short L3 header to gsm_04_08.h
by Jenkins Builder 23 May '23

23 May '23
Jenkins Builder has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/32935 ) Change subject: Add short L3 header to gsm_04_08.h ...................................................................... Patch Set 1: (1 comment) File include/osmocom/gsm/protocol/gsm_04_08.h: Robot Comment from checkpatch (run ID jenkins-gerrit-lint-7259): https://gerrit.osmocom.org/c/libosmocore/+/32935/comment/16452a7c_71b8e6d1 PS1, Line 1424: /* Secion 11.3.2.1 3GPP TS 24.007: Short PDISC */ 'Secion' may be misspelled - perhaps 'Section'? -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/32935 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I0eceb380e401e1f842edbaa92f4b4738703a031c Gerrit-Change-Number: 32935 Gerrit-PatchSet: 1 Gerrit-Owner: jolly <andreas(a)eversberg.eu> Gerrit-CC: Jenkins Builder Gerrit-Comment-Date: Tue, 23 May 2023 14:03:15 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Gerrit-MessageType: comment
1 0
0 0
[L] Change in libosmocore[master]: ASCI: Add 3GPP TS 44.068 and 44.069 protocol definitions
by jolly 23 May '23

23 May '23
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 <jolly(a)eversberg.eu> + * 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 <jolly(a)eversberg.eu> + * 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 <andreas(a)eversberg.eu> Gerrit-MessageType: newchange
1 0
0 0
[L] Change in libosmocore[master]: ASCI: Add IE transcoding according to 3GPP TS 48.008
by jolly 23 May '23

23 May '23
jolly has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/32931 ) Change subject: ASCI: Add IE transcoding according to 3GPP TS 48.008 ...................................................................... ASCI: Add IE transcoding according to 3GPP TS 48.008 Change-Id: Ic1fc714bb04228a7f32e9925811e21c8efc610bd --- M include/osmocom/gsm/gsm0808_utils.h M src/gsm/gsm0808_utils.c M src/gsm/libosmogsm.map 3 files changed, 468 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/31/32931/1 diff --git a/include/osmocom/gsm/gsm0808_utils.h b/include/osmocom/gsm/gsm0808_utils.h index 85244a5..7b6c4e1 100644 --- a/include/osmocom/gsm/gsm0808_utils.h +++ b/include/osmocom/gsm/gsm0808_utils.h @@ -23,14 +23,14 @@ */ #pragma once -struct sockaddr_storage; - #include <osmocom/gsm/protocol/gsm_08_08.h> #include <osmocom/gsm/protocol/gsm_04_08.h> #include <osmocom/gsm/gsm29205.h> #include <osmocom/gsm/gsm23003.h> #include <osmocom/gsm/gsm_utils.h> #include <osmocom/gsm/tlv.h> +#include <osmocom/gsm/gsm48.h> +#include <sys/socket.h> /*! (225-1)/2 is the maximum number of elements in a cell identifier list. */ #define GSM0808_CELL_ID_LIST2_MAXLEN 127 @@ -62,6 +62,126 @@ unsigned int id_list_len; }; +/*! Parsed representation of a Priority IE (GGPP TS 48.008 3.2.2.18) */ +struct gsm0808_priority { + /* Preemtion Capability indicator */ + bool pci; + /* Priority level: 1 == hightest, 14 == lowest */ + uint8_t priority_level; + /* Queuing allowed indicator */ + bool qa; + /* Preemtion Vulnerability indicator */ + bool pvi; +}; + +/*! Parsed representation of a VGCS Feature Flags IE (3GPP TS 48.008 3.2.2.88) */ +struct gsm0808_vgcs_feature_flags { + /* Talker priority supported */ + bool tp_ind; + /* A-interface circuit sharing supported */ + bool as_ind_circuit; + /* A-interface link sharing supported */ + bool as_ind_link; + /* BSS supports re-establishment */ + bool bss_res; + /* Talker channel parameter supported */ + bool tcp; +}; + +/* TS 48.008 3.2.2.52 */ +enum gsm0808_assignment_requirement { + GSM0808_ASRQ_DELAY_ALLOWED = 0x00, + GSM0808_ASRQ_IMMEDIATE = 0x01, + GSM0808_ASRQ_IMMEDIATE_ON_DEMAND = 0x02, +}; + +/* TS 48.008 Table 10.5.8 */ +enum gsm0808_service_flag { + GSM0808_SF_VBS = 0, + GSM0808_SF_VGCS = 1, +}; + +enum gsm0808_call_priority { + GSM0808_CALL_PRIORITY_NONE = 0x00, + GSM0808_CALL_PRIORITY_LEVEL_4 = 0x01, + GSM0808_CALL_PRIORITY_LEVEL_3 = 0x02, + GSM0808_CALL_PRIORITY_LEVEL_2 = 0x03, + GSM0808_CALL_PRIORITY_LEVEL_1 = 0x04, + GSM0808_CALL_PRIORITY_LEVEL_0 = 0x05, + GSM0808_CALL_PRIORITY_LEVEL_B = 0x06, + GSM0808_CALL_PRIORITY_LEVEL_A = 0x07, +}; + +/*! Parsed representation of a Group Call Reference IE (3GPP TS 48.008 3.2.2.55) */ +struct gsm0808_group_callref { + /* Group or Broadcast Call Reference */ + uint32_t callref; + /* Service flag */ + enum gsm0808_service_flag sf; + /* Acknowledgement flag */ + bool af; + /* Call piorioity */ + enum gsm0808_call_priority call_priority; + /* Ciphering information (key number to use; 0 == no ciphering) */ + uint8_t ciphering_info; +}; + +/* TS 48.008 3.2.2.26 */ +enum gsm0808_downlink_dtx_flag { + GSM0808_DTX_FLAG_ALLOW = 0, + GSM0808_DTX_FLAG_FORBID = 1, +}; + +/*! Parsed representation of a Cell Identifier List Segment IE (3GPP TS 48.008 3.2.2.27a) */ +struct gsm0808_cell_id_list_segment { + uint8_t seq_last; + uint8_t seq_number; + struct gsm0808_cell_id_list2 cil; +}; + +/*! Parsed representation of a Circuit Pool List IE (3GPP TS 48.008 3.2.2.26) */ +#define CIRCUIT_POOL_LIST_MAXLEN 252 +struct gsm0808_circuit_pool_list { + uint8_t pool[CIRCUIT_POOL_LIST_MAXLEN]; + unsigned int list_len; +}; + +/* 3GPP TS 48.008 Table 3.2.2.90.1 Talker Priority */ +enum gsm0808_talker_priority { + GSM0808_TALKER_NORMAL_PRIORITY = 0x00, + GSM0808_TALKER_PRIVILEGED_PRIORITY = 0x01, + GSM0808_TALKER_EMERGENCY_PRIORITY = 0x02, +}; + +/*! Parsed representation of a Layer 3 Information IE (3GPP TS 48.008 3.2.2.24) */ +#define LAYER_3_INFORMATION_MAXLEN 252 +struct gsm0808_layer_3_information { + uint8_t l3[LAYER_3_INFORMATION_MAXLEN]; + unsigned int l3_len; +}; + +/*! Parsed representation of a Talker Identity IE (3GPP TS 48.008 3.2.2.91) */ +#define TALKER_IDENTITY_MAXLEN 17 +struct gsm0808_talker_identity { + uint8_t talker_id[TALKER_IDENTITY_MAXLEN]; + unsigned int id_bits; +}; + +/* 3GPP TS 48.008 3.2.2.94 VGCS/VBS Cell Status */ +enum gsm0808_vgcs_vbs_cell_status { + GSM0808_CSTAT_ESTABLISHED = 0x00, + GSM0808_CSTAT_NOT_ESTABLISHED1 = 0x01, + GSM0808_CSTAT_RELEASED_NO_USER = 0x02, + GSM0808_CSTAT_NOT_ESTABLISHED2 = 0x03, +}; + +/*! Parsed representation of a SMS to VGCS IE (3GPP TS 48.008 3.2.2.92) */ +#define SMS_TO_VGCS_MAXLEN 252 +struct gsm0808_sms_to_vgcs { + uint8_t sms[SMS_TO_VGCS_MAXLEN]; + unsigned int sms_len; +}; + /*! LCLS-related parameters from 3GPP TS 48.008 */ struct osmo_lcls { enum gsm0808_lcls_config config; /**< §3.2.2.116 Configuration */ @@ -303,4 +423,19 @@ char *gsm0808_channel_type_name_buf(char *buf, size_t buf_len, const struct gsm0808_channel_type *ct); char *gsm0808_channel_type_name_c(const void *ctx, const struct gsm0808_channel_type *ct); +uint8_t gsm0808_enc_group_callref(struct msgb *msg, const struct gsm0808_group_callref *gc); +int gsm0808_dec_group_callref(struct gsm0808_group_callref *gc, const uint8_t *elem, uint8_t len); +uint8_t gsm0808_enc_priority(struct msgb *msg, const struct gsm0808_priority *pri); +int gsm0808_dec_priority(struct gsm0808_priority *pri, const uint8_t *elem, uint8_t len); +uint8_t gsm0808_enc_vgcs_feature_flags(struct msgb *msg, const struct gsm0808_vgcs_feature_flags *ff); +int gsm0808_dec_vgcs_feature_flags(struct gsm0808_vgcs_feature_flags *ff, const uint8_t *elem, uint8_t len); +uint8_t gsm0808_enc_talker_identity(struct msgb *msg, const struct gsm0808_talker_identity *ti); +int gsm0808_dec_talker_identity(struct gsm0808_talker_identity *ti, const uint8_t *elem, uint8_t len); +uint8_t gsm0808_enc_assign_req(struct msgb *msg, const enum gsm0808_assignment_requirement ar); +int gsm0808_dec_assign_req(enum gsm0808_assignment_requirement *ar, const uint8_t *elem, uint8_t len); +uint8_t gsm0808_enc_cell_id_list_segment(struct msgb *msg, uint8_t ie_type, + const struct gsm0808_cell_id_list_segment *ci); +int gsm0808_dec_cell_id_list_segment(struct gsm0808_cell_id_list_segment *ci, const uint8_t *elem, uint8_t len); +int gsm0808_dec_call_id(uint32_t *ci, const uint8_t *elem, uint8_t len); + /*! @} */ diff --git a/src/gsm/gsm0808_utils.c b/src/gsm/gsm0808_utils.c index efa9305..0f04b04 100644 --- a/src/gsm/gsm0808_utils.c +++ b/src/gsm/gsm0808_utils.c @@ -2210,4 +2210,313 @@ return gsm0808_channel_type_name_buf(buf, 128, ct); } +/*! Encode Group Call Reference IE (3GPP TS 48.008 3.2.2.55). + * \param[out] msg Message Buffer to which IE is to be appended + * \param[in] gc Group Call Reference to be encoded + * \returns number of bytes appended to \a msg */ +uint8_t gsm0808_enc_group_callref(struct msgb *msg, const struct gsm0808_group_callref *gc) +{ + uint8_t *old_tail; + uint8_t *tlv_len; + uint8_t *ptr; + + OSMO_ASSERT(msg); + OSMO_ASSERT(gc); + + msgb_put_u8(msg, GSM0808_IE_GROUP_CALL_REFERENCE); + tlv_len = msgb_put(msg, 1); + old_tail = msg->tail; + + ptr = msgb_put(msg, 5); + osmo_store32be(gc->callref << 5, ptr); + ptr[3] |= gc->sf << 4; + ptr[3] |= gc->af << 3; + ptr[3] |= gc->call_priority; + ptr[4] |= gc->ciphering_info << 4; + + *tlv_len = (uint8_t) (msg->tail - old_tail); + return *tlv_len + 2; +} + +/*! Decode Group Call Reference IE (3GPP TS 48.008 3.2.2.55). + * \param[out] gc Group Call Reference structure to store data + * \param[in] elem IE value to be decoded. + * \param[in] len Length of \a elem in bytes. + * \returns number of bytes parsed; negative on error */ +int gsm0808_dec_group_callref(struct gsm0808_group_callref *gc, const uint8_t *elem, uint8_t len) +{ + OSMO_ASSERT(gc); + OSMO_ASSERT(elem); + + if (len != 5) + return -EINVAL; + + gc->callref = osmo_load32be(elem) >> 5; + gc->sf = (elem[3] >> 4) & 0x1; + gc->af = (elem[3] >> 3) & 0x1; + gc->call_priority = elem[3] & 0x7; + gc->ciphering_info = elem[4] >> 4; + + return 5; +} + +/*! Encode Priority IE (3GPP TS 48.008 3.2.2.18). + * \param[out] msg Message Buffer to which IE is to be appended + * \param[in] pri Priority to be encoded + * \returns number of bytes appended to \a msg */ +uint8_t gsm0808_enc_priority(struct msgb *msg, const struct gsm0808_priority *pri) +{ + uint8_t *old_tail; + uint8_t *tlv_len; + uint8_t *ptr; + + OSMO_ASSERT(msg); + OSMO_ASSERT(pri); + + msgb_put_u8(msg, GSM0808_IE_PRIORITY); + tlv_len = msgb_put(msg, 1); + old_tail = msg->tail; + + ptr = msgb_put(msg, 1); + ptr[0] = pri->pci << 6; + ptr[0] |= pri->priority_level << 2; + ptr[0] |= pri->qa << 1; + ptr[0] |= pri->pvi; + + *tlv_len = (uint8_t) (msg->tail - old_tail); + return *tlv_len + 2; +} + +/*! Decode Priority IE (3GPP TS 48.008 3.2.2.18). + * \param[out] pri Priority structure to store data + * \param[in] elem IE value to be decoded. + * \param[in] len Length of \a elem in bytes. + * \returns number of bytes parsed; negative on error */ +int gsm0808_dec_priority(struct gsm0808_priority *pri, const uint8_t *elem, uint8_t len) +{ + OSMO_ASSERT(pri); + OSMO_ASSERT(elem); + + if (len != 1) + return -EINVAL; + + pri->pci = (elem[0] >> 6) & 0x1; + pri->priority_level = (elem[0] >> 2) & 0xf; + pri->qa = (elem[0] >> 1) & 0x1; + pri->pvi = elem[0] & 0x1; + + return 1; +} + +/*! Encode VGCS Feature Flags IE (3GPP TS 48.008 3.2.2.88). + * \param[out] msg Message Buffer to which IE is to be appended + * \param[in] ff VGCS Feature Flags to be encoded + * \returns number of bytes appended to \a msg */ +uint8_t gsm0808_enc_vgcs_feature_flags(struct msgb *msg, const struct gsm0808_vgcs_feature_flags *ff) +{ + uint8_t *old_tail; + uint8_t *tlv_len; + uint8_t *ptr; + + OSMO_ASSERT(msg); + OSMO_ASSERT(ff); + + msgb_put_u8(msg, GSM0808_IE_VGCS_FEATURE_FLAGS); + tlv_len = msgb_put(msg, 1); + old_tail = msg->tail; + + ptr = msgb_put(msg, 1); + ptr[0] = ff->tcp << 4; + ptr[0] |= ff->bss_res << 3; + ptr[0] |= ff->as_ind_link << 2; + ptr[0] |= ff->as_ind_circuit << 1; + ptr[0] |= ff->tp_ind; + + *tlv_len = (uint8_t) (msg->tail - old_tail); + return *tlv_len + 2; +} + +/*! Decode VGCS Feature Flags IE (3GPP TS 48.008 3.2.2.88). + * \param[out] ff VGCS Feature Flags structure to store data + * \param[in] elem IE value to be decoded. + * \param[in] len Length of \a elem in bytes. + * \returns number of bytes parsed; negative on error */ +int gsm0808_dec_vgcs_feature_flags(struct gsm0808_vgcs_feature_flags *ff, const uint8_t *elem, uint8_t len) +{ + OSMO_ASSERT(ff); + OSMO_ASSERT(elem); + + if (len != 1) + return -EINVAL; + + ff->tcp = (elem[0] >> 4) & 0x1; + ff->bss_res = (elem[0] >> 3) & 0x1; + ff->as_ind_link = (elem[0] >> 2) & 0x1; + ff->as_ind_circuit = (elem[0] >> 1) & 0x1; + ff->tp_ind = elem[0] & 0x1; + + return 1; +} + +/*! Encode Talker Identity IE (3GPP TS 48.008 3.2.2.91). + * \param[out] msg Message Buffer to which IE is to be appended + * \param[in] ti Talker Identity to be encoded + * \returns number of bytes appended to \a msg */ +uint8_t gsm0808_enc_talker_identity(struct msgb *msg, const struct gsm0808_talker_identity *ti) +{ + uint8_t *old_tail; + uint8_t *tlv_len; + uint8_t *ptr; + unsigned int bytes; + + OSMO_ASSERT(msg); + OSMO_ASSERT(ti); + + msgb_put_u8(msg, GSM0808_IE_TALKER_IDENTITY); + tlv_len = msgb_put(msg, 1); + old_tail = msg->tail; + + bytes = (ti->id_bits + 7) >> 3; + ptr = msgb_put(msg, 1 + bytes); + ptr[0] = -ti->id_bits & 0x7; + memcpy(ptr + 1, ti->talker_id, bytes); + + *tlv_len = (uint8_t) (msg->tail - old_tail); + return *tlv_len + 2; +} + +/*! Decode Talker Identity IE (3GPP TS 48.008 3.2.2.91). + * \param[out] ti Talker Identity structure to store data + * \param[in] elem IE value to be decoded. + * \param[in] len Length of \a elem in bytes. + * \returns number of bytes parsed; negative on error */ +int gsm0808_dec_talker_identity(struct gsm0808_talker_identity *ti, const uint8_t *elem, uint8_t len) +{ + OSMO_ASSERT(ti); + OSMO_ASSERT(elem); + + if (len < 2) + return -EINVAL; + unsigned int bytes; + + bytes = len - 1; + if (bytes > TALKER_IDENTITY_MAXLEN) + return -EINVAL; + ti->id_bits = (bytes << 3) - (elem[0] & 0x7); + memcpy(ti->talker_id, elem + 1, bytes); + + return len; +} + +/*! Encode Assignment Requirements IE (3GPP TS 48.008 3.2.2.52). + * \param[out] msg Message Buffer to which IE is to be appended + * \param[in] ar Assignment Requirement to be encoded + * \returns number of bytes appended to \a msg */ +uint8_t gsm0808_enc_assign_req(struct msgb *msg, const enum gsm0808_assignment_requirement ar) +{ + uint8_t *ptr; + + OSMO_ASSERT(msg); + + msgb_put_u8(msg, GSM0808_IE_ASSIGNMENT_REQUIREMENT); + + ptr = msgb_put(msg, 1); + ptr[0] = ar; + + return 2; +} + +/*! Decode Assignment Requirements IE (3GPP TS 48.008 3.2.2.52). + * \param[out] ar Assignment Requirements enum to store data + * \param[in] elem IE value to be decoded. + * \param[in] len Length of \a elem in bytes. + * \returns number of bytes parsed; negative on error */ +int gsm0808_dec_assign_req(enum gsm0808_assignment_requirement *ar, const uint8_t *elem, uint8_t len) +{ + OSMO_ASSERT(ar); + OSMO_ASSERT(elem); + + if (len != 1) + return -EINVAL; + + *ar = elem[0]; + + return 1; +} + +/*! Encode Cell Identifier List Segment IE (3GPP TS 48.008 3.2.2.27a). + * \param[out] msg Message Buffer to which IE is to be appended + * \param[in] ie_type Type of IE to use (5 different lists are specified.) + * \param[in] ci Cell Identifier List Segment to be encoded + * \returns number of bytes appended to \a msg */ +uint8_t gsm0808_enc_cell_id_list_segment(struct msgb *msg, uint8_t ie_type, + const struct gsm0808_cell_id_list_segment *ci) +{ + uint8_t *old_tail; + uint8_t *tlv_len; + uint8_t *ptr; + int rc; + + OSMO_ASSERT(msg); + OSMO_ASSERT(ci); + + msgb_put_u8(msg, ie_type); + tlv_len = msgb_put(msg, 1); + old_tail = msg->tail; + + ptr = msgb_put(msg, 1); + ptr[0] = ci->seq_last << 4; + ptr[0] |= ci->seq_number; + + rc = gsm0808_enc_cell_id_list2(msg, &ci->cil); + if (rc <= 0) + return rc; + + *tlv_len = (uint8_t) (msg->tail - old_tail); + return *tlv_len + 2; +} + +/*! Decode Cell Identifier List Segment IE (3GPP TS 48.008 3.2.2.27a). + * \param[out] ci Cell Identifier List Segment structure to store data + * \param[in] elem IE value to be decoded. + * \param[in] len Length of \a elem in bytes. + * \returns number of bytes parsed; negative on error */ +int gsm0808_dec_cell_id_list_segment(struct gsm0808_cell_id_list_segment *ci, const uint8_t *elem, uint8_t len) +{ + int rc; + + OSMO_ASSERT(ci); + OSMO_ASSERT(elem); + + if (len < 1) + return -EINVAL; + + ci->seq_last = elem[0] >> 4; + ci->seq_number = elem[0] & 0x0f; + + rc = gsm0808_dec_cell_id_list2(&ci->cil, elem + 1, len - 1); + if (rc < 0) + return rc; + + return len; +} + +/*! Decode Call Identifier IE (3GPP TS 48.008 3.2.2.105). + * \param[out] ci Call Identifier structure to store data + * \param[in] elem IE value to be decoded. + * \param[in] len Length of \a elem in bytes. + * \returns number of bytes parsed; negative on error */ +int gsm0808_dec_call_id(uint32_t *ci, const uint8_t *elem, uint8_t len) +{ + OSMO_ASSERT(ci); + OSMO_ASSERT(elem); + + if (len != 4) + return -EINVAL; + + *ci = osmo_load32le(elem); + + return 4; +} + /*! @} */ diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map index 52cda4c..c37e87c 100644 --- a/src/gsm/libosmogsm.map +++ b/src/gsm/libosmogsm.map @@ -231,6 +231,19 @@ gsm0808_enc_cell_id_list2; gsm0808_dec_cell_id_list; gsm0808_dec_cell_id_list2; +gsm0808_enc_group_callref; +gsm0808_dec_group_callref; +gsm0808_enc_priority; +gsm0808_dec_priority; +gsm0808_enc_vgcs_feature_flags; +gsm0808_dec_vgcs_feature_flags; +gsm0808_enc_talker_identity; +gsm0808_dec_talker_identity; +gsm0808_enc_assign_req; +gsm0808_dec_assign_req; +gsm0808_enc_cell_id_list_segment; +gsm0808_dec_cell_id_list_segment; +gsm0808_dec_call_id; gsm0808_cell_id_list_add; gsm0808_cell_id_to_list; gsm0808_cell_id_to_cgi; -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/32931 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: Ic1fc714bb04228a7f32e9925811e21c8efc610bd Gerrit-Change-Number: 32931 Gerrit-PatchSet: 1 Gerrit-Owner: jolly <andreas(a)eversberg.eu> Gerrit-MessageType: newchange
1 0
0 0
[S] Change in libosmocore[master]: Add support for sending Bter UI frames at lapdm.c
by jolly 23 May '23

23 May '23
jolly has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/32933 ) Change subject: Add support for sending Bter UI frames at lapdm.c ...................................................................... Add support for sending Bter UI frames at lapdm.c Bter frames may be used on downlink of a main DCCH or SACCH channel. It applies to SAPI 0 and UI frames only. It includes a short layer 2 header with 2 bits only. All other bits are used for the message. The message size is 23 bytes on main DCCH and 21 bytes on SACCH. The length of the L3 messsage is used to distinguish between Bter frames and other (UI) frames. Note that the L3 message header is different, so that the length of the UI frame will determine which header is used. Change-Id: Ia3a25c009d1ff09f83258bdb226a85b81466d7a1 --- M src/gsm/lapdm.c 1 file changed, 31 insertions(+), 7 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/33/32933/1 diff --git a/src/gsm/lapdm.c b/src/gsm/lapdm.c index b7f5769..aade046 100644 --- a/src/gsm/lapdm.c +++ b/src/gsm/lapdm.c @@ -1029,7 +1029,7 @@ uint8_t link_id = rllh->link_id; uint8_t sapi = link_id & 7; struct tlv_parsed tv; - int length, ui_bts; + int length, ui_bts, b_ter; if (!le) { LOGDL(&dl->dl, LOGL_ERROR, "lapdm_datalink without entity error\n"); @@ -1055,8 +1055,10 @@ } msg->l3h = (uint8_t *) TLVP_VAL(&tv, RSL_IE_L3_INFO); length = TLVP_LEN(&tv, RSL_IE_L3_INFO); + /* check for Bter frame */ + b_ter = (length == ((link_id & 0x40) ? 21 : 23) && sapi == 0); /* check if the layer3 message length exceeds N201 */ - if (length + ((link_id & 0x40) ? 4 : 2) + !ui_bts > 23) { + if (length + ((link_id & 0x40) ? 4 : 2) + !ui_bts > 23 && !b_ter) { LOGDL(&dl->dl, LOGL_ERROR, "frame too large: %d > N201(%d) " "(discarding)\n", length, ((link_id & 0x40) ? 18 : 20) + ui_bts); @@ -1071,11 +1073,14 @@ msgb_trim(msg, length); /* Push L1 + LAPDm header on msgb */ - msg->l2h = msgb_push(msg, 2 + !ui_bts); - msg->l2h[0] = LAPDm_ADDR(LAPDm_LPD_NORMAL, sapi, dl->dl.cr.loc2rem.cmd); - msg->l2h[1] = LAPDm_CTRL_U(LAPDm_U_UI, 0); - if (!ui_bts) - msg->l2h[2] = LAPDm_LEN(length); + if (!b_ter) { + msg->l2h = msgb_push(msg, 2 + !ui_bts); + msg->l2h[0] = LAPDm_ADDR(LAPDm_LPD_NORMAL, sapi, dl->dl.cr.loc2rem.cmd); + msg->l2h[1] = LAPDm_CTRL_U(LAPDm_U_UI, 0); + if (!ui_bts) + msg->l2h[2] = LAPDm_LEN(length); + } else + msg->l2h = msg->data; if (link_id & 0x40) { msg->l2h = msgb_push(msg, 2); msg->l2h[0] = le->tx_power; -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/32933 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: Ia3a25c009d1ff09f83258bdb226a85b81466d7a1 Gerrit-Change-Number: 32933 Gerrit-PatchSet: 1 Gerrit-Owner: jolly <andreas(a)eversberg.eu> Gerrit-MessageType: newchange
1 0
0 0
[S] Change in libosmocore[master]: Add short L3 header to gsm_04_08.h
by jolly 23 May '23

23 May '23
jolly has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/32935 ) Change subject: Add short L3 header to gsm_04_08.h ...................................................................... Add short L3 header to gsm_04_08.h Change-Id: I0eceb380e401e1f842edbaa92f4b4738703a031c --- M include/osmocom/gsm/protocol/gsm_04_08.h 1 file changed, 26 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/35/32935/1 diff --git a/include/osmocom/gsm/protocol/gsm_04_08.h b/include/osmocom/gsm/protocol/gsm_04_08.h index e6dc73b..56842b8 100644 --- a/include/osmocom/gsm/protocol/gsm_04_08.h +++ b/include/osmocom/gsm/protocol/gsm_04_08.h @@ -1174,6 +1174,20 @@ #endif } __attribute__ ((packed)); +/* Short header */ +struct gsm48_hdr_sh { +#if OSMO_IS_LITTLE_ENDIAN + uint8_t l2_header:2, /* < short layer 2 header : bit(2) > See 3GPP TS 44.006 §6.4a */ + msg_type:5, /* < message type : bit(5) > See 3GPP TS 44.018 Table 10.4.2 */ + rr_short_pd:1; /* < RR short PD : bit > See 3GPP TS 24.007 §11.3.2 */ + uint8_t data[0]; +#elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ + uint8_t rr_short_pd:1, msg_type:5, l2_header:2; + uint8_t data[0]; +#endif +} __attribute__ ((packed)); + /* Section 9.1.50 System Information type 10 (ASCI) */ struct gsm48_system_information_type_10 { #if OSMO_IS_LITTLE_ENDIAN @@ -1407,6 +1421,9 @@ #define GSM48_PDISC_TEST 0x0f /* as per 11.10, 04.14 */ #define GSM48_PDISC_MASK 0x0f +/* Secion 11.3.2.1 3GPP TS 24.007: Short PDISC */ +#define GSM48_PDISC_SH_RR 0 + extern const struct value_string gsm48_pdisc_names[]; static inline const char *gsm48_pdisc_name(uint8_t val) { return get_value_string(gsm48_pdisc_names, val); } -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/32935 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I0eceb380e401e1f842edbaa92f4b4738703a031c Gerrit-Change-Number: 32935 Gerrit-PatchSet: 1 Gerrit-Owner: jolly <andreas(a)eversberg.eu> Gerrit-MessageType: newchange
1 0
0 0
[S] Change in libosmocore[master]: Add support for receiving Bter UI frames at lapdm.c
by jolly 23 May '23

23 May '23
jolly has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/32934 ) Change subject: Add support for receiving Bter UI frames at lapdm.c ...................................................................... Add support for receiving Bter UI frames at lapdm.c Similar to support of sending Bter frame, the same rules apply when receiving them. Change-Id: If04115884743455c7bf2b2bc5f7e49e74b6ffb60 --- M src/gsm/lapdm.c 1 file changed, 31 insertions(+), 7 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/34/32934/1 diff --git a/src/gsm/lapdm.c b/src/gsm/lapdm.c index aade046..ec2e661 100644 --- a/src/gsm/lapdm.c +++ b/src/gsm/lapdm.c @@ -57,6 +57,7 @@ #define LAPDm_ADDR_SAPI(addr) (((addr) >> 2) & 0x7) #define LAPDm_ADDR_CR(addr) (((addr) >> 1) & 0x1) #define LAPDm_ADDR_EA(addr) ((addr) & 0x1) +#define LAPDm_ADDR_SHORT_L2(addr) ((addr) & 0x3) /* TS 04.06 Table 3 / Section 3.4.3 */ #define LAPDm_CTRL_I(nr, ns, p) ((((nr) & 0x7) << 5) | (((p) & 0x1) << 4) | (((ns) & 0x7) << 1)) @@ -725,15 +726,23 @@ if (mctx.link_id & 0x40) { /* It was received from network on SACCH */ + /* A Short L3 header has both bits == 0. */ + if (LAPDm_ADDR_SHORT_L2(msg->l2h[2]) == 0x0) { + mctx.lapdm_fmt = LAPDm_FMT_Bter; + n201 = N201_Bter_SACCH; + sapi = 0; + } else /* If UI on SACCH sent by BTS, lapdm_fmt must be B4 */ if (le->mode == LAPDM_MODE_MS && LAPDm_CTRL_is_U(msg->l2h[3]) && LAPDm_CTRL_U_BITS(msg->l2h[3]) == 0) { mctx.lapdm_fmt = LAPDm_FMT_B4; n201 = N201_B4; + sapi = (msg->l2h[0] >> 2) & 7; } else { mctx.lapdm_fmt = LAPDm_FMT_B; n201 = N201_AB_SACCH; + sapi = (msg->l2h[0] >> 2) & 7; } /* SACCH frames have a two-byte L1 header that * OsmocomBB L1 doesn't strip */ @@ -741,11 +750,17 @@ mctx.ta_ind = msg->l2h[1]; msgb_pull(msg, 2); msg->l2h += 2; - sapi = (msg->l2h[0] >> 2) & 7; } else { - mctx.lapdm_fmt = LAPDm_FMT_B; - n201 = N201_AB_SDCCH; - sapi = (msg->l2h[0] >> 2) & 7; + /* A Short L3 header has both bits == 0. */ + if (LAPDm_ADDR_SHORT_L2(msg->l2h[2]) == 0x0) { + mctx.lapdm_fmt = LAPDm_FMT_Bter; + n201 = N201_Bter_SDCCH; + sapi = 0; + } else { + mctx.lapdm_fmt = LAPDm_FMT_B; + n201 = N201_AB_SDCCH; + sapi = (msg->l2h[0] >> 2) & 7; + } } } @@ -838,9 +853,6 @@ rc = lapd_ph_data_ind(msg, &lctx); break; case LAPDm_FMT_Bter: - /* FIXME */ - msgb_free(msg); - break; case LAPDm_FMT_Bbis: /* directly pass up to layer3 */ msg->l3h = msg->l2h; -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/32934 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: If04115884743455c7bf2b2bc5f7e49e74b6ffb60 Gerrit-Change-Number: 32934 Gerrit-PatchSet: 1 Gerrit-Owner: jolly <andreas(a)eversberg.eu> Gerrit-MessageType: newchange
1 0
0 0
[S] Change in libosmocore[master]: Fix short L3 header of SI 10 at gsm_04_08.h
by jolly 23 May '23

23 May '23
jolly has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/32936 ) Change subject: Fix short L3 header of SI 10 at gsm_04_08.h ...................................................................... Fix short L3 header of SI 10 at gsm_04_08.h Change-Id: I1c3002716b08e31016cc6e623f8f8a413ef7916f --- M include/osmocom/gsm/protocol/gsm_04_08.h 1 file changed, 12 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/36/32936/1 diff --git a/include/osmocom/gsm/protocol/gsm_04_08.h b/include/osmocom/gsm/protocol/gsm_04_08.h index 56842b8..06e353d 100644 --- a/include/osmocom/gsm/protocol/gsm_04_08.h +++ b/include/osmocom/gsm/protocol/gsm_04_08.h @@ -1191,13 +1191,13 @@ /* Section 9.1.50 System Information type 10 (ASCI) */ struct gsm48_system_information_type_10 { #if OSMO_IS_LITTLE_ENDIAN - uint8_t rr_short_pd:1, /* < RR short PD : bit > See 3GPP TS 24.007 §11.3.2 */ + uint8_t l2_header:2, /* < short layer 2 header : bit(2) > See 3GPP TS 44.006 §6.4a */ msg_type:5, /* < message type : bit(5) > See 3GPP TS 44.018 Table 10.4.2 */ - l2_header:2; /* < short layer 2 header : bit(2) > See 3GPP TS 44.006 §6.4a */ + rr_short_pd:1; /* < RR short PD : bit > See 3GPP TS 24.007 §11.3.2 */ uint8_t rest_octets[0]; /* < SI10 Rest Octets : bit(160) > See 3GPP TS 44.018 §10.5.2.44 */ #elif OSMO_IS_BIG_ENDIAN /* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ - uint8_t l2_header:2, msg_type:5, rr_short_pd:1; + uint8_t rr_short_pd:1, msg_type:5, l2_header:2; uint8_t rest_octets[0]; #endif } __attribute__ ((packed)); -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/32936 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I1c3002716b08e31016cc6e623f8f8a413ef7916f Gerrit-Change-Number: 32936 Gerrit-PatchSet: 1 Gerrit-Owner: jolly <andreas(a)eversberg.eu> Gerrit-MessageType: newchange
1 0
0 0
[XL] Change in libosmocore[master]: ASCI: Add message definition and encoding according to 3GPP TS 48.008
by jolly 23 May '23

23 May '23
jolly has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/32932 ) Change subject: ASCI: Add message definition and encoding according to 3GPP TS 48.008 ...................................................................... ASCI: Add message definition and encoding according to 3GPP TS 48.008 Change-Id: Ib94c64136c31ce4af67c314a8550d93946cc844f --- M include/osmocom/gsm/gsm0808.h M include/osmocom/gsm/gsm0808_utils.h M include/osmocom/gsm/protocol/gsm_08_08.h M src/gsm/gsm0808.c M src/gsm/gsm0808_utils.c M src/gsm/libosmogsm.map 6 files changed, 1,037 insertions(+), 4 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/32/32932/1 diff --git a/include/osmocom/gsm/gsm0808.h b/include/osmocom/gsm/gsm0808.h index dcff415..0859fdc 100644 --- a/include/osmocom/gsm/gsm0808.h +++ b/include/osmocom/gsm/gsm0808.h @@ -332,6 +332,243 @@ }; struct msgb *gsm0808_create_handover_performed(const struct gsm0808_handover_performed *params); +/*! 3GPP TS 48.008 §3.2.1.50 VGCS/VBS SETUP */ +struct gsm0808_vgcs_vbs_setup { + struct gsm0808_group_callref callref; + + bool priority_present; + struct gsm0808_priority priority; + + bool vgcs_feature_flags_present; + struct gsm0808_vgcs_feature_flags flags; +}; +struct msgb *gsm0808_create_vgcs_vbs_setup(const struct gsm0808_vgcs_vbs_setup *params); + +/*! 3GPP TS 48.008 §3.2.1.51 VGCS/VBS SETUP ACK */ +struct gsm0808_vgcs_vbs_setup_ack { + bool vgcs_feature_flags_present; + struct gsm0808_vgcs_feature_flags flags; +}; +struct msgb *gsm0808_create_vgcs_vbs_setup_ack(const struct gsm0808_vgcs_vbs_setup_ack *params); + +/*! 3GPP TS 48.008 §3.2.1.52 VGCS/VBS SETUP REFUSE */ +struct msgb *gsm0808_create_vgcs_vbs_setup_refuse(enum gsm0808_cause cause); + +/*! 3GPP TS 48.008 §3.2.1.53 VGCS/VBS ASSIGNMENT REQUEST */ +struct gsm0808_vgcs_vbs_assign_req { + struct gsm0808_channel_type channel_type; + enum gsm0808_assignment_requirement ass_req; + struct gsm0808_cell_id cell_identifier; + struct gsm0808_group_callref callref; + + bool priority_present; + struct gsm0808_priority priority; + + bool cic_present; + uint16_t cic; + + bool downlink_dtx_flag_present; + enum gsm0808_downlink_dtx_flag downlink_dtx_flag; + + bool encryption_information_present; + struct gsm0808_encrypt_info encryption_information; + + bool vstk_rand_present; + uint8_t vstk_rand[5]; + + bool vstk_present; + uint8_t vstk[16]; + + bool cils_present; + struct gsm0808_cell_id_list_segment cils; + + bool aoip_transport_layer_present; + struct sockaddr_storage aoip_transport_layer; + + bool call_id_present; + uint32_t call_id; + + bool codec_list_present; + struct gsm0808_speech_codec_list codec_list_msc_preferred; +}; +struct msgb *gsm0808_create_vgcs_vbs_assign_req(const struct gsm0808_vgcs_vbs_assign_req *params); + +/*! 3GPP TS 48.008 §3.2.1.54 VGCS/VBS ASSIGNMENT RESULT */ +struct gsm0808_vgcs_vbs_assign_res { + struct gsm0808_channel_type channel_type; + struct gsm0808_cell_id cell_identifier; + + bool chosen_channel_present; + uint8_t chosen_channel; + + bool cic_present; + uint16_t cic; + + bool circuit_pool_present; + uint8_t circuit_pool; + + bool aoip_transport_layer_present; + struct sockaddr_storage aoip_transport_layer; + + bool codec_present; + struct gsm0808_speech_codec codec_msc_chosen; + + bool call_id_present; + uint32_t call_id; +}; +struct msgb *gsm0808_create_vgcs_vbs_assign_res(const struct gsm0808_vgcs_vbs_assign_res *params); + +/*! 3GPP TS 48.008 §3.2.1.55 VGCS/VBS ASSIGNMENT FAILURE */ +struct gsm0808_vgcs_vbs_assign_fail { + enum gsm0808_cause cause; + + bool circuit_pool_present; + uint8_t circuit_pool; + + bool cpl_present; + struct gsm0808_circuit_pool_list cpl; + + bool codec_list_present; + struct gsm0808_speech_codec_list codec_list_bss_supported; +}; +struct msgb *gsm0808_create_vgcs_vbs_assign_fail(const struct gsm0808_vgcs_vbs_assign_fail *params); + +/*! 3GPP TS 48.008 §3.2.1.57 (VGCS) UPLINK REQUEST */ +struct gsm0808_uplink_request { + bool talker_priority_present; + enum gsm0808_talker_priority talker_priority; + + bool cell_identifier_present; + struct gsm0808_cell_id cell_identifier; + + bool l3_present; + struct gsm0808_layer_3_information l3; + + bool mi_present; + struct osmo_mobile_identity mi; +}; +struct msgb *gsm0808_create_uplink_request(const struct gsm0808_uplink_request *params); + +/*! 3GPP TS 48.008 §3.2.1.58 (VGCS) UPLINK REQUEST ACKNOWLEDGE */ +struct gsm0808_uplink_request_ack { + bool talker_priority_present; + enum gsm0808_talker_priority talker_priority; + + bool emerg_set_ind_present; + + bool talker_identity_present; + struct gsm0808_talker_identity talker_identity; +}; +struct msgb *gsm0808_create_uplink_request_ack(const struct gsm0808_uplink_request_ack *params); + +/*! 3GPP TS 48.008 §3.2.1.59 (VGCS) UPLINK REQUEST CONFIRM */ +struct gsm0808_uplink_request_cnf { + struct gsm0808_cell_id cell_identifier; + + bool talker_identity_present; + struct gsm0808_talker_identity talker_identity; + + /* mandatory! */ + struct gsm0808_layer_3_information l3; +}; +struct msgb *gsm0808_create_uplink_request_cnf(const struct gsm0808_uplink_request_cnf *params); + +/*! 3GPP TS 48.008 §3.2.1.59a (VGCS) UPLINK APPLICATION DATA */ +struct gsm0808_uplink_app_data { + struct gsm0808_cell_id cell_identifier; + struct gsm0808_layer_3_information l3; + bool bt_ind; +}; +struct msgb *gsm0808_create_uplink_app_data(const struct gsm0808_uplink_app_data *params); + +/*! 3GPP TS 48.008 §3.2.1.60 (VGCS) UPLINK RELEASE INDICATION */ +struct gsm0808_uplink_release_ind { + enum gsm0808_cause cause; + + bool talker_priority_present; + enum gsm0808_talker_priority talker_priority; +}; +struct msgb *gsm0808_create_uplink_release_ind(const struct gsm0808_uplink_release_ind *params); + +/*! 3GPP TS 48.008 §3.2.1.61 (VGCS) UPLINK REJECT COMMAND */ +struct gsm0808_uplink_reject_cmd { + enum gsm0808_cause cause; + + bool current_talker_priority_present; + enum gsm0808_talker_priority current_talker_priority; + bool rejected_talker_priority_present; + enum gsm0808_talker_priority rejected_talker_priority; + + bool talker_identity_present; + struct gsm0808_talker_identity talker_identity; +}; +struct msgb *gsm0808_create_uplink_reject_cmd(const struct gsm0808_uplink_reject_cmd *params); + +/*! 3GPP TS 48.008 §3.2.1.62 (VGCS) UPLINK RELEASE COMMAND */ +struct msgb *gsm0808_create_uplink_release_cmd(const enum gsm0808_cause cause); + +/*! 3GPP TS 48.008 §3.2.1.63 (VGCS) UPLINK SEIZED COMMAND */ +struct gsm0808_uplink_seized_cmd { + enum gsm0808_cause cause; + + bool talker_priority_present; + enum gsm0808_talker_priority talker_priority; + + bool emerg_set_ind_present; + + bool talker_identity_present; + struct gsm0808_talker_identity talker_identity; +}; +struct msgb *gsm0808_create_uplink_seized_cmd(const struct gsm0808_uplink_seized_cmd *params); + +/*! 3GPP TS 48.008 §3.2.1.78 VGCS ADDITIONAL INFORMATION */ +struct msgb *gsm0808_create_vgcs_additional_info(const struct gsm0808_talker_identity *ti); + +/*! 3GPP TS 48.008 §3.2.1.79 VGCS/VBS AREA CELL INFO */ +struct gsm0808_vgcs_vbs_area_cell_info { + struct gsm0808_cell_id_list_segment cils; + + bool ass_req_present; + enum gsm0808_assignment_requirement ass_req; +}; +struct msgb *gsm0808_create_vgcs_vbs_area_cell_info(const struct gsm0808_vgcs_vbs_area_cell_info *params); + +/*! 3GPP TS 48.008 §3.2.1.80 VGCS/VBS ASSIGNMENT STATUS */ +struct gsm0808_vgcs_vbs_assign_stat { + /* established cells */ + bool cils_est_present; + struct gsm0808_cell_id_list_segment cils_est; + + /* cells to be established */ + bool cils_tbe_present; + struct gsm0808_cell_id_list_segment cils_tbe; + + /* released cells - no user present */ + bool cils_rel_present; + struct gsm0808_cell_id_list_segment cils_rel; + + /* not established cells - no establishment possible */ + bool cils_ne_present; + struct gsm0808_cell_id_list_segment cils_ne; + + bool cell_status_present; + enum gsm0808_vgcs_vbs_cell_status cell_status; +}; +struct msgb *gsm0808_create_vgcs_vbs_assign_stat(const struct gsm0808_vgcs_vbs_assign_stat *params); + +/*! 3GPP TS 48.008 §3.2.1.81 VGCS SMS */ +struct msgb *gsm0808_create_vgcs_sms(const struct gsm0808_sms_to_vgcs *sms); + +/*! 3GPP TS 48.008 §3.2.1.82 (VGCS/VBS) NOTIFICATION DATA */ +struct gsm0808_notification_data { + struct gsm0808_application_data app_data; + struct gsm0808_data_identity data_ident; + + bool msisdn_present; + char msisdn[MSISDN_MAXLEN + 1]; +}; +struct msgb *gsm0808_create_notification_data(const struct gsm0808_notification_data *parms); + struct msgb *gsm0808_create_dtap(struct msgb *msg, uint8_t link_id); void gsm0808_prepend_dtap_header(struct msgb *msg, uint8_t link_id); diff --git a/include/osmocom/gsm/gsm0808_utils.h b/include/osmocom/gsm/gsm0808_utils.h index 7b6c4e1..e9cbf88 100644 --- a/include/osmocom/gsm/gsm0808_utils.h +++ b/include/osmocom/gsm/gsm0808_utils.h @@ -182,6 +182,35 @@ unsigned int sms_len; }; +/*! Parsed representation of a Application Data IE (3GPP TS 48.008 3.2.2.98) */ +#define APP_DATA_MAXLEN 9 +struct gsm0808_application_data { + uint8_t data[APP_DATA_MAXLEN]; + unsigned int data_len; +}; + +/*! Parsed representation of a Data Identity IE (GGPP TS 48.008 3.2.2.99) */ +enum gsm0808_application_idndicator { + GSM0808_AI_APP_DATA = 0x00, + GSM0808_AI_CONFIRM_APP_DATA = 0x01, +}; + +#define GSM0808_DP_MASK_TALKERS_LISTENERS 0x04 +#define GSM0808_DP_MASK_DISPATCHERS 0x02 +#define GSM0808_DP_MASK_NETWORK_APP 0x01 + +struct gsm0808_data_identity { + /* Application Indicator */ + uint8_t ai; + /* Data identifier */ + uint8_t di; + /* Distribution parameter (bit mask) */ + uint8_t dp; +}; + +/*! Parsed representation of a MSISDN IE (3GPP TS 48.008 3.2.2.101) */ +#define MSISDN_MAXLEN 20 + /*! LCLS-related parameters from 3GPP TS 48.008 */ struct osmo_lcls { enum gsm0808_lcls_config config; /**< §3.2.2.116 Configuration */ @@ -431,6 +460,10 @@ int gsm0808_dec_vgcs_feature_flags(struct gsm0808_vgcs_feature_flags *ff, const uint8_t *elem, uint8_t len); uint8_t gsm0808_enc_talker_identity(struct msgb *msg, const struct gsm0808_talker_identity *ti); int gsm0808_dec_talker_identity(struct gsm0808_talker_identity *ti, const uint8_t *elem, uint8_t len); +uint8_t gsm0808_enc_data_identity(struct msgb *msg, const struct gsm0808_data_identity *ai); +int gsm0808_dec_data_identity(struct gsm0808_data_identity *ai, const uint8_t *elem, uint8_t len); +uint8_t gsm0808_enc_msisdn(struct msgb *msg, const char *msisdn); +int gsm0808_dec_msisdn(char *msisdn, const char *elem, uint8_t len); uint8_t gsm0808_enc_assign_req(struct msgb *msg, const enum gsm0808_assignment_requirement ar); int gsm0808_dec_assign_req(enum gsm0808_assignment_requirement *ar, const uint8_t *elem, uint8_t len); uint8_t gsm0808_enc_cell_id_list_segment(struct msgb *msg, uint8_t ie_type, diff --git a/include/osmocom/gsm/protocol/gsm_08_08.h b/include/osmocom/gsm/protocol/gsm_08_08.h index fad75c2..c78f6d6 100644 --- a/include/osmocom/gsm/protocol/gsm_08_08.h +++ b/include/osmocom/gsm/protocol/gsm_08_08.h @@ -166,14 +166,17 @@ BSS_MAP_MSG_VGCS_VBS_ASSIGNMENT_RESULT = 28, BSS_MAP_MSG_VGCS_VBS_ASSIGNMENT_FAILURE = 29, BSS_MAP_MSG_VGCS_VBS_QUEUING_INDICATION = 30, - BSS_MAP_MSG_UPLINK_RQST = 31, + BSS_MAP_MSG_UPLINK_RQST = 31, BSS_MAP_MSG_UPLINK_RQST_ACKNOWLEDGE = 39, + BSS_MAP_MSG_VGCS_VBS_ASSIGNMENT_STATUS = 59, + BSS_MAP_MSG_VGCS_VBS_AREA_CELL_INFO = 60, BSS_MAP_MSG_UPLINK_RQST_CONFIRMATION = 73, BSS_MAP_MSG_UPLINK_RELEASE_INDICATION = 74, - BSS_MAP_MSG_UPLINK_REJECT_CMD = 75, - BSS_MAP_MSG_UPLINK_RELEASE_CMD = 76, - BSS_MAP_MSG_UPLINK_SEIZED_CMD = 77, + BSS_MAP_MSG_UPLINK_REJECT_CMD = 75, + BSS_MAP_MSG_UPLINK_RELEASE_CMD = 76, + BSS_MAP_MSG_UPLINK_SEIZED_CMD = 77, BSS_MAP_MSG_VGCS_ADDL_INFO = 0x60, + BSS_MAP_MSG_VGCS_SMS = 0x61, BSS_MAP_MSG_NOTIFICATION_DATA = 0x62, BSS_MAP_MSG_UPLINK_APP_DATA = 0x63, diff --git a/src/gsm/gsm0808.c b/src/gsm/gsm0808.c index e1768c1..4c995c2 100644 --- a/src/gsm/gsm0808.c +++ b/src/gsm/gsm0808.c @@ -1514,6 +1514,645 @@ return msg; } +/*! Create BSSMAP VGCS/VBS SETUP message, 3GPP TS 48.008 3.2.1.50. + * Sent from the MSC to the BSC to request VGCS/VBS call. */ +struct msgb *gsm0808_create_vgcs_vbs_setup(const struct gsm0808_vgcs_vbs_setup *params) +{ + struct msgb *msg; + + msg = msgb_alloc_headroom(BSSMAP_MSG_SIZE, BSSMAP_MSG_HEADROOM, "BSSMAP-VGCS/VBS-SETUP"); + if (!msg) + return NULL; + + /* Message Type, 3.2.2.1 */ + msgb_v_put(msg, BSS_MAP_MSG_VGCS_VBS_SETUP); + + /* Group Call Reference, 3.2.2.55 */ + gsm0808_enc_group_callref(msg, &params->callref); + + /* Priority, 3.2.2.18 */ + if (params->priority_present) + gsm0808_enc_priority(msg, &params->priority); + + /* VGCS Feature Flags, 3.2.2.88 */ + if (params->vgcs_feature_flags_present) + gsm0808_enc_vgcs_feature_flags(msg, &params->flags); + + /* prepend header with final length */ + msg->l3h = msgb_tv_push(msg, BSSAP_MSG_BSS_MANAGEMENT, msgb_length(msg)); + + return msg; +} + +/*! Create BSSMAP VGCS/VBS SETUP ACK message, 3GPP TS 48.008 3.2.1.51. + * Sent from the BSC to the MSC to confirm VGCS/VBS call. */ +struct msgb *gsm0808_create_vgcs_vbs_setup_ack(const struct gsm0808_vgcs_vbs_setup_ack *params) +{ + struct msgb *msg; + + msg = msgb_alloc_headroom(BSSMAP_MSG_SIZE, BSSMAP_MSG_HEADROOM, "BSSMAP-VGCS/VBS-SETUP-ACK"); + if (!msg) + return NULL; + + /* Message Type, 3.2.2.1 */ + msgb_v_put(msg, BSS_MAP_MSG_VGCS_VBS_SETUP_ACK); + + /* VGCS Feature Flags, 3.2.2.88 */ + if (params->vgcs_feature_flags_present) + gsm0808_enc_vgcs_feature_flags(msg, &params->flags); + + /* prepend header with final length */ + msg->l3h = msgb_tv_push(msg, BSSAP_MSG_BSS_MANAGEMENT, msgb_length(msg)); + + return msg; +} + +/*! Create BSSMAP VGCS/VBS SETUP REFUSE message, 3GPP TS 48.008 3.2.1.52. + * Sent from the BSC to the MSC to reject VGCS/VBS call. */ +struct msgb *gsm0808_create_vgcs_vbs_setup_refuse(enum gsm0808_cause cause) +{ + struct msgb *msg; + + msg = msgb_alloc_headroom(BSSMAP_MSG_SIZE, BSSMAP_MSG_HEADROOM, "BSSMAP-VGCS/VBS-SETUP-REFUSE"); + if (!msg) + return NULL; + + /* Message Type, 3.2.2.1 */ + msgb_v_put(msg, BSS_MAP_MSG_VGCS_VBS_SETUP_REFUSE); + + /* Cause, 3.2.2.5 */ + gsm0808_enc_cause(msg, cause); + + /* prepend header with final length */ + msg->l3h = msgb_tv_push(msg, BSSAP_MSG_BSS_MANAGEMENT, msgb_length(msg)); + + return msg; +} + +/*! Create BSSMAP VGCS/VBS ASSIGNMENT REQUEST message, 3GPP TS 48.008 3.2.1.53. + * Sent from the MSC to the BSC to assign radio resources for a VGCS/VBS. */ +struct msgb *gsm0808_create_vgcs_vbs_assign_req(const struct gsm0808_vgcs_vbs_assign_req *params) +{ + struct msgb *msg; + + msg = msgb_alloc_headroom(BSSMAP_MSG_SIZE, BSSMAP_MSG_HEADROOM, "BSSMAP-VGCS/VBS-ASSIGNMENT-REQUEST"); + if (!msg) + return NULL; + + /* Message Type, 3.2.2.1 */ + msgb_v_put(msg, BSS_MAP_MSG_VGCS_VBS_ASSIGNMENT_RQST); + + /* Channel Type, 3.2.2.11 */ + gsm0808_enc_channel_type(msg, &params->channel_type); + + /* Assignment Requrirement, 3.2.2.52 */ + gsm0808_enc_assign_req(msg, params->ass_req); + + /* Cell Identifier, 3.2.2.17 */ + gsm0808_enc_cell_id(msg, &params->cell_identifier); + + /* Group Call Reference, 3.2.2.55 */ + gsm0808_enc_group_callref(msg, &params->callref); + + /* Priority, 3.2.2.18 */ + if (params->priority_present) + gsm0808_enc_priority(msg, &params->priority); + + /* Circuit Identity Code, 3.2.2.2 */ + if (params->cic_present) + msgb_tv16_put(msg, GSM0808_IE_CIRCUIT_IDENTITY_CODE, params->cic); + + /* Downlink DTX Flag, 3.2.2.26 */ + if (params->downlink_dtx_flag_present) + msgb_tv_put(msg, GSM0808_IE_DOWNLINK_DTX_FLAG, params->downlink_dtx_flag); + + /* Encryption Information, 3.2.2.10 */ + if (params->encryption_information_present) + gsm0808_enc_encrypt_info(msg, &params->encryption_information); + + /* VSTK_RAND Imformation, 3.2.2.83 */ + if (params->vstk_rand_present) + msgb_tlv_put(msg, GSM0808_IE_VSTK_RAND_INFO, sizeof(params->vstk_rand), params->vstk_rand); + + /* VSTK Information, 3.2.2.84 */ + if (params->vstk_present) + msgb_tlv_put(msg, GSM0808_IE_VSTK_INFO, sizeof(params->vstk), params->vstk); + + /* Cell Identifier List Segment, 3.2.2.27a */ + if (params->cils_present) + gsm0808_enc_cell_id_list_segment(msg, GSM0808_IE_CELL_ID_LIST_SEGMENT, &params->cils); + + /* AoIP Transport Layer Address (MGW), 3.2.2.102 */ + if (params->aoip_transport_layer_present) + gsm0808_enc_aoip_trasp_addr(msg, &params->aoip_transport_layer); + + /* Call Identifier, 3.2.2.105 */ + if (params->call_id_present) { + /* NOTE: 3GPP TS 48.008, section 3.2.2.105 specifies that + * the least significant byte shall be transmitted first. */ + msgb_v_put(msg, GSM0808_IE_CALL_ID); + osmo_store32le(params->call_id, msgb_put(msg, sizeof(uint32_t))); + } + + /* Codec List (MSC Preferred) 3.2.2.103 */ + if (params->codec_list_present) + gsm0808_enc_speech_codec_list2(msg, &params->codec_list_msc_preferred); + + /* prepend header with final length */ + msg->l3h = msgb_tv_push(msg, BSSAP_MSG_BSS_MANAGEMENT, msgb_length(msg)); + + return msg; +} + +/*! Create BSSMAP VGCS/VBS ASSIGNMENT RESULT message, 3GPP TS 48.008 3.2.1.54. + * Sent from the BSC to the MSC to indicate assignment/deassingment of radio resources for a VGCS/VBS. */ +struct msgb *gsm0808_create_vgcs_vbs_assign_res(const struct gsm0808_vgcs_vbs_assign_res *params) +{ + struct msgb *msg; + + msg = msgb_alloc_headroom(BSSMAP_MSG_SIZE, BSSMAP_MSG_HEADROOM, "BSSMAP-VGCS/VBS-ASSIGNMENT-RESULT"); + if (!msg) + return NULL; + + /* Message Type, 3.2.2.1 */ + msgb_v_put(msg, BSS_MAP_MSG_VGCS_VBS_ASSIGNMENT_RESULT); + + /* Channel Type, 3.2.2.11 */ + gsm0808_enc_channel_type(msg, &params->channel_type); + + /* Cell Identifier, 3.2.2.17 */ + gsm0808_enc_cell_id(msg, &params->cell_identifier); + + /* Chosen Channel, 3.2.2.33 */ + if (params->chosen_channel_present) + msgb_tv_put(msg, GSM0808_IE_CHOSEN_CHANNEL, params->chosen_channel); + + /* Circuit Identity Code, 3.2.2.2 */ + if (params->cic_present) + msgb_tv16_put(msg, GSM0808_IE_CIRCUIT_IDENTITY_CODE, params->cic); + + /* Circuit Pool, 3.2.2.45 */ + if (params->circuit_pool_present) + msgb_tv_put(msg, GSM0808_IE_CIRCUIT_POOL, params->circuit_pool); + + /* AoIP Transport Layer Address (BSS), 3.2.2.102 */ + if (params->aoip_transport_layer_present) + gsm0808_enc_aoip_trasp_addr(msg, &params->aoip_transport_layer); + + /* Codec (MSC Chosen) 3.2.2.103 */ + if (params->codec_present) + gsm0808_enc_speech_codec2(msg, &params->codec_msc_chosen); + + /* Call Identifier, 3.2.2.105 */ + if (params->call_id_present) { + /* NOTE: 3GPP TS 48.008, section 3.2.2.105 specifies that + * the least significant byte shall be transmitted first. */ + msgb_v_put(msg, GSM0808_IE_CALL_ID); + osmo_store32le(params->call_id, msgb_put(msg, sizeof(uint32_t))); + } + + /* prepend header with final length */ + msg->l3h = msgb_tv_push(msg, BSSAP_MSG_BSS_MANAGEMENT, msgb_length(msg)); + + return msg; +} + +/*! Create BSSMAP VGCS/VBS ASSIGNMENT FAILURE message, 3GPP TS 48.008 3.2.1.55. + * Sent from the BSC to the MSC to indicate assignment failure for a VGCS/VBS. */ +struct msgb *gsm0808_create_vgcs_vbs_assign_fail(const struct gsm0808_vgcs_vbs_assign_fail *params) +{ + struct msgb *msg; + + msg = msgb_alloc_headroom(BSSMAP_MSG_SIZE, BSSMAP_MSG_HEADROOM, "BSSMAP-VGCS/VBS-ASSIGNMENT-RESULT"); + if (!msg) + return NULL; + + /* Message Type, 3.2.2.1 */ + msgb_v_put(msg, BSS_MAP_MSG_VGCS_VBS_ASSIGNMENT_FAILURE); + + /* Cause, 3.2.2.5 */ + gsm0808_enc_cause(msg, params->cause); + + /* Circuit Pool, 3.2.2.45 */ + if (params->circuit_pool_present) + msgb_tv_put(msg, GSM0808_IE_CIRCUIT_POOL, params->circuit_pool); + + /* Circuit Pool List, 3.2.2.46 */ + if (params->circuit_pool_present) + msgb_tlv_put(msg, GSM0808_IE_CIRCUIT_POOL_LIST, params->cpl.list_len, params->cpl.pool); + + /* Codec List (BSS Supported) 3.2.2.103 */ + if (params->codec_list_present) + gsm0808_enc_speech_codec_list2(msg, &params->codec_list_bss_supported); + + /* prepend header with final length */ + msg->l3h = msgb_tv_push(msg, BSSAP_MSG_BSS_MANAGEMENT, msgb_length(msg)); + + return msg; +} + +/*! Create BSSMAP VGCS/VBS QUEUING INDICATION message, 3GPP TS 48.008 3.2.1.56. + * Sent from the BSC to the MSC to indicate delay in assignment for a VGCS/VBS. */ +struct msgb *gsm0808_create_vgcs_queuing_ind(void) +{ + struct msgb *msg; + uint8_t val = BSS_MAP_MSG_VGCS_VBS_QUEUING_INDICATION; + + msg = msgb_alloc_headroom(BSSMAP_MSG_SIZE, BSSMAP_MSG_HEADROOM, "BSSMAP-VGCS/VBS-QUEUING-INDICATION"); + if (!msg) + return NULL; + + msg->l3h = msg->data; + msgb_tlv_put(msg, BSSAP_MSG_BSS_MANAGEMENT, 1, &val); + + return msg; +} + +/*! Create BSSMAP (VGCS) UPLINK REQUEST message, 3GPP TS 48.008 3.2.1.57. + * Sent from the BSC to the MSC to indicate that a mobile requested access to uplink. */ +struct msgb *gsm0808_create_uplink_request(const struct gsm0808_uplink_request *params) +{ + struct msgb *msg; + int rc; + + msg = msgb_alloc_headroom(BSSMAP_MSG_SIZE, BSSMAP_MSG_HEADROOM, "BSSMAP-UPLINK-REQUEST"); + if (!msg) + return NULL; + + /* Message Type, 3.2.2.1 */ + msgb_v_put(msg, BSS_MAP_MSG_UPLINK_RQST); + + /* Talker Priority, 3.2.2.89 */ + if (params->talker_priority_present) + msgb_tv_put(msg, GSM0808_IE_TALKER_PRIORITY, params->talker_priority); + + /* Cell Identifier, 3.2.2.17 */ + if (params->cell_identifier_present) + gsm0808_enc_cell_id(msg, &params->cell_identifier); + + /* Layer 3 Information, 3.2.2.24 */ + if (params->l3_present) + msgb_tlv_put(msg, GSM0808_IE_LAYER_3_INFORMATION, params->l3.l3_len, params->l3.l3); + + /* Mobile Identity, 3.2.2.41 */ + if (params->mi_present) { + rc = osmo_mobile_identity_encode_msgb(msg, &params->mi, false); + if (rc < 0) { + msgb_free(msg); + return NULL; + } + } + + /* prepend header with final length */ + msg->l3h = msgb_tv_push(msg, BSSAP_MSG_BSS_MANAGEMENT, msgb_length(msg)); + + return msg; +} + +/*! Create BSSMAP (VGCS) UPLINK REQUEST ACKNOWLEDGE message, 3GPP TS 48.008 3.2.1.58. + * Sent from the MSC to the BSC to indicate that access to uplink was granted. */ +struct msgb *gsm0808_create_uplink_request_ack(const struct gsm0808_uplink_request_ack *params) +{ + struct msgb *msg; + + msg = msgb_alloc_headroom(BSSMAP_MSG_SIZE, BSSMAP_MSG_HEADROOM, "BSSMAP-UPLINK-REQUEST-ACKNOWLEDGE"); + if (!msg) + return NULL; + + /* Message Type, 3.2.2.1 */ + msgb_v_put(msg, BSS_MAP_MSG_UPLINK_RQST_ACKNOWLEDGE); + + /* Talker Priority, 3.2.2.89 */ + if (params->talker_priority_present) + msgb_tv_put(msg, GSM0808_IE_TALKER_PRIORITY, params->talker_priority); + + /* Emergency set indication, 3.2.2.90 */ + if (params->emerg_set_ind_present) + msgb_v_put(msg, GSM0808_IE_EMERGENCY_SET_INDICATION); + + /* Talker Identity, 3.2.2.91 */ + if (params->talker_identity_present) + gsm0808_enc_talker_identity(msg, &params->talker_identity); + + /* prepend header with final length */ + msg->l3h = msgb_tv_push(msg, BSSAP_MSG_BSS_MANAGEMENT, msgb_length(msg)); + + return msg; +} + +/*! Create BSSMAP (VGCS) UPLINK CONFIRM message, 3GPP TS 48.008 3.2.1.59. + * Sent from the BSC to the MSC to indicate that access to uplink was has been successfully established. */ +struct msgb *gsm0808_create_uplink_request_cnf(const struct gsm0808_uplink_request_cnf *params) +{ + struct msgb *msg; + + msg = msgb_alloc_headroom(BSSMAP_MSG_SIZE, BSSMAP_MSG_HEADROOM, "BSSMAP-UPLINK-REQUEST-CONFIRM"); + if (!msg) + return NULL; + + /* Message Type, 3.2.2.1 */ + msgb_v_put(msg, BSS_MAP_MSG_UPLINK_RQST_CONFIRMATION); + + /* Cell Identifier, 3.2.2.17 */ + gsm0808_enc_cell_id(msg, &params->cell_identifier); + + /* Talker Identity, 3.2.2.91 */ + if (params->talker_identity_present) + gsm0808_enc_talker_identity(msg, &params->talker_identity); + + /* Layer 3 Information, 3.2.2.24 */ + msgb_tlv_put(msg, GSM0808_IE_LAYER_3_INFORMATION, params->l3.l3_len, params->l3.l3); + + /* prepend header with final length */ + msg->l3h = msgb_tv_push(msg, BSSAP_MSG_BSS_MANAGEMENT, msgb_length(msg)); + + return msg; +} + +/*! Create BSSMAP (VGCS) UPLINK APPLICATION DATA message, 3GPP TS 48.008 3.2.1.59a. + * Sent from the BSC to the MSC to pass L3 info from the talker. */ +struct msgb *gsm0808_create_uplink_app_data(const struct gsm0808_uplink_app_data *params) +{ + struct msgb *msg; + uint8_t val; + + msg = msgb_alloc_headroom(BSSMAP_MSG_SIZE, BSSMAP_MSG_HEADROOM, "BSSMAP-UPLINK-APPLICATION-DATA"); + if (!msg) + return NULL; + + /* Message Type, 3.2.2.1 */ + msgb_v_put(msg, BSS_MAP_MSG_UPLINK_APP_DATA); + + /* Cell Identifier, 3.2.2.17 */ + gsm0808_enc_cell_id(msg, &params->cell_identifier); + + /* Layer 3 Information, 3.2.2.24 */ + msgb_tlv_put(msg, GSM0808_IE_LAYER_3_INFORMATION, params->l3.l3_len, params->l3.l3); + + /* Application Data Information, 3.2.2.100 */ + val = params->bt_ind; + msgb_tlv_put(msg, GSM0808_IE_APP_DATA_INFO, 1, &val); + + /* prepend header with final length */ + msg->l3h = msgb_tv_push(msg, BSSAP_MSG_BSS_MANAGEMENT, msgb_length(msg)); + + return msg; +} + +/*! Create BSSMAP (VGCS) UPLINK RELEASE INDICATION message, 3GPP TS 48.008 3.2.1.60. + * Sent from the BSC to the MSC to indicate that the uplink has been released. */ +struct msgb *gsm0808_create_uplink_release_ind(const struct gsm0808_uplink_release_ind *params) +{ + struct msgb *msg; + + msg = msgb_alloc_headroom(BSSMAP_MSG_SIZE, BSSMAP_MSG_HEADROOM, "BSSMAP-UPLINK-RELEASE-INDICATION"); + if (!msg) + return NULL; + + /* Message Type, 3.2.2.1 */ + msgb_v_put(msg, BSS_MAP_MSG_UPLINK_RELEASE_INDICATION); + + /* Cause, 3.2.2.5 */ + gsm0808_enc_cause(msg, params->cause); + + /* Talker Priority, 3.2.2.89 */ + if (params->talker_priority_present) + msgb_tv_put(msg, GSM0808_IE_TALKER_PRIORITY, params->talker_priority); + + /* prepend header with final length */ + msg->l3h = msgb_tv_push(msg, BSSAP_MSG_BSS_MANAGEMENT, msgb_length(msg)); + + return msg; +} + +/*! Create BSSMAP (VGCS) UPLINK REJECT COMMAND message, 3GPP TS 48.008 3.2.1.61. + * Sent from the MSC to the BSC to indicate that the uplink is not available for allocation. */ +struct msgb *gsm0808_create_uplink_reject_cmd(const struct gsm0808_uplink_reject_cmd *params) +{ + struct msgb *msg; + + msg = msgb_alloc_headroom(BSSMAP_MSG_SIZE, BSSMAP_MSG_HEADROOM, "BSSMAP-UPLINK-REJECT-COMMAND"); + if (!msg) + return NULL; + + /* Message Type, 3.2.2.1 */ + msgb_v_put(msg, BSS_MAP_MSG_UPLINK_REJECT_CMD); + + /* Cause, 3.2.2.5 */ + gsm0808_enc_cause(msg, params->cause); + + /* Talker Priority, 3.2.2.89 */ + if (params->current_talker_priority_present) + msgb_tv_put(msg, GSM0808_IE_TALKER_PRIORITY, params->current_talker_priority); + + /* Talker Priority, 3.2.2.89 */ + if (params->rejected_talker_priority_present) + msgb_tv_put(msg, GSM0808_IE_TALKER_PRIORITY, params->rejected_talker_priority); + + /* Talker Identity, 3.2.2.91 */ + if (params->talker_identity_present) + gsm0808_enc_talker_identity(msg, &params->talker_identity); + + /* prepend header with final length */ + msg->l3h = msgb_tv_push(msg, BSSAP_MSG_BSS_MANAGEMENT, msgb_length(msg)); + + return msg; +} + +/*! Create BSSMAP (VGCS) UPLINK RELEASE COMMAND message, 3GPP TS 48.008 3.2.1.62. + * Sent from the MSC to the BSC to indicate that the uplink is available for allocation. */ +struct msgb *gsm0808_create_uplink_release_cmd(const enum gsm0808_cause cause) +{ + struct msgb *msg; + + msg = msgb_alloc_headroom(BSSMAP_MSG_SIZE, BSSMAP_MSG_HEADROOM, "BSSMAP-UPLINK-RELEASE-COMMAND"); + if (!msg) + return NULL; + + /* Message Type, 3.2.2.1 */ + msgb_v_put(msg, BSS_MAP_MSG_UPLINK_RELEASE_CMD); + + /* Cause, 3.2.2.5 */ + gsm0808_enc_cause(msg, cause); + + /* prepend header with final length */ + msg->l3h = msgb_tv_push(msg, BSSAP_MSG_BSS_MANAGEMENT, msgb_length(msg)); + + return msg; +} + +/*! Create BSSMAP (VGCS) UPLINK SEIZED COMMAND message, 3GPP TS 48.008 3.2.1.62. + * Sent from the MSC to the BSC to indicate that the uplink is no longer available for allocation. */ +struct msgb *gsm0808_create_uplink_seized_cmd(const struct gsm0808_uplink_seized_cmd *params) +{ + struct msgb *msg; + + msg = msgb_alloc_headroom(BSSMAP_MSG_SIZE, BSSMAP_MSG_HEADROOM, "BSSMAP-UPLINK-SEIZED-COMMAND"); + if (!msg) + return NULL; + + /* Message Type, 3.2.2.1 */ + msgb_v_put(msg, BSS_MAP_MSG_UPLINK_SEIZED_CMD); + + /* Cause, 3.2.2.5 */ + gsm0808_enc_cause(msg, params->cause); + + /* Talker Priority, 3.2.2.89 */ + if (params->talker_priority_present) + msgb_tv_put(msg, GSM0808_IE_TALKER_PRIORITY, params->talker_priority); + + /* Emergency set indication, 3.2.2.90 */ + if (params->emerg_set_ind_present) + msgb_v_put(msg, GSM0808_IE_EMERGENCY_SET_INDICATION); + + /* Talker Identity, 3.2.2.91 */ + if (params->talker_identity_present) + gsm0808_enc_talker_identity(msg, &params->talker_identity); + + /* prepend header with final length */ + msg->l3h = msgb_tv_push(msg, BSSAP_MSG_BSS_MANAGEMENT, msgb_length(msg)); + + return msg; +} + +/*! Create BSSMAP VGCS ADDITIONAL INFORMATION message, 3GPP TS 48.008 3.2.1.78. + * Sent from the MSC to the BSC to transfer talker identity. */ +struct msgb *gsm0808_create_vgcs_additional_info(const struct gsm0808_talker_identity *ti) +{ + struct msgb *msg; + + msg = msgb_alloc_headroom(BSSMAP_MSG_SIZE, BSSMAP_MSG_HEADROOM, "BSSMAP-VGCS-ADDITIONAL-INFO"); + if (!msg) + return NULL; + + /* Message Type, 3.2.2.1 */ + msgb_v_put(msg, BSS_MAP_MSG_VGCS_ADDL_INFO); + + /* Talker Identity, 3.2.2.91 */ + gsm0808_enc_talker_identity(msg, ti); + + /* prepend header with final length */ + msg->l3h = msgb_tv_push(msg, BSSAP_MSG_BSS_MANAGEMENT, msgb_length(msg)); + + return msg; +} + +/*! Create BSSMAP VGCS/VBS AREA CELL INFO message, 3GPP TS 48.008 3.2.1.79. + * Sent from the BSC to the MSC to transfer additional infos about cells. */ +struct msgb *gsm0808_create_vgcs_vbs_area_cell_info(const struct gsm0808_vgcs_vbs_area_cell_info *params) +{ + struct msgb *msg; + + msg = msgb_alloc_headroom(BSSMAP_MSG_SIZE, BSSMAP_MSG_HEADROOM, "BSSMAP-VGCS/VBS-AREA-CELL-INFO"); + if (!msg) + return NULL; + + /* Message Type, 3.2.2.1 */ + msgb_v_put(msg, BSS_MAP_MSG_VGCS_VBS_ASSIGNMENT_RQST); + + /* Cell Identifier List Segment, 3.2.2.27a */ + gsm0808_enc_cell_id_list_segment(msg, GSM0808_IE_CELL_ID_LIST_SEGMENT, &params->cils); + + /* Assignment Requrirement, 3.2.2.52 */ + if (params->ass_req_present) + gsm0808_enc_assign_req(msg, params->ass_req); + + /* prepend header with final length */ + msg->l3h = msgb_tv_push(msg, BSSAP_MSG_BSS_MANAGEMENT, msgb_length(msg)); + + return msg; +} + +/*! Create BSSMAP VGCS/VBS ASSIGNMENT STATUS message, 3GPP TS 48.008 3.2.1.80. + * Sent from the BSC to the MSC to indicate assignment status for each cell. */ +struct msgb *gsm0808_create_vgcs_vbs_assign_stat(const struct gsm0808_vgcs_vbs_assign_stat *params) +{ + struct msgb *msg; + uint8_t val; + + msg = msgb_alloc_headroom(BSSMAP_MSG_SIZE, BSSMAP_MSG_HEADROOM, "BSSMAP-VGCS/VBS-ASSIGNMENT-STATUS"); + if (!msg) + return NULL; + + /* Message Type, 3.2.2.1 */ + msgb_v_put(msg, BSS_MAP_MSG_VGCS_VBS_ASSIGNMENT_STATUS); + + /* Cell Identifier List Segment, 3.2.2.27b */ + if (params->cils_est_present) + gsm0808_enc_cell_id_list_segment(msg, GSM0808_IE_CELL_ID_LIST_SEG_EST_CELLS, &params->cils_est); + /* Cell Identifier List Segment, 3.2.2.27c */ + if (params->cils_tbe_present) + gsm0808_enc_cell_id_list_segment(msg, GSM0808_IE_CELL_ID_LIST_SEG_CELLS_TBE, &params->cils_tbe); + /* Cell Identifier List Segment, 3.2.2.27e */ + if (params->cils_rel_present) + gsm0808_enc_cell_id_list_segment(msg, GSM0808_IE_CELL_ID_LIST_SEG_REL_CELLS, &params->cils_rel); + /* Cell Identifier List Segment, 3.2.2.27f */ + if (params->cils_ne_present) + gsm0808_enc_cell_id_list_segment(msg, GSM0808_IE_CELL_ID_LIST_SEG_NE_CELLS, &params->cils_ne); + + /* VGCS/VBS Cell Status, 3.2.2.94 */ + if (params->cell_status_present) { + val = params->cell_status; + msgb_tlv_put(msg, GSM0808_IE_VGCS_VBS_CELL_STATUS, 1, &val); + } + + /* prepend header with final length */ + msg->l3h = msgb_tv_push(msg, BSSAP_MSG_BSS_MANAGEMENT, msgb_length(msg)); + + return msg; +} + +/*! Create BSSMAP VGCS SMS message, 3GPP TS 48.008 3.2.1.81. + * Sent from the MSC to the BSC to send an SMS to VGCS. */ +struct msgb *gsm0808_create_vgcs_sms(const struct gsm0808_sms_to_vgcs *sms) +{ + struct msgb *msg; + + msg = msgb_alloc_headroom(BSSMAP_MSG_SIZE, BSSMAP_MSG_HEADROOM, "BSSMAP-VGCS-SMS"); + if (!msg) + return NULL; + + /* SMS to VGCS, 3.2.2.92 */ + msgb_tlv_put(msg, GSM0808_IE_VGCS_VBS_CELL_STATUS, sms->sms_len, sms->sms); + + /* prepend header with final length */ + msg->l3h = msgb_tv_push(msg, BSSAP_MSG_BSS_MANAGEMENT, msgb_length(msg)); + + return msg; +} + +/*! Create BSSMAP (VGCS/VBS) NOTIFICATION DATA message, 3GPP TS 48.008 3.2.1.82. + * Sent from the MSC to the BSC to send application specific data. */ +struct msgb *gsm0808_create_notification_data(const struct gsm0808_notification_data *params) +{ + struct msgb *msg; + + msg = msgb_alloc_headroom(BSSMAP_MSG_SIZE, BSSMAP_MSG_HEADROOM, "BSSMAP-VGCS-SMS"); + if (!msg) + return NULL; + + /* Message Type, 3.2.2.1 */ + msgb_v_put(msg, BSS_MAP_MSG_NOTIFICATION_DATA); + + /* Application Data, 3.2.2.98 */ + msgb_tlv_put(msg, GSM0808_IE_APP_DATA, params->app_data.data_len, params->app_data.data); + + /* Data Identity, 3.2.2.99 */ + gsm0808_enc_data_identity(msg, &params->data_ident); + + /* MSISDN, 3.2.2.101 */ + if (params->msisdn_present) + gsm0808_enc_msisdn(msg, params->msisdn); + + /* prepend header with final length */ + msg->l3h = msgb_tv_push(msg, BSSAP_MSG_BSS_MANAGEMENT, msgb_length(msg)); + + return msg; +} + +/* Note that EMERGENCY RESET INDICATION and EMERGENCY RESET COMMAND cannot be implemented, due to lack of + * message type infromation in the specifications. */ + /* As per 3GPP TS 48.008 version 11.7.0 Release 11 */ static const struct tlv_definition bss_att_tlvdef = { .def = { @@ -1775,7 +2414,9 @@ { BSS_MAP_MSG_VGCS_VBS_ASSIGNMENT_RQST, "VGCS/VBS ASSIGN REQ" }, { BSS_MAP_MSG_VGCS_VBS_ASSIGNMENT_RESULT, "VGCS/VBS ASSIGN RES" }, { BSS_MAP_MSG_VGCS_VBS_ASSIGNMENT_FAILURE, "VGCS/VBS ASSIGN FAIL" }, + { BSS_MAP_MSG_VGCS_VBS_ASSIGNMENT_STATUS, "VGCS/VBS ASSIGN STATUS" }, { BSS_MAP_MSG_VGCS_VBS_QUEUING_INDICATION, "VGCS/VBS QUEUING IND" }, + { BSS_MAP_MSG_VGCS_VBS_AREA_CELL_INFO, "VGCS/VBS AREA CELL INFO" }, { BSS_MAP_MSG_UPLINK_RQST, "UPLINK REQ" }, { BSS_MAP_MSG_UPLINK_RQST_ACKNOWLEDGE, "UPLINK REQ ACK" }, { BSS_MAP_MSG_UPLINK_RQST_CONFIRMATION, "UPLINK REQ CONF" }, @@ -1784,6 +2425,7 @@ { BSS_MAP_MSG_UPLINK_RELEASE_CMD, "UPLINK REL CMD" }, { BSS_MAP_MSG_UPLINK_SEIZED_CMD, "UPLINK SEIZED CMD" }, { BSS_MAP_MSG_VGCS_ADDL_INFO, "VGCS ADDL INFO" }, + { BSS_MAP_MSG_VGCS_SMS, "VGCS SMS" }, { BSS_MAP_MSG_NOTIFICATION_DATA, "NOTIF DATA" }, { BSS_MAP_MSG_UPLINK_APP_DATA, "UPLINK APP DATA" }, diff --git a/src/gsm/gsm0808_utils.c b/src/gsm/gsm0808_utils.c index 0f04b04..dd40776 100644 --- a/src/gsm/gsm0808_utils.c +++ b/src/gsm/gsm0808_utils.c @@ -2358,6 +2358,96 @@ return 1; } +/*! Encode Data Identity IE (3GPP TS 48.008 3.2.2.99). + * \param[out] msg Message Buffer to which IE is to be appended + * \param[in] di Data Identity to be encoded + * \returns number of bytes appended to \a msg */ +uint8_t gsm0808_enc_data_identity(struct msgb *msg, const struct gsm0808_data_identity *ti) +{ + uint8_t *old_tail; + uint8_t *tlv_len; + uint8_t *ptr; + + OSMO_ASSERT(msg); + OSMO_ASSERT(ti); + + msgb_put_u8(msg, GSM0808_IE_DATA_IDENTITY); + tlv_len = msgb_put(msg, 1); + old_tail = msg->tail; + + ptr = msgb_put(msg, 1); + ptr[0] = ti->ai; + ptr[0] |= ti->di << 1; + ptr[0] |= ti->dp << 5; + + *tlv_len = (uint8_t) (msg->tail - old_tail); + return *tlv_len + 2; +} + +/*! Decode Data Identity IE (3GPP TS 48.008 3.2.2.99). + * \param[out] di Data Identity structure to store data + * \param[in] elem IE value to be decoded. + * \param[in] len Length of \a elem in bytes. + * \returns number of bytes parsed; negative on error */ +int gsm0808_dec_data_identity(struct gsm0808_data_identity *ti, const uint8_t *elem, uint8_t len) +{ + OSMO_ASSERT(ti); + OSMO_ASSERT(elem); + + if (len < 1) + return -EINVAL; + + ti->ai = elem[0] & 0x01; + ti->di = (elem[0] & 0x1e) >> 1; + ti->dp = (elem[0] & 0xe0) >> 5; + + return len; +} + +/*! Encode MSISDN IE (3GPP TS 48.008 3.2.2.101). + * \param[out] msg Message Buffer to which IE is to be appended + * \param[in] msisdn MSISDN to be encoded + * \returns number of bytes appended to \a msg */ +uint8_t gsm0808_enc_msisdn(struct msgb *msg, const char *msisdn) +{ + uint8_t *tlv_len; + uint8_t bcd_lv[11]; + int rc; + + OSMO_ASSERT(msg); + OSMO_ASSERT(msisdn); + + rc = gsm48_encode_bcd_number(bcd_lv, sizeof(bcd_lv), 0, msisdn); + if (rc < 1) + return 0; + + msgb_put_u8(msg, GSM0808_IE_MSISDN); + tlv_len = msgb_put(msg, rc); + + memcpy(tlv_len, bcd_lv, rc); + + *tlv_len = rc - 1; + return *tlv_len + 2; +} + +/*! Decode MSISDN IE (3GPP TS 48.008 3.2.2.101). + * \param[out] msisdn MSISDN structure to store data + * \param[in] elem IE value to be decoded. + * \param[in] len Length of \a elem in bytes. + * \returns number of bytes parsed; negative on error */ +int gsm0808_dec_msisdn(char *msisdn, const char *elem, uint8_t len) +{ + OSMO_ASSERT(msisdn); + OSMO_ASSERT(elem); + + if (len < 1) + return -EINVAL; + + gsm48_decode_bcd_number(msisdn, MSISDN_MAXLEN + 1, (uint8_t *)(elem - 1), 0); + + return len; +} + /*! Encode Talker Identity IE (3GPP TS 48.008 3.2.2.91). * \param[out] msg Message Buffer to which IE is to be appended * \param[in] ti Talker Identity to be encoded diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map index c37e87c..3118221 100644 --- a/src/gsm/libosmogsm.map +++ b/src/gsm/libosmogsm.map @@ -209,6 +209,25 @@ gsm0808_create_handover_complete; gsm0808_create_handover_failure; gsm0808_create_handover_performed; +gsm0808_create_vgcs_vbs_setup; +gsm0808_create_vgcs_vbs_setup_ack; +gsm0808_create_vgcs_vbs_setup_refuse; +gsm0808_create_vgcs_vbs_assign_req; +gsm0808_create_vgcs_vbs_assign_res; +gsm0808_create_vgcs_vbs_assign_fail; +gsm0808_create_uplink_request; +gsm0808_create_uplink_request_ack; +gsm0808_create_uplink_request_cnf; +gsm0808_create_uplink_app_data; +gsm0808_create_uplink_release_ind; +gsm0808_create_uplink_reject_cmd; +gsm0808_create_uplink_release_cmd; +gsm0808_create_uplink_seized_cmd; +gsm0808_create_vgcs_additional_info; +gsm0808_create_vgcs_vbs_area_cell_info; +gsm0808_create_vgcs_vbs_assign_stat; +gsm0808_create_vgcs_sms; +gsm0808_create_notification_data; gsm0808_create_common_id; gsm0808_prepend_dtap_header; gsm0808_enc_cause; -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/32932 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: Ib94c64136c31ce4af67c314a8550d93946cc844f Gerrit-Change-Number: 32932 Gerrit-PatchSet: 1 Gerrit-Owner: jolly <andreas(a)eversberg.eu> Gerrit-MessageType: newchange
1 0
0 0
[S] Change in libosmocore[master]: gsm620: make osmo_hr_check_sid compatible with RFC 5993
by falconia 23 May '23

23 May '23
Attention is currently required from: pespin, fixeria, dexter. falconia has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/32740 ) Change subject: gsm620: make osmo_hr_check_sid compatible with RFC 5993 ...................................................................... Patch Set 2: Code-Review-1 (1 comment) Patchset: PS1: > I was thinking about normalizing the to one format at the beginning but I quickly realized that this […] @dexter - please read my notes under the Redmine ticket for OS#5688. With my proposed solution, there won't be any double conversion like you are talking about - not just "often", but never at all. Also if OS#5688 ends up being "solved" the way you are going about it, I will never be able to implement OS#6036, and I won't be able to add HR1 support to OS#5996 - the issue that originally prompted you to create the present patch. I vote in strongest possible terms for leaving the osmo_hr_check_sid() function as it currently is. Also how urgent is this OS#5688 bug? If the issue isn't an urgent one, and we have a disagreement about how to approach it, perhaps we can pause any code-change actions until we discuss it in June OsmoDevCall? My original plan was to focus on FR1 and EFR there, but I have now studied up on HR1 too, and given that deciding on the way to handle HR1 is an active open issue, I now plan on discussing HR1 extensively too, both OS#5688 and OS#6036. -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/32740 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I25728299b757fbc87dd1b3f5adaec9b8b240c5d1 Gerrit-Change-Number: 32740 Gerrit-PatchSet: 2 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: falconia <falcon(a)freecalypso.org> Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Attention: dexter <pmaier(a)sysmocom.de> Gerrit-Comment-Date: Tue, 23 May 2023 13:54:10 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes Comment-In-Reply-To: falconia <falcon(a)freecalypso.org> Comment-In-Reply-To: fixeria <vyanitskiy(a)sysmocom.de> Comment-In-Reply-To: pespin <pespin(a)sysmocom.de> Comment-In-Reply-To: dexter <pmaier(a)sysmocom.de> Gerrit-MessageType: comment
1 0
0 0
[S] Change in ...osmo-python-tests[master]: osmoutil: print return code in end_proc()
by fixeria 23 May '23

23 May '23
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/python/osmo-python-tests/+/32929 ) Change subject: osmoutil: print return code in end_proc() ...................................................................... osmoutil: print return code in end_proc() Change-Id: If11616be6e9afc85814fa0b494e231cc7530459c Related: OS#5665 --- M osmopy/osmoutil.py 1 file changed, 12 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/python/osmo-python-tests refs/changes/29/32929/1 diff --git a/osmopy/osmoutil.py b/osmopy/osmoutil.py index ec9c8c3..ecd88f2 100755 --- a/osmopy/osmoutil.py +++ b/osmopy/osmoutil.py @@ -68,7 +68,8 @@ print("Killed child process") elif waited_time > .002: print("Terminating took %.3fs" % waited_time) - proc.wait() + rc = proc.wait() + print("Process returned code: %d" % rc) """Add a directory to sys.path, try to import a config file.""" -- To view, visit https://gerrit.osmocom.org/c/python/osmo-python-tests/+/32929 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: python/osmo-python-tests Gerrit-Branch: master Gerrit-Change-Id: If11616be6e9afc85814fa0b494e231cc7530459c Gerrit-Change-Number: 32929 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • ...
  • 259
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.