libosmogsm  0.11.0-dirty
Osmocom GSM library
include/osmocom/gsm/gsm23003.h File Reference
#include <stdint.h>
#include <stdbool.h>

Go to the source code of this file.

Data Structures

struct  osmo_plmn_id
struct  osmo_location_area_id
struct  osmo_routing_area_id
struct  osmo_cell_global_id
struct  osmo_lac_and_ci_id
struct  osmo_service_area_id
struct  osmo_shared_network_area_id
struct  osmo_gsn_address
struct  osmo_tracking_area_id
struct  osmo_eutran_cell_global_id
struct  osmo_mme_id
struct  osmo_gummei
struct  osmo_guti

Enumerations

enum  osmo_gsn_addr_type {
  GSN_ADDR_TYPE_IPV4 = 0,
  GSN_ADDR_TYPE_IPV6 = 1
}

Functions

bool osmo_imsi_str_valid (const char *imsi)
 Determine whether the given IMSI is valid according to 3GPP TS 23.003.
bool osmo_msisdn_str_valid (const char *msisdn)
 Determine whether the given MSISDN is valid according to 3GPP TS 23.003.
const char * osmo_mcc_name (uint16_t mcc)
 Return MCC string as standardized 3-digit with leading zeros.
const char * osmo_mnc_name (uint16_t mnc, bool mnc_3_digits)
 Return MNC string as standardized 2- or 3-digit with leading zeros.
const char * osmo_plmn_name (const struct osmo_plmn_id *plmn)
 Return MCC-MNC string as standardized 3-digit-dash-2/3-digit with leading zeros.
const char * osmo_plmn_name2 (const struct osmo_plmn_id *plmn)
 Same as osmo_mcc_mnc_name(), but returning in a different static buffer.
const char * osmo_lai_name (const struct osmo_location_area_id *lai)
 Return MCC-MNC-LAC as string, in a static buffer.
const char * osmo_cgi_name (const struct osmo_cell_global_id *cgi)
 Return MCC-MNC-LAC-CI as string, in a static buffer.
const char * osmo_cgi_name2 (const struct osmo_cell_global_id *cgi)
 Same as osmo_cgi_name(), but uses a different static buffer.
void osmo_plmn_to_bcd (uint8_t *bcd_dst, const struct osmo_plmn_id *plmn)
void osmo_plmn_from_bcd (const uint8_t *bcd_src, struct osmo_plmn_id *plmn)
int osmo_mnc_from_str (const char *mnc_str, uint16_t *mnc, bool *mnc_3_digits)
static int osmo_mcc_from_str (const char *mcc_str, uint16_t *mcc)
int osmo_mnc_cmp (uint16_t a_mnc, bool a_mnc_3_digits, uint16_t b_mnc, bool b_mnc_3_digits)
int osmo_plmn_cmp (const struct osmo_plmn_id *a, const struct osmo_plmn_id *b)

Detailed Description


Enumeration Type Documentation

Enumerator:
GSN_ADDR_TYPE_IPV4 
GSN_ADDR_TYPE_IPV6 

Function Documentation

const char* osmo_cgi_name ( const struct osmo_cell_global_id cgi)

Return MCC-MNC-LAC-CI as string, in a static buffer.

Parameters:
[in]cgiCGI to encode.
Returns:
Static string buffer.

References _cgi_name().

Referenced by gsm0808_cell_id_u_name().

const char* osmo_cgi_name2 ( const struct osmo_cell_global_id cgi)

Same as osmo_cgi_name(), but uses a different static buffer.

Useful for printing two distinct CGIs in the same printf format.

Parameters:
[in]cgiCGI to encode.
Returns:
Static string buffer.

References _cgi_name().

bool osmo_imsi_str_valid ( const char *  imsi)

Determine whether the given IMSI is valid according to 3GPP TS 23.003.

Parameters:
imsiIMSI digits in ASCII string representation.
Returns:
true when the IMSI is valid, false for invalid characters or number of digits.

References GSM23003_IMSI_MAX_DIGITS, GSM23003_IMSI_MIN_DIGITS, and is_n_digits().

const char* osmo_lai_name ( const struct osmo_location_area_id lai)

Return MCC-MNC-LAC as string, in a static buffer.

Parameters:
[in]laiLAI to encode, the rac member is ignored.
Returns:
Static string buffer.

References osmo_location_area_id::lac, osmo_plmn_name(), and osmo_location_area_id::plmn.

Referenced by _cgi_name(), and gsm0808_cell_id_u_name().

static int osmo_mcc_from_str ( const char *  mcc_str,
uint16_t *  mcc 
) [inline, static]

References osmo_mnc_from_str().

const char* osmo_mcc_name ( uint16_t  mcc)

Return MCC string as standardized 3-digit with leading zeros.

Parameters:
[in]mccMCC value.
Returns:
string in static buffer.

Referenced by osmo_rai_name(), and plmn_name().

int osmo_mnc_cmp ( uint16_t  a_mnc,
bool  a_mnc_3_digits,
uint16_t  b_mnc,
bool  b_mnc_3_digits 
)

Referenced by osmo_plmn_cmp().

int osmo_mnc_from_str ( const char *  mnc_str,
uint16_t *  mnc,
bool *  mnc_3_digits 
)

Referenced by osmo_mcc_from_str().

const char* osmo_mnc_name ( uint16_t  mnc,
bool  mnc_3_digits 
)

Return MNC string as standardized 2- or 3-digit with leading zeros.

Parameters:
[in]mncMNC value.
[in]mnc_3_digitsTrue if an MNC should fill three digits, only has an effect if MNC < 100.
Returns:
string in static buffer.

Referenced by osmo_rai_name(), and plmn_name().

bool osmo_msisdn_str_valid ( const char *  msisdn)

Determine whether the given MSISDN is valid according to 3GPP TS 23.003.

Parameters:
msisdnMSISDN digits in ASCII string representation.
Returns:
true when the MSISDN is valid, false for invalid characters or number of digits.

References is_n_digits().

int osmo_plmn_cmp ( const struct osmo_plmn_id a,
const struct osmo_plmn_id b 
)
void osmo_plmn_from_bcd ( const uint8_t *  bcd_src,
struct osmo_plmn_id plmn 
)
const char* osmo_plmn_name ( const struct osmo_plmn_id plmn)

Return MCC-MNC string as standardized 3-digit-dash-2/3-digit with leading zeros.

Parameters:
[in]plmnMCC-MNC value.
Returns:
string in static buffer.

References plmn_name().

Referenced by osmo_lai_name().

const char* osmo_plmn_name2 ( const struct osmo_plmn_id plmn)

Same as osmo_mcc_mnc_name(), but returning in a different static buffer.

Parameters:
[in]plmnMCC-MNC value.
Returns:
string in static buffer.

References plmn_name().

void osmo_plmn_to_bcd ( uint8_t *  bcd_dst,
const struct osmo_plmn_id plmn 
)
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines