libosmogsm 1.13.1.1-afb4 Osmocom GSM library

Macros | Functions | Variables
apn.c File Reference

(C) 2014 by Harald Welte lafor.nosp@m.ge@g.nosp@m.numon.nosp@m.ks.o.nosp@m.rg (C) 2015,2017 by sysmocom - s.f.m.c. More...

`#include <stdio.h>`
`#include <stdint.h>`
`#include <stdlib.h>`
`#include <string.h>`
`#include <osmocom/core/talloc.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_buf (char *buf, size_t buf_len, unsigned int mcc, unsigned int mnc, const char *ni)
char * | osmo_apn_qualify (unsigned int mcc, unsigned int mnc, const char *ni)
char * | osmo_apn_qualify_c (const void *ctx, unsigned int mcc, unsigned int mnc, const char *ni)
char * | osmo_apn_qualify_from_imsi_buf (char *buf, size_t buf_len, const char *imsi, const char *ni, int have_3dig_mnc)
char * | osmo_apn_qualify_from_imsi (const char *imsi, const char *ni, int have_3dig_mnc)
char * | osmo_apn_qualify_from_imsi_c (const void *ctx, 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 __thread char | apn_strbuf [APN_MAXLEN+1]

## Detailed Description

(C) 2014 by Harald Welte lafor.nosp@m.ge@g.nosp@m.numon.nosp@m.ks.o.nosp@m.rg (C) 2015,2017 by sysmocom - s.f.m.c.

GmbH All Rights Reserved.

SPDX-License-Identifier: GPL-2.0+

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, see http://www.gnu.org/licenses/.

## Macro Definition Documentation

## ◆ APN_GPRS_FMT

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

## ◆ APN_OI_GPRS_FMT

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

## Function Documentation

## ◆ osmo_apn_from_str()

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_enc | the encoded APN
  max_apn_enc_len | the size of the apn_enc buffer
  str | the source string

Returns
  out_str on success and NULL otherwise

References len.

Referenced by msgb_sgsap_name_put().

## ◆ osmo_apn_qualify()

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

References apn_strbuf, and osmo_apn_qualify_buf().

## ◆ osmo_apn_qualify_buf()

char * osmo_apn_qualify_buf | ( | char * | buf,
|  | size_t | buf_len,
|  | unsigned int | mcc,
|  | unsigned int | mnc,
|  | const char * | ni
| ) |  |

References APN_GPRS_FMT.

Referenced by osmo_apn_qualify(), osmo_apn_qualify_c(), and osmo_apn_qualify_from_imsi_buf().

## ◆ osmo_apn_qualify_c()

char * osmo_apn_qualify_c | ( | const void * | ctx,
|  | unsigned int | mcc,
|  | unsigned int | mnc,
|  | const char * | ni
| ) |  |

References APN_MAXLEN, and osmo_apn_qualify_buf().

## ◆ osmo_apn_qualify_from_imsi()

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

References apn_strbuf, and osmo_apn_qualify_from_imsi_buf().

## ◆ osmo_apn_qualify_from_imsi_buf()

char * osmo_apn_qualify_from_imsi_buf | ( | char * | buf,
|  | size_t | buf_len,
|  | const char * | imsi,
|  | const char * | ni,
|  | int | have_3dig_mnc
| ) |  |

References osmo_apn_qualify_buf().

Referenced by osmo_apn_qualify_from_imsi(), and osmo_apn_qualify_from_imsi_c().

## ◆ osmo_apn_qualify_from_imsi_c()

char * osmo_apn_qualify_from_imsi_c | ( | const void * | ctx,
|  | const char * | imsi,
|  | const char * | ni,
|  | int | have_3dig_mnc
| ) |  |

References APN_MAXLEN, and osmo_apn_qualify_from_imsi_buf().

## ◆ osmo_apn_to_str()

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_str | the destination buffer (size must be >= max(app_enc_len,1))
  apn_enc | the encoded APN
  apn_enc_len | the length of the encoded APN

Returns
  out_str on success and NULL otherwise

## Variable Documentation

## ◆ apn_strbuf

__thread char apn_strbuf[APN_MAXLEN+1]
| static

Referenced by osmo_apn_qualify(), and osmo_apn_qualify_from_imsi().