blob: 463fabf561660556bc9cb785c8a57fd797ef5878 [file] [log] [blame]
Neels Hofmeyrc6848f42020-09-18 18:00:50 +02001/*! \defgroup bssmap_le 3GPP TS 49.031 BSSMAP-LE.
2 * @{
3 * \file gsm_49_031.h
4 */
5/*
6 * (C) 2020 by sysmocom - s.f.m.c. GmbH <info@sysmocom.de>
7 * All Rights Reserved
8 *
9 * Author: Neels Hofmeyr <neels@hofmeyr.de>
10 *
11 * SPDX-License-Identifier: GPL-2.0+
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
Neels Hofmeyrc6848f42020-09-18 18:00:50 +020023 */
24#pragma once
25
26#include <stdint.h>
27#include <stdbool.h>
Vadim Yanitskiybe133872022-03-22 18:17:30 +030028
29#include <osmocom/core/endian.h>
Neels Hofmeyr02de87b2020-09-18 18:00:50 +020030#include <osmocom/gsm/protocol/gsm_48_071.h>
31#include <osmocom/gsm/protocol/gsm_23_032.h>
32#include <osmocom/gsm/gsm0808_utils.h>
33#include <osmocom/gsm/gsm48.h>
Neels Hofmeyrc6848f42020-09-18 18:00:50 +020034
35/*! 3GPP TS 49.031 10.13 LCS Cause, also in 3GPP TS 48.008 3.2.2.66, which simply refers to the former. */
36enum lcs_cause {
37 LCS_CAUSE_UNSPECIFIED = 0,
38 LCS_CAUSE_SYSTEM_FAILURE = 1,
39 LCS_CAUSE_PROTOCOL_ERROR = 2,
40 LCS_CAUSE_DATA_MISSING_IN_REQ = 3,
41 LCS_CAUSE_UNEXP_DATA_IN_REQ = 4,
42 LCS_CAUSE_POS_METH_FAILURE = 5,
43 LCS_CAUSE_TGT_MS_UNREACHABLE = 6,
44 LCS_CAUSE_REQUEST_ABORTED = 7,
45 LCS_CAUSE_FACILITY_NOTSUPP = 8,
46 LCS_CAUSE_INTER_BSC_HO = 9,
47 LCS_CAUSE_INTRA_BSC_HO = 10,
48 LCS_CAUSE_CONGESTION = 11,
49 LCS_CAUSE_INTER_NSE_CHG = 12,
50 LCS_CAUSE_RA_UPDAT = 13,
51 LCS_CAUSE_PTMSI_REALLOC = 14,
52 LCS_CAUSE_GPRS_SUSPENSION = 15,
53};
54
55/*! 3GPP TS 49.031 10.13 LCS Cause, also in 3GPP TS 48.008 3.2.2.66, which simply refers to the former. */
56struct lcs_cause_ie {
57 bool present;
58 enum lcs_cause cause_val;
59 bool diag_val_present;
60 uint8_t diag_val;
61};
62
Vadim Yanitskiybe133872022-03-22 18:17:30 +030063/* 3GPP TS 49.031 10.16 LCS QoS IE */
64struct osmo_bssmap_le_lcs_qos {
65#if OSMO_IS_LITTLE_ENDIAN
66 uint8_t vert:1, vel:1, spare1:6;
67 uint8_t ha_val:7, ha_ind:1;
68 uint8_t va_val:7, va_ind:1;
69 uint8_t spare3:6, rt:2;
70#elif OSMO_IS_BIG_ENDIAN
Oliver Smith48706d62023-02-20 09:47:59 +010071/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */
Vadim Yanitskiybe133872022-03-22 18:17:30 +030072 uint8_t spare1:6, vel:1, vert:1;
73 uint8_t ha_ind:1, ha_val:7;
74 uint8_t va_ind:1, va_val:7;
75 uint8_t rt:2, spare3:6;
76#endif
77} __attribute__ ((packed));
78
Neels Hofmeyr02de87b2020-09-18 18:00:50 +020079enum bssap_le_msg_discr {
80 BSSAP_LE_MSG_DISCR_BSSMAP_LE = 0,
81};
82
83enum bssmap_le_msgt {
84 BSSMAP_LE_MSGT_PERFORM_LOC_REQ = 0x2b,
85 BSSMAP_LE_MSGT_PERFORM_LOC_RESP = 0x2d,
86 BSSMAP_LE_MSGT_PERFORM_LOC_ABORT = 0x2e,
87 BSSMAP_LE_MSGT_PERFORM_LOC_INFO = 0x2f,
88 BSSMAP_LE_MSGT_ASSIST_INFO_REQ = 0x20,
89 BSSMAP_LE_MSGT_ASSIST_INFO_RESP = 0x21,
90 BSSMAP_LE_MSGT_CONN_ORIENTED_INFO = 0x2a,
91 BSSMAP_LE_MSGT_CONN_LESS_INFO = 0x3a,
92 BSSMAP_LE_MSGT_RESET = 0x30,
93 BSSMAP_LE_MSGT_RESET_ACK = 0x31,
94};
95
96enum bssmap_le_iei {
97 BSSMAP_LE_IEI_LCS_QoS = 0x3e,
98 BSSMAP_LE_IEI_LCS_PRIORITY = 0x43,
99 BSSMAP_LE_IEI_LOCATION_TYPE = 0x44,
100 BSSMAP_LE_IEI_GANSS_LOCATION_TYPE = 0x82,
101 BSSMAP_LE_IEI_GEO_LOCATION = 0x45,
102 BSSMAP_LE_IEI_POSITIONING_DATA = 0x46,
103 BSSMAP_LE_IEI_GANSS_POS_DATA = 0x83,
104 BSSMAP_LE_IEI_VELOCITY_DATA = 0x55,
105 BSSMAP_LE_IEI_LCS_CAUSE = 0x47,
106 BSSMAP_LE_IEI_LCS_CLIENT_TYPE = 0x48,
107 BSSMAP_LE_IEI_APDU = 0x49,
108 BSSMAP_LE_IEI_NET_ELEM_ID = 0x4a,
109 BSSMAP_LE_IEI_REQ_GPS_ASS_D = 0x4b,
110 BSSMAP_LE_IEI_REQ_GANSS_ASS_D = 0x41,
111 BSSMAP_LE_IEI_DECIPH_KEYS = 0x4c,
112 BSSMAP_LE_IEI_RET_ERR_REQ = 0x4d,
113 BSSMAP_LE_IEI_RET_ERR_CAUSE = 0x4e,
114 BSSMAP_LE_IEI_SEGMENTATION = 0x4f,
115 BSSMAP_LE_IEI_CLASSMARK3_INFO = 0x13,
116 BSSMAP_LE_IEI_CAUSE = 0x4,
117 BSSMAP_LE_IEI_CELL_ID = 0x5,
118 BSSMAP_LE_IEI_CHOSEN_CHAN = 0x21,
119 BSSMAP_LE_IEI_IMSI = 0x0,
120 BSSMAP_LE_IEI_LCS_CAPABILITY = 0x50,
121 BSSMAP_LE_IEI_PKT_MEAS_REP = 0x51,
122 BSSMAP_LE_IEI_CELL_ID_LIST = 0x52,
123 BSSMAP_LE_IEI_IMEI = 0x80,
124 BSSMAP_LE_IEI_BSS_MLAT_CAP = 0x84,
125 BSSMAP_LE_IEI_CELL_INFO_LIST = 0x85,
126 BSSMAP_LE_IEI_BTS_RX_ACC_LVL = 0x86,
127 BSSMAP_LE_IEI_MLAT_METHOD = 0x87,
128 BSSMAP_LE_IEI_MLAT_TA = 0x88,
129 BSSMAP_LE_IEI_MS_SYNC_ACC = 0x89,
130 BSSMAP_LE_IEI_SHORT_ID_SET = 0x8a,
131 BSSMAP_LE_IEI_RANDOM_ID_SET = 0x8b,
132 BSSMAP_LE_IEI_SHORT_BSS_ID = 0x8c,
133 BSSMAP_LE_IEI_RANDOM_ID = 0x8d,
134 BSSMAP_LE_IEI_SHORT_ID = 0x8e,
135 BSSMAP_LE_IEI_COVERAGE_CLASS = 0x8f,
136 BSSMAP_LE_IEI_MTA_ACC_SEC_RQD = 0x90,
137};
138
139enum bssmap_le_apdu_proto {
140 BSSMAP_LE_APDU_PROT_RESERVED = 0,
141 BSSMAP_LE_APDU_PROT_BSSLAP = 1,
142 BSSMAP_LE_APDU_PROT_LLP = 2,
143 BSSMAP_LE_APDU_PROT_SMLCPP = 3,
144};
145
146enum bssmap_le_location_information {
147 BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC = 0x0,
148 BSSMAP_LE_LOC_INFO_ASSIST_TARGET_MS = 0x1,
149 BSSMAP_LE_LOC_INFO_BC_DECIPHER_KEYS = 0x2,
150};
151
152enum bssmap_le_positioning_method {
153 BSSMAP_LE_POS_METHOD_OMITTED = 0x0,
154 BSSMAP_LE_POS_METHOD_MOBILE_ASSISTED_E_OTD = 0x1,
155 BSSMAP_LE_POS_METHOD_MOBILE_BASED_E_OTD = 0x2,
156 BSSMAP_LE_POS_METHOD_ASSISTED_GPS = 0x3,
157};
158
159struct bssmap_le_location_type {
160 enum bssmap_le_location_information location_information;
161 enum bssmap_le_positioning_method positioning_method;
162};
163
164enum bssmap_le_lcs_client_type {
165 BSSMAP_LE_LCS_CTYPE_VALUE_ADDED_UNSPECIFIED = 0x0,
166 BSSMAP_LE_LCS_CTYPE_PLMN_OPER_UNSPECIFIED = 0x20,
167 BSSMAP_LE_LCS_CTYPE_PLMN_OPER_BCAST_SERVICE = 0x21,
168 BSSMAP_LE_LCS_CTYPE_PLMN_OPER_OAM = 0x22,
169 BSSMAP_LE_LCS_CTYPE_PLMN_OPER_ANON_STATS = 0x23,
170 BSSMAP_LE_LCS_CTYPE_PLMN_OPER_TGT_MS_SVC = 0x24,
171 BSSMAP_LE_LCS_CTYPE_EMERG_SVC_UNSPECIFIED = 0x30,
172 BSSMAP_LE_LCS_CTYPE_LI_UNSPECIFIED = 0x40,
173};
174
175struct bssmap_le_perform_loc_req {
176 struct bssmap_le_location_type location_type;
177 struct gsm0808_cell_id cell_id;
178
179 bool lcs_client_type_present;
180 enum bssmap_le_lcs_client_type lcs_client_type;
181
182 struct osmo_mobile_identity imsi;
183 struct osmo_mobile_identity imei;
184
185 bool apdu_present;
186 struct bsslap_pdu apdu;
187
Vadim Yanitskiybe133872022-03-22 18:17:30 +0300188 bool more_items; /*!< set this to true iff any fields below are used */
189
190 bool lcs_priority_present;
191 uint8_t lcs_priority; /*!< see in 3GPP TS 29.002 */
192
193 bool lcs_qos_present;
194 struct osmo_bssmap_le_lcs_qos lcs_qos;
195
196 bool more_items2; /*!< always set this to false */
Neels Hofmeyr02de87b2020-09-18 18:00:50 +0200197};
198
199struct bssmap_le_perform_loc_resp {
200 bool location_estimate_present;
201 union gad_raw location_estimate;
202
203 struct lcs_cause_ie lcs_cause;
204
205 bool more_items; /*!< always set this to false */
206};
207
208struct bssmap_le_conn_oriented_info {
209 struct bsslap_pdu apdu;
210
211 bool more_items; /*!< always set this to false */
212};
213
214struct bssmap_le_pdu {
215 enum bssmap_le_msgt msg_type;
216 union {
217 enum gsm0808_cause reset;
218 /* reset_ack consists only of the message type */
219 struct bssmap_le_perform_loc_req perform_loc_req;
220 struct bssmap_le_perform_loc_resp perform_loc_resp;
221 struct lcs_cause_ie perform_loc_abort;
222 struct bssmap_le_conn_oriented_info conn_oriented_info;
223 };
224};
225
226struct bssap_le_pdu {
227 enum bssap_le_msg_discr discr;
228 union {
229 struct bssmap_le_pdu bssmap_le;
230 /* future: add DTAP PDU, currently not implemented */
231 };
232};
233
Neels Hofmeyrc6848f42020-09-18 18:00:50 +0200234/*! @} */