blob: ab5f4938c15c6a559a183ae6c41f5f0c9ea1c69a [file] [log] [blame]
Neels Hofmeyr17518fe2017-06-20 04:35:06 +02001/*! \file apn.h */
2
Harald Welte908085c2014-10-01 16:18:11 +08003#pragma once
4
5#include <stdint.h>
6
7/* 23.003 Section 9.1.1, excluding any terminating zero byte */
8#define APN_NI_MAXLEN 63
9
10/* 23.003 Section 9.1, excluding any terminating zero byte */
11#define APN_MAXLEN 100
12
13char *osmo_apn_qualify(unsigned int mcc, unsigned int mnc, const char *ni);
Harald Welte4a62eda2019-03-18 18:27:00 +010014char *osmo_apn_qualify_buf(char *buf, size_t buf_len, unsigned int mcc, unsigned int mnc, const char *ni);
Harald Welte179f3572019-03-18 18:38:47 +010015char *osmo_apn_qualify_c(const void *ctx, unsigned int mcc, unsigned int mnc, const char *ni);
Neels Hofmeyr9e57a5a2015-12-21 11:20:14 +010016
17/* Compose a string of the form '<ni>.mnc001.mcc002.gprs\0', returned in a
18 * static buffer. */
Harald Welte908085c2014-10-01 16:18:11 +080019char *osmo_apn_qualify_from_imsi(const char *imsi,
20 const char *ni, int have_3dig_mnc);
Harald Welte4a62eda2019-03-18 18:27:00 +010021char *osmo_apn_qualify_from_imsi_buf(char *buf, size_t buf_len, const char *imsi,
22 const char *ni, int have_3dig_mnc);
Harald Welte179f3572019-03-18 18:38:47 +010023char *osmo_apn_qualify_from_imsi_c(const void *ctx, const char *imsi, const char *ni, int have_3dig_mnc);
Jacob Erlbeck81142942015-11-17 08:42:05 +010024
25int osmo_apn_from_str(uint8_t *apn_enc, size_t max_apn_enc_len, const char *str);
Philipp Maier8a942d22018-12-07 11:00:59 +010026char *osmo_apn_to_str(char *out_str, const uint8_t *apn_enc, size_t apn_enc_len);