libosmogsm  0.11.0-dirty
Osmocom GSM library
GSM 08.08 / 3GPP TS 48.008 A Interface

Data Structures

union  gsm0808_cell_id_u
 Instead of this, use either struct gsm0808_cell_id or gsm0808_cell_id_list2. More...
struct  gsm0808_cell_id
 Parsed representation of Cell Identifier IE (3GPP TS 48.008 3.2.2.17) More...
struct  gsm0808_cell_id_list2
 Parsed representation of a Cell Identifier List IE (3GPP TS 48.008 3.2.2.27). More...

Files

file  gsm0808.h
file  gsm0808_utils.h
file  gsm0808.c
 

Helper functions regarding the TS 08.08 / 48.008 A interface, primarily message generation/encoding.


Defines

#define GSM0808_CELL_ID_LIST2_MAXLEN   127
 (225-1)/2 is the maximum number of elements in a cell identifier list.
#define BSSMAP_MSG_SIZE   512
#define BSSMAP_MSG_HEADROOM   128

Functions

struct msgbgsm0808_create_layer3 (struct msgb *msg_l3, uint16_t nc, uint16_t cc, int lac, uint16_t _ci)
 Create "Complete L3 Info" for A, legacy implementation.
struct msgbgsm0808_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)
 Create "Complete L3 Info" for AoIP, legacy implementation.
struct msgbgsm0808_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.
struct msgbgsm0808_create_reset (void)
 Create BSSMAP RESET message.
struct msgbgsm0808_create_reset_ack (void)
 Create BSSMAP RESET ACK message.
struct msgbgsm0808_create_clear_command (uint8_t reason)
 Create BSSMAP Clear Command message.
struct msgbgsm0808_create_clear_complete (void)
 Create BSSMAP Clear Complete message.
struct msgbgsm0808_create_cipher (const struct gsm0808_encrypt_info *ei, const uint8_t *cipher_response_mode)
 Create BSSMAP Cipher Mode Command message.
struct msgbgsm0808_create_cipher_complete (struct msgb *layer3, uint8_t alg_id)
 Create BSSMAP Cipher Mode Complete message.
struct msgbgsm0808_create_cipher_reject (uint8_t cause)
 Create BSSMAP Cipher Mode Reject message.
struct msgbgsm0808_create_classmark_update (const uint8_t *cm2, uint8_t cm2_len, const uint8_t *cm3, uint8_t cm3_len)
 Create BSSMAP Classmark Update message.
struct msgbgsm0808_create_sapi_reject (uint8_t link_id)
 Create BSSMAP SAPI N Reject message.
struct msgbgsm0808_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.
struct msgbgsm0808_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.
struct msgbgsm0808_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.
struct msgbgsm0808_create_ass_fail (uint8_t cause, const uint8_t *rr_cause, const struct gsm0808_speech_codec_list *scl)
 Create BSSMAP Assignment Failure message.
struct msgbgsm0808_create_assignment_failure (uint8_t cause, uint8_t *rr_cause)
 Create BSSMAP Assignment Failure message.
struct msgbgsm0808_create_clear_rqst (uint8_t cause)
 Create BSSMAP Clear Request message.
struct msgbgsm0808_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.
struct msgbgsm0808_create_paging (const char *imsi, const uint32_t *tmsi, const struct gsm0808_cell_id_list *cil, const uint8_t *chan_needed)
 DEPRECATED: Use gsm0808_create_paging2 instead.
struct msgbgsm0808_create_dtap (struct msgb *msg_l3, uint8_t link_id)
 Create BSSMAP DTAP message.
void gsm0808_prepend_dtap_header (struct msgb *msg, uint8_t link_id)
 Prepend a DTAP header to given Message Buffer.
struct tlv_definitiongsm0808_att_tlvdef (void)
const char * gsm0808_bssmap_name (uint8_t msg_type)
 Return string name of BSSMAP Message Type.
const char * gsm0808_bssap_name (uint8_t msg_type)
 Return string name of BSSAP Message Type.
const char * gsm0808_cause_name (uint8_t cause)
 Return string name of BSSMAP Cause name.
static const char * gsm0808_cell_id_discr_name (enum CELL_IDENT id_discr)
const char * gsm0808_cell_id_name (const struct gsm0808_cell_id *cid)
 Return a human readable representation of a Cell Identifier, like "LAC:123" or "CGI:001-01-42-23".
const char * gsm0808_cell_id_name2 (const struct gsm0808_cell_id *cid)
 Like gsm0808_cell_id_name() but uses a different static buffer.
const char * gsm0808_cell_id_list_name (const struct gsm0808_cell_id_list2 *cil)
 Return a human-readable representation of cil in a static buffer.
int gsm0808_cell_id_list_name_buf (char *buf, size_t buflen, const struct gsm0808_cell_id_list2 *cil)
 Return a human readable representation of the Cell Identifier List, like "LAC[2]:{123, 456}".
int gsm0808_cell_id_u_name (char *buf, size_t buflen, enum CELL_IDENT id_discr, const union gsm0808_cell_id_u *u)
 Print a human readable name of the cell identifier to the char buffer.
uint8_t gsm0808_enc_aoip_trasp_addr (struct msgb *msg, const struct sockaddr_storage *ss)
int gsm0808_dec_aoip_trasp_addr (struct sockaddr_storage *ss, const uint8_t *elem, uint8_t len)
uint8_t gsm0808_enc_speech_codec (struct msgb *msg, const struct gsm0808_speech_codec *sc)
 Encode TS 08.08 Speech Codec IE.
int gsm0808_dec_speech_codec (struct gsm0808_speech_codec *sc, const uint8_t *elem, uint8_t len)
 Decode TS 08.08 Speech Codec IE.
uint8_t gsm0808_enc_speech_codec_list (struct msgb *msg, const struct gsm0808_speech_codec_list *scl)
 Encode TS 08.08 Speech Codec list.
