Harald Welte | 37b6165 | 2017-10-16 18:46:03 +0200 | [diff] [blame] | 1 | /*! \defgroup gsm0808 GSM 08.08 / 3GPP TS 48.008 A Interface |
| 2 | * @{ |
| 3 | * \file gsm0808.h */ |
Neels Hofmeyr | 17518fe | 2017-06-20 04:35:06 +0200 | [diff] [blame] | 4 | /* |
| 5 | * (C) 2009,2010 by Holger Hans Peter Freyther <zecke@selfish.org> |
Holger Hans Peter Freyther | 280cd51 | 2010-04-15 10:10:39 +0200 | [diff] [blame] | 6 | * (C) 2009,2010 by On-Waves |
| 7 | * All Rights Reserved |
| 8 | * |
| 9 | * This program is free software; you can redistribute it and/or modify |
| 10 | * it under the terms of the GNU General Public License as published by |
| 11 | * the Free Software Foundation; either version 2 of the License, or |
| 12 | * (at your option) any later version. |
| 13 | * |
| 14 | * This program is distributed in the hope that it will be useful, |
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 | * GNU General Public License for more details. |
| 18 | * |
Holger Hans Peter Freyther | 280cd51 | 2010-04-15 10:10:39 +0200 | [diff] [blame] | 19 | */ |
Sylvain Munaut | 12ba778 | 2014-06-16 10:13:40 +0200 | [diff] [blame] | 20 | #pragma once |
Holger Hans Peter Freyther | 280cd51 | 2010-04-15 10:10:39 +0200 | [diff] [blame] | 21 | |
| 22 | #include "tlv.h" |
Philipp Maier | fa896ab | 2017-03-27 16:55:32 +0200 | [diff] [blame] | 23 | #include <osmocom/gsm/protocol/gsm_08_08.h> |
Neels Hofmeyr | 70aba3f | 2018-03-13 03:40:53 +0100 | [diff] [blame] | 24 | #include <osmocom/gsm/gsm0808_utils.h> |
Neels Hofmeyr | c4fce14 | 2018-02-20 13:47:08 +0100 | [diff] [blame] | 25 | #include <osmocom/gsm/gsm23003.h> |
Neels Hofmeyr | f7e9c51 | 2019-03-06 04:25:38 +0100 | [diff] [blame] | 26 | #include <osmocom/gsm/protocol/gsm_23_003.h> |
Harald Welte | ebd362d | 2018-06-02 14:11:19 +0200 | [diff] [blame] | 27 | #include <osmocom/core/utils.h> |
Neels Hofmeyr | c4fce14 | 2018-02-20 13:47:08 +0100 | [diff] [blame] | 28 | |
Neels Hofmeyr | 99273c7 | 2019-02-22 04:48:56 +0100 | [diff] [blame] | 29 | #define BSSMAP_MSG_SIZE 1024 |
| 30 | #define BSSMAP_MSG_HEADROOM 512 |
Max | f69aa9c | 2018-11-29 23:32:06 +0100 | [diff] [blame] | 31 | |
Harald Welte | 20725b9 | 2017-05-15 12:50:04 +0200 | [diff] [blame] | 32 | struct sockaddr_storage; |
Holger Hans Peter Freyther | 280cd51 | 2010-04-15 10:10:39 +0200 | [diff] [blame] | 33 | |
| 34 | struct msgb; |
Stefan Sperling | 11a4d9d | 2018-02-15 18:28:04 +0100 | [diff] [blame] | 35 | struct gsm0808_cell_id_list2; |
Holger Hans Peter Freyther | 280cd51 | 2010-04-15 10:10:39 +0200 | [diff] [blame] | 36 | |
Philipp Maier | fa896ab | 2017-03-27 16:55:32 +0200 | [diff] [blame] | 37 | struct msgb *gsm0808_create_layer3(struct msgb *msg_l3, uint16_t nc, |
Neels Hofmeyr | bd6c8b5 | 2018-03-22 14:05:21 +0100 | [diff] [blame] | 38 | uint16_t cc, int lac, uint16_t _ci) |
| 39 | OSMO_DEPRECATED("Use gsm0808_create_layer3_2() instead, to not lose leading zeros in the MNC"); |
Philipp Maier | fa896ab | 2017-03-27 16:55:32 +0200 | [diff] [blame] | 40 | struct msgb *gsm0808_create_layer3_aoip(const struct msgb *msg_l3, uint16_t nc, |
| 41 | uint16_t cc, int lac, uint16_t _ci, |
Neels Hofmeyr | bd6c8b5 | 2018-03-22 14:05:21 +0100 | [diff] [blame] | 42 | const struct gsm0808_speech_codec_list *scl) |
| 43 | OSMO_DEPRECATED("Use gsm0808_create_layer3_2() instead, to not lose leading zeros in the MNC"); |
Neels Hofmeyr | c4fce14 | 2018-02-20 13:47:08 +0100 | [diff] [blame] | 44 | struct msgb *gsm0808_create_layer3_2(const struct msgb *msg_l3, const struct osmo_cell_global_id *cell, |
| 45 | const struct gsm0808_speech_codec_list *scl); |
Holger Hans Peter Freyther | 280cd51 | 2010-04-15 10:10:39 +0200 | [diff] [blame] | 46 | struct msgb *gsm0808_create_reset(void); |
Harald Welte | a62fe31 | 2013-06-19 15:14:37 +0200 | [diff] [blame] | 47 | struct msgb *gsm0808_create_reset_ack(void); |
Philipp Maier | 1a146c8 | 2018-10-30 09:36:49 +0100 | [diff] [blame] | 48 | struct msgb *gsm0808_create_clear_command(uint8_t cause); |
Philipp Maier | 74c4c4e | 2019-02-04 16:42:28 +0100 | [diff] [blame] | 49 | struct msgb *gsm0808_create_clear_command2(uint8_t cause, bool csfb_ind); |
Holger Hans Peter Freyther | 280cd51 | 2010-04-15 10:10:39 +0200 | [diff] [blame] | 50 | struct msgb *gsm0808_create_clear_complete(void); |
Philipp Maier | b478dd3 | 2017-03-29 15:50:05 +0200 | [diff] [blame] | 51 | struct msgb *gsm0808_create_cipher(const struct gsm0808_encrypt_info *ei, |
| 52 | const uint8_t *cipher_response_mode); |
Neels Hofmeyr | 4a9756c | 2021-06-10 00:48:15 +0200 | [diff] [blame] | 53 | |
| 54 | struct gsm0808_cipher_mode_command { |
| 55 | struct gsm0808_encrypt_info ei; |
| 56 | |
| 57 | /*! 3GPP TS 48.008 3.2.2.34 Cipher Response Mode, optional IE */ |
| 58 | bool cipher_response_mode_present; |
| 59 | /*! 3GPP TS 48.008 3.2.2.34 Cipher Response Mode: |
| 60 | * 0 - IMEISV must not be included by the Mobile Station; |
| 61 | * 1 - IMEISV must be included by the Mobile Station. |
| 62 | */ |
| 63 | uint8_t cipher_response_mode; |
| 64 | |
| 65 | bool kc128_present; |
| 66 | uint8_t kc128[16]; |
| 67 | |
| 68 | /* more items are defined in the spec and may be added later */ |
| 69 | bool more_items; /*< always set this to false */ |
| 70 | }; |
| 71 | struct msgb *gsm0808_create_cipher2(const struct gsm0808_cipher_mode_command *cmc); |
| 72 | |
Holger Hans Peter Freyther | 81716d5 | 2010-04-17 06:16:35 +0200 | [diff] [blame] | 73 | struct msgb *gsm0808_create_cipher_complete(struct msgb *layer3, uint8_t alg_id); |
Max | aa93463 | 2018-11-07 13:16:54 +0100 | [diff] [blame] | 74 | struct msgb *gsm0808_create_cipher_reject(enum gsm0808_cause cause); |
Max | ed651d2 | 2018-11-07 15:25:05 +0100 | [diff] [blame] | 75 | struct msgb *gsm0808_create_cipher_reject_ext(enum gsm0808_cause_class class, uint8_t ext); |
Harald Welte | e61d459 | 2022-11-03 11:05:58 +0100 | [diff] [blame] | 76 | struct msgb *gsm0808_create_classmark_request(void); |
Harald Welte | 07b625d | 2012-01-23 10:02:58 +0100 | [diff] [blame] | 77 | struct msgb *gsm0808_create_classmark_update(const uint8_t *cm2, uint8_t cm2_len, |
| 78 | const uint8_t *cm3, uint8_t cm3_len); |
Vadim Yanitskiy | fa6cd88 | 2020-08-26 18:03:59 +0700 | [diff] [blame] | 79 | struct msgb *gsm0808_create_sapi_reject_cause(uint8_t link_id, uint16_t cause); |
| 80 | struct msgb *gsm0808_create_sapi_reject(uint8_t link_id) |
| 81 | OSMO_DEPRECATED("Use gsm0808_create_sapi_reject_cause() instead"); |
Philipp Maier | c6144a2 | 2017-03-29 17:53:43 +0200 | [diff] [blame] | 82 | struct msgb *gsm0808_create_ass(const struct gsm0808_channel_type *ct, |
| 83 | const uint16_t *cic, |
| 84 | const struct sockaddr_storage *ss, |
| 85 | const struct gsm0808_speech_codec_list *scl, |
| 86 | const uint32_t *ci); |
Max | 5207432 | 2018-11-30 10:44:07 +0100 | [diff] [blame] | 87 | struct msgb *gsm0808_create_ass2(const struct gsm0808_channel_type *ct, |
| 88 | const uint16_t *cic, |
| 89 | const struct sockaddr_storage *ss, |
| 90 | const struct gsm0808_speech_codec_list *scl, |
| 91 | const uint32_t *ci, |
| 92 | const uint8_t *kc, const struct osmo_lcls *lcls); |
Philipp Maier | fa896ab | 2017-03-27 16:55:32 +0200 | [diff] [blame] | 93 | struct msgb *gsm0808_create_ass_compl(uint8_t rr_cause, uint8_t chosen_channel, |
| 94 | uint8_t encr_alg_id, uint8_t speech_mode, |
| 95 | const struct sockaddr_storage *ss, |
| 96 | const struct gsm0808_speech_codec *sc, |
| 97 | const struct gsm0808_speech_codec_list |
| 98 | *scl); |
Max | 414c8f5 | 2019-01-08 14:44:24 +0100 | [diff] [blame] | 99 | struct msgb *gsm0808_create_ass_compl2(uint8_t rr_cause, uint8_t chosen_channel, |
| 100 | uint8_t encr_alg_id, uint8_t speech_mode, |
| 101 | const struct sockaddr_storage *ss, |
| 102 | const struct gsm0808_speech_codec *sc, |
| 103 | const struct gsm0808_speech_codec_list *scl, |
| 104 | enum gsm0808_lcls_status lcls_bss_status); |
Holger Hans Peter Freyther | b60a4b3 | 2010-07-23 18:35:59 +0800 | [diff] [blame] | 105 | struct msgb *gsm0808_create_assignment_completed(uint8_t rr_cause, |
Philipp Maier | fa896ab | 2017-03-27 16:55:32 +0200 | [diff] [blame] | 106 | uint8_t chosen_channel, |
| 107 | uint8_t encr_alg_id, |
Holger Hans Peter Freyther | ba6172a | 2010-04-17 06:21:49 +0200 | [diff] [blame] | 108 | uint8_t speech_mode); |
Philipp Maier | fa896ab | 2017-03-27 16:55:32 +0200 | [diff] [blame] | 109 | struct msgb *gsm0808_create_ass_fail(uint8_t cause, const uint8_t *rr_cause, |
| 110 | const struct gsm0808_speech_codec_list |
| 111 | *scl); |
Holger Hans Peter Freyther | 280cd51 | 2010-04-15 10:10:39 +0200 | [diff] [blame] | 112 | struct msgb *gsm0808_create_assignment_failure(uint8_t cause, uint8_t *rr_cause); |
Holger Hans Peter Freyther | af270a4 | 2010-11-04 12:42:50 +0100 | [diff] [blame] | 113 | struct msgb *gsm0808_create_clear_rqst(uint8_t cause); |
Stefan Sperling | 11a4d9d | 2018-02-15 18:28:04 +0100 | [diff] [blame] | 114 | struct msgb *gsm0808_create_paging2(const char *imsi, const uint32_t *tmsi, |
| 115 | const struct gsm0808_cell_id_list2 *cil, |
| 116 | const uint8_t *chan_needed); |
Philipp Maier | 3d48ec0 | 2017-03-29 17:37:55 +0200 | [diff] [blame] | 117 | struct msgb *gsm0808_create_paging(const char *imsi, const uint32_t *tmsi, |
| 118 | const struct gsm0808_cell_id_list *cil, |
Stefan Sperling | 11a4d9d | 2018-02-15 18:28:04 +0100 | [diff] [blame] | 119 | const uint8_t *chan_needed) |
| 120 | OSMO_DEPRECATED("use gsm0808_create_paging2 instead"); |
Max | 45f89c9 | 2018-12-19 19:35:26 +0100 | [diff] [blame] | 121 | struct msgb *gsm0808_create_lcls_conn_ctrl(enum gsm0808_lcls_config config, |
| 122 | enum gsm0808_lcls_control control); |
Harald Welte | 64e807c | 2018-05-29 21:00:56 +0200 | [diff] [blame] | 123 | struct msgb *gsm0808_create_lcls_conn_ctrl_ack(enum gsm0808_lcls_status status); |
| 124 | struct msgb *gsm0808_create_lcls_notification(enum gsm0808_lcls_status status, bool break_req); |
Harald Welte | 1bd726a | 2020-06-21 22:04:52 +0200 | [diff] [blame] | 125 | struct msgb *gsm0808_create_common_id(const char *imsi, |
| 126 | const struct osmo_plmn_id *selected_plmn_id, |
| 127 | const struct osmo_plmn_id *last_used_eutran_plnm_id); |
Harald Welte | 64e807c | 2018-05-29 21:00:56 +0200 | [diff] [blame] | 128 | |
Holger Hans Peter Freyther | 280cd51 | 2010-04-15 10:10:39 +0200 | [diff] [blame] | 129 | |
Neels Hofmeyr | 70aba3f | 2018-03-13 03:40:53 +0100 | [diff] [blame] | 130 | /*! 3GPP TS 48.008 ยง3.2.2.5.8 Old BSS to New BSS information */ |
| 131 | struct gsm0808_old_bss_to_new_bss_info { |
| 132 | bool extra_information_present; |
| 133 | struct { |
| 134 | bool prec; |
| 135 | bool lcs; |
| 136 | bool ue_prob; |
| 137 | } extra_information; |
| 138 | |
| 139 | bool current_channel_type_2_present; |
| 140 | struct { |
| 141 | uint8_t mode; |
| 142 | uint8_t field; |
| 143 | } current_channel_type_2; |
| 144 | |
Pau Espin Pedrol | 1b625cb | 2021-04-14 21:27:31 +0200 | [diff] [blame] | 145 | bool last_eutran_plmn_id_present; |
| 146 | struct osmo_plmn_id last_eutran_plmn_id; |
| 147 | |
Neels Hofmeyr | 70aba3f | 2018-03-13 03:40:53 +0100 | [diff] [blame] | 148 | /* more items are defined in the spec and may be added later */ |
Neels Hofmeyr | 60f3153 | 2018-04-16 22:42:09 +0200 | [diff] [blame] | 149 | bool more_items; /*< always set this to false */ |
Neels Hofmeyr | 70aba3f | 2018-03-13 03:40:53 +0100 | [diff] [blame] | 150 | }; |
| 151 | |
| 152 | /*! 3GPP TS 48.008 ยง3.2.1.9 HANDOVER REQUIRED */ |
| 153 | struct gsm0808_handover_required { |
| 154 | uint16_t cause; |
| 155 | struct gsm0808_cell_id_list2 cil; |
| 156 | |
| 157 | bool current_channel_type_1_present; |
| 158 | uint8_t current_channel_type_1; |
| 159 | |
| 160 | bool speech_version_used_present; |
Neels Hofmeyr | 302aafc | 2019-04-10 19:23:45 +0200 | [diff] [blame] | 161 | enum gsm0808_permitted_speech speech_version_used; |
Neels Hofmeyr | 70aba3f | 2018-03-13 03:40:53 +0100 | [diff] [blame] | 162 | |
| 163 | bool old_bss_to_new_bss_info_present; |
| 164 | struct gsm0808_old_bss_to_new_bss_info old_bss_to_new_bss_info; |
| 165 | |
| 166 | /* more items are defined in the spec and may be added later */ |
Neels Hofmeyr | 60f3153 | 2018-04-16 22:42:09 +0200 | [diff] [blame] | 167 | bool more_items; /*< always set this to false */ |
Neels Hofmeyr | 70aba3f | 2018-03-13 03:40:53 +0100 | [diff] [blame] | 168 | }; |
| 169 | struct msgb *gsm0808_create_handover_required(const struct gsm0808_handover_required *params); |
| 170 | |
Neels Hofmeyr | f7e9c51 | 2019-03-06 04:25:38 +0100 | [diff] [blame] | 171 | /*! 3GPP TS 48.008 ยง3.2.1.37 HANDOVER REQUIRED REJECT */ |
| 172 | struct gsm0808_handover_required_reject { |
| 173 | uint16_t cause; |
| 174 | |
| 175 | /* more items are defined in the spec and may be added later */ |
| 176 | bool more_items; /*< always set this to false */ |
| 177 | }; |
| 178 | struct msgb *gsm0808_create_handover_required_reject(const struct gsm0808_handover_required_reject *params); |
| 179 | |
| 180 | /*! 3GPP TS 48.008 ยง3.2.1.8 HANDOVER REQUEST */ |
| 181 | struct gsm0808_handover_request { |
| 182 | struct gsm0808_channel_type channel_type; |
| 183 | struct gsm0808_encrypt_info encryption_information; |
| 184 | struct osmo_gsm48_classmark classmark_information; |
| 185 | struct gsm0808_cell_id cell_identifier_serving; |
| 186 | struct gsm0808_cell_id cell_identifier_target; |
| 187 | enum gsm0808_cause cause; |
| 188 | |
| 189 | bool current_channel_type_1_present; |
| 190 | uint8_t current_channel_type_1; |
| 191 | |
| 192 | enum gsm0808_permitted_speech speech_version_used; |
| 193 | |
| 194 | uint8_t chosen_encryption_algorithm_serving; |
| 195 | |
| 196 | /*! Pass either old_bss_to_new_bss_info or old_bss_to_new_bss_info_raw. */ |
| 197 | bool old_bss_to_new_bss_info_present; |
| 198 | struct gsm0808_old_bss_to_new_bss_info old_bss_to_new_bss_info; |
| 199 | /*! To feed the Old BSS to New BSS Information IE unchanged from the Handover Required message without having to |
| 200 | * decode it. Pass either old_bss_to_new_bss_info or old_bss_to_new_bss_info_raw. Omit the TL part. */ |
| 201 | const uint8_t *old_bss_to_new_bss_info_raw; |
| 202 | uint8_t old_bss_to_new_bss_info_raw_len; |
| 203 | |
| 204 | const char *imsi; |
| 205 | |
| 206 | const struct sockaddr_storage *aoip_transport_layer; |
| 207 | |
| 208 | const struct gsm0808_speech_codec_list *codec_list_msc_preferred; |
| 209 | |
| 210 | bool call_id_present; |
| 211 | uint32_t call_id; |
| 212 | |
| 213 | const uint8_t *global_call_reference; |
| 214 | uint8_t global_call_reference_len; |
| 215 | |
| 216 | /* more items are defined in the spec and may be added later */ |
Neels Hofmeyr | e4378b7 | 2021-06-10 00:54:35 +0200 | [diff] [blame] | 217 | bool more_items; /*!< set this to true iff any fields below are used */ |
| 218 | |
| 219 | bool kc128_present; |
| 220 | uint8_t kc128[16]; |
| 221 | |
| 222 | bool more_items2; /*!< always set this to false */ |
Neels Hofmeyr | f7e9c51 | 2019-03-06 04:25:38 +0100 | [diff] [blame] | 223 | }; |
| 224 | struct msgb *gsm0808_create_handover_request(const struct gsm0808_handover_request *params); |
| 225 | |
Harald Welte | aa98c48 | 2019-05-06 10:31:35 +0200 | [diff] [blame] | 226 | struct msgb *gsm0808_create_handover_request_ack(const uint8_t *l3_info, uint8_t l3_info_len, |
| 227 | uint8_t chosen_channel, uint8_t chosen_encr_alg, |
| 228 | uint8_t chosen_speech_version); |
| 229 | |
Neels Hofmeyr | 73b943e | 2019-03-14 04:10:25 +0100 | [diff] [blame] | 230 | struct gsm0808_handover_request_ack { |
| 231 | const uint8_t *l3_info; |
| 232 | uint8_t l3_info_len; |
| 233 | |
| 234 | bool chosen_channel_present; |
| 235 | uint8_t chosen_channel; |
| 236 | |
| 237 | /*! For A5/N set chosen_encr_alg = N+1, e.g. chosen_encr_alg = 1 means A5/0 (no encryption), 2 means A5/1, 4 |
| 238 | * means A5/3. Set chosen_encr_alg = 0 to omit the Chosen Encryption Algorithm IE. */ |
| 239 | uint8_t chosen_encr_alg; |
| 240 | |
| 241 | /* chosen_speech_version == 0 omits the IE */ |
| 242 | enum gsm0808_permitted_speech chosen_speech_version; |
| 243 | |
| 244 | bool speech_codec_chosen_present; |
| 245 | struct gsm0808_speech_codec speech_codec_chosen; |
| 246 | |
| 247 | const struct sockaddr_storage *aoip_transport_layer; |
| 248 | |
Neels Hofmeyr | a25a6dc | 2022-02-23 14:25:22 +0100 | [diff] [blame] | 249 | bool more_items; /*!< set this to true iff any fields below are used */ |
| 250 | |
| 251 | struct gsm0808_speech_codec_list codec_list_bss_supported; /*< omit when .len == 0 */ |
| 252 | |
Neels Hofmeyr | 73b943e | 2019-03-14 04:10:25 +0100 | [diff] [blame] | 253 | /* more items are defined in the spec and may be added later */ |
Neels Hofmeyr | a25a6dc | 2022-02-23 14:25:22 +0100 | [diff] [blame] | 254 | bool more_items2; /*!< always set this to false */ |
Neels Hofmeyr | 73b943e | 2019-03-14 04:10:25 +0100 | [diff] [blame] | 255 | }; |
| 256 | struct msgb *gsm0808_create_handover_request_ack2(const struct gsm0808_handover_request_ack *params); |
Neels Hofmeyr | b662b36 | 2018-04-16 22:31:15 +0200 | [diff] [blame] | 257 | |
Neels Hofmeyr | f7e9c51 | 2019-03-06 04:25:38 +0100 | [diff] [blame] | 258 | struct gsm0808_handover_command { |
| 259 | const uint8_t *l3_info; |
| 260 | uint8_t l3_info_len; |
| 261 | |
| 262 | struct gsm0808_cell_id cell_identifier; |
| 263 | |
| 264 | const uint8_t *new_bss_to_old_bss_info_raw; |
| 265 | size_t new_bss_to_old_bss_info_raw_len; |
| 266 | |
| 267 | /* more items are defined in the spec and may be added later */ |
| 268 | bool more_items; /*!< always set this to false */ |
| 269 | }; |
| 270 | struct msgb *gsm0808_create_handover_command(const struct gsm0808_handover_command *params); |
| 271 | |
Harald Welte | e61d459 | 2022-11-03 11:05:58 +0100 | [diff] [blame] | 272 | struct msgb *gsm0808_create_handover_detect(void); |
| 273 | struct msgb *gsm0808_create_handover_succeeded(void); |
Neels Hofmeyr | 60f3153 | 2018-04-16 22:42:09 +0200 | [diff] [blame] | 274 | |
| 275 | struct gsm0808_handover_complete { |
| 276 | bool rr_cause_present; |
| 277 | uint8_t rr_cause; |
| 278 | |
| 279 | bool speech_codec_chosen_present; |
| 280 | struct gsm0808_speech_codec speech_codec_chosen; |
| 281 | |
| 282 | struct gsm0808_speech_codec_list codec_list_bss_supported; /*< omit when .len == 0 */ |
| 283 | |
| 284 | bool chosen_encr_alg_present; |
| 285 | uint8_t chosen_encr_alg; |
Pau Espin Pedrol | 4da98cc | 2021-04-14 21:28:01 +0200 | [diff] [blame] | 286 | |
Neels Hofmeyr | 60f3153 | 2018-04-16 22:42:09 +0200 | [diff] [blame] | 287 | bool chosen_channel_present; |
| 288 | uint8_t chosen_channel; |
| 289 | |
| 290 | bool lcls_bss_status_present; |
| 291 | enum gsm0808_lcls_status lcls_bss_status; |
| 292 | |
| 293 | /* more items are defined in the spec and may be added later */ |
| 294 | bool more_items; /*< always set this to false */ |
| 295 | }; |
| 296 | struct msgb *gsm0808_create_handover_complete(const struct gsm0808_handover_complete *params); |
| 297 | |
| 298 | struct gsm0808_handover_failure { |
| 299 | uint16_t cause; |
| 300 | |
| 301 | bool rr_cause_present; |
| 302 | uint8_t rr_cause; |
| 303 | |
| 304 | struct gsm0808_speech_codec_list codec_list_bss_supported; /*< omit when .len == 0 */ |
| 305 | |
| 306 | /* more items are defined in the spec and may be added later */ |
| 307 | bool more_items; /*< always set this to false */ |
| 308 | }; |
| 309 | struct msgb *gsm0808_create_handover_failure(const struct gsm0808_handover_failure *params); |
| 310 | |
Philipp Maier | 225bdf4 | 2018-10-30 14:56:59 +0100 | [diff] [blame] | 311 | struct gsm0808_handover_performed { |
| 312 | uint16_t cause; |
| 313 | struct gsm0808_cell_id cell_id; |
| 314 | |
| 315 | bool chosen_channel_present; |
| 316 | uint8_t chosen_channel; |
| 317 | |
| 318 | bool chosen_encr_alg_present; |
| 319 | uint8_t chosen_encr_alg; |
| 320 | |
| 321 | bool speech_version_chosen_present; |
Neels Hofmeyr | 302aafc | 2019-04-10 19:23:45 +0200 | [diff] [blame] | 322 | enum gsm0808_permitted_speech speech_version_chosen; |
Philipp Maier | 225bdf4 | 2018-10-30 14:56:59 +0100 | [diff] [blame] | 323 | |
| 324 | bool speech_codec_chosen_present; |
| 325 | struct gsm0808_speech_codec speech_codec_chosen; |
| 326 | |
| 327 | bool lcls_bss_status_present; |
| 328 | enum gsm0808_lcls_status lcls_bss_status; |
| 329 | |
| 330 | /* more items are defined in the spec and may be added later */ |
| 331 | bool more_items; /*< always set this to false */ |
| 332 | }; |
| 333 | struct msgb *gsm0808_create_handover_performed(const struct gsm0808_handover_performed *params); |
| 334 | |
Holger Hans Peter Freyther | c25c668 | 2010-11-04 12:26:06 +0100 | [diff] [blame] | 335 | struct msgb *gsm0808_create_dtap(struct msgb *msg, uint8_t link_id); |
Holger Hans Peter Freyther | 9a3dec0 | 2010-05-16 08:15:40 +0800 | [diff] [blame] | 336 | void gsm0808_prepend_dtap_header(struct msgb *msg, uint8_t link_id); |
| 337 | |
Harald Welte | f4d45ab | 2011-07-16 12:13:00 +0200 | [diff] [blame] | 338 | const struct tlv_definition *gsm0808_att_tlvdef(void); |
Pau Espin Pedrol | cde4779 | 2021-04-19 12:24:02 +0200 | [diff] [blame] | 339 | extern const struct tlv_definition gsm0808_old_bss_to_new_bss_info_att_tlvdef; |
Holger Hans Peter Freyther | 280cd51 | 2010-04-15 10:10:39 +0200 | [diff] [blame] | 340 | |
Max | c0d1de3 | 2018-11-07 15:24:11 +0100 | [diff] [blame] | 341 | /*! Parse BSSAP TLV structure using \ref tlv_parse */ |
| 342 | #define osmo_bssap_tlv_parse(dec, buf, len) tlv_parse(dec, gsm0808_att_tlvdef(), buf, len, 0, 0) |
Neels Hofmeyr | d791327 | 2019-04-03 18:07:27 +0200 | [diff] [blame] | 343 | /*! Parse BSSAP TLV structure using \ref tlv_parse2 */ |
| 344 | #define osmo_bssap_tlv_parse2(dec, dec_multiples, buf, len) \ |
| 345 | tlv_parse2(dec, dec_multiples, gsm0808_att_tlvdef(), buf, len, 0, 0) |
Max | c0d1de3 | 2018-11-07 15:24:11 +0100 | [diff] [blame] | 346 | |
Harald Welte | 9b837e6 | 2011-07-11 17:43:19 +0200 | [diff] [blame] | 347 | const char *gsm0808_bssmap_name(uint8_t msg_type); |
| 348 | const char *gsm0808_bssap_name(uint8_t msg_type); |
Max | aa93463 | 2018-11-07 13:16:54 +0100 | [diff] [blame] | 349 | const char *gsm0808_cause_name(enum gsm0808_cause cause); |
| 350 | const char *gsm0808_cause_class_name(enum gsm0808_cause_class class); |
Harald Welte | 37b6165 | 2017-10-16 18:46:03 +0200 | [diff] [blame] | 351 | |
Alexander Chemeris | fdfe25b | 2020-05-12 23:21:56 +0300 | [diff] [blame] | 352 | /*! Parse Cause TLV 3GPP TS 08.08 ยง3.2.2.5 |
| 353 | * \returns Cause value */ |
| 354 | enum gsm0808_cause gsm0808_get_cause(const struct tlv_parsed *tp); |
| 355 | |
Alexander Chemeris | 22630e6 | 2020-05-13 00:44:04 +0300 | [diff] [blame] | 356 | const char *gsm0808_diagnostics_octet_location_str(uint8_t pointer); |
| 357 | const char *gsm0808_diagnostics_bit_location_str(uint8_t bit_pointer); |
| 358 | |
Harald Welte | ebd362d | 2018-06-02 14:11:19 +0200 | [diff] [blame] | 359 | extern const struct value_string gsm0808_lcls_config_names[]; |
| 360 | extern const struct value_string gsm0808_lcls_control_names[]; |
| 361 | extern const struct value_string gsm0808_lcls_status_names[]; |
| 362 | |
Max | e118ed2 | 2018-12-19 17:05:37 +0100 | [diff] [blame] | 363 | static inline const char *gsm0808_lcls_config_name(enum gsm0808_lcls_config val) { |
Harald Welte | ebd362d | 2018-06-02 14:11:19 +0200 | [diff] [blame] | 364 | return get_value_string(gsm0808_lcls_config_names, val); |
| 365 | } |
Max | e118ed2 | 2018-12-19 17:05:37 +0100 | [diff] [blame] | 366 | static inline const char *gsm0808_lcls_control_name(enum gsm0808_lcls_control val) { |
Harald Welte | ebd362d | 2018-06-02 14:11:19 +0200 | [diff] [blame] | 367 | return get_value_string(gsm0808_lcls_control_names, val); |
| 368 | } |
Max | e118ed2 | 2018-12-19 17:05:37 +0100 | [diff] [blame] | 369 | static inline const char *gsm0808_lcls_status_name(enum gsm0808_lcls_status val) { |
Harald Welte | ebd362d | 2018-06-02 14:11:19 +0200 | [diff] [blame] | 370 | return get_value_string(gsm0808_lcls_status_names, val); |
| 371 | } |
| 372 | |
Harald Welte | 37b6165 | 2017-10-16 18:46:03 +0200 | [diff] [blame] | 373 | /*! @} */ |