libosmogsm  0.11.0.54.60f31
Osmocom GSM library
gsm0808.h
Go to the documentation of this file.
1 
4 /*
5  * (C) 2009,2010 by Holger Hans Peter Freyther <zecke@selfish.org>
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  *
19  * You should have received a copy of the GNU General Public License along
20  * with this program; if not, write to the Free Software Foundation, Inc.,
21  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22  *
23  */
24 #pragma once
25 
26 #include "tlv.h"
29 #include <osmocom/gsm/gsm23003.h>
30 #include <osmocom/core/utils.h>
31 
32 struct sockaddr_storage;
33 
34 struct msgb;
36 
37 struct msgb *gsm0808_create_layer3(struct msgb *msg_l3, uint16_t nc,
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");
40 struct msgb *gsm0808_create_layer3_aoip(const struct msgb *msg_l3, uint16_t nc,
41  uint16_t cc, int lac, uint16_t _ci,
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");
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);
46 struct msgb *gsm0808_create_reset(void);
47 struct msgb *gsm0808_create_reset_ack(void);
48 struct msgb *gsm0808_create_clear_command(uint8_t reason);
50 struct msgb *gsm0808_create_cipher(const struct gsm0808_encrypt_info *ei,
51  const uint8_t *cipher_response_mode);
52 struct msgb *gsm0808_create_cipher_complete(struct msgb *layer3, uint8_t alg_id);
53 struct msgb *gsm0808_create_cipher_reject(uint8_t cause);
54 struct msgb *gsm0808_create_classmark_update(const uint8_t *cm2, uint8_t cm2_len,
55  const uint8_t *cm3, uint8_t cm3_len);
56 struct msgb *gsm0808_create_sapi_reject(uint8_t link_id);
57 struct msgb *gsm0808_create_ass(const struct gsm0808_channel_type *ct,
58  const uint16_t *cic,
59  const struct sockaddr_storage *ss,
60  const struct gsm0808_speech_codec_list *scl,
61  const uint32_t *ci);
62 struct msgb *gsm0808_create_ass_compl(uint8_t rr_cause, uint8_t chosen_channel,
63  uint8_t encr_alg_id, uint8_t speech_mode,
64  const struct sockaddr_storage *ss,
65  const struct gsm0808_speech_codec *sc,
66  const struct gsm0808_speech_codec_list
67  *scl);
68 struct msgb *gsm0808_create_assignment_completed(uint8_t rr_cause,
69  uint8_t chosen_channel,
70  uint8_t encr_alg_id,
71  uint8_t speech_mode);
72 struct msgb *gsm0808_create_ass_fail(uint8_t cause, const uint8_t *rr_cause,
73  const struct gsm0808_speech_codec_list
74  *scl);
75 struct msgb *gsm0808_create_assignment_failure(uint8_t cause, uint8_t *rr_cause);
76 struct msgb *gsm0808_create_clear_rqst(uint8_t cause);
77 struct msgb *gsm0808_create_paging2(const char *imsi, const uint32_t *tmsi,
78  const struct gsm0808_cell_id_list2 *cil,
79  const uint8_t *chan_needed);
80 struct msgb *gsm0808_create_paging(const char *imsi, const uint32_t *tmsi,
81  const struct gsm0808_cell_id_list *cil,
82  const uint8_t *chan_needed)
83  OSMO_DEPRECATED("use gsm0808_create_paging2 instead");
85  enum gsm0808_lcls_control *control);
87 struct msgb *gsm0808_create_lcls_notification(enum gsm0808_lcls_status status, bool break_req);
88 
89 
93  struct {
94  bool prec;
95  bool lcs;
96  bool ue_prob;
97  } extra_information;
98 
100  struct {
101  uint8_t mode;
102  uint8_t field;
103  } current_channel_type_2;
104 
105  /* more items are defined in the spec and may be added later */
106  bool more_items; /*< always set this to false */
107 };
108 
111  uint16_t cause;
113 
116 
119 
121  struct gsm0808_old_bss_to_new_bss_info old_bss_to_new_bss_info;
122 
123  /* more items are defined in the spec and may be added later */
124  bool more_items; /*< always set this to false */
125 };
127 
128 struct msgb *gsm0808_create_handover_request_ack(const uint8_t *l3_info, uint8_t l3_info_len,
129  uint8_t chosen_channel, uint8_t chosen_encr_alg,
130  uint8_t chosen_speech_version);
131 
133 
136  uint8_t rr_cause;
137 
139  struct gsm0808_speech_codec speech_codec_chosen;
140 
141  struct gsm0808_speech_codec_list codec_list_bss_supported; /*< omit when .len == 0 */
142 
145 
147  uint8_t chosen_channel;
148 
150  enum gsm0808_lcls_status lcls_bss_status;
151 
152  /* more items are defined in the spec and may be added later */
153  bool more_items; /*< always set this to false */
154 };
156 
158  uint16_t cause;
159 
161  uint8_t rr_cause;
162 
163  struct gsm0808_speech_codec_list codec_list_bss_supported; /*< omit when .len == 0 */
164 
165  /* more items are defined in the spec and may be added later */
166  bool more_items; /*< always set this to false */
167 };
169 
170 struct msgb *gsm0808_create_dtap(struct msgb *msg, uint8_t link_id);
171 void gsm0808_prepend_dtap_header(struct msgb *msg, uint8_t link_id);
172 
173 const struct tlv_definition *gsm0808_att_tlvdef(void);
174 
175 const char *gsm0808_bssmap_name(uint8_t msg_type);
176 const char *gsm0808_bssap_name(uint8_t msg_type);
177 const char *gsm0808_cause_name(uint8_t cause);
178 
179 extern const struct value_string gsm0808_lcls_config_names[];
180 extern const struct value_string gsm0808_lcls_control_names[];
181 extern const struct value_string gsm0808_lcls_status_names[];
182 
183 static inline const char *gsm0808_lcls_config_name(uint8_t val) {
185 }
186 static inline const char *gsm0808_lcls_control_name(uint8_t val) {
188 }
189 static inline const char *gsm0808_lcls_status_name(uint8_t val) {
191 }
192 
uint8_t msg_type
Definition: gsm_04_08.h:504
const struct value_string gsm0808_lcls_status_names[]
Definition: gsm0808.c:1253
struct msgb * gsm0808_create_assignment_completed(uint8_t rr_cause, uint8_t chosen_channel, uint8_t encr_alg_id, uint8_t speech_mode)
Create BSSMAP Assignment Completed message.
Definition: gsm0808.c:516
bool prec
Definition: gsm0808.h:94
bool speech_version_used_present
Definition: gsm0808.h:117
struct msgb * gsm0808_create_handover_detect()
Create BSSMAP HANDOVER DETECT message, 3GPP TS 48.008 3.2.1.40.
Definition: gsm0808.c:772
bool old_bss_to_new_bss_info_present
Definition: gsm0808.h:120
struct msgb * gsm0808_create_reset_ack(void)
Create BSSMAP RESET ACK message.
Definition: gsm0808.c:155
struct msgb * gsm0808_create_assignment_failure(uint8_t cause, uint8_t *rr_cause)
Create BSSMAP Assignment Failure message.
Definition: gsm0808.c:563
const char * get_value_string(const struct value_string *vs, uint32_t val)
Parsed representation of a Cell Identifier List IE (3GPP TS 48.008 3.2.2.27).
Definition: gsm0808_utils.h:54
uint8_t field
Definition: gsm0808.h:102
struct msgb * gsm0808_create_lcls_conn_ctrl(enum gsm0808_lcls_config *config, enum gsm0808_lcls_control *control)
Create BSSMAP LCLS CONNECT CONTROL message (TS 48.008 3.2.1.91).
Definition: gsm0808.c:289
uint16_t cause
Definition: gsm0808.h:111
struct msgb * gsm0808_create_paging(const char *imsi, const uint32_t *tmsi, const struct gsm0808_cell_id_list *cil, const uint8_t *chan_needed) OSMO_DEPRECATED("use gsm0808_create_paging2 instead")
DEPRECATED: Use gsm0808_create_paging2 instead.
Definition: gsm0808.c:653
struct msgb * gsm0808_create_sapi_reject(uint8_t link_id)
Create BSSMAP SAPI N Reject message.
Definition: gsm0808.c:373
gsm0808_lcls_control
Definition: gsm_08_08.h:551
gsm0808_lcls_status
Definition: gsm_08_08.h:560
static const char * gsm0808_lcls_config_name(uint8_t val)
Definition: gsm0808.h:183
uint8_t rr_cause
Definition: gsm0808.h:161
struct msgb * gsm0808_create_paging2(const char *imsi, const uint32_t *tmsi, const struct gsm0808_cell_id_list2 *cil, const uint8_t *chan_needed)
Create BSSMAP PAGING message.
Definition: gsm0808.c:594
struct msgb * gsm0808_create_reset(void)
Create BSSMAP RESET message.
Definition: gsm0808.c:138
uint8_t cause
Definition: gsm_04_08.h:504
bool more_items
Definition: gsm0808.h:124
struct msgb * gsm0808_create_ass_fail(uint8_t cause, const uint8_t *rr_cause, const struct gsm0808_speech_codec_list *scl)
Create BSSMAP Assignment Failure message.
Definition: gsm0808.c:530
struct msgb * gsm0808_create_cipher_reject(uint8_t cause)
Create BSSMAP Cipher Mode Reject message.
Definition: gsm0808.c:270
struct msgb * gsm0808_create_handover_required(const struct gsm0808_handover_required *params)
Create BSSMAP HANDOVER REQUIRED message.
Definition: gsm0808.c:708
static const char * gsm0808_lcls_status_name(uint8_t val)
Definition: gsm0808.h:189
uint8_t link_id
Definition: gsm_08_08.h:453
struct msgb * gsm0808_create_lcls_conn_ctrl_ack(enum gsm0808_lcls_status status)
Create BSSMAP LCLS CONNECT CONTROL ACK message (TS 48.008 3.2.1.92).
Definition: gsm0808.c:310
bool more_items
Definition: gsm0808.h:106
struct msgb * gsm0808_create_classmark_update(const uint8_t *cm2, uint8_t cm2_len, const uint8_t *cm3, uint8_t cm3_len)
Create BSSMAP Classmark Update message.
Definition: gsm0808.c:351
struct msgb * gsm0808_create_dtap(struct msgb *msg, uint8_t link_id)
Create BSSMAP DTAP message.
Definition: gsm0808.c:864
Definition: gsm_08_08.h:503
Definition: gsm0808.h:134
const char * gsm0808_bssmap_name(uint8_t msg_type)
Return string name of BSSMAP Message Type.
Definition: gsm0808.c:1125
bool chosen_channel_present
Definition: gsm0808.h:146
struct msgb * gsm0808_create_handover_complete(const struct gsm0808_handover_complete *params)
Create BSSMAP HANDOVER COMPLETE message, 3GPP TS 48.008 3.2.1.12.
Definition: gsm0808.c:788
uint8_t rr_cause
Definition: gsm_04_08.h:502
3GPP TS 48.008 §3.2.1.9 HANDOVER REQUIRED
Definition: gsm0808.h:110
struct msgb * gsm0808_create_cipher(const struct gsm0808_encrypt_info *ei, const uint8_t *cipher_response_mode)
Create BSSMAP Cipher Mode Command message.
Definition: gsm0808.c:205
struct msgb to not lose leading zeros in the MNC
Definition: gsm0808.h:39
uint8_t sc
Definition: gsm_04_08.h:502
struct msgb * gsm0808_create_layer3_aoip(const struct msgb *msg_l3, uint16_t nc, uint16_t cc, int lac, uint16_t _ci, const struct gsm0808_speech_codec_list *scl) OSMO_DEPRECATED("Use gsm0808_create_layer3_2() instead
Create "Complete L3 Info" for AoIP, legacy implementation.
Definition: gsm0808.c:49
struct msgb * gsm0808_create_ass(const struct gsm0808_channel_type *ct, const uint16_t *cic, const struct sockaddr_storage *ss, const struct gsm0808_speech_codec_list *scl, const uint32_t *ci)
Create BSSMAP Assignment Request message.
Definition: gsm0808.c:396
const struct tlv_definition * gsm0808_att_tlvdef(void)
Definition: gsm0808.c:1019
bool ue_prob
Definition: gsm0808.h:96
Definition: gsm23003.h:28
const char * gsm0808_bssap_name(uint8_t msg_type)
Return string name of BSSAP Message Type.
Definition: gsm0808.c:1137
uint16_t cause
Definition: gsm0808.h:158
const struct value_string gsm0808_lcls_control_names[]
Definition: gsm0808.c:1244
uint8_t cm3
Definition: gsm_04_08.h:104
3GPP TS 48.008 §3.2.2.5.8 Old BSS to New BSS information
Definition: gsm0808.h:91
bool lcls_bss_status_present
Definition: gsm0808.h:149
struct gsm48_classmark2 cm2
Definition: gsm_04_08.h:503
struct msgb * gsm0808_create_ass_compl(uint8_t rr_cause, uint8_t chosen_channel, uint8_t encr_alg_id, uint8_t speech_mode, const struct sockaddr_storage *ss, const struct gsm0808_speech_codec *sc, const struct gsm0808_speech_codec_list *scl)
Create BSSMAP Assignment Completed message.
Definition: gsm0808.c:461
uint8_t chosen_encr_alg
Definition: gsm0808.h:144
uint8_t speech_version_used
Definition: gsm0808.h:118
struct msgb * gsm0808_create_clear_complete(void)
Create BSSMAP Clear Complete message.
Definition: gsm0808.c:170
Definition: gsm0808.h:157
const struct value_string gsm0808_lcls_config_names[]
Definition: gsm0808.c:1229
struct msgb * gsm0808_create_clear_rqst(uint8_t cause)
Create BSSMAP Clear Request message.
Definition: gsm0808.c:572
bool lcs
Definition: gsm0808.h:95
uint8_t mode
Definition: gsm0808.h:101
struct msgb * gsm0808_create_clear_command(uint8_t reason)
Create BSSMAP Clear Command message.
Definition: gsm0808.c:187
bool chosen_encr_alg_present
Definition: gsm0808.h:143
Definition: gsm_08_08.h:510
uint8_t chosen_channel
Definition: gsm0808.h:147
bool more_items
Definition: gsm0808.h:166
struct msgb * gsm0808_create_layer3_2(const struct msgb *msg_l3, const struct osmo_cell_global_id *cell, const struct gsm0808_speech_codec_list *scl)
Create "Complete L3 Info" for AoIP.
Definition: gsm0808.c:72
bool rr_cause_present
Definition: gsm0808.h:160
const char * gsm0808_cause_name(uint8_t cause)
Return string name of BSSMAP Cause name.
Definition: gsm0808.c:1224
bool more_items
Definition: gsm0808.h:153
struct msgb * gsm0808_create_handover_failure(const struct gsm0808_handover_failure *params)
Create BSSMAP HANDOVER FAILURE message, 3GPP TS 48.008 3.2.1.16.
Definition: gsm0808.c:824
struct msgb * gsm0808_create_layer3(struct msgb *msg_l3, uint16_t nc, uint16_t cc, int lac, uint16_t _ci) OSMO_DEPRECATED("Use gsm0808_create_layer3_2() instead
Create "Complete L3 Info" for A, legacy implementation.
Definition: gsm0808.c:120
bool extra_information_present
Definition: gsm0808.h:92
struct msgb * gsm0808_create_handover_request_ack(const uint8_t *l3_info, uint8_t l3_info_len, uint8_t chosen_channel, uint8_t chosen_encr_alg, uint8_t chosen_speech_version)
Create BSSMAP HANDOVER REQUEST ACKNOWLEDGE message, 3GPP TS 48.008 3.2.1.10.
Definition: gsm0808.c:745
bool rr_cause_present
Definition: gsm0808.h:135
Definition: gsm_08_08.h:520
uint8_t rr_cause
Definition: gsm0808.h:136
uint8_t current_channel_type_1
Definition: gsm0808.h:115
uint8_t cm2_len
Definition: gsm_04_08.h:502
Definition of All 256 IE / TLV.
Definition: tlv.h:419
bool current_channel_type_2_present
Definition: gsm0808.h:99
struct msgb * gsm0808_create_lcls_notification(enum gsm0808_lcls_status status, bool break_req)
Create BSSMAP LCLS NOTIFICATION message (TS 48.008 3.2.1.93).
Definition: gsm0808.c:328
uint16_t lac
Definition: gsm_04_08.h:503
uint8_t alg_id
Definition: gsm_04_08.h:502
gsm0808_lcls_config
Definition: gsm_08_08.h:541
bool current_channel_type_1_present
Definition: gsm0808.h:114
void gsm0808_prepend_dtap_header(struct msgb *msg, uint8_t link_id)
Prepend a DTAP header to given Message Buffer.
Definition: gsm0808.c:852
bool speech_codec_chosen_present
Definition: gsm0808.h:138
static const char * gsm0808_lcls_control_name(uint8_t val)
Definition: gsm0808.h:186
struct msgb * gsm0808_create_cipher_complete(struct msgb *layer3, uint8_t alg_id)
Create BSSMAP Cipher Mode Complete message.
Definition: gsm0808.c:242
DEPRECATED: This definition of the cell identifier list is insufficient.
Definition: gsm_08_08.h:534
Definition: gsm_08_08.h:471