int gsm0808_dec_speech_codec_list (struct gsm0808_speech_codec_list *scl, const uint8_t *elem, uint8_t len)
 Decode TS 08.08 Speech Codec list IE.
uint8_t gsm0808_enc_channel_type (struct msgb *msg, const struct gsm0808_channel_type *ct)
 Encode TS 08.08 Channel Type IE.
int gsm0808_dec_channel_type (struct gsm0808_channel_type *ct, const uint8_t *elem, uint8_t len)
 Decode TS 08.08 Channel Type IE.
uint8_t gsm0808_enc_encrypt_info (struct msgb *msg, const struct gsm0808_encrypt_info *ei)
 Encode TS 08.08 Encryption Information IE.
int gsm0808_dec_encrypt_info (struct gsm0808_encrypt_info *ei, const uint8_t *elem, uint8_t len)
 Decode TS 08.08 Encryption Information IE.
uint8_t gsm0808_enc_cell_id_list2 (struct msgb *msg, const struct gsm0808_cell_id_list2 *cil)
 Encode TS 08.08 Cell Identifier List IE.
uint8_t gsm0808_enc_cell_id_list (struct msgb *msg, const struct gsm0808_cell_id_list *cil) OSMO_DEPRECATED("use gsm0808_enc_cell_id_list2 instead")
 DEPRECATED: Use gsm0808_enc_cell_id_list2 instead.
int gsm0808_dec_cell_id_list2 (struct gsm0808_cell_id_list2 *cil, const uint8_t *elem, uint8_t len)
 Decode Cell Identifier List IE.
int gsm0808_dec_cell_id_list (struct gsm0808_cell_id_list *cil, const uint8_t *elem, uint8_t len) OSMO_DEPRECATED("use gsm0808_dec_cell_id_list2 instead")
 DEPRECATED: Use gsm0808_dec_cell_id_list2 instead.
int gsm0808_cell_id_list_add (struct gsm0808_cell_id_list2 *dst, const struct gsm0808_cell_id_list2 *src)
 Append entries from one Cell Identifier List to another.
uint8_t gsm0808_enc_cell_id (struct msgb *msg, const struct gsm0808_cell_id *ci)
 Encode Cell Identifier IE (3GPP TS 48.008 3.2.2.17).
int gsm0808_dec_cell_id (struct gsm0808_cell_id *ci, const uint8_t *elem, uint8_t len)
 Decode Cell Identifier IE (3GPP TS 48.008 3.2.2.17).
int gsm0808_chan_type_to_speech_codec (uint8_t perm_spch)
 Convert the representation of the permitted speech codec identifier that is used in struct gsm0808_channel_type to the speech codec representation we use in struct gsm0808_speech_codec.
int gsm0808_speech_codec_from_chan_type (struct gsm0808_speech_codec *sc, uint8_t perm_spch)
 Extrapolate a speech codec field from a given permitted speech parameter (channel type).
static uint8_t gsm0808_current_channel_type_1 (enum gsm_chan_t type)
 Return 3GPP TS 48.008 3.2.2.49 Current Channel Type 1 from enum gsm_chan_t.
static enum
gsm0808_permitted_speech 
gsm0808_permitted_speech (enum gsm_chan_t type, enum gsm48_chan_mode mode)
 Return 3GPP TS 48.008 3.2.2.51 Speech Version aka permitted speech version indication in 3.2.2.11 Channel Type.
static uint8_t gsm0808_chosen_channel (enum gsm_chan_t type, enum gsm48_chan_mode mode)
 Return 3GPP TS 48.008 3.2.2.33 Chosen Channel.
const char * gsm0808_channel_type_name (const struct gsm0808_channel_type *ct)

Variables

struct msgb to not lose
leading zeros in the 
MNC
struct value_string gsm0808_cell_id_discr_names []
 value_string[] for enum CELL_IDENT.
static struct tlv_definition bss_att_tlvdef
static struct value_string gsm0808_msgt_names []
static struct value_string gsm0808_bssap_names []
struct value_string gsm0808_speech_codec_type_names []
static struct value_string gsm0808_cause_names []

Define Documentation


Function Documentation

struct tlv_definition * gsm0808_att_tlvdef ( void  ) [read]

References bss_att_tlvdef.

const char * gsm0808_bssap_name ( uint8_t  msg_type)

Return string name of BSSAP Message Type.

References get_value_string().

const char * gsm0808_bssmap_name ( uint8_t  msg_type)

Return string name of BSSMAP Message Type.

References get_value_string().

const char * gsm0808_cause_name ( uint8_t  cause)

Return string name of BSSMAP Cause name.

References get_value_string().

int gsm0808_cell_id_list_add ( struct gsm0808_cell_id_list2 dst,
const struct gsm0808_cell_id_list2 src 
)

Append entries from one Cell Identifier List to another.

The cell identifier types must be identical between the two lists.

Parameters:
dst[out]Append entries to this list.
src[in]Append these entries to dst.
Returns:
the nr of items added, or negative on error: -EINVAL if the id_discr mismatch between the lists, -ENOSPC if the destination list does not have enough space. If an error is returned, dst may have already been changed (particularly on -ENOSPC). Note that a return value of zero may occur when the src->id_list_len is zero, or when all entries from src already exist in dst, and does not indicate error per se.

References ARRAY_SIZE, CELL_IDENT_BSS, gsm0808_cell_id_list2::id_discr, gsm0808_cell_id_list2::id_list, gsm0808_cell_id_list2::id_list_len, and same_cell_id_list_entries().

const char* gsm0808_cell_id_list_name ( const struct gsm0808_cell_id_list2 cil)

Return a human-readable representation of cil in a static buffer.

If the list is too long, the output may be truncated. See also gsm0808_cell_id_list_name_buf().

