gsm0808.h
Go to the documentation of this file.
/*
* (C) 2009,2010 by Holger Hans Peter Freyther <zecke@selfish.org>
* (C) 2009,2010 by On-Waves
* All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
#pragma once
#include "tlv.h"
#include <osmocom/gsm/protocol/gsm_08_08.h>
#include <osmocom/gsm/gsm0808_utils.h>
#include <osmocom/gsm/gsm23003.h>
#include <osmocom/core/utils.h>
struct sockaddr_storage;
struct msgb;
struct gsm0808_cell_id_list2;
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, to not lose leading zeros in the MNC");
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, to not lose leading zeros in the MNC");
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);
struct msgb *gsm0808_create_reset(void);
struct msgb *gsm0808_create_reset_ack(void);
struct msgb *gsm0808_create_clear_command(uint8_t reason);
struct msgb *gsm0808_create_clear_complete(void);
struct msgb *gsm0808_create_cipher(const struct gsm0808_encrypt_info *ei,
const uint8_t *cipher_response_mode);
struct msgb *gsm0808_create_cipher_complete(struct msgb *layer3, uint8_t alg_id);
struct msgb *gsm0808_create_cipher_reject(uint8_t cause);
struct msgb *gsm0808_create_classmark_update(const uint8_t *cm2, uint8_t cm2_len,
const uint8_t *cm3, uint8_t cm3_len);
struct msgb *gsm0808_create_sapi_reject(uint8_t link_id);
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);
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);
struct msgb *gsm0808_create_assignment_completed(uint8_t rr_cause,
uint8_t chosen_channel,
uint8_t encr_alg_id,
uint8_t speech_mode);
struct msgb *gsm0808_create_ass_fail(uint8_t cause, const uint8_t *rr_cause,
const struct gsm0808_speech_codec_list
*scl);
struct msgb *gsm0808_create_assignment_failure(uint8_t cause, uint8_t *rr_cause);
struct msgb *gsm0808_create_clear_rqst(uint8_t cause);
struct msgb *gsm0808_create_paging2(const char *imsi, const uint32_t *tmsi,
const struct gsm0808_cell_id_list2 *cil,
const uint8_t *chan_needed);
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");
struct msgb *gsm0808_create_lcls_conn_ctrl(enum gsm0808_lcls_config *config,
enum gsm0808_lcls_control *control);
struct msgb *gsm0808_create_lcls_conn_ctrl_ack(enum gsm0808_lcls_status status);
struct msgb *gsm0808_create_lcls_notification(enum gsm0808_lcls_status status, bool break_req);
struct gsm0808_old_bss_to_new_bss_info {
bool extra_information_present;
struct {
bool prec;
bool lcs;
bool ue_prob;
} extra_information;
bool current_channel_type_2_present;
struct {
uint8_t mode;
uint8_t field;
} current_channel_type_2;
/* more items are defined in the spec and may be added later */
bool more_items; /*< always set this to false */
};
struct gsm0808_handover_required {
uint16_t cause;
struct gsm0808_cell_id_list2 cil;
bool current_channel_type_1_present;
uint8_t current_channel_type_1;
bool speech_version_used_present;
uint8_t speech_version_used;
bool old_bss_to_new_bss_info_present;
struct gsm0808_old_bss_to_new_bss_info old_bss_to_new_bss_info;
/* more items are defined in the spec and may be added later */
bool more_items; /*< always set this to false */
};
struct msgb *gsm0808_create_handover_required(const struct gsm0808_handover_required *params);
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);
struct msgb *gsm0808_create_handover_detect();
struct gsm0808_handover_complete {
bool rr_cause_present;
uint8_t rr_cause;
bool speech_codec_chosen_present;
struct gsm0808_speech_codec speech_codec_chosen;
struct gsm0808_speech_codec_list codec_list_bss_supported; /*< omit when .len == 0 */
bool chosen_encr_alg_present;
uint8_t chosen_encr_alg;
bool chosen_channel_present;
uint8_t chosen_channel;
bool lcls_bss_status_present;
enum gsm0808_lcls_status lcls_bss_status;
/* more items are defined in the spec and may be added later */
bool more_items; /*< always set this to false */
};
struct msgb *gsm0808_create_handover_complete(const struct gsm0808_handover_complete *params);
struct gsm0808_handover_failure {
uint16_t cause;
bool rr_cause_present;
uint8_t rr_cause;
struct gsm0808_speech_codec_list codec_list_bss_supported; /*< omit when .len == 0 */
/* more items are defined in the spec and may be added later */
bool more_items; /*< always set this to false */
};
struct msgb *gsm0808_create_handover_failure(const struct gsm0808_handover_failure *params);
struct msgb *gsm0808_create_dtap(struct msgb *msg, uint8_t link_id);
void gsm0808_prepend_dtap_header(struct msgb *msg, uint8_t link_id);
const struct tlv_definition *gsm0808_att_tlvdef(void);
const char *gsm0808_bssmap_name(uint8_t msg_type);
const char *gsm0808_bssap_name(uint8_t msg_type);
const char *gsm0808_cause_name(uint8_t cause);
extern const struct value_string gsm0808_lcls_config_names[];
extern const struct value_string gsm0808_lcls_control_names[];
extern const struct value_string gsm0808_lcls_status_names[];
static inline const char *gsm0808_lcls_config_name(uint8_t val) {
return get_value_string(gsm0808_lcls_config_names, val);
}
static inline const char *gsm0808_lcls_control_name(uint8_t val) {
return get_value_string(gsm0808_lcls_control_names, val);
}
static inline const char *gsm0808_lcls_status_name(uint8_t val) {
return get_value_string(gsm0808_lcls_status_names, val);
}
gsm0808_create_layer3
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
gsm0808_lcls_config
gsm0808_lcls_config
Definition: gsm_08_08.h:546
gsm0808_handover_required::current_channel_type_1_present
bool current_channel_type_1_present
Definition: gsm0808.h:114
gsm0808_lcls_config_names
const struct value_string gsm0808_lcls_config_names[]
Definition: gsm0808.c:1255
link_id
uint8_t link_id
Definition: gsm_08_08.h:3
gsm0808_att_tlvdef
const struct tlv_definition * gsm0808_att_tlvdef(void)
Definition: gsm0808.c:1019
gsm0808_bssap_name
const char * gsm0808_bssap_name(uint8_t msg_type)
Return string name of BSSAP Message Type.
Definition: gsm0808.c:1137
gsm0808_create_layer3_2
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
MNC
struct msgb to not lose leading zeros in the MNC
Definition: gsm0808.h:39
cause
uint8_t cause
Definition: gsm_04_08.h:710
gsm0808_lcls_status
gsm0808_lcls_status
Definition: gsm_08_08.h:565
gsm0808_handover_complete::rr_cause_present
bool rr_cause_present
Definition: gsm0808.h:135
gsm0808_handover_complete::chosen_channel
uint8_t chosen_channel
Definition: gsm0808.h:147
gsm0808_handover_complete::lcls_bss_status_present
bool lcls_bss_status_present
Definition: gsm0808.h:149
gsm0808_old_bss_to_new_bss_info::more_items
bool more_items
Definition: gsm0808.h:106
gsm0808_create_handover_failure
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
gsm0808_handover_required::cause
uint16_t cause
Definition: gsm0808.h:111
osmo_cell_global_id
Definition: gsm23003.h:28
gsm0808_create_handover_request_ack
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
gsm0808_handover_failure::more_items
bool more_items
Definition: gsm0808.h:166
cm3
uint8_t cm3
Definition: gsm_04_08.h:38
gsm0808_handover_complete::chosen_encr_alg
uint8_t chosen_encr_alg
Definition: gsm0808.h:144
gsm0808_create_clear_complete
struct msgb * gsm0808_create_clear_complete(void)
Create BSSMAP Clear Complete message.
Definition: gsm0808.c:170
gsm0808_channel_type
Definition: gsm_08_08.h:515
gsm0808_create_lcls_notification
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
gsm0808_handover_failure::rr_cause
uint8_t rr_cause
Definition: gsm0808.h:161
rr_cause
uint8_t rr_cause
Definition: gsm_04_08.h:708
gsm0808_handover_complete::chosen_encr_alg_present
bool chosen_encr_alg_present
Definition: gsm0808.h:143
gsm0808_create_clear_command
struct msgb * gsm0808_create_clear_command(uint8_t reason)
Create BSSMAP Clear Command message.
Definition: gsm0808.c:187
gsm0808_prepend_dtap_header
void gsm0808_prepend_dtap_header(struct msgb *msg, uint8_t link_id)
Prepend a DTAP header to given Message Buffer.
Definition: gsm0808.c:852
gsm0808_lcls_control_names
const struct value_string gsm0808_lcls_control_names[]
Definition: gsm0808.c:1270
gsm0808_cause_name
const char * gsm0808_cause_name(uint8_t cause)
Return string name of BSSMAP Cause name.
Definition: gsm0808.c:1250
gsm0808_old_bss_to_new_bss_info::ue_prob
bool ue_prob
Definition: gsm0808.h:96
tlv_definition
Definition of All 256 IE / TLV.
Definition: tlv.h:419
gsm0808_speech_codec_list
Definition: gsm_08_08.h:508
gsm0808_old_bss_to_new_bss_info::field
uint8_t field
Definition: gsm0808.h:102
gsm0808_speech_codec
Definition: gsm_08_08.h:476
gsm0808_handover_complete::more_items
bool more_items
Definition: gsm0808.h:153
sc
uint8_t sc
Definition: gsm_04_08.h:717
gsm0808_create_clear_rqst
struct msgb * gsm0808_create_clear_rqst(uint8_t cause)
Create BSSMAP Clear Request message.
Definition: gsm0808.c:572
gsm0808_old_bss_to_new_bss_info::current_channel_type_2_present
bool current_channel_type_2_present
Definition: gsm0808.h:99
gsm0808_handover_complete::rr_cause
uint8_t rr_cause
Definition: gsm0808.h:136
gsm0808_handover_complete::lcls_bss_status
enum gsm0808_lcls_status lcls_bss_status
Definition: gsm0808.h:150
gsm0808_old_bss_to_new_bss_info::prec
bool prec
Definition: gsm0808.h:94
gsm0808_lcls_control_name
static const char * gsm0808_lcls_control_name(uint8_t val)
Definition: gsm0808.h:186
gsm0808_handover_required::old_bss_to_new_bss_info_present
bool old_bss_to_new_bss_info_present
Definition: gsm0808.h:120
gsm0808_utils.h
gsm0808_old_bss_to_new_bss_info::lcs
bool lcs
Definition: gsm0808.h:95
gsm0808_handover_complete::speech_codec_chosen_present
bool speech_codec_chosen_present
Definition: gsm0808.h:138
gsm0808_handover_required::speech_version_used
uint8_t speech_version_used
Definition: gsm0808.h:118
gsm0808_cell_id_list
DEPRECATED: This definition of the cell identifier list is insufficient.
Definition: gsm_08_08.h:539
gsm0808_cell_id_list2
Parsed representation of a Cell Identifier List IE (3GPP TS 48.008 3.2.2.27).
Definition: gsm0808_utils.h:54
gsm0808_create_handover_detect
struct msgb * gsm0808_create_handover_detect()
Create BSSMAP HANDOVER DETECT message, 3GPP TS 48.008 3.2.1.40.
Definition: gsm0808.c:772
gsm0808_create_handover_required
struct msgb * gsm0808_create_handover_required(const struct gsm0808_handover_required *params)
Create BSSMAP HANDOVER REQUIRED message.
Definition: gsm0808.c:708
gsm0808_create_paging2
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
gsm0808_lcls_status_names
const struct value_string gsm0808_lcls_status_names[]
Definition: gsm0808.c:1279
gsm0808_create_ass_fail
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
gsm0808_old_bss_to_new_bss_info::extra_information_present
bool extra_information_present
Definition: gsm0808.h:92
gsm0808_handover_required::old_bss_to_new_bss_info
struct gsm0808_old_bss_to_new_bss_info old_bss_to_new_bss_info
Definition: gsm0808.h:121
gsm0808_handover_required::more_items
bool more_items
Definition: gsm0808.h:124
gsm23003.h
gsm0808_handover_required::current_channel_type_1
uint8_t current_channel_type_1
Definition: gsm0808.h:115
gsm0808_create_assignment_completed
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
gsm0808_old_bss_to_new_bss_info
3GPP TS 48.008 §3.2.2.5.8 Old BSS to New BSS information
Definition: gsm0808.h:91
gsm0808_create_reset
struct msgb * gsm0808_create_reset(void)
Create BSSMAP RESET message.
Definition: gsm0808.c:138
gsm0808_create_cipher_complete
struct msgb * gsm0808_create_cipher_complete(struct msgb *layer3, uint8_t alg_id)
Create BSSMAP Cipher Mode Complete message.
Definition: gsm0808.c:242
alg_id
uint8_t alg_id
Definition: gsm_04_08.h:716
gsm0808_handover_required
3GPP TS 48.008 §3.2.1.9 HANDOVER REQUIRED
Definition: gsm0808.h:110
gsm0808_create_reset_ack
struct msgb * gsm0808_create_reset_ack(void)
Create BSSMAP RESET ACK message.
Definition: gsm0808.c:155
gsm_08_08.h
gsm0808_create_assignment_failure
struct msgb * gsm0808_create_assignment_failure(uint8_t cause, uint8_t *rr_cause)
Create BSSMAP Assignment Failure message.
Definition: gsm0808.c:563
lac
uint16_t lac
Definition: gsm_04_08.h:709
cm2_len
uint8_t cm2_len
Definition: gsm_04_08.h:708
gsm0808_encrypt_info
Definition: gsm_08_08.h:525
gsm0808_handover_failure::codec_list_bss_supported
struct gsm0808_speech_codec_list codec_list_bss_supported
Definition: gsm0808.h:163
gsm0808_create_lcls_conn_ctrl
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
gsm0808_handover_complete::speech_codec_chosen
struct gsm0808_speech_codec speech_codec_chosen
Definition: gsm0808.h:139
gsm0808_handover_complete::chosen_channel_present
bool chosen_channel_present
Definition: gsm0808.h:146
gsm0808_handover_failure::rr_cause_present
bool rr_cause_present
Definition: gsm0808.h:160
gsm0808_bssmap_name
const char * gsm0808_bssmap_name(uint8_t msg_type)
Return string name of BSSMAP Message Type.
Definition: gsm0808.c:1125
gsm0808_handover_failure
Definition: gsm0808.h:157
gsm0808_create_sapi_reject
struct msgb * gsm0808_create_sapi_reject(uint8_t link_id)
Create BSSMAP SAPI N Reject message.
Definition: gsm0808.c:373
gsm0808_create_cipher
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
gsm0808_lcls_control
gsm0808_lcls_control
Definition: gsm_08_08.h:556
gsm0808_create_lcls_conn_ctrl_ack
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
gsm0808_handover_complete::codec_list_bss_supported
struct gsm0808_speech_codec_list codec_list_bss_supported
Definition: gsm0808.h:141
gsm0808_create_paging
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
cm2
struct gsm48_classmark2 cm2
Definition: gsm_04_08.h:709
gsm0808_handover_required::speech_version_used_present
bool speech_version_used_present
Definition: gsm0808.h:117
gsm0808_create_cipher_reject
struct msgb * gsm0808_create_cipher_reject(uint8_t cause)
Create BSSMAP Cipher Mode Reject message.
Definition: gsm0808.c:270
tlv.h
msg_type
uint8_t msg_type
Definition: gsm_04_08.h:710
gsm0808_create_ass
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
gsm0808_lcls_status_name
static const char * gsm0808_lcls_status_name(uint8_t val)
Definition: gsm0808.h:189
gsm0808_old_bss_to_new_bss_info::mode
uint8_t mode
Definition: gsm0808.h:101
gsm0808_lcls_config_name
static const char * gsm0808_lcls_config_name(uint8_t val)
Definition: gsm0808.h:183
gsm0808_create_layer3_aoip
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
gsm0808_create_classmark_update
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
gsm0808_handover_complete
Definition: gsm0808.h:134
gsm0808_handover_failure::cause
uint16_t cause
Definition: gsm0808.h:158
gsm0808_create_dtap
struct msgb * gsm0808_create_dtap(struct msgb *msg, uint8_t link_id)
Create BSSMAP DTAP message.
Definition: gsm0808.c:864
gsm0808_create_ass_compl
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
gsm0808_create_handover_complete
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
gsm0808_handover_required::cil
struct gsm0808_cell_id_list2 cil
Definition: gsm0808.h:112