Neels Hofmeyr | c6848f4 | 2020-09-18 18:00:50 +0200 | [diff] [blame] | 1 | /*! \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 | * |
| 23 | * You should have received a copy of the GNU General Public License along |
| 24 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 25 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 26 | * |
| 27 | */ |
| 28 | #pragma once |
| 29 | |
| 30 | #include <stdint.h> |
| 31 | #include <stdbool.h> |
Neels Hofmeyr | 02de87b | 2020-09-18 18:00:50 +0200 | [diff] [blame] | 32 | #include <osmocom/gsm/protocol/gsm_48_071.h> |
| 33 | #include <osmocom/gsm/protocol/gsm_23_032.h> |
| 34 | #include <osmocom/gsm/gsm0808_utils.h> |
| 35 | #include <osmocom/gsm/gsm48.h> |
Neels Hofmeyr | c6848f4 | 2020-09-18 18:00:50 +0200 | [diff] [blame] | 36 | |
| 37 | /*! 3GPP TS 49.031 10.13 LCS Cause, also in 3GPP TS 48.008 3.2.2.66, which simply refers to the former. */ |
| 38 | enum lcs_cause { |
| 39 | LCS_CAUSE_UNSPECIFIED = 0, |
| 40 | LCS_CAUSE_SYSTEM_FAILURE = 1, |
| 41 | LCS_CAUSE_PROTOCOL_ERROR = 2, |
| 42 | LCS_CAUSE_DATA_MISSING_IN_REQ = 3, |
| 43 | LCS_CAUSE_UNEXP_DATA_IN_REQ = 4, |
| 44 | LCS_CAUSE_POS_METH_FAILURE = 5, |
| 45 | LCS_CAUSE_TGT_MS_UNREACHABLE = 6, |
| 46 | LCS_CAUSE_REQUEST_ABORTED = 7, |
| 47 | LCS_CAUSE_FACILITY_NOTSUPP = 8, |
| 48 | LCS_CAUSE_INTER_BSC_HO = 9, |
| 49 | LCS_CAUSE_INTRA_BSC_HO = 10, |
| 50 | LCS_CAUSE_CONGESTION = 11, |
| 51 | LCS_CAUSE_INTER_NSE_CHG = 12, |
| 52 | LCS_CAUSE_RA_UPDAT = 13, |
| 53 | LCS_CAUSE_PTMSI_REALLOC = 14, |
| 54 | LCS_CAUSE_GPRS_SUSPENSION = 15, |
| 55 | }; |
| 56 | |
| 57 | /*! 3GPP TS 49.031 10.13 LCS Cause, also in 3GPP TS 48.008 3.2.2.66, which simply refers to the former. */ |
| 58 | struct lcs_cause_ie { |
| 59 | bool present; |
| 60 | enum lcs_cause cause_val; |
| 61 | bool diag_val_present; |
| 62 | uint8_t diag_val; |
| 63 | }; |
| 64 | |
Neels Hofmeyr | 02de87b | 2020-09-18 18:00:50 +0200 | [diff] [blame] | 65 | enum bssap_le_msg_discr { |
| 66 | BSSAP_LE_MSG_DISCR_BSSMAP_LE = 0, |
| 67 | }; |
| 68 | |
| 69 | enum bssmap_le_msgt { |
| 70 | BSSMAP_LE_MSGT_PERFORM_LOC_REQ = 0x2b, |
| 71 | BSSMAP_LE_MSGT_PERFORM_LOC_RESP = 0x2d, |
| 72 | BSSMAP_LE_MSGT_PERFORM_LOC_ABORT = 0x2e, |
| 73 | BSSMAP_LE_MSGT_PERFORM_LOC_INFO = 0x2f, |
| 74 | BSSMAP_LE_MSGT_ASSIST_INFO_REQ = 0x20, |
| 75 | BSSMAP_LE_MSGT_ASSIST_INFO_RESP = 0x21, |
| 76 | BSSMAP_LE_MSGT_CONN_ORIENTED_INFO = 0x2a, |
| 77 | BSSMAP_LE_MSGT_CONN_LESS_INFO = 0x3a, |
| 78 | BSSMAP_LE_MSGT_RESET = 0x30, |
| 79 | BSSMAP_LE_MSGT_RESET_ACK = 0x31, |
| 80 | }; |
| 81 | |
| 82 | enum bssmap_le_iei { |
| 83 | BSSMAP_LE_IEI_LCS_QoS = 0x3e, |
| 84 | BSSMAP_LE_IEI_LCS_PRIORITY = 0x43, |
| 85 | BSSMAP_LE_IEI_LOCATION_TYPE = 0x44, |
| 86 | BSSMAP_LE_IEI_GANSS_LOCATION_TYPE = 0x82, |
| 87 | BSSMAP_LE_IEI_GEO_LOCATION = 0x45, |
| 88 | BSSMAP_LE_IEI_POSITIONING_DATA = 0x46, |
| 89 | BSSMAP_LE_IEI_GANSS_POS_DATA = 0x83, |
| 90 | BSSMAP_LE_IEI_VELOCITY_DATA = 0x55, |
| 91 | BSSMAP_LE_IEI_LCS_CAUSE = 0x47, |
| 92 | BSSMAP_LE_IEI_LCS_CLIENT_TYPE = 0x48, |
| 93 | BSSMAP_LE_IEI_APDU = 0x49, |
| 94 | BSSMAP_LE_IEI_NET_ELEM_ID = 0x4a, |
| 95 | BSSMAP_LE_IEI_REQ_GPS_ASS_D = 0x4b, |
| 96 | BSSMAP_LE_IEI_REQ_GANSS_ASS_D = 0x41, |
| 97 | BSSMAP_LE_IEI_DECIPH_KEYS = 0x4c, |
| 98 | BSSMAP_LE_IEI_RET_ERR_REQ = 0x4d, |
| 99 | BSSMAP_LE_IEI_RET_ERR_CAUSE = 0x4e, |
| 100 | BSSMAP_LE_IEI_SEGMENTATION = 0x4f, |
| 101 | BSSMAP_LE_IEI_CLASSMARK3_INFO = 0x13, |
| 102 | BSSMAP_LE_IEI_CAUSE = 0x4, |
| 103 | BSSMAP_LE_IEI_CELL_ID = 0x5, |
| 104 | BSSMAP_LE_IEI_CHOSEN_CHAN = 0x21, |
| 105 | BSSMAP_LE_IEI_IMSI = 0x0, |
| 106 | BSSMAP_LE_IEI_LCS_CAPABILITY = 0x50, |
| 107 | BSSMAP_LE_IEI_PKT_MEAS_REP = 0x51, |
| 108 | BSSMAP_LE_IEI_CELL_ID_LIST = 0x52, |
| 109 | BSSMAP_LE_IEI_IMEI = 0x80, |
| 110 | BSSMAP_LE_IEI_BSS_MLAT_CAP = 0x84, |
| 111 | BSSMAP_LE_IEI_CELL_INFO_LIST = 0x85, |
| 112 | BSSMAP_LE_IEI_BTS_RX_ACC_LVL = 0x86, |
| 113 | BSSMAP_LE_IEI_MLAT_METHOD = 0x87, |
| 114 | BSSMAP_LE_IEI_MLAT_TA = 0x88, |
| 115 | BSSMAP_LE_IEI_MS_SYNC_ACC = 0x89, |
| 116 | BSSMAP_LE_IEI_SHORT_ID_SET = 0x8a, |
| 117 | BSSMAP_LE_IEI_RANDOM_ID_SET = 0x8b, |
| 118 | BSSMAP_LE_IEI_SHORT_BSS_ID = 0x8c, |
| 119 | BSSMAP_LE_IEI_RANDOM_ID = 0x8d, |
| 120 | BSSMAP_LE_IEI_SHORT_ID = 0x8e, |
| 121 | BSSMAP_LE_IEI_COVERAGE_CLASS = 0x8f, |
| 122 | BSSMAP_LE_IEI_MTA_ACC_SEC_RQD = 0x90, |
| 123 | }; |
| 124 | |
| 125 | enum bssmap_le_apdu_proto { |
| 126 | BSSMAP_LE_APDU_PROT_RESERVED = 0, |
| 127 | BSSMAP_LE_APDU_PROT_BSSLAP = 1, |
| 128 | BSSMAP_LE_APDU_PROT_LLP = 2, |
| 129 | BSSMAP_LE_APDU_PROT_SMLCPP = 3, |
| 130 | }; |
| 131 | |
| 132 | enum bssmap_le_location_information { |
| 133 | BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC = 0x0, |
| 134 | BSSMAP_LE_LOC_INFO_ASSIST_TARGET_MS = 0x1, |
| 135 | BSSMAP_LE_LOC_INFO_BC_DECIPHER_KEYS = 0x2, |
| 136 | }; |
| 137 | |
| 138 | enum bssmap_le_positioning_method { |
| 139 | BSSMAP_LE_POS_METHOD_OMITTED = 0x0, |
| 140 | BSSMAP_LE_POS_METHOD_MOBILE_ASSISTED_E_OTD = 0x1, |
| 141 | BSSMAP_LE_POS_METHOD_MOBILE_BASED_E_OTD = 0x2, |
| 142 | BSSMAP_LE_POS_METHOD_ASSISTED_GPS = 0x3, |
| 143 | }; |
| 144 | |
| 145 | struct bssmap_le_location_type { |
| 146 | enum bssmap_le_location_information location_information; |
| 147 | enum bssmap_le_positioning_method positioning_method; |
| 148 | }; |
| 149 | |
| 150 | enum bssmap_le_lcs_client_type { |
| 151 | BSSMAP_LE_LCS_CTYPE_VALUE_ADDED_UNSPECIFIED = 0x0, |
| 152 | BSSMAP_LE_LCS_CTYPE_PLMN_OPER_UNSPECIFIED = 0x20, |
| 153 | BSSMAP_LE_LCS_CTYPE_PLMN_OPER_BCAST_SERVICE = 0x21, |
| 154 | BSSMAP_LE_LCS_CTYPE_PLMN_OPER_OAM = 0x22, |
| 155 | BSSMAP_LE_LCS_CTYPE_PLMN_OPER_ANON_STATS = 0x23, |
| 156 | BSSMAP_LE_LCS_CTYPE_PLMN_OPER_TGT_MS_SVC = 0x24, |
| 157 | BSSMAP_LE_LCS_CTYPE_EMERG_SVC_UNSPECIFIED = 0x30, |
| 158 | BSSMAP_LE_LCS_CTYPE_LI_UNSPECIFIED = 0x40, |
| 159 | }; |
| 160 | |
| 161 | struct bssmap_le_perform_loc_req { |
| 162 | struct bssmap_le_location_type location_type; |
| 163 | struct gsm0808_cell_id cell_id; |
| 164 | |
| 165 | bool lcs_client_type_present; |
| 166 | enum bssmap_le_lcs_client_type lcs_client_type; |
| 167 | |
| 168 | struct osmo_mobile_identity imsi; |
| 169 | struct osmo_mobile_identity imei; |
| 170 | |
| 171 | bool apdu_present; |
| 172 | struct bsslap_pdu apdu; |
| 173 | |
| 174 | bool more_items; /*!< always set this to false */ |
| 175 | }; |
| 176 | |
| 177 | struct bssmap_le_perform_loc_resp { |
| 178 | bool location_estimate_present; |
| 179 | union gad_raw location_estimate; |
| 180 | |
| 181 | struct lcs_cause_ie lcs_cause; |
| 182 | |
| 183 | bool more_items; /*!< always set this to false */ |
| 184 | }; |
| 185 | |
| 186 | struct bssmap_le_conn_oriented_info { |
| 187 | struct bsslap_pdu apdu; |
| 188 | |
| 189 | bool more_items; /*!< always set this to false */ |
| 190 | }; |
| 191 | |
| 192 | struct bssmap_le_pdu { |
| 193 | enum bssmap_le_msgt msg_type; |
| 194 | union { |
| 195 | enum gsm0808_cause reset; |
| 196 | /* reset_ack consists only of the message type */ |
| 197 | struct bssmap_le_perform_loc_req perform_loc_req; |
| 198 | struct bssmap_le_perform_loc_resp perform_loc_resp; |
| 199 | struct lcs_cause_ie perform_loc_abort; |
| 200 | struct bssmap_le_conn_oriented_info conn_oriented_info; |
| 201 | }; |
| 202 | }; |
| 203 | |
| 204 | struct bssap_le_pdu { |
| 205 | enum bssap_le_msg_discr discr; |
| 206 | union { |
| 207 | struct bssmap_le_pdu bssmap_le; |
| 208 | /* future: add DTAP PDU, currently not implemented */ |
| 209 | }; |
| 210 | }; |
| 211 | |
Neels Hofmeyr | c6848f4 | 2020-09-18 18:00:50 +0200 | [diff] [blame] | 212 | /*! @} */ |