References gsm0808_cell_id_list_name_buf().

int gsm0808_cell_id_list_name_buf ( char *  buf,
size_t  buflen,
const struct gsm0808_cell_id_list2 cil 
)

Return a human readable representation of the Cell Identifier List, like "LAC[2]:{123, 456}".

The return value semantics are like snprintf() and thus allow ensuring a complete untruncated string by determining the required string length from the return value. If buflen > 0, always nul-terminate the string in buf, also when it is truncated. If buflen == 0, do not modify buf, just return the would-be length.

Parameters:
[out]bufDestination buffer to write string representation to.
[in]buflenAmount of memory available in buf.
[in]cilCell Identifer List.
Returns:
Like snprintf(): the amount of characters (excluding terminating nul) written, or that would have been written if the buffer were large enough.

References APPEND_CELL_ID_U, APPEND_STR, CELL_IDENT_BSS, CELL_IDENT_NO_CELL, gsm0808_cell_id_discr_name(), gsm0808_cell_id_list2::id_discr, gsm0808_cell_id_list2::id_list, and gsm0808_cell_id_list2::id_list_len.

Referenced by gsm0808_cell_id_list_name().

const char* gsm0808_cell_id_name ( const struct gsm0808_cell_id cid)

Return a human readable representation of a Cell Identifier, like "LAC:123" or "CGI:001-01-42-23".

Parameters:
[in]cidCell Identifer.
Returns:
String in a static buffer.

References gsm0808_cell_id_name_buf().

const char* gsm0808_cell_id_name2 ( const struct gsm0808_cell_id cid)

Like gsm0808_cell_id_name() but uses a different static buffer.

Parameters:
[in]cidCell Identifer.
Returns:
String in a static buffer.

References gsm0808_cell_id_name_buf().

int gsm0808_cell_id_u_name ( char *  buf,
size_t  buflen,
enum CELL_IDENT  id_discr,
const union gsm0808_cell_id_u u 
)

Print a human readable name of the cell identifier to the char buffer.

This is useful both for struct gsm0808_cell_id and struct gsm0808_cell_id_list2. See also gsm0808_cell_id_name() and gsm0808_cell_id_list_name().

Parameters:
[out]bufDestination buffer to write string representation to.
[in]buflenAmount of memory available in buf.
[in]id_discrCell Identifier type.
[in]uCell Identifer value.
Returns:
Like snprintf(): the amount of characters (excluding terminating nul) written, or that would have been written if the buffer were large enough.

References CELL_IDENT_CI, CELL_IDENT_LAC, CELL_IDENT_LAC_AND_CI, CELL_IDENT_LAI_AND_LAC, CELL_IDENT_WHOLE_GLOBAL, osmo_lac_and_ci_id::ci, gsm0808_cell_id_u::ci, gsm0808_cell_id_u::global, gsm0808_cell_id_discr_name(), osmo_lac_and_ci_id::lac, gsm0808_cell_id_u::lac, gsm0808_cell_id_u::lac_and_ci, gsm0808_cell_id_u::lai_and_lac, osmo_cgi_name(), and osmo_lai_name().

int gsm0808_chan_type_to_speech_codec ( uint8_t  perm_spch)

Convert the representation of the permitted speech codec identifier that is used in struct gsm0808_channel_type to the speech codec representation we use in struct gsm0808_speech_codec.

Parameters:
[in]perm_spchto be converted (see also gsm0808_permitted_speech)
Returns:
GSM speech codec type; negative on error

The speech codec type, which is used in the channel type field to signal the permitted speech versions (codecs) has a different encoding than the type field in the speech codec type element (See also 3GPP TS 48.008, 3.2.2.11 and 3.2.2.103)

References GSM0808_PERM_FR1, GSM0808_PERM_FR2, GSM0808_PERM_FR3, GSM0808_PERM_FR4, GSM0808_PERM_FR5, GSM0808_PERM_HR1, GSM0808_PERM_HR3, GSM0808_PERM_HR4, GSM0808_PERM_HR6, GSM0808_SCT_FR1, GSM0808_SCT_FR2, GSM0808_SCT_FR3, GSM0808_SCT_FR4, GSM0808_SCT_FR5, GSM0808_SCT_HR1, GSM0808_SCT_HR3, GSM0808_SCT_HR4, and GSM0808_SCT_HR6.

Referenced by gsm0808_speech_codec_from_chan_type().

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 
) [read]

Create BSSMAP Assignment Request message.

Parameters:
[in]ctChannel Type
[in]cicCircuit Identity Code (Classic A only)
[in]ssSocket Address of MSC-side RTP socket (AoIP only)
[in]sclSpeech Codec List (AoIP only)
[in]ciCall Identifier (Optional, LCLS)
Returns:
callee-allocated msgb with BSSMAP Assignment Request message

References BSS_MAP_MSG_ASSIGMENT_RQST, BSSAP_MSG_BSS_MANAGEMENT, BSSMAP_MSG_HEADROOM, BSSMAP_MSG_SIZE, gsm0808_enc_aoip_trasp_addr(), gsm0808_enc_channel_type(), gsm0808_enc_speech_codec_list(), GSM0808_IE_CALL_ID, GSM0808_IE_CIRCUIT_IDENTITY_CODE, msgb::l3h, msgb_alloc_headroom(), msgb_length(), msgb_tv_fixed_put(), msgb_tv_push(), msgb_v_put(), OSMO_ASSERT, osmo_htonl, and osmo_htons.

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 
) [read]

Create BSSMAP Assignment Completed message.

Parameters:
[in]rr_causeGSM 04.08 RR Cause value
[in]chosen_channelChosen Channel
[in]encr_alg_idEncryption Algorithm ID
[in]speech_modeSpeech Mode
[in]ssSocket Address of BSS-side RTP socket
[in]scSpeech Codec (current)
[in]sclSpeech Codec List (permitted)
Returns:
callee-allocated msgb with BSSMAP Assignment Complete message

