libosmogsm  0.12.0.55-9540
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);
55 struct msgb *gsm0808_create_classmark_update(const uint8_t *cm2, uint8_t cm2_len,
56  const uint8_t *cm3, uint8_t cm3_len);
57 struct msgb *gsm0808_create_sapi_reject(uint8_t link_id);
58 struct msgb *gsm0808_create_ass(const struct gsm0808_channel_type *ct,
59  const uint16_t *cic,
60  const struct sockaddr_storage *ss,
61  const struct gsm0808_speech_codec_list *scl,
62  const uint32_t *ci);
63 struct msgb *gsm0808_create_ass_compl(uint8_t rr_cause, uint8_t chosen_channel,
64  uint8_t encr_alg_id, uint8_t speech_mode,
65  const struct sockaddr_storage *ss,
66  const struct gsm0808_speech_codec *sc,
67  const struct gsm0808_speech_codec_list
68  *scl);
69 struct msgb *gsm0808_create_assignment_completed(uint8_t rr_cause,
70  uint8_t chosen_channel,
71  uint8_t encr_alg_id,
72  uint8_t speech_mode);
73 struct msgb *gsm0808_create_ass_fail(uint8_t cause, const uint8_t *rr_cause,
74  const struct gsm0808_speech_codec_list
75  *scl);
76 struct msgb *gsm0808_create_assignment_failure(uint8_t cause, uint8_t *rr_cause);
77 struct msgb *gsm0808_create_clear_rqst(uint8_t cause);
78 struct msgb *gsm0808_create_paging2(const char *imsi, const uint32_t *tmsi,
79  const struct gsm0808_cell_id_list2 *cil,
80  const uint8_t *chan_needed);
81 struct msgb *gsm0808_create_paging(const char *imsi, const uint32_t *tmsi,
82  const struct gsm0808_cell_id_list *cil,
83  const uint8_t *chan_needed)
84  OSMO_DEPRECATED("use gsm0808_create_paging2 instead");
86  enum gsm0808_lcls_control *control);
88 struct msgb *gsm0808_create_lcls_notification(enum gsm0808_lcls_status status, bool break_req);
89 
90 
94  struct {
95  bool prec;
96  bool lcs;
97  bool ue_prob;
98  } extra_information;
99 
101  struct {
102  uint8_t mode;
103  uint8_t field;
104  } current_channel_type_2;
105 
106  /* more items are defined in the spec and may be added later */
107  bool more_items; /*< always set this to false */
108 };
109 
112  uint16_t cause;
114 
117 
120 
122  struct gsm0808_old_bss_to_new_bss_info old_bss_to_new_bss_info;
123 
124  /* more items are defined in the spec and may be added later */
125  bool more_items; /*< always set this to false */
126 };
128 
129 struct msgb *gsm0808_create_handover_request_ack(const uint8_t *l3_info, uint8_t l3_info_len,
130  uint8_t chosen_channel, uint8_t chosen_encr_alg,
131  uint8_t chosen_speech_version);
132 
134 
137  uint8_t rr_cause;
138 
140  struct gsm0808_speech_codec speech_codec_chosen;
141 
142  struct gsm0808_speech_codec_list codec_list_bss_supported; /*< omit when .len == 0 */
143 
146 
148  uint8_t chosen_channel;
149 
151  enum gsm0808_lcls_status lcls_bss_status;
152 
153  /* more items are defined in the spec and may be added later */
154  bool more_items; /*< always set this to false */
155 };
157 
159  uint16_t cause;
160 
162  uint8_t rr_cause;
163 
164  struct gsm0808_speech_codec_list codec_list_bss_supported; /*< omit when .len == 0 */
165 
166  /* more items are defined in the spec and may be added later */
167  bool more_items; /*< always set this to false */
168 };
170 
171 struct msgb *gsm0808_create_dtap(struct msgb *msg, uint8_t link_id);
172 void gsm0808_prepend_dtap_header(struct msgb *msg, uint8_t link_id);
173 
174 const struct tlv_definition *gsm0808_att_tlvdef(void);
175 
176 const char *gsm0808_bssmap_name(uint8_t msg_type);
177 const char *gsm0808_bssap_name(uint8_t msg_type);
178 const char *gsm0808_cause_name(uint8_t cause);
179 
180 extern const struct value_string gsm0808_lcls_config_names[];
181 extern const struct value_string gsm0808_lcls_control_names[];
182 extern const struct value_string gsm0808_lcls_status_names[];
183 
184 static inline const char *gsm0808_lcls_config_name(uint8_t val) {
186 }
187 static inline const char *gsm0808_lcls_control_name(uint8_t val) {
189 }
190 static inline const char *gsm0808_lcls_status_name(uint8_t val) {
192 }
193 
uint8_t msg_type
Definition: gsm_04_08.h:559
const struct value_string gsm0808_lcls_status_names[]
Definition: gsm0808.c:1303
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:529
bool prec
Definition: gsm0808.h:95
bool speech_version_used_present
Definition: gsm0808.h:118
struct msgb * gsm0808_create_handover_detect()
Create BSSMAP HANDOVER DETECT message, 3GPP TS 48.008 3.2.1.40.
Definition: gsm0808.c:787
bool old_bss_to_new_bss_info_present
Definition: gsm0808.h:121
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:576
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:103
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:112
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:665
struct msgb * gsm0808_create_sapi_reject(uint8_t link_id)
Create BSSMAP SAPI N Reject message.
Definition: gsm0808.c:386
gsm0808_lcls_control
Definition: gsm_08_08.h:556
gsm0808_lcls_status
Definition: gsm_08_08.h:565
static const char * gsm0808_lcls_config_name(uint8_t val)
Definition: gsm0808.h:184
uint8_t rr_cause
Definition: gsm0808.h:162
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:607
struct msgb * gsm0808_create_reset(void)
Create BSSMAP RESET message.
Definition: gsm0808.c:138
uint8_t cause
Definition: gsm_04_08.h:559
bool more_items
Definition: gsm0808.h:125
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:543
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:720
static const char * gsm0808_lcls_status_name(uint8_t val)
Definition: gsm0808.h:190
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
struct msgb * gsm0808_create_classmark_request()
Create BSSMAP Classmark Request message.
Definition: gsm0808.c:346
bool more_items
Definition: gsm0808.h:107
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:364
struct msgb * gsm0808_create_dtap(struct msgb *msg, uint8_t link_id)
Create BSSMAP DTAP message.
Definition: gsm0808.c:888
Definition: gsm_08_08.h:508
Definition: gsm0808.h:135
const char * gsm0808_bssmap_name(uint8_t msg_type)
Return string name of BSSMAP Message Type.
Definition: gsm0808.c:1149
bool chosen_channel_present
Definition: gsm0808.h:147
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:806
uint8_t rr_cause
Definition: gsm_04_08.h:557
3GPP TS 48.008 §3.2.1.9 HANDOVER REQUIRED
Definition: gsm0808.h:111
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:557
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:409
const struct tlv_definition * gsm0808_att_tlvdef(void)
Definition: gsm0808.c:1043
bool ue_prob
Definition: gsm0808.h:97
Definition: gsm23003.h:28
const char * gsm0808_bssap_name(uint8_t msg_type)
Return string name of BSSAP Message Type.
Definition: gsm0808.c:1161
uint16_t cause
Definition: gsm0808.h:159
const struct value_string gsm0808_lcls_control_names[]
Definition: gsm0808.c:1294
uint8_t cm3
Definition: gsm_04_08.h:85
3GPP TS 48.008 §3.2.2.5.8 Old BSS to New BSS information
Definition: gsm0808.h:92
bool lcls_bss_status_present
Definition: gsm0808.h:150
struct gsm48_classmark2 cm2
Definition: gsm_04_08.h:558
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:474
uint8_t chosen_encr_alg
Definition: gsm0808.h:145
uint8_t speech_version_used
Definition: gsm0808.h:119
struct msgb * gsm0808_create_clear_complete(void)
Create BSSMAP Clear Complete message.
Definition: gsm0808.c:170
Definition: gsm0808.h:158
const struct value_string gsm0808_lcls_config_names[]
Definition: gsm0808.c:1279
struct msgb * gsm0808_create_clear_rqst(uint8_t cause)
Create BSSMAP Clear Request message.
Definition: gsm0808.c:585
bool lcs
Definition: gsm0808.h:96
uint8_t mode
Definition: gsm0808.h:102
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:144
Definition: gsm_08_08.h:515
uint8_t chosen_channel
Definition: gsm0808.h:148
bool more_items
Definition: gsm0808.h:167
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:161
const char * gsm0808_cause_name(uint8_t cause)
Return string name of BSSMAP Cause name.
Definition: gsm0808.c:1274
bool more_items
Definition: gsm0808.h:154
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:845
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:93
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:757
bool rr_cause_present
Definition: gsm0808.h:136
Definition: gsm_08_08.h:525
uint8_t rr_cause
Definition: gsm0808.h:137
uint8_t current_channel_type_1
Definition: gsm0808.h:116
uint8_t cm2_len
Definition: gsm_04_08.h:557
Definition of All 256 IE / TLV.
Definition: tlv.h:419
bool current_channel_type_2_present
Definition: gsm0808.h:100
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:558
uint8_t alg_id
Definition: gsm_04_08.h:557
gsm0808_lcls_config
Definition: gsm_08_08.h:546
bool current_channel_type_1_present
Definition: gsm0808.h:115
_parse instead
Definition: ipa.h:30
void gsm0808_prepend_dtap_header(struct msgb *msg, uint8_t link_id)
Prepend a DTAP header to given Message Buffer.
Definition: gsm0808.c:876
bool speech_codec_chosen_present
Definition: gsm0808.h:139
static const char * gsm0808_lcls_control_name(uint8_t val)
Definition: gsm0808.h:187
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:539
Definition: gsm_08_08.h:476