libosmogsm  0.9.6.20171026
Osmocom GSM library
apn.c File Reference
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <osmocom/gsm/apn.h>

Macros

#define APN_OI_GPRS_FMT   "mnc%03u.mcc%03u.gprs"
 
#define APN_GPRS_FMT   "%s.mnc%03u.mcc%03u.gprs"
 

Functions

char * osmo_apn_qualify (unsigned int mcc, unsigned int mnc, const char *ni)
 
char * osmo_apn_qualify_from_imsi (const char *imsi, const char *ni, int have_3dig_mnc)
 
char * osmo_apn_to_str (char *out_str, const uint8_t *apn_enc, size_t apn_enc_len)
 Convert an encoded APN into a dot-separated string. More...
 
int osmo_apn_from_str (uint8_t *apn_enc, size_t max_apn_enc_len, const char *str)
 Convert a dot-separated string into an encoded APN. More...
 

Variables

static char apn_strbuf [APN_MAXLEN+1]
 

Macro Definition Documentation

#define APN_GPRS_FMT   "%s.mnc%03u.mcc%03u.gprs"

Referenced by osmo_apn_qualify().

#define APN_OI_GPRS_FMT   "mnc%03u.mcc%03u.gprs"

Function Documentation

int osmo_apn_from_str ( uint8_t *  apn_enc,
size_t  max_apn_enc_len,
const char *  str 
)

Convert a dot-separated string into an encoded APN.

Parameters
apn_encthe encoded APN
max_apn_enc_lenthe size of the apn_enc buffer
strthe source string
Returns
out_str on success and NULL otherwise

References len.

char* osmo_apn_qualify ( unsigned int  mcc,
unsigned int  mnc,
const char *  ni 
)

References APN_GPRS_FMT, and apn_strbuf.

Referenced by osmo_apn_qualify_from_imsi().

char* osmo_apn_qualify_from_imsi ( const char *  imsi,
const char *  ni,
int  have_3dig_mnc 
)

References osmo_apn_qualify().

char* osmo_apn_to_str ( char *  out_str,
const uint8_t *  apn_enc,
size_t  apn_enc_len 
)

Convert an encoded APN into a dot-separated string.

Parameters
out_strthe destination buffer (size must be >= max(app_enc_len,1))
apn_encthe encoded APN
apn_enc_lenthe length of the encoded APN
Returns
out_str on success and NULL otherwise

Variable Documentation

char apn_strbuf[APN_MAXLEN+1]
static

Referenced by osmo_apn_qualify().