References BSS_MAP_MSG_ASSIGMENT_COMPLETE, BSSAP_MSG_BSS_MANAGEMENT, BSSMAP_MSG_HEADROOM, BSSMAP_MSG_SIZE, gsm0808_enc_aoip_trasp_addr(), gsm0808_enc_speech_codec(), gsm0808_enc_speech_codec_list(), GSM0808_IE_CHOSEN_CHANNEL, GSM0808_IE_CHOSEN_ENCR_ALG, GSM0808_IE_RR_CAUSE, GSM0808_IE_SPEECH_VERSION, msgb::l3h, msgb_alloc_headroom(), msgb_length(), msgb_tv_push(), msgb_tv_put(), and msgb_v_put().

Referenced by gsm0808_create_assignment_completed().

struct msgb * gsm0808_create_ass_fail ( uint8_t  cause,
const uint8_t *  rr_cause,
const struct gsm0808_speech_codec_list scl 
) [read]

Create BSSMAP Assignment Failure message.

Parameters:
[in]causeBSSMAP Cause value
[in]rr_causeGSM 04.08 RR Cause value
[in]sclOptional Speech Cdec List (AoIP)
Returns:
callee-allocated msgb with BSSMAP Assignment Failure message

References BSS_MAP_MSG_ASSIGMENT_FAILURE, BSSAP_MSG_BSS_MANAGEMENT, BSSMAP_MSG_HEADROOM, BSSMAP_MSG_SIZE, gsm0808_enc_speech_codec_list(), GSM0808_IE_CAUSE, GSM0808_IE_RR_CAUSE, msgb::l3h, msgb_alloc_headroom(), msgb_length(), msgb_tlv_put(), msgb_tv_push(), msgb_tv_put(), and msgb_v_put().

Referenced by gsm0808_create_assignment_failure().

struct msgb * gsm0808_create_assignment_completed ( uint8_t  rr_cause,
uint8_t  chosen_channel,
uint8_t  encr_alg_id,
uint8_t  speech_mode 
) [read]

Create BSSMAP Assignment Completed message.

Parameters:
[in]rr_causeGSM 04.08 RR Cause value
[in]chosen_channelChosen Channel
[in]encr_alg_idEncryption Algorithm ID
[in]speech_modeSpeech Mode
Returns:
callee-allocated msgb with BSSMAP Assignment Complete message

References gsm0808_create_ass_compl().

struct msgb * gsm0808_create_assignment_failure ( uint8_t  cause,
uint8_t *  rr_cause 
) [read]

Create BSSMAP Assignment Failure message.

Parameters:
[in]causeBSSMAP Cause value
[in]rr_causeGSM 04.08 RR Cause value
Returns:
callee-allocated msgb with BSSMAP Assignment Failure message

References gsm0808_create_ass_fail().

struct msgb * gsm0808_create_cipher ( const struct gsm0808_encrypt_info ei,
const uint8_t *  cipher_response_mode 
) [read]

Create BSSMAP Cipher Mode Command message.

Parameters:
[in]eiMandatory Encryption Information
[in]cipher_response_modeoptional 1-byte Cipher Response Mode
Returns:
callee-allocated msgb with BSSMAP Cipher Mode Command message

References BSS_MAP_MSG_CIPHER_MODE_CMD, BSSAP_MSG_BSS_MANAGEMENT, BSSMAP_MSG_HEADROOM, BSSMAP_MSG_SIZE, gsm0808_enc_encrypt_info(), GSM0808_IE_CIPHER_RESPONSE_MODE, msgb::l3h, msgb_alloc_headroom(), msgb_length(), msgb_tv_push(), msgb_tv_put(), msgb_v_put(), and OSMO_ASSERT.

struct msgb * gsm0808_create_cipher_complete ( struct msgb layer3,
uint8_t  alg_id 
) [read]

Create BSSMAP Cipher Mode Complete message.

Parameters:
[in]layer3L3 Message to be included
[in]alg_idChosen Encrpytion Algorithm
Returns:
callee-allocated msgb with BSSMAP Cipher Mode Complete message

References BSS_MAP_MSG_CIPHER_MODE_COMPLETE, BSSAP_MSG_BSS_MANAGEMENT, BSSMAP_MSG_HEADROOM, BSSMAP_MSG_SIZE, GSM0808_IE_CHOSEN_ENCR_ALG, GSM0808_IE_LAYER_3_MESSAGE_CONTENTS, msgb::l3h, msgb::l4h, msgb_alloc_headroom(), msgb_l3len(), msgb_length(), msgb_tlv_put(), msgb_tv_push(), msgb_tv_put(), and msgb_v_put().

struct msgb * gsm0808_create_cipher_reject ( uint8_t  cause) [read]

Create BSSMAP Cipher Mode Reject message.

Parameters:
[in]reasonTS 08.08 cause value
Returns:
callee-allocated msgb with BSSMAP Cipher Mode Reject message

References BSS_MAP_MSG_CIPHER_MODE_REJECT, BSSAP_MSG_BSS_MANAGEMENT, BSSMAP_MSG_HEADROOM, BSSMAP_MSG_SIZE, GSM0808_IE_CAUSE, msgb::l3h, msgb_alloc_headroom(), msgb_length(), msgb_tlv_put(), msgb_tv_push(), and msgb_v_put().

struct msgb * gsm0808_create_classmark_update ( const uint8_t *  cm2,
uint8_t  cm2_len,
const uint8_t *  cm3,
uint8_t  cm3_len 
) [read]

Create BSSMAP Classmark Update message.

Parameters:
[in]cm2Classmark 2
[in]cm2_lenlength (in octets) of cm2
[in]cm3Classmark 3
[in]cm3_lenlength (in octets) of cm3
Returns:
callee-allocated msgb with BSSMAP Classmark Update message

References BSS_MAP_MSG_CLASSMARK_UPDATE, BSSAP_MSG_BSS_MANAGEMENT, BSSMAP_MSG_HEADROOM, BSSMAP_MSG_SIZE, GSM0808_IE_CLASSMARK_INFORMATION_T2, GSM0808_IE_CLASSMARK_INFORMATION_T3, msgb::l3h, msgb_alloc_headroom(), msgb_length(), msgb_tlv_put(), msgb_tv_push(), and msgb_v_put().

struct msgb * gsm0808_create_clear_command ( uint8_t  reason) [read]

Create BSSMAP Clear Command message.

Parameters:
[in]reasonTS 08.08 cause value
Returns:
callee-allocated msgb with BSSMAP Clear Command message

References BSS_MAP_MSG_CLEAR_CMD, BSSAP_MSG_BSS_MANAGEMENT, BSSMAP_MSG_HEADROOM, BSSMAP_MSG_SIZE, GSM0808_IE_CAUSE, msgb::l3h, msgb_alloc_headroom(), msgb_tlv_put(), msgb_tv_put(), and msgb_v_put().

struct msgb * gsm0808_create_clear_complete ( void  ) [read]

Create BSSMAP Clear Complete message.

Returns:
callee-allocated msgb with BSSMAP Clear Complete message

References BSS_MAP_MSG_CLEAR_COMPLETE, BSSAP_MSG_BSS_MANAGEMENT, BSSMAP_MSG_HEADROOM, BSSMAP_MSG_SIZE, msgb::data, msgb::l3h, msgb_alloc_headroom(), and msgb_tlv_put().

struct msgb * gsm0808_create_clear_rqst ( uint8_t  cause) [read]

Create BSSMAP Clear Request message.

Parameters:
[in]causeBSSMAP Cause value
Returns:
callee-allocated msgb with BSSMAP Clear Request message

References BSS_MAP_MSG_CLEAR_RQST, BSSAP_MSG_BSS_MANAGEMENT, BSSMAP_MSG_HEADROOM, BSSMAP_MSG_SIZE, GSM0808_IE_CAUSE, msgb::l3h, msgb_alloc_headroom(), msgb_length(), msgb_tlv_put(), msgb_tv_push(), and msgb_v_put().

struct msgb * gsm0808_create_dtap ( struct msgb msg_l3,
uint8_t  link_id 
) [read]

Create BSSMAP DTAP message.

Parameters:
[in]msg_l3Messge Buffer containing Layer3 message
[in]link_idLink Identifier
Returns:
callee-allocated msgb with BSSMAP DTAP message

References BSSAP_MSG_DTAP, BSSMAP_MSG_HEADROOM, BSSMAP_MSG_SIZE, data, header, msgb::l3h, dtap_header::length, dtap_header::link_id, msgb_alloc_headroom(), msgb_l3len(), msgb_put(), and dtap_header::type.

struct msgb * gsm0808_create_layer3 ( struct msgb msg_l3,
uint16_t  nc,
uint16_t  cc,
int  lac,
uint16_t  _ci 
) [read]

Create "Complete L3 Info" for A, legacy implementation.

Instead use gsm0808_create_layer3_2() with the scl parameter passed as NULL, which is capable of three-digit MNC with leading zeros.

Parameters:
[in]msg_l3msgb containing Layer 3 Message
[in]ncMobile Network Code
[in]ccMobile Country Code
[in]lacLocation Area Code
[in]_ciCell Identity
Returns:
callee-allocated msgb with Complete L3 Info message

References gsm0808_create_layer3_2(), lac, osmo_cell_global_id::lai, osmo_plmn_id::mcc, and osmo_location_area_id::plmn.

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 
) [read]

Create "Complete L3 Info" for AoIP.

Parameters:
[in]msg_l3msgb containing Layer 3 Message -- not modified by this call.
[in]cellMCC, MNC, LAC, CI to identify the cell.
[in]sclSpeech Codec List, optional.
Returns:
newly allocated msgb with Complete L3 Info message

References __attribute__, BSS_MAP_MSG_COMPLETE_LAYER_3, BSSAP_MSG_BSS_MANAGEMENT, BSSMAP_MSG_HEADROOM, BSSMAP_MSG_SIZE, CELL_IDENT_WHOLE_GLOBAL, osmo_cell_global_id::cell_identity, gsm0808_enc_speech_codec_list(), GSM0808_IE_CELL_IDENTIFIER, GSM0808_IE_LAYER_3_INFORMATION, gsm48_generate_lai2(), msgb::l3h, osmo_cell_global_id::lai, msgb_alloc_headroom(), msgb_l3len(), msgb_length(), msgb_tlv_put(), msgb_tv_push(), msgb_v_put(), and osmo_htons.

Referenced by gsm0808_create_layer3(), and 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 
) [read]

Create "Complete L3 Info" for AoIP, legacy implementation.

Instead use gsm0808_create_layer3_aoip2(), which is capable of three-digit MNC with leading zeros.

Parameters:
[in]msg_l3msgb containing Layer 3 Message
[in]ncMobile Network Code
[in]ccMobile Country Code
[in]lacLocation Area Code
[in]_ciCell Identity
[in]sclSpeech Codec List
Returns:
callee-allocated msgb with Complete L3 Info message

References gsm0808_create_layer3_2(), lac, osmo_cell_global_id::lai, osmo_plmn_id::mcc, and osmo_location_area_id::plmn.

struct msgb * gsm0808_create_paging ( const char *  imsi,
const uint32_t *  tmsi,
const struct gsm0808_cell_id_list cil,
const uint8_t *  chan_needed 
) [read]

DEPRECATED: Use gsm0808_create_paging2 instead.

Create BSSMAP PAGING message.

Parameters:
[in]imsiMandatory paged IMSI in string representation
[in]tmsiOptional paged TMSI
[in]cilCell Identity List (where to page)
[in]chan_neededChannel Type needed
Returns:
callee-allocated msgb with BSSMAP PAGING message

References GSM0808_CELL_ID_LIST2_MAXLEN, gsm0808_create_paging2(), gsm0808_cell_id_list2::id_discr, gsm0808_cell_id_list::id_discr, gsm0808_cell_id_list2::id_list, gsm0808_cell_id_list::id_list_lac, gsm0808_cell_id_list2::id_list_len, gsm0808_cell_id_list::id_list_len, gsm0808_cell_id_u::lac, and OSMO_ASSERT.

struct msgb * gsm0808_create_paging2 ( const char *  imsi,
const uint32_t *  tmsi,
const struct gsm0808_cell_id_list2 cil,
const uint8_t *  chan_needed 
) [read]

Create BSSMAP PAGING message.

Parameters:
[in]imsiMandatory paged IMSI in string representation
[in]tmsiOptional paged TMSI
[in]cilCell Identity List (where to page)
[in]chan_neededChannel Type needed
Returns:
callee-allocated msgb with BSSMAP PAGING message

References BSS_MAP_MSG_PAGING, BSSAP_MSG_BSS_MANAGEMENT, BSSMAP_MSG_HEADROOM, BSSMAP_MSG_SIZE, gsm0808_enc_cell_id_list2(), GSM0808_IE_CHANNEL_NEEDED, GSM0808_IE_IMSI, GSM0808_IE_TMSI, gsm48_generate_mid_from_imsi(), GSM48_MI_SIZE, msgb::l3h, msgb_alloc_headroom(), msgb_length(), msgb_tlv_put(), msgb_tv_push(), msgb_tv_put(), msgb_v_put(), OSMO_ASSERT, and osmo_htonl.

Referenced by gsm0808_create_paging().

struct msgb * gsm0808_create_reset ( void  ) [read]
struct msgb * gsm0808_create_reset_ack ( void  ) [read]

Create BSSMAP RESET ACK message.

Returns:
callee-allocated msgb with BSSMAP Reset ACK message

References BSS_MAP_MSG_RESET_ACKNOWLEDGE, BSSAP_MSG_BSS_MANAGEMENT, BSSMAP_MSG_HEADROOM, BSSMAP_MSG_SIZE, msgb::l3h, msgb_alloc_headroom(), msgb_length(), msgb_tv_push(), and msgb_v_put().

struct msgb * gsm0808_create_sapi_reject ( uint8_t  link_id) [read]

Create BSSMAP SAPI N Reject message.

Parameters:
[in]link_idLink Identifier
Returns:
callee-allocated msgb with BSSMAP SAPI N Reject message

References BSS_MAP_MSG_SAPI_N_REJECT, BSSAP_MSG_BSS_MANAGEMENT, BSSMAP_MSG_HEADROOM, BSSMAP_MSG_SIZE, GSM0808_CAUSE_BSS_NOT_EQUIPPED, msgb::l3h, msgb_alloc_headroom(), msgb_length(), msgb_tv_push(), and msgb_v_put().

static uint8_t gsm0808_current_channel_type_1 ( enum gsm_chan_t  type) [inline, static]

Return 3GPP TS 48.008 3.2.2.49 Current Channel Type 1 from enum gsm_chan_t.

References GSM_LCHAN_SDCCH, GSM_LCHAN_TCH_F, and GSM_LCHAN_TCH_H.

int gsm0808_dec_aoip_trasp_addr ( struct sockaddr_storage *  ss,
const uint8_t *  elem,
uint8_t  len 
)
int gsm0808_dec_cell_id ( struct gsm0808_cell_id ci,
const uint8_t *  elem,
uint8_t  len 
)

Decode Cell Identifier IE (3GPP TS 48.008 3.2.2.17).

Parameters:
[out]ciCaller-provided memory to store Cell ID.
[in]elemIE value to be decoded.
[in]lenLength of elem in bytes.
Returns:
number of bytes parsed; negative on error

References CELL_IDENT_BSS, CELL_IDENT_NO_CELL, gsm0808_dec_cell_id_list2(), gsm0808_cell_id::id, gsm0808_cell_id::id_discr, gsm0808_cell_id_list2::id_discr, gsm0808_cell_id_list2::id_list, and gsm0808_cell_id_list2::id_list_len.

int gsm0808_dec_cell_id_list ( struct gsm0808_cell_id_list cil,
const uint8_t *  elem,
uint8_t  len 
)

DEPRECATED: Use gsm0808_dec_cell_id_list2 instead.

Decode Cell Identifier List IE

Parameters:
[out]cilCaller-provided memory to store Cell ID list
[in]elemIE value to be decoded
[in]lenLength of elem in bytes
Returns:
number of bytes parsed; negative on error

References CELL_IDENT_BSS, CELL_IDENT_LAC, gsm0808_cell_id_list::id_discr, gsm0808_cell_id_list::id_list_lac, gsm0808_cell_id_list::id_list_len, and OSMO_ASSERT.

int gsm0808_dec_cell_id_list2 ( struct gsm0808_cell_id_list2 cil,
const uint8_t *  elem,
uint8_t  len 
)

Decode Cell Identifier List IE.

Parameters:
[out]cilCaller-provided memory to store Cell ID list
[in]elemIE value to be decoded
[in]lenLength of elem in bytes
Returns:
number of bytes parsed; negative on error

References CELL_IDENT_BSS, CELL_IDENT_CI, CELL_IDENT_LAC, CELL_IDENT_LAC_AND_CI, CELL_IDENT_LAI_AND_LAC, CELL_IDENT_NO_CELL, CELL_IDENT_WHOLE_GLOBAL, gsm0808_cell_id_list2::id_discr, gsm0808_cell_id_list2::id_list_len, OSMO_ASSERT, parse_cell_id_ci_list(), parse_cell_id_global_list(), parse_cell_id_lac_and_ci_list(), parse_cell_id_lac_list(), and parse_cell_id_lai_and_lac().

Referenced by gsm0808_dec_cell_id().

int gsm0808_dec_channel_type ( struct gsm0808_channel_type ct,
const uint8_t *  elem,
uint8_t  len 
)

Decode TS 08.08 Channel Type IE.

Parameters:
[out]ctCaller-provided memory to store channel type
[in]elemIE Value to be decoded
[in]lenLength of elem in bytes
Returns:
number of bytes parsed; negative on error

See also 3GPP TS 48.008 3.2.2.11 Channel Type

References ARRAY_SIZE, gsm0808_channel_type::ch_indctr, gsm0808_channel_type::ch_rate_type, OSMO_ASSERT, gsm0808_channel_type::perm_spch, and gsm0808_channel_type::perm_spch_len.

int gsm0808_dec_encrypt_info ( struct gsm0808_encrypt_info ei,
const uint8_t *  elem,
uint8_t  len 
)

Decode TS 08.08 Encryption Information IE.

Parameters:
[out]eiCaller-provided memory to store encryption information
[in]elemIE value to be decoded
[in]lenLength of elem in bytes
Returns:
number of bytes parsed; negative on error

References ENCRY_INFO_PERM_ALGO_MAXLEN, gsm0808_encrypt_info::key, gsm0808_encrypt_info::key_len, OSMO_ASSERT, gsm0808_encrypt_info::perm_algo, and gsm0808_encrypt_info::perm_algo_len.

int gsm0808_dec_speech_codec ( struct gsm0808_speech_codec sc,
const uint8_t *  elem,
uint8_t  len 
)

Decode TS 08.08 Speech Codec IE.

Parameters:
[out]scCaller-allocated memory for Speech Codec
[in]elemIE value to be decoded
[in]lenLength of elem in bytes
Returns:
number of bytes parsed; negative on error

References gsm0808_speech_codec::cfg, gsm0808_speech_codec::fi, GSM0808_SCT_CSD, GSM0808_SCT_FR1, GSM0808_SCT_FR2, GSM0808_SCT_FR3, GSM0808_SCT_FR4, GSM0808_SCT_FR5, GSM0808_SCT_HR1, GSM0808_SCT_HR3, GSM0808_SCT_HR4, GSM0808_SCT_HR6, header, OSMO_ASSERT, gsm0808_speech_codec::pi, gsm0808_speech_codec::pt, gsm0808_speech_codec::tf, and gsm0808_speech_codec::type.

Referenced by gsm0808_dec_speech_codec_list().

int gsm0808_dec_speech_codec_list ( struct gsm0808_speech_codec_list scl,
const uint8_t *  elem,
uint8_t  len 
)

Decode TS 08.08 Speech Codec list IE.

Parameters:
[out]sclCaller-provided memory to store codec list
[in]elemIE value to be decoded
[in]lenLength of elem in bytes
Returns:
number of bytes parsed; negative on error

See also 3GPP TS 48.008 3.2.2.103 Speech Codec List

References ARRAY_SIZE, gsm0808_speech_codec_list::codec, gsm0808_dec_speech_codec(), gsm0808_speech_codec_list::len, and OSMO_ASSERT.

uint8_t gsm0808_enc_aoip_trasp_addr ( struct msgb msg,
const struct sockaddr_storage *  ss 
)
uint8_t gsm0808_enc_cell_id ( struct msgb msg,
const struct gsm0808_cell_id ci 
)

Encode Cell Identifier IE (3GPP TS 48.008 3.2.2.17).

Parameters:
[out]msgMessage Buffer to which IE is to be appended
[in]ciCell ID to be encoded
Returns:
number of bytes appended to msg

References gsm0808_enc_cell_id_list2(), GSM0808_IE_CELL_IDENTIFIER, gsm0808_cell_id::id, gsm0808_cell_id::id_discr, gsm0808_cell_id_list2::id_discr, OSMO_ASSERT, and msgb::tail.

uint8_t gsm0808_enc_cell_id_list ( struct msgb msg,
const struct gsm0808_cell_id_list cil 
)

DEPRECATED: Use gsm0808_enc_cell_id_list2 instead.

Encode TS 08.08 Cell Identifier List IE

Parameters:
[out]msgMessage Buffer to which IE is to be appended
[in]cilCell ID List to be encoded
Returns:
number of bytes appended to msg

References CELL_ID_LIST_LAC_MAXLEN, CELL_IDENT_BSS, CELL_IDENT_LAC, GSM0808_IE_CELL_IDENTIFIER_LIST, gsm0808_cell_id_list::id_discr, gsm0808_cell_id_list::id_list_lac, gsm0808_cell_id_list::id_list_len, msgb_put(), msgb_put_u16(), msgb_put_u8(), OSMO_ASSERT, and msgb::tail.

uint8_t gsm0808_enc_channel_type ( struct msgb msg,
const struct gsm0808_channel_type ct 
)

Encode TS 08.08 Channel Type IE.

Parameters:
[out]msgMessage Buffer to which IE is to be appended
[in]ctChannel Type to be encoded
Returns:
number of bytes added to msg

See also 3GPP TS 48.008 3.2.2.11 Channel Type

References gsm0808_channel_type::ch_indctr, gsm0808_channel_type::ch_rate_type, CHANNEL_TYPE_ELEMENT_MAXLEN, GSM0808_CHAN_SIGN, GSM0808_CHAN_SPEECH, GSM0808_IE_CHANNEL_TYPE, msgb_put(), msgb_put_u8(), OSMO_ASSERT, gsm0808_channel_type::perm_spch, gsm0808_channel_type::perm_spch_len, and msgb::tail.

Referenced by gsm0808_create_ass().

uint8_t gsm0808_enc_encrypt_info ( struct msgb msg,
const struct gsm0808_encrypt_info ei 
)

Encode TS 08.08 Encryption Information IE.

Parameters:
[out]msgMessage Buffer to which IE is to be appended
[in]eiEncryption Information to be encoded
Returns:
number of bytes appended to msg

References ARRAY_SIZE, ENCRY_INFO_PERM_ALGO_MAXLEN, GSM0808_IE_ENCRYPTION_INFORMATION, gsm0808_encrypt_info::key, gsm0808_encrypt_info::key_len, msgb_put(), msgb_put_u8(), OSMO_ASSERT, gsm0808_encrypt_info::perm_algo, gsm0808_encrypt_info::perm_algo_len, and msgb::tail.

Referenced by gsm0808_create_cipher().

uint8_t gsm0808_enc_speech_codec ( struct msgb msg,
const struct gsm0808_speech_codec sc 
)

Encode TS 08.08 Speech Codec IE.

Parameters:
[out]msgMessage Buffer to which IE will be appended
[in]scSpeech Codec to be encoded into IE
Returns:
number of bytes appended to msg

See also 3GPP TS 48.008 3.2.2.103 Speech Codec List

References enc_speech_codec(), GSM0808_IE_SPEECH_CODEC, msgb_put(), msgb_put_u8(), OSMO_ASSERT, and msgb::tail.

Referenced by gsm0808_create_ass_compl().

uint8_t gsm0808_enc_speech_codec_list ( struct msgb msg,
const struct gsm0808_speech_codec_list scl 
)

Encode TS 08.08 Speech Codec list.

Parameters:
[out]msgMessage Buffer to which IE is to be appended
[in]sclSpeech Codec List to be encoded into IE
Returns:
number of bytes added to msg

See also 3GPP TS 48.008 3.2.2.103 Speech Codec List

References gsm0808_speech_codec_list::codec, enc_speech_codec(), GSM0808_IE_SPEECH_CODEC_LIST, gsm0808_speech_codec_list::len, msgb_put(), msgb_put_u8(), OSMO_ASSERT, and msgb::tail.

Referenced by gsm0808_create_ass(), gsm0808_create_ass_compl(), gsm0808_create_ass_fail(), and gsm0808_create_layer3_2().

static enum gsm0808_permitted_speech gsm0808_permitted_speech ( enum gsm_chan_t  type,
enum gsm48_chan_mode  mode 
) [inline, static]

Return 3GPP TS 48.008 3.2.2.51 Speech Version aka permitted speech version indication in 3.2.2.11 Channel Type.

References GSM0808_PERM_FR1, GSM0808_PERM_FR2, GSM0808_PERM_HR1, GSM0808_PERM_HR2, GSM0808_PERM_HR3, GSM48_CMODE_SPEECH_AMR, GSM48_CMODE_SPEECH_EFR, GSM48_CMODE_SPEECH_V1, GSM_LCHAN_TCH_F, and GSM_LCHAN_TCH_H.

void gsm0808_prepend_dtap_header ( struct msgb msg,
uint8_t  link_id 
)

Prepend a DTAP header to given Message Buffer.

Parameters:
[in]msgbMessage Buffer
[in]link_idLink Identifier

References BSSAP_MSG_DTAP, msgb::len, link_id, and msgb_push().

int gsm0808_speech_codec_from_chan_type ( struct gsm0808_speech_codec sc,
uint8_t  perm_spch 
)

Extrapolate a speech codec field from a given permitted speech parameter (channel type).

Parameters:
[out]scCaller provided memory to store the resulting speech codec
[in]perm_spchvalue that is used to derive the speech codec info (see also: enum gsm0808_speech_codec_type in gsm0808_utils.h)
Returns:
zero when successful; negative on error

References gsm0808_speech_codec::cfg, gsm0808_speech_codec::fi, gsm0808_chan_type_to_speech_codec(), GSM0808_SC_CFG_DEFAULT_FR_AMR, GSM0808_SC_CFG_DEFAULT_FR_AMR_WB, GSM0808_SC_CFG_DEFAULT_HR_AMR, GSM0808_SC_CFG_DEFAULT_OFR_AMR_WB, GSM0808_SC_CFG_DEFAULT_OHR_AMR, GSM0808_SC_CFG_DEFAULT_OHR_AMR_WB, GSM0808_SCT_FR3, GSM0808_SCT_FR4, GSM0808_SCT_FR5, GSM0808_SCT_HR3, GSM0808_SCT_HR4, GSM0808_SCT_HR6, and gsm0808_speech_codec::type.


Variable Documentation

struct tlv_definition bss_att_tlvdef [static]

Referenced by gsm0808_att_tlvdef().

struct value_string gsm0808_bssap_names[] [static]
Initial value:
 {
        { BSSAP_MSG_BSS_MANAGEMENT,             "MANAGEMENT" },
        { BSSAP_MSG_DTAP,                       "DTAP" },
        { 0, NULL }
}
struct value_string gsm0808_cause_names[] [static]
struct value_string gsm0808_msgt_names[] [static]
Initial value:
 {
        { GSM0808_SCT_FR1, "FR1" },
        { GSM0808_SCT_FR2, "FR2" },
        { GSM0808_SCT_FR3, "FR3" },
        { GSM0808_SCT_FR4, "FR4" },
        { GSM0808_SCT_FR5, "FR5" },
        { GSM0808_SCT_HR1, "HR1" },
        { GSM0808_SCT_HR3, "HR3" },
        { GSM0808_SCT_HR4, "HR4" },
        { GSM0808_SCT_HR6, "HR6" },
        { GSM0808_SCT_CSD, "CSD" },
        { 0, NULL }
}

Referenced by gsm0808_speech_codec_type_name().

void to not lose leading zeros in the MNC
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines