aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2017-07-06 18:39:28 +0200
committerHarald Welte <laforge@gnumonks.org>2017-08-29 12:51:19 +0000
commitbac227653a372d8cbd611eefe59ca40ab96dedab (patch)
tree8713a770780b3ba9a4d791b993c7ecc9d2454d97 /include
parent4585317f1b55789e0a1edeb18b1a977e00ce30d5 (diff)
split off osmo-msc: remove files, apply build, rename
Diffstat (limited to 'include')
-rw-r--r--include/Makefile.am5
-rw-r--r--include/compat_af_isdn.h39
-rw-r--r--include/mISDNif.h387
-rw-r--r--include/openbsc/Makefile.am24
-rw-r--r--include/openbsc/bsc_nat.h462
-rw-r--r--include/openbsc/bsc_nat_callstats.h55
-rw-r--r--include/openbsc/bsc_nat_sccp.h105
-rw-r--r--include/openbsc/bsc_subscriber.h43
-rw-r--r--include/openbsc/gb_proxy.h288
-rw-r--r--include/openbsc/gprs_gb_parse.h59
-rw-r--r--include/openbsc/gprs_gmm.h35
-rw-r--r--include/openbsc/gprs_llc.h284
-rw-r--r--include/openbsc/gprs_llc_xid.h57
-rw-r--r--include/openbsc/gprs_sgsn.h478
-rw-r--r--include/openbsc/gprs_sndcp.h79
-rw-r--r--include/openbsc/gprs_sndcp_comp.h82
-rw-r--r--include/openbsc/gprs_sndcp_dcomp.h53
-rw-r--r--include/openbsc/gprs_sndcp_pcomp.h46
-rw-r--r--include/openbsc/gprs_sndcp_xid.h218
-rw-r--r--include/openbsc/gprs_subscriber.h31
-rw-r--r--include/openbsc/gprs_utils.h44
-rw-r--r--include/openbsc/nat_rewrite_trie.h47
-rw-r--r--include/openbsc/paging.h1
-rw-r--r--include/openbsc/pcu_if.h35
-rw-r--r--include/openbsc/pcuif_proto.h176
-rw-r--r--include/openbsc/sgsn.h191
-rw-r--r--include/openbsc/v42bis.h147
-rw-r--r--include/openbsc/v42bis_private.h126
28 files changed, 0 insertions, 3597 deletions
diff --git a/include/Makefile.am b/include/Makefile.am
index 3234e6265..677eec3aa 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -1,8 +1,3 @@
SUBDIRS = \
openbsc \
$(NULL)
-
-noinst_HEADERS = \
- mISDNif.h \
- compat_af_isdn.h \
- $(NULL)
diff --git a/include/compat_af_isdn.h b/include/compat_af_isdn.h
deleted file mode 100644
index 56cbfb3f2..000000000
--- a/include/compat_af_isdn.h
+++ /dev/null
@@ -1,39 +0,0 @@
-#ifdef MISDN_OLD_AF_COMPATIBILITY
-#undef AF_ISDN
-#undef PF_ISDN
-
-extern int AF_ISDN;
-#define PF_ISDN AF_ISDN
-
-int AF_ISDN;
-
-#endif
-
-extern void init_af_isdn(void);
-
-#ifdef AF_COMPATIBILITY_FUNC
-#ifdef MISDN_OLD_AF_COMPATIBILITY
-void init_af_isdn(void)
-{
- int s;
-
- /* test for new value */
- AF_ISDN = 34;
- s = socket(AF_ISDN, SOCK_RAW, ISDN_P_BASE);
- if (s >= 0) {
- close(s);
- return;
- }
- AF_ISDN = 27;
- s = socket(AF_ISDN, SOCK_RAW, ISDN_P_BASE);
- if (s >= 0) {
- close(s);
- return;
- }
-}
-#else
-void init_af_isdn(void)
-{
-}
-#endif
-#endif
diff --git a/include/mISDNif.h b/include/mISDNif.h
deleted file mode 100644
index 8e065d24b..000000000
--- a/include/mISDNif.h
+++ /dev/null
@@ -1,387 +0,0 @@
-/*
- *
- * Author Karsten Keil <kkeil@novell.com>
- *
- * Copyright 2008 by Karsten Keil <kkeil@novell.com>
- *
- * This code is free software; you can redistribute it and/or modify
- * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE
- * version 2.1 as published by the Free Software Foundation.
- *
- * This code 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 LESSER GENERAL PUBLIC LICENSE for more details.
- *
- */
-
-#ifndef mISDNIF_H
-#define mISDNIF_H
-
-#include <stdarg.h>
-#ifdef linux
-#include <linux/types.h>
-#include <linux/errno.h>
-#include <linux/socket.h>
-#else
-#include <sys/types.h>
-#include <sys/errno.h>
-#include <sys/socket.h>
-#endif
-
-/*
- * ABI Version 32 bit
- *
- * <8 bit> Major version
- * - changed if any interface become backwards incompatible
- *
- * <8 bit> Minor version
- * - changed if any interface is extended but backwards compatible
- *
- * <16 bit> Release number
- * - should be incremented on every checkin
- */
-#define MISDN_MAJOR_VERSION 1
-#define MISDN_MINOR_VERSION 1
-#define MISDN_RELEASE 20
-
-/* primitives for information exchange
- * generell format
- * <16 bit 0 >
- * <8 bit command>
- * BIT 8 = 1 LAYER private
- * BIT 7 = 1 answer
- * BIT 6 = 1 DATA
- * <8 bit target layer mask>
- *
- * Layer = 00 is reserved for general commands
- Layer = 01 L2 -> HW
- Layer = 02 HW -> L2
- Layer = 04 L3 -> L2
- Layer = 08 L2 -> L3
- * Layer = FF is reserved for broadcast commands
- */
-
-#define MISDN_CMDMASK 0xff00
-#define MISDN_LAYERMASK 0x00ff
-
-/* generell commands */
-#define OPEN_CHANNEL 0x0100
-#define CLOSE_CHANNEL 0x0200
-#define CONTROL_CHANNEL 0x0300
-#define CHECK_DATA 0x0400
-
-/* layer 2 -> layer 1 */
-#define PH_ACTIVATE_REQ 0x0101
-#define PH_DEACTIVATE_REQ 0x0201
-#define PH_DATA_REQ 0x2001
-#define MPH_ACTIVATE_REQ 0x0501
-#define MPH_DEACTIVATE_REQ 0x0601
-#define MPH_INFORMATION_REQ 0x0701
-#define PH_CONTROL_REQ 0x0801
-
-/* layer 1 -> layer 2 */
-#define PH_ACTIVATE_IND 0x0102
-#define PH_ACTIVATE_CNF 0x4102
-#define PH_DEACTIVATE_IND 0x0202
-#define PH_DEACTIVATE_CNF 0x4202
-#define PH_DATA_IND 0x2002
-#define PH_DATA_E_IND 0x3002
-#define MPH_ACTIVATE_IND 0x0502
-#define MPH_DEACTIVATE_IND 0x0602
-#define MPH_INFORMATION_IND 0x0702
-#define PH_DATA_CNF 0x6002
-#define PH_CONTROL_IND 0x0802
-#define PH_CONTROL_CNF 0x4802
-
-/* layer 3 -> layer 2 */
-#define DL_ESTABLISH_REQ 0x1004
-#define DL_RELEASE_REQ 0x1104
-#define DL_DATA_REQ 0x3004
-#define DL_UNITDATA_REQ 0x3104
-#define DL_INFORMATION_REQ 0x0004
-
-/* layer 2 -> layer 3 */
-#define DL_ESTABLISH_IND 0x1008
-#define DL_ESTABLISH_CNF 0x5008
-#define DL_RELEASE_IND 0x1108
-#define DL_RELEASE_CNF 0x5108
-#define DL_DATA_IND 0x3008
-#define DL_UNITDATA_IND 0x3108
-#define DL_INFORMATION_IND 0x0008
-
-/* intern layer 2 managment */
-#define MDL_ASSIGN_REQ 0x1804
-#define MDL_ASSIGN_IND 0x1904
-#define MDL_REMOVE_REQ 0x1A04
-#define MDL_REMOVE_IND 0x1B04
-#define MDL_STATUS_UP_IND 0x1C04
-#define MDL_STATUS_DOWN_IND 0x1D04
-#define MDL_STATUS_UI_IND 0x1E04
-#define MDL_ERROR_IND 0x1F04
-#define MDL_ERROR_RSP 0x5F04
-
-/* DL_INFORMATION_IND types */
-#define DL_INFO_L2_CONNECT 0x0001
-#define DL_INFO_L2_REMOVED 0x0002
-
-/* PH_CONTROL types */
-/* TOUCH TONE IS 0x20XX XX "0"..."9", "A","B","C","D","*","#" */
-#define DTMF_TONE_VAL 0x2000
-#define DTMF_TONE_MASK 0x007F
-#define DTMF_TONE_START 0x2100
-#define DTMF_TONE_STOP 0x2200
-#define DTMF_HFC_COEF 0x4000
-#define DSP_CONF_JOIN 0x2403
-#define DSP_CONF_SPLIT 0x2404
-#define DSP_RECEIVE_OFF 0x2405
-#define DSP_RECEIVE_ON 0x2406
-#define DSP_ECHO_ON 0x2407
-#define DSP_ECHO_OFF 0x2408
-#define DSP_MIX_ON 0x2409
-#define DSP_MIX_OFF 0x240a
-#define DSP_DELAY 0x240b
-#define DSP_JITTER 0x240c
-#define DSP_TXDATA_ON 0x240d
-#define DSP_TXDATA_OFF 0x240e
-#define DSP_TX_DEJITTER 0x240f
-#define DSP_TX_DEJ_OFF 0x2410
-#define DSP_TONE_PATT_ON 0x2411
-#define DSP_TONE_PATT_OFF 0x2412
-#define DSP_VOL_CHANGE_TX 0x2413
-#define DSP_VOL_CHANGE_RX 0x2414
-#define DSP_BF_ENABLE_KEY 0x2415
-#define DSP_BF_DISABLE 0x2416
-#define DSP_BF_ACCEPT 0x2416
-#define DSP_BF_REJECT 0x2417
-#define DSP_PIPELINE_CFG 0x2418
-#define HFC_VOL_CHANGE_TX 0x2601
-#define HFC_VOL_CHANGE_RX 0x2602
-#define HFC_SPL_LOOP_ON 0x2603
-#define HFC_SPL_LOOP_OFF 0x2604
-
-/* DSP_TONE_PATT_ON parameter */
-#define TONE_OFF 0x0000
-#define TONE_GERMAN_DIALTONE 0x0001
-#define TONE_GERMAN_OLDDIALTONE 0x0002
-#define TONE_AMERICAN_DIALTONE 0x0003
-#define TONE_GERMAN_DIALPBX 0x0004
-#define TONE_GERMAN_OLDDIALPBX 0x0005
-#define TONE_AMERICAN_DIALPBX 0x0006
-#define TONE_GERMAN_RINGING 0x0007
-#define TONE_GERMAN_OLDRINGING 0x0008
-#define TONE_AMERICAN_RINGPBX 0x000b
-#define TONE_GERMAN_RINGPBX 0x000c
-#define TONE_GERMAN_OLDRINGPBX 0x000d
-#define TONE_AMERICAN_RINGING 0x000e
-#define TONE_GERMAN_BUSY 0x000f
-#define TONE_GERMAN_OLDBUSY 0x0010
-#define TONE_AMERICAN_BUSY 0x0011
-#define TONE_GERMAN_HANGUP 0x0012
-#define TONE_GERMAN_OLDHANGUP 0x0013
-#define TONE_AMERICAN_HANGUP 0x0014
-#define TONE_SPECIAL_INFO 0x0015
-#define TONE_GERMAN_GASSENBESETZT 0x0016
-#define TONE_GERMAN_AUFSCHALTTON 0x0016
-
-/* MPH_INFORMATION_IND */
-#define L1_SIGNAL_LOS_OFF 0x0010
-#define L1_SIGNAL_LOS_ON 0x0011
-#define L1_SIGNAL_AIS_OFF 0x0012
-#define L1_SIGNAL_AIS_ON 0x0013
-#define L1_SIGNAL_RDI_OFF 0x0014
-#define L1_SIGNAL_RDI_ON 0x0015
-#define L1_SIGNAL_SLIP_RX 0x0020
-#define L1_SIGNAL_SLIP_TX 0x0021
-
-/*
- * protocol ids
- * D channel 1-31
- * B channel 33 - 63
- */
-
-#define ISDN_P_NONE 0
-#define ISDN_P_BASE 0
-#define ISDN_P_TE_S0 0x01
-#define ISDN_P_NT_S0 0x02
-#define ISDN_P_TE_E1 0x03
-#define ISDN_P_NT_E1 0x04
-#define ISDN_P_TE_UP0 0x05
-#define ISDN_P_NT_UP0 0x06
-
-#define IS_ISDN_P_TE(p) ((p == ISDN_P_TE_S0) || (p == ISDN_P_TE_E1) || \
- (p == ISDN_P_TE_UP0) || (p == ISDN_P_LAPD_TE))
-#define IS_ISDN_P_NT(p) ((p == ISDN_P_NT_S0) || (p == ISDN_P_NT_E1) || \
- (p == ISDN_P_NT_UP0) || (p == ISDN_P_LAPD_NT))
-#define IS_ISDN_P_S0(p) ((p == ISDN_P_TE_S0) || (p == ISDN_P_NT_S0))
-#define IS_ISDN_P_E1(p) ((p == ISDN_P_TE_E1) || (p == ISDN_P_NT_E1))
-#define IS_ISDN_P_UP0(p) ((p == ISDN_P_TE_UP0) || (p == ISDN_P_NT_UP0))
-
-
-#define ISDN_P_LAPD_TE 0x10
-#define ISDN_P_LAPD_NT 0x11
-
-#define ISDN_P_B_MASK 0x1f
-#define ISDN_P_B_START 0x20
-
-#define ISDN_P_B_RAW 0x21
-#define ISDN_P_B_HDLC 0x22
-#define ISDN_P_B_X75SLP 0x23
-#define ISDN_P_B_L2DTMF 0x24
-#define ISDN_P_B_L2DSP 0x25
-#define ISDN_P_B_L2DSPHDLC 0x26
-
-#define OPTION_L2_PMX 1
-#define OPTION_L2_PTP 2
-#define OPTION_L2_FIXEDTEI 3
-#define OPTION_L2_CLEANUP 4
-
-/* should be in sync with linux/kobject.h:KOBJ_NAME_LEN */
-#define MISDN_MAX_IDLEN 20
-
-struct mISDNhead {
- unsigned int prim;
- unsigned int id;
-} __attribute__((packed));
-
-#define MISDN_HEADER_LEN sizeof(struct mISDNhead)
-#define MAX_DATA_SIZE 2048
-#define MAX_DATA_MEM (MAX_DATA_SIZE + MISDN_HEADER_LEN)
-#define MAX_DFRAME_LEN 260
-
-#define MISDN_ID_ADDR_MASK 0xFFFF
-#define MISDN_ID_TEI_MASK 0xFF00
-#define MISDN_ID_SAPI_MASK 0x00FF
-#define MISDN_ID_TEI_ANY 0x7F00
-
-#define MISDN_ID_ANY 0xFFFF
-#define MISDN_ID_NONE 0xFFFE
-
-#define GROUP_TEI 127
-#define TEI_SAPI 63
-#define CTRL_SAPI 0
-
-#define MISDN_MAX_CHANNEL 127
-#define MISDN_CHMAP_SIZE ((MISDN_MAX_CHANNEL + 1) >> 3)
-
-#define SOL_MISDN 0
-
-struct sockaddr_mISDN {
- sa_family_t family;
- unsigned char dev;
- unsigned char channel;
- unsigned char sapi;
- unsigned char tei;
-};
-
-struct mISDNversion {
- unsigned char major;
- unsigned char minor;
- unsigned short release;
-};
-
-#define MAX_DEVICE_ID 63
-
-struct mISDN_devinfo {
- u_int id;
- u_int Dprotocols;
- u_int Bprotocols;
- u_int protocol;
- u_char channelmap[MISDN_CHMAP_SIZE];
- u_int nrbchan;
- char name[MISDN_MAX_IDLEN];
-};
-
-struct mISDN_devrename {
- u_int id;
- char name[MISDN_MAX_IDLEN];
-};
-
-struct ph_info_ch {
- int32_t protocol;
- int64_t Flags;
-};
-
-struct ph_info_dch {
- struct ph_info_ch ch;
- int16_t state;
- int16_t num_bch;
-};
-
-struct ph_info {
- struct ph_info_dch dch;
- struct ph_info_ch bch[];
-};
-
-/* timer device ioctl */
-#define IMADDTIMER _IOR('I', 64, int)
-#define IMDELTIMER _IOR('I', 65, int)
-/* socket ioctls */
-#define IMGETVERSION _IOR('I', 66, int)
-#define IMGETCOUNT _IOR('I', 67, int)
-#define IMGETDEVINFO _IOR('I', 68, int)
-#define IMCTRLREQ _IOR('I', 69, int)
-#define IMCLEAR_L2 _IOR('I', 70, int)
-#define IMSETDEVNAME _IOR('I', 71, struct mISDN_devrename)
-
-static inline int
-test_channelmap(u_int nr, u_char *map)
-{
- if (nr <= MISDN_MAX_CHANNEL)
- return map[nr >> 3] & (1 << (nr & 7));
- else
- return 0;
-}
-
-static inline void
-set_channelmap(u_int nr, u_char *map)
-{
- map[nr >> 3] |= (1 << (nr & 7));
-}
-
-static inline void
-clear_channelmap(u_int nr, u_char *map)
-{
- map[nr >> 3] &= ~(1 << (nr & 7));
-}
-
-/* CONTROL_CHANNEL parameters */
-#define MISDN_CTRL_GETOP 0x0000
-#define MISDN_CTRL_LOOP 0x0001
-#define MISDN_CTRL_CONNECT 0x0002
-#define MISDN_CTRL_DISCONNECT 0x0004
-#define MISDN_CTRL_PCMCONNECT 0x0010
-#define MISDN_CTRL_PCMDISCONNECT 0x0020
-#define MISDN_CTRL_SETPEER 0x0040
-#define MISDN_CTRL_UNSETPEER 0x0080
-#define MISDN_CTRL_RX_OFF 0x0100
-#define MISDN_CTRL_FILL_EMPTY 0x0200
-#define MISDN_CTRL_GETPEER 0x0400
-#define MISDN_CTRL_HW_FEATURES_OP 0x2000
-#define MISDN_CTRL_HW_FEATURES 0x2001
-#define MISDN_CTRL_HFC_OP 0x4000
-#define MISDN_CTRL_HFC_PCM_CONN 0x4001
-#define MISDN_CTRL_HFC_PCM_DISC 0x4002
-#define MISDN_CTRL_HFC_CONF_JOIN 0x4003
-#define MISDN_CTRL_HFC_CONF_SPLIT 0x4004
-#define MISDN_CTRL_HFC_RECEIVE_OFF 0x4005
-#define MISDN_CTRL_HFC_RECEIVE_ON 0x4006
-#define MISDN_CTRL_HFC_ECHOCAN_ON 0x4007
-#define MISDN_CTRL_HFC_ECHOCAN_OFF 0x4008
-
-
-/* socket options */
-#define MISDN_TIME_STAMP 0x0001
-
-struct mISDN_ctrl_req {
- int op;
- int channel;
- int p1;
- int p2;
-};
-
-/* muxer options */
-#define MISDN_OPT_ALL 1
-#define MISDN_OPT_TEIMGR 2
-
-#endif /* mISDNIF_H */
diff --git a/include/openbsc/Makefile.am b/include/openbsc/Makefile.am
index c1cb6a3fb..6e7aa384b 100644
--- a/include/openbsc/Makefile.am
+++ b/include/openbsc/Makefile.am
@@ -8,11 +8,7 @@ noinst_HEADERS = \
auth.h \
bsc_msc.h \
bsc_msg_filter.h \
- bsc_nat.h \
- bsc_nat_callstats.h \
- bsc_nat_sccp.h \
bsc_rll.h \
- bsc_subscriber.h \
bss.h \
bts_ipaccess_nanobts_omlattr.h \
chan_alloc.h \
@@ -24,19 +20,6 @@ noinst_HEADERS = \
db.h \
debug.h \
e1_config.h \
- gb_proxy.h \
- gprs_gb_parse.h \
- gprs_gmm.h \
- gprs_llc.h \
- gprs_llc_xid.h \
- gprs_sgsn.h \
- gprs_sndcp.h \
- gprs_sndcp_comp.h \
- gprs_sndcp_dcomp.h \
- gprs_sndcp_pcomp.h \
- gprs_sndcp_xid.h \
- gprs_subscriber.h \
- gprs_utils.h \
gsm_04_08.h \
gsm_04_11.h \
gsm_04_14.h \
@@ -45,7 +28,6 @@ noinst_HEADERS = \
gsm_data_shared.h \
gsm_subscriber.h \
gsup_client.h \
- gtphub.h \
handover.h \
handover_decision.h \
ipaccess.h \
@@ -58,7 +40,6 @@ noinst_HEADERS = \
mncc.h \
mncc_int.h \
msc_ifaces.h \
- nat_rewrite_trie.h \
network_listen.h \
oap_client.h \
openbscdefines.h \
@@ -71,13 +52,10 @@ noinst_HEADERS = \
bsc_msc_data.h \
osmux.h \
paging.h \
- pcu_if.h \
- pcuif_proto.h \
rest_octets.h \
rrlp.h \
rs232.h \
rtp_proxy.h \
- sgsn.h \
signal.h \
silent_call.h \
slhc.h \
@@ -91,8 +69,6 @@ noinst_HEADERS = \
ussd.h \
vlr.h \
vty.h \
- v42bis.h \
- v42bis_private.h \
$(NULL)
openbsc_HEADERS = \
diff --git a/include/openbsc/bsc_nat.h b/include/openbsc/bsc_nat.h
deleted file mode 100644
index 452daf2ab..000000000
--- a/include/openbsc/bsc_nat.h
+++ /dev/null
@@ -1,462 +0,0 @@
-/*
- * (C) 2010-2012 by Holger Hans Peter Freyther <zecke@selfish.org>
- * (C) 2010-2012 by On-Waves
- * All Rights Reserved
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation; either version 3 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef BSC_NAT_H
-#define BSC_NAT_H
-
-#include <osmocom/legacy_mgcp/mgcp.h>
-
-#include "bsc_msg_filter.h"
-
-#include <osmocom/core/select.h>
-#include <osmocom/core/msgb.h>
-#include <osmocom/core/msgfile.h>
-#include <osmocom/core/timer.h>
-#include <osmocom/core/write_queue.h>
-#include <osmocom/core/rate_ctr.h>
-#include <osmocom/core/statistics.h>
-#include <osmocom/gsm/protocol/gsm_04_08.h>
-
-#include <regex.h>
-#include <stdbool.h>
-
-#define DIR_BSC 1
-#define DIR_MSC 2
-
-#define PAGIN_GROUP_UNASSIGNED -1
-
-struct sccp_source_reference;
-struct nat_sccp_connection;
-struct bsc_nat_parsed;
-struct bsc_nat;
-struct bsc_nat_ussd_con;
-struct nat_rewrite_rule;
-
-/*
- * Is this terminated to the MSC, to the local machine (release
- * handling for IMSI filtering) or to a USSD provider?
- */
-enum {
- NAT_CON_END_MSC,
- NAT_CON_END_LOCAL,
- NAT_CON_END_USSD,
-};
-
-/*
- * Pending command entry
- */
-struct bsc_cmd_list {
- struct llist_head list_entry;
-
- struct osmo_timer_list timeout;
-
- /* The NATed ID used on the bsc_con*/
- int nat_id;
-
- /* The control connection from which the command originated */
- struct ctrl_connection *ccon;
-
- /* The command from the control connection */
- struct ctrl_cmd *cmd;
-};
-
-/*
- * Per BSC data structure
- */
-struct bsc_connection {
- struct llist_head list_entry;
-
- /* do we know anything about this BSC? */
- int authenticated;
- uint8_t last_rand[16];
-
- /* the fd we use to communicate */
- struct osmo_wqueue write_queue;
-
- /* incoming message buffer */
- struct msgb *pending_msg;
-
- /* the BSS associated */
- struct bsc_config *cfg;
-
- /* a timeout node */
- struct osmo_timer_list id_timeout;
-
- /* pong timeout */
- struct osmo_timer_list ping_timeout;
- struct osmo_timer_list pong_timeout;
-
- /* mgcp related code */
- char *_endpoint_status;
- int number_multiplexes;
- int max_endpoints;
- int last_endpoint;
- int next_transaction;
- uint32_t pending_dlcx_count;
- struct llist_head pending_dlcx;
-
- /* track the pending commands for this BSC */
- struct llist_head cmd_pending;
- int last_id;
-
- /* a back pointer */
- struct bsc_nat *nat;
-};
-
-/**
- * Stats per BSC
- */
-struct bsc_config_stats {
- struct rate_ctr_group *ctrg;
-};
-
-enum bsc_cfg_ctr {
- BCFG_CTR_SCCP_CONN,
- BCFG_CTR_SCCP_CALLS,
- BCFG_CTR_NET_RECONN,
- BCFG_CTR_DROPPED_SCCP,
- BCFG_CTR_DROPPED_CALLS,
- BCFG_CTR_REJECTED_CR,
- BCFG_CTR_REJECTED_MSG,
- BCFG_CTR_ILL_PACKET,
- BCFG_CTR_CON_TYPE_LU,
- BCFG_CTR_CON_CMSERV_RQ,
- BCFG_CTR_CON_PAG_RESP,
- BCFG_CTR_CON_SSA,
- BCFG_CTR_CON_OTHER,
-};
-
-/**
- * One BSC entry in the config
- */
-struct bsc_config {
- struct llist_head entry;
-
- uint8_t key[16];
- uint8_t key_present;
- char *token;
- int nr;
-
- char *description;
-
- /* imsi white and blacklist */
- char *acc_lst_name;
-
- int forbid_paging;
- int paging_group;
-
- /* audio handling */
- int max_endpoints;
-
- /* used internally for reload handling */
- bool remove;
- bool token_updated;
-
- /* backpointer */
- struct bsc_nat *nat;
-
- struct bsc_config_stats stats;
-
- struct llist_head lac_list;
-
- /* Osmux is enabled/disabled per BSC */
- int osmux;
-};
-
-struct bsc_lac_entry {
- struct llist_head entry;
- uint16_t lac;
-};
-
-struct bsc_nat_paging_group {
- struct llist_head entry;
-
- /* list of lac entries */
- struct llist_head lists;
- int nr;
-};
-
-/**
- * BSCs point of view of endpoints
- */
-struct bsc_endpoint {
- /* the operation that is carried out */
- int transaction_state;
- /* the pending transaction id */
- char *transaction_id;
- /* the bsc we are talking to */
- struct bsc_connection *bsc;
-};
-
-/**
- * Statistic for the nat.
- */
-struct bsc_nat_statistics {
- struct {
- struct osmo_counter *conn;
- struct osmo_counter *calls;
- } sccp;
-
- struct {
- struct osmo_counter *reconn;
- struct osmo_counter *auth_fail;
- } bsc;
-
- struct {
- struct osmo_counter *reconn;
- } msc;
-
- struct {
- struct osmo_counter *reconn;
- } ussd;
-};
-
-/**
- * the structure of the "nat" network
- */
-struct bsc_nat {
- /* active SCCP connections that need patching */
- struct llist_head sccp_connections;
-
- /* active BSC connections that need patching */
- struct llist_head bsc_connections;
-
- /* access lists */
- struct llist_head access_lists;
-
- /* paging groups */
- struct llist_head paging_groups;
-
- /* known BSC's */
- struct llist_head bsc_configs;
- int num_bsc;
- int bsc_ip_dscp;
-
- /* MGCP config */
- struct mgcp_config *mgcp_cfg;
- uint8_t mgcp_msg[4096];
- int mgcp_length;
- int mgcp_ipa;
- int sdp_ensure_amr_mode_set;
-
- /* msc things */
- struct llist_head dests;
- struct bsc_msc_dest *main_dest;
- struct bsc_msc_connection *msc_con;
- char *token;
-
- /* timeouts */
- int auth_timeout;
- int ping_timeout;
- int pong_timeout;
-
- struct bsc_endpoint *bsc_endpoints;
-
- /* path to file with BSC config */
- char *include_file;
- char *include_base;
- char *resolved_path;
-
- /* filter */
- char *acc_lst_name;
-
- /* Barring of subscribers with a rb tree */
- struct rb_root imsi_black_list;
- char *imsi_black_list_fn;
-
- /* number rewriting */
- char *num_rewr_name;
- struct llist_head num_rewr;
- char *num_rewr_post_name;
- struct llist_head num_rewr_post;
-
- char *smsc_rewr_name;
- struct llist_head smsc_rewr;
- char *tpdest_match_name;
- struct llist_head tpdest_match;
- char *sms_clear_tp_srr_name;
- struct llist_head sms_clear_tp_srr;
- char *sms_num_rewr_name;
- struct llist_head sms_num_rewr;
-
- /* more rewriting */
- char *num_rewr_trie_name;
- struct nat_rewrite *num_rewr_trie;
-
- /* USSD messages we want to match */
- char *ussd_lst_name;
- char *ussd_query;
- regex_t ussd_query_re;
- char *ussd_token;
- char *ussd_local;
- struct osmo_fd ussd_listen;
- struct bsc_nat_ussd_con *ussd_con;
-
- /* for maintainenance */
- int blocked;
-
- /* statistics */
- struct bsc_nat_statistics stats;
-
- /* control interface */
- struct ctrl_handle *ctrl;
-};
-
-struct bsc_nat_ussd_con {
- struct osmo_wqueue queue;
- struct bsc_nat *nat;
- int authorized;
-
- struct msgb *pending_msg;
-
- struct osmo_timer_list auth_timeout;
-};
-
-/* create and init the structures */
-struct bsc_config *bsc_config_alloc(struct bsc_nat *nat, const char *token,
- unsigned int number);
-struct bsc_config *bsc_config_num(struct bsc_nat *nat, int num);
-struct bsc_config *bsc_config_by_token(struct bsc_nat *nat, const char *token, int len);
-void bsc_config_free(struct bsc_config *);
-void bsc_config_add_lac(struct bsc_config *cfg, int lac);
-void bsc_config_del_lac(struct bsc_config *cfg, int lac);
-int bsc_config_handles_lac(struct bsc_config *cfg, int lac);
-
-struct bsc_nat *bsc_nat_alloc(void);
-struct bsc_connection *bsc_connection_alloc(struct bsc_nat *nat);
-void bsc_nat_set_msc_ip(struct bsc_nat *bsc, const char *ip);
-
-void sccp_connection_destroy(struct nat_sccp_connection *);
-void bsc_close_connection(struct bsc_connection *);
-
-const char *bsc_con_type_to_string(int type);
-
-/**
- * parse the given message into the above structure
- */
-struct bsc_nat_parsed *bsc_nat_parse(struct msgb *msg);
-
-/**
- * filter based on IP Access header in both directions
- */
-int bsc_nat_filter_ipa(int direction, struct msgb *msg, struct bsc_nat_parsed *parsed);
-int bsc_nat_vty_init(struct bsc_nat *nat);
-int bsc_nat_find_paging(struct msgb *msg, const uint8_t **,int *len);
-
-/**
- * SCCP patching and handling
- */
-struct nat_sccp_connection *create_sccp_src_ref(struct bsc_connection *bsc, struct bsc_nat_parsed *parsed);
-int update_sccp_src_ref(struct nat_sccp_connection *sccp, struct bsc_nat_parsed *parsed);
-void remove_sccp_src_ref(struct bsc_connection *bsc, struct msgb *msg, struct bsc_nat_parsed *parsed);
-struct nat_sccp_connection *patch_sccp_src_ref_to_bsc(struct msgb *, struct bsc_nat_parsed *, struct bsc_nat *);
-struct nat_sccp_connection *patch_sccp_src_ref_to_msc(struct msgb *, struct bsc_nat_parsed *, struct bsc_connection *);
-struct nat_sccp_connection *bsc_nat_find_con_by_bsc(struct bsc_nat *, struct sccp_source_reference *);
-
-/**
- * MGCP/Audio handling
- */
-int bsc_mgcp_nr_multiplexes(int max_endpoints);
-int bsc_write_mgcp(struct bsc_connection *bsc, const uint8_t *data, unsigned int length);
-int bsc_mgcp_assign_patch(struct nat_sccp_connection *, struct msgb *msg);
-void bsc_mgcp_init(struct nat_sccp_connection *);
-void bsc_mgcp_dlcx(struct nat_sccp_connection *);
-void bsc_mgcp_free_endpoints(struct bsc_nat *nat);
-int bsc_mgcp_nat_init(struct bsc_nat *nat);
-
-struct nat_sccp_connection *bsc_mgcp_find_con(struct bsc_nat *, int endpoint_number);
-struct msgb *bsc_mgcp_rewrite(char *input, int length, int endp, const char *ip,
- int port, int osmux, int *first_payload_type, int mode_set);
-void bsc_mgcp_forward(struct bsc_connection *bsc, struct msgb *msg);
-
-void bsc_mgcp_clear_endpoints_for(struct bsc_connection *bsc);
-int bsc_mgcp_parse_response(const char *str, int *code, char transaction[60]);
-uint32_t bsc_mgcp_extract_ci(const char *resp);
-
-
-int bsc_write(struct bsc_connection *bsc, struct msgb *msg, int id);
-int bsc_do_write(struct osmo_wqueue *queue, struct msgb *msg, int id);
-int bsc_write_msg(struct osmo_wqueue *queue, struct msgb *msg);
-int bsc_write_cb(struct osmo_fd *bfd, struct msgb *msg);
-
-int bsc_nat_msc_is_connected(struct bsc_nat *nat);
-
-int bsc_conn_type_to_ctr(struct nat_sccp_connection *conn);
-
-struct gsm48_hdr *bsc_unpack_dtap(struct bsc_nat_parsed *parsed, struct msgb *msg, uint32_t *len);
-
-/** USSD filtering */
-int bsc_ussd_init(struct bsc_nat *nat);
-int bsc_ussd_check(struct nat_sccp_connection *con, struct bsc_nat_parsed *parsed, struct msgb *msg);
-int bsc_ussd_close_connections(struct bsc_nat *nat);
-
-struct msgb *bsc_nat_rewrite_msg(struct bsc_nat *nat, struct msgb *msg, struct bsc_nat_parsed *, const char *imsi);
-
-/** paging group handling */
-struct bsc_nat_paging_group *bsc_nat_paging_group_num(struct bsc_nat *nat, int group);
-struct bsc_nat_paging_group *bsc_nat_paging_group_create(struct bsc_nat *nat, int group);
-void bsc_nat_paging_group_delete(struct bsc_nat_paging_group *);
-void bsc_nat_paging_group_add_lac(struct bsc_nat_paging_group *grp, int lac);
-void bsc_nat_paging_group_del_lac(struct bsc_nat_paging_group *grp, int lac);
-
-/**
- * Number rewriting support below
- */
-struct bsc_nat_num_rewr_entry {
- struct llist_head list;
-
- regex_t msisdn_reg;
- regex_t num_reg;
-
- char *replace;
- uint8_t is_prefix_lookup;
-};
-
-void bsc_nat_num_rewr_entry_adapt(void *ctx, struct llist_head *head, const struct osmo_config_list *);
-
-void bsc_nat_send_mgcp_to_msc(struct bsc_nat *bsc_nat, struct msgb *msg);
-void bsc_nat_handle_mgcp(struct bsc_nat *bsc, struct msgb *msg);
-
-struct ctrl_handle *bsc_nat_controlif_setup(struct bsc_nat *nat,
- const char *bind_addr, int port);
-void bsc_nat_ctrl_del_pending(struct bsc_cmd_list *pending);
-int bsc_nat_handle_ctrlif_msg(struct bsc_connection *bsc, struct msgb *msg);
-
-int bsc_nat_extract_lac(struct bsc_connection *bsc, struct nat_sccp_connection *con,
- struct bsc_nat_parsed *parsed, struct msgb *msg);
-
-int bsc_nat_filter_sccp_cr(struct bsc_connection *bsc, struct msgb *msg,
- struct bsc_nat_parsed *, int *con_type, char **imsi,
- struct bsc_filter_reject_cause *cause);
-int bsc_nat_filter_dt(struct bsc_connection *bsc, struct msgb *msg,
- struct nat_sccp_connection *con, struct bsc_nat_parsed *parsed,
- struct bsc_filter_reject_cause *cause);
-
-/**
- * CTRL interface helper
- */
-void bsc_nat_inform_reject(struct bsc_connection *bsc, const char *imsi);
-
-/*
- * Use for testing
- */
-void bsc_nat_free(struct bsc_nat *nat);
-
-#endif
diff --git a/include/openbsc/bsc_nat_callstats.h b/include/openbsc/bsc_nat_callstats.h
deleted file mode 100644
index 64f9bfc0a..000000000
--- a/include/openbsc/bsc_nat_callstats.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * (C) 2010-2012 by Holger Hans Peter Freyther <zecke@selfish.org>
- * (C) 2010-2012 by On-Waves
- * All Rights Reserved
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation; either version 3 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef BSC_NAT_CALLSTATS_H
-#define BSC_NAT_CALLSTATS_H
-
-#include <osmocom/core/linuxlist.h>
-
-#include <osmocom/sccp/sccp_types.h>
-
-struct bsc_nat_call_stats {
- struct llist_head entry;
-
- struct sccp_source_reference remote_ref;
- struct sccp_source_reference src_ref; /* as seen by the MSC */
-
- /* mgcp options */
- uint32_t ci;
- int bts_rtp_port;
- int net_rtp_port;
- struct in_addr bts_addr;
- struct in_addr net_addr;
-
-
- /* as witnessed by the NAT */
- uint32_t net_ps;
- uint32_t net_os;
- uint32_t bts_pr;
- uint32_t bts_or;
- uint32_t bts_expected;
- uint32_t bts_jitter;
- int bts_loss;
-
- uint32_t trans_id;
- int msc_endpoint;
-};
-
-#endif
diff --git a/include/openbsc/bsc_nat_sccp.h b/include/openbsc/bsc_nat_sccp.h
deleted file mode 100644
index 082466408..000000000
--- a/include/openbsc/bsc_nat_sccp.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/* NAT utilities using SCCP types */
-/*
- * (C) 2010 by Holger Hans Peter Freyther <zecke@selfish.org>
- * (C) 2010 by On-Waves
- * All Rights Reserved
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation; either version 3 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef BSC_NAT_SCCP_H
-#define BSC_NAT_SCCP_H
-
-#include "bsc_msg_filter.h"
-
-#include <osmocom/sccp/sccp_types.h>
-
-/*
- * For the NAT we will need to analyze and later patch
- * the received message. This would require us to parse
- * the IPA and SCCP header twice. Instead of doing this
- * we will have one analyze structure and have the patching
- * and filter operate on the same structure.
- */
-struct bsc_nat_parsed {
- /* ip access prototype */
- int ipa_proto;
-
- /* source local reference */
- struct sccp_source_reference *src_local_ref;
-
- /* destination local reference */
- struct sccp_source_reference *dest_local_ref;
-
- /* original value */
- struct sccp_source_reference original_dest_ref;
-
- /* called ssn number */
- int called_ssn;
-
- /* calling ssn number */
- int calling_ssn;
-
- /* sccp message type */
- int sccp_type;
-
- /* bssap type, e.g. 0 for BSS Management */
- int bssap;
-
- /* the gsm0808 message type */
- int gsm_type;
-};
-
-/*
- * Per SCCP source local reference patch table. It needs to
- * be updated on new SCCP connections, connection confirm and reject,
- * and on the loss of the BSC connection.
- */
-struct nat_sccp_connection {
- struct llist_head list_entry;
-
- struct bsc_connection *bsc;
- struct bsc_msc_connection *msc_con;
-
- struct sccp_source_reference real_ref;
- struct sccp_source_reference patched_ref;
- struct sccp_source_reference remote_ref;
- int has_remote_ref;
-
- /* status */
- int con_local;
- int authorized;
-
- struct bsc_filter_state filter_state;
-
- uint16_t lac;
- uint16_t ci;
-
- /* remember which Transactions we run over the bypass */
- char ussd_ti[8];
-
- /*
- * audio handling. Remember if we have ever send a CRCX,
- * remember the endpoint used by the MSC and BSC.
- */
- int msc_endp;
- int bsc_endp;
-
- /* timeout handling */
- struct timespec creation_time;
-};
-
-
-#endif
diff --git a/include/openbsc/bsc_subscriber.h b/include/openbsc/bsc_subscriber.h
deleted file mode 100644
index 324734f9a..000000000
--- a/include/openbsc/bsc_subscriber.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* GSM subscriber details for use in BSC land */
-
-#pragma once
-
-#include <stdint.h>
-
-#include <osmocom/core/linuxlist.h>
-#include <osmocom/gsm/protocol/gsm_23_003.h>
-
-struct log_target;
-
-struct bsc_subscr {
- struct llist_head entry;
- int use_count;
-
- char imsi[GSM23003_IMSI_MAX_DIGITS+1];
- uint32_t tmsi;
- uint16_t lac;
-};
-
-const char *bsc_subscr_name(struct bsc_subscr *bsub);
-
-struct bsc_subscr *bsc_subscr_find_or_create_by_imsi(struct llist_head *list,
- const char *imsi);
-struct bsc_subscr *bsc_subscr_find_or_create_by_tmsi(struct llist_head *list,
- uint32_t tmsi);
-
-struct bsc_subscr *bsc_subscr_find_by_imsi(struct llist_head *list,
- const char *imsi);
-struct bsc_subscr *bsc_subscr_find_by_tmsi(struct llist_head *list,
- uint32_t tmsi);
-
-void bsc_subscr_set_imsi(struct bsc_subscr *bsub, const char *imsi);
-
-struct bsc_subscr *_bsc_subscr_get(struct bsc_subscr *bsub,
- const char *file, int line);
-struct bsc_subscr *_bsc_subscr_put(struct bsc_subscr *bsub,
- const char *file, int line);
-#define bsc_subscr_get(bsub) _bsc_subscr_get(bsub, __BASE_FILE__, __LINE__)
-#define bsc_subscr_put(bsub) _bsc_subscr_put(bsub, __BASE_FILE__, __LINE__)
-
-void log_set_filter_bsc_subscr(struct log_target *target,
- struct bsc_subscr *bsub);
diff --git a/include/openbsc/gb_proxy.h b/include/openbsc/gb_proxy.h
deleted file mode 100644
index e10894fc3..000000000
--- a/include/openbsc/gb_proxy.h
+++ /dev/null
@@ -1,288 +0,0 @@
-#ifndef _GB_PROXY_H
-#define _GB_PROXY_H
-
-
-#include <osmocom/core/msgb.h>
-
-#include <osmocom/gprs/gprs_ns.h>
-#include <osmocom/vty/command.h>
-
-#include <sys/types.h>
-#include <regex.h>
-
-#define GBPROXY_INIT_VU_GEN_TX 256
-
-struct rate_ctr_group;
-struct gprs_gb_parse_context;
-struct tlv_parsed;
-
-enum gbproxy_global_ctr {
- GBPROX_GLOB_CTR_INV_BVCI,
- GBPROX_GLOB_CTR_INV_LAI,
- GBPROX_GLOB_CTR_INV_RAI,
- GBPROX_GLOB_CTR_INV_NSEI,
- GBPROX_GLOB_CTR_PROTO_ERR_BSS,
- GBPROX_GLOB_CTR_PROTO_ERR_SGSN,
- GBPROX_GLOB_CTR_NOT_SUPPORTED_BSS,
- GBPROX_GLOB_CTR_NOT_SUPPORTED_SGSN,
- GBPROX_GLOB_CTR_RESTART_RESET_SGSN,
- GBPROX_GLOB_CTR_TX_ERR_SGSN,
- GBPROX_GLOB_CTR_OTHER_ERR,
- GBPROX_GLOB_CTR_PATCH_PEER_ERR,
-};
-
-enum gbproxy_peer_ctr {
- GBPROX_PEER_CTR_BLOCKED,
- GBPROX_PEER_CTR_UNBLOCKED,
- GBPROX_PEER_CTR_DROPPED,
- GBPROX_PEER_CTR_INV_NSEI,
- GBPROX_PEER_CTR_TX_ERR,
- GBPROX_PEER_CTR_RAID_PATCHED_BSS,
- GBPROX_PEER_CTR_RAID_PATCHED_SGSN,
- GBPROX_PEER_CTR_APN_PATCHED,
- GBPROX_PEER_CTR_TLLI_PATCHED_BSS,
- GBPROX_PEER_CTR_TLLI_PATCHED_SGSN,
- GBPROX_PEER_CTR_PTMSI_PATCHED_BSS,
- GBPROX_PEER_CTR_PTMSI_PATCHED_SGSN,
- GBPROX_PEER_CTR_PATCH_CRYPT_ERR,
- GBPROX_PEER_CTR_PATCH_ERR,
- GBPROX_PEER_CTR_ATTACH_REQS,
- GBPROX_PEER_CTR_ATTACH_REJS,
- GBPROX_PEER_CTR_ATTACH_ACKS,
- GBPROX_PEER_CTR_ATTACH_COMPLS,
- GBPROX_PEER_CTR_RA_UPD_REQS,
- GBPROX_PEER_CTR_RA_UPD_REJS,
- GBPROX_PEER_CTR_RA_UPD_ACKS,
- GBPROX_PEER_CTR_RA_UPD_COMPLS,
- GBPROX_PEER_CTR_GMM_STATUS_BSS,
- GBPROX_PEER_CTR_GMM_STATUS_SGSN,
- GBPROX_PEER_CTR_DETACH_REQS,
- GBPROX_PEER_CTR_DETACH_ACKS,
- GBPROX_PEER_CTR_PDP_ACT_REQS,
- GBPROX_PEER_CTR_PDP_ACT_REJS,
- GBPROX_PEER_CTR_PDP_ACT_ACKS,
- GBPROX_PEER_CTR_PDP_DEACT_REQS,
- GBPROX_PEER_CTR_PDP_DEACT_ACKS,
- GBPROX_PEER_CTR_TLLI_UNKNOWN,
- GBPROX_PEER_CTR_TLLI_CACHE_SIZE,
- GBPROX_PEER_CTR_LAST,
-};
-
-enum gbproxy_keep_mode {
- GBPROX_KEEP_NEVER,
- GBPROX_KEEP_REATTACH,
- GBPROX_KEEP_IDENTIFIED,
- GBPROX_KEEP_ALWAYS,
-};
-
-enum gbproxy_match_id {
- GBPROX_MATCH_PATCHING,
- GBPROX_MATCH_ROUTING,
- GBPROX_MATCH_LAST
-};
-
-struct gbproxy_match {
- int enable;
- char *re_str;
- regex_t re_comp;
-};
-
-struct gbproxy_config {
- /* parsed from config file */
- uint16_t nsip_sgsn_nsei;
-
- /* misc */
- struct gprs_ns_inst *nsi;
-
- /* Linked list of all Gb peers (except SGSN) */
- struct llist_head bts_peers;
-
- /* Counter */
- struct rate_ctr_group *ctrg;
-
- /* force mcc/mnc */
- int core_mnc;
- int core_mcc;
- uint8_t* core_apn;
- size_t core_apn_size;
- int tlli_max_age;
- int tlli_max_len;
-
- /* Experimental config */
- int patch_ptmsi;
- int acquire_imsi;
- int route_to_sgsn2;
- uint16_t nsip_sgsn2_nsei;
- enum gbproxy_keep_mode keep_link_infos;
-
- /* IMSI checking/matching */
- struct gbproxy_match matches[GBPROX_MATCH_LAST];
-};
-
-struct gbproxy_patch_state {
- int local_mnc;
- int local_mcc;
-
- /* List of TLLIs for which patching is enabled */
- struct llist_head logical_links;
- int logical_link_count;
-};
-
-struct gbproxy_peer {
- struct llist_head list;
-
- /* point back to the config */
- struct gbproxy_config *cfg;
-
- /* NSEI of the peer entity */
- uint16_t nsei;
-
- /* BVCI used for Point-to-Point to this peer */
- uint16_t bvci;
- int blocked;
-
- /* Routeing Area that this peer is part of (raw 04.08 encoding) */
- uint8_t ra[6];
-
- /* Counter */
- struct rate_ctr_group *ctrg;
-
- struct gbproxy_patch_state patch_state;
-};
-
-struct gbproxy_tlli_state {
- uint32_t current;
- uint32_t assigned;
- int bss_validated;
- int net_validated;
-
- uint32_t ptmsi;
-};
-
-struct gbproxy_link_info {
- struct llist_head list;
-
- struct gbproxy_tlli_state tlli;
- struct gbproxy_tlli_state sgsn_tlli;
- uint32_t sgsn_nsei;
-
- time_t timestamp;
- uint8_t *imsi;
- size_t imsi_len;
-
- int imsi_acq_pending;
- struct llist_head stored_msgs;
- unsigned vu_gen_tx_bss;
-
- int is_deregistered;
-
- int is_matching[GBPROX_MATCH_LAST];
-};
-
-
-/* gb_proxy_vty .c */
-
-int gbproxy_vty_init(void);
-int gbproxy_parse_config(const char *config_file, struct gbproxy_config *cfg);
-
-
-/* gb_proxy.c */
-int gbproxy_init_config(struct gbproxy_config *cfg);
-
-/* Main input function for Gb proxy */
-int gbprox_rcvmsg(struct gbproxy_config *cfg, struct msgb *msg, uint16_t nsei, uint16_t ns_bvci, uint16_t nsvci);
-
-int gbprox_signal(unsigned int subsys, unsigned int signal,
- void *handler_data, void *signal_data);
-
-/* Reset all persistent NS-VC's */
-int gbprox_reset_persistent_nsvcs(struct gprs_ns_inst *nsi);
-
-void gbprox_reset(struct gbproxy_config *cfg);
-
-/* TLLI info handling */
-void gbproxy_delete_link_infos(struct gbproxy_peer *peer);
-struct gbproxy_link_info *gbproxy_update_link_state_ul(
- struct gbproxy_peer *peer, time_t now,
- struct gprs_gb_parse_context *parse_ctx);
-struct gbproxy_link_info *gbproxy_update_link_state_dl(
- struct gbproxy_peer *peer, time_t now,
- struct gprs_gb_parse_context *parse_ctx);
-int gbproxy_update_link_state_after(
- struct gbproxy_peer *peer, struct gbproxy_link_info *link_info,
- time_t now, struct gprs_gb_parse_context *parse_ctx);
-int gbproxy_remove_stale_link_infos(struct gbproxy_peer *peer, time_t now);
-void gbproxy_delete_link_info(struct gbproxy_peer *peer,
- struct gbproxy_link_info *link_info);
-void gbproxy_link_info_discard_messages(struct gbproxy_link_info *link_info);
-
-void gbproxy_attach_link_info(struct gbproxy_peer *peer, time_t now,
- struct gbproxy_link_info *link_info);
-void gbproxy_update_link_info(struct gbproxy_link_info *link_info,
- const uint8_t *imsi, size_t imsi_len);
-void gbproxy_detach_link_info(struct gbproxy_peer *peer,
- struct gbproxy_link_info *link_info);
-struct gbproxy_link_info *gbproxy_link_info_alloc( struct gbproxy_peer *peer);
-
-struct gbproxy_link_info *gbproxy_link_info_by_tlli(
- struct gbproxy_peer *peer, uint32_t tlli);
-struct gbproxy_link_info *gbproxy_link_info_by_imsi(
- struct gbproxy_peer *peer, const uint8_t *imsi, size_t imsi_len);
-struct gbproxy_link_info *gbproxy_link_info_by_any_sgsn_tlli(
- struct gbproxy_peer *peer, uint32_t tlli);
-struct gbproxy_link_info *gbproxy_link_info_by_sgsn_tlli(
- struct gbproxy_peer *peer,
- uint32_t tlli, uint32_t sgsn_nsei);
-struct gbproxy_link_info *gbproxy_link_info_by_ptmsi(
- struct gbproxy_peer *peer,
- uint32_t ptmsi);
-
-int gbproxy_imsi_matches(
- struct gbproxy_config *cfg,
- enum gbproxy_match_id match_id,
- struct gbproxy_link_info *link_info);
-uint32_t gbproxy_map_tlli(
- uint32_t other_tlli, struct gbproxy_link_info *link_info, int to_bss);
-
-/* needed by gb_proxy_tlli.h */
-uint32_t gbproxy_make_bss_ptmsi(struct gbproxy_peer *peer, uint32_t sgsn_ptmsi);
-uint32_t gbproxy_make_sgsn_tlli(
- struct gbproxy_peer *peer, struct gbproxy_link_info *link_info,
- uint32_t bss_tlli);
-void gbproxy_reset_link(struct gbproxy_link_info *link_info);
-int gbproxy_check_imsi(
- struct gbproxy_match *match, const uint8_t *imsi, size_t imsi_len);
-
-/* Message patching */
-void gbproxy_patch_bssgp(
- struct msgb *msg, uint8_t *bssgp, size_t bssgp_len,
- struct gbproxy_peer *peer, struct gbproxy_link_info *link_info,
- int *len_change, struct gprs_gb_parse_context *parse_ctx);
-
-int gbproxy_patch_llc(
- struct msgb *msg, uint8_t *llc, size_t llc_len,
- struct gbproxy_peer *peer, struct gbproxy_link_info *link_info,
- int *len_change, struct gprs_gb_parse_context *parse_ctx);
-
-int gbproxy_set_patch_filter(
- struct gbproxy_match *match, const char *filter, const char **err_msg);
-void gbproxy_clear_patch_filter(struct gbproxy_match *match);
-
-/* Peer handling */
-struct gbproxy_peer *gbproxy_peer_by_bvci(
- struct gbproxy_config *cfg, uint16_t bvci);
-struct gbproxy_peer *gbproxy_peer_by_nsei(
- struct gbproxy_config *cfg, uint16_t nsei);
-struct gbproxy_peer *gbproxy_peer_by_rai(
- struct gbproxy_config *cfg, const uint8_t *ra);
-struct gbproxy_peer *gbproxy_peer_by_lai(
- struct gbproxy_config *cfg, const uint8_t *la);
-struct gbproxy_peer *gbproxy_peer_by_lac(
- struct gbproxy_config *cfg, const uint8_t *la);
-struct gbproxy_peer *gbproxy_peer_by_bssgp_tlv(
- struct gbproxy_config *cfg, struct tlv_parsed *tp);
-struct gbproxy_peer *gbproxy_peer_alloc(struct gbproxy_config *cfg, uint16_t bvci);
-void gbproxy_peer_free(struct gbproxy_peer *peer);
-int gbproxy_cleanup_peers(struct gbproxy_config *cfg, uint16_t nsei, uint16_t bvci);
-
-#endif
diff --git a/include/openbsc/gprs_gb_parse.h b/include/openbsc/gprs_gb_parse.h
deleted file mode 100644
index 246839286..000000000
--- a/include/openbsc/gprs_gb_parse.h
+++ /dev/null
@@ -1,59 +0,0 @@
-#pragma once
-
-#include <openbsc/gprs_llc.h>
-
-#include <sys/types.h>
-
-struct gprs_gb_parse_context {
- /* Pointer to protocol specific parts */
- struct gsm48_hdr *g48_hdr;
- struct bssgp_normal_hdr *bgp_hdr;
- struct bssgp_ud_hdr *bud_hdr;
- uint8_t *bssgp_data;
- size_t bssgp_data_len;
- uint8_t *llc;
- size_t llc_len;
-
- /* Extracted information */
- struct gprs_llc_hdr_parsed llc_hdr_parsed;
- struct tlv_parsed bssgp_tp;
- int to_bss;
- uint8_t *tlli_enc;
- uint8_t *old_tlli_enc;
- uint8_t *imsi;
- size_t imsi_len;
- uint8_t *apn_ie;
- size_t apn_ie_len;
- uint8_t *ptmsi_enc;
- uint8_t *new_ptmsi_enc;
- uint8_t *raid_enc;
- uint8_t *old_raid_enc;
- uint8_t *bssgp_raid_enc;
- uint8_t *bssgp_ptmsi_enc;
-
- /* General info */
- const char *llc_msg_name;
- int invalidate_tlli;
- int await_reattach;
- int need_decryption;
- uint32_t tlli;
- int pdu_type;
- int old_raid_is_foreign;
- int peer_nsei;
-};
-
-int gprs_gb_parse_dtap(uint8_t *data, size_t data_len,
- struct gprs_gb_parse_context *parse_ctx);
-
-int gprs_gb_parse_llc(uint8_t *llc, size_t llc_len,
- struct gprs_gb_parse_context *parse_ctx);
-
-int gprs_gb_parse_bssgp(uint8_t *bssgp, size_t bssgp_len,
- struct gprs_gb_parse_context *parse_ctx);
-
-const char *gprs_gb_message_name(const struct gprs_gb_parse_context *parse_ctx,
- const char *default_msg_name);
-
-void gprs_gb_log_parse_context(int log_level,
- struct gprs_gb_parse_context *parse_ctx,
- const char *default_msg_name);
diff --git a/include/openbsc/gprs_gmm.h b/include/openbsc/gprs_gmm.h
deleted file mode 100644
index c38e49f0d..000000000
--- a/include/openbsc/gprs_gmm.h
+++ /dev/null
@@ -1,35 +0,0 @@
-#ifndef _GPRS_GMM_H
-#define _GPRS_GMM_H
-
-#include <osmocom/core/msgb.h>
-#include <openbsc/gprs_sgsn.h>
-
-#include <stdbool.h>
-
-int gsm48_tx_gsm_deact_pdp_req(struct sgsn_pdp_ctx *pdp, uint8_t sm_cause);
-int gsm48_tx_gsm_act_pdp_rej(struct sgsn_mm_ctx *mm, uint8_t tid,
- uint8_t cause, uint8_t pco_len, uint8_t *pco_v);
-int gsm48_tx_gsm_act_pdp_acc(struct sgsn_pdp_ctx *pdp);
-int gsm48_tx_gsm_deact_pdp_acc(struct sgsn_pdp_ctx *pdp);
-
-int gsm0408_gprs_rcvmsg_gb(struct msgb *msg, struct gprs_llc_llme *llme,
- bool drop_cipherable);
-int gsm0408_gprs_rcvmsg_iu(struct msgb *msg, struct gprs_ra_id *ra_id,
- uint16_t *sai);
-int gsm0408_gprs_force_reattach(struct sgsn_mm_ctx *mmctx);
-int gsm0408_gprs_force_reattach_oldmsg(struct msgb *msg,
- struct gprs_llc_llme *llme);
-void gsm0408_gprs_access_granted(struct sgsn_mm_ctx *mmctx);
-void gsm0408_gprs_access_denied(struct sgsn_mm_ctx *mmctx, int gmm_cause);
-void gsm0408_gprs_access_cancelled(struct sgsn_mm_ctx *mmctx, int gmm_cause);
-void gsm0408_gprs_authenticate(struct sgsn_mm_ctx *mmctx);
-
-int gprs_gmm_rx_suspend(struct gprs_ra_id *raid, uint32_t tlli);
-int gprs_gmm_rx_resume(struct gprs_ra_id *raid, uint32_t tlli,
- uint8_t suspend_ref);
-
-time_t gprs_max_time_to_idle(void);
-
-int iu_rab_act_ps(uint8_t rab_id, struct sgsn_pdp_ctx *pdp);
-
-#endif /* _GPRS_GMM_H */
diff --git a/include/openbsc/gprs_llc.h b/include/openbsc/gprs_llc.h
deleted file mode 100644
index 8bc226781..000000000
--- a/include/openbsc/gprs_llc.h
+++ /dev/null
@@ -1,284 +0,0 @@
-#ifndef _GPRS_LLC_H
-#define _GPRS_LLC_H
-
-#include <stdint.h>
-#include <stdbool.h>
-#include <openbsc/gprs_sgsn.h>
-#include <openbsc/gprs_llc_xid.h>
-
-/* Section 4.7 LLC Layer Structure */
-enum gprs_llc_sapi {
- GPRS_SAPI_GMM = 1,
- GPRS_SAPI_TOM2 = 2,
- GPRS_SAPI_SNDCP3 = 3,
- GPRS_SAPI_SNDCP5 = 5,
- GPRS_SAPI_SMS = 7,
- GPRS_SAPI_TOM8 = 8,
- GPRS_SAPI_SNDCP9 = 9,
- GPRS_SAPI_SNDCP11 = 11,
-};
-
-/* Section 6.4 Commands and Responses */
-enum gprs_llc_u_cmd {
- GPRS_LLC_U_DM_RESP = 0x01,
- GPRS_LLC_U_DISC_CMD = 0x04,
- GPRS_LLC_U_UA_RESP = 0x06,
- GPRS_LLC_U_SABM_CMD = 0x07,
- GPRS_LLC_U_FRMR_RESP = 0x08,
- GPRS_LLC_U_XID = 0x0b,
- GPRS_LLC_U_NULL_CMD = 0x00,
-};
-
-/* Section 6.4.1.6 / Table 6 */
-enum gprs_llc_xid_type {
- GPRS_LLC_XID_T_VERSION = 0,
- GPRS_LLC_XID_T_IOV_UI = 1,
- GPRS_LLC_XID_T_IOV_I = 2,
- GPRS_LLC_XID_T_T200 = 3,
- GPRS_LLC_XID_T_N200 = 4,
- GPRS_LLC_XID_T_N201_U = 5,
- GPRS_LLC_XID_T_N201_I = 6,
- GPRS_LLC_XID_T_mD = 7,
- GPRS_LLC_XID_T_mU = 8,
- GPRS_LLC_XID_T_kD = 9,
- GPRS_LLC_XID_T_kU = 10,
- GPRS_LLC_XID_T_L3_PAR = 11,
- GPRS_LLC_XID_T_RESET = 12,
-};
-
-extern const struct value_string gprs_llc_xid_type_names[];
-
-/* TS 04.64 Section 7.1.2 Table 7: LLC layer primitives (GMM/SNDCP/SMS/TOM) */
-/* TS 04.65 Section 5.1.2 Table 2: Service primitives used by SNDCP */
-enum gprs_llc_primitive {
- /* GMM <-> LLME */
- LLGMM_ASSIGN_REQ, /* GMM tells us new TLLI: TLLI old, TLLI new, Kc, CiphAlg */
- LLGMM_RESET_REQ, /* GMM tells us to perform XID negotiation: TLLI */
- LLGMM_RESET_CNF, /* LLC informs GMM that XID has completed: TLLI */
- LLGMM_SUSPEND_REQ, /* GMM tells us MS has suspended: TLLI, Page */
- LLGMM_RESUME_REQ, /* GMM tells us MS has resumed: TLLI */
- LLGMM_PAGE_IND, /* LLC asks GMM to page MS: TLLI */
- LLGMM_IOV_REQ, /* GMM tells us to perform XID: TLLI */
- LLGMM_STATUS_IND, /* LLC informs GMM about error: TLLI, Cause */
- /* LLE <-> (GMM/SNDCP/SMS/TOM) */
- LL_RESET_IND, /* TLLI */
- LL_ESTABLISH_REQ, /* TLLI, XID Req */
- LL_ESTABLISH_IND, /* TLLI, XID Req, N201-I, N201-U */
- LL_ESTABLISH_RESP, /* TLLI, XID Negotiated */
- LL_ESTABLISH_CONF, /* TLLI, XID Neg, N201-i, N201-U */
- LL_RELEASE_REQ, /* TLLI, Local */
- LL_RELEASE_IND, /* TLLI, Cause */
- LL_RELEASE_CONF, /* TLLI */
- LL_XID_REQ, /* TLLI, XID Requested */
- LL_XID_IND, /* TLLI, XID Req, N201-I, N201-U */
- LL_XID_RESP, /* TLLI, XID Negotiated */
- LL_XID_CONF, /* TLLI, XID Neg, N201-I, N201-U */
- LL_DATA_REQ, /* TLLI, SN-PDU, Ref, QoS, Radio Prio, Ciph */
- LL_DATA_IND, /* TLLI, SN-PDU */
- LL_DATA_CONF, /* TLLI, Ref */
- LL_UNITDATA_REQ, /* TLLI, SN-PDU, Ref, QoS, Radio Prio, Ciph */
- LL_UNITDATA_IND, /* TLLI, SN-PDU */
- LL_STATUS_IND, /* TLLI, Cause */
-};
-
-/* Section 4.5.2 Logical Link States + Annex C.2 */
-enum gprs_llc_lle_state {
- GPRS_LLES_UNASSIGNED = 1, /* No TLLI yet */
- GPRS_LLES_ASSIGNED_ADM = 2, /* TLLI assigned */
- GPRS_LLES_LOCAL_EST = 3, /* Local Establishment */
- GPRS_LLES_REMOTE_EST = 4, /* Remote Establishment */
- GPRS_LLES_ABM = 5,
- GPRS_LLES_LOCAL_REL = 6, /* Local Release */
- GPRS_LLES_TIMER_REC = 7, /* Timer Recovery */
-};
-
-enum gprs_llc_llme_state {
- GPRS_LLMS_UNASSIGNED = 1, /* No TLLI yet */
- GPRS_LLMS_ASSIGNED = 2, /* TLLI assigned */
-};
-
-/* Section 8.9.9 LLC layer parameter default values */
-struct gprs_llc_params {
- uint16_t iov_i_exp;
- uint16_t t200_201;
- uint16_t n200;
- uint16_t n201_u;
- uint16_t n201_i;
- uint16_t mD;
- uint16_t mU;
- uint16_t kD;
- uint16_t kU;
-};
-
-/* Section 4.7.1: Logical Link Entity: One per DLCI (TLLI + SAPI) */
-struct gprs_llc_lle {
- struct llist_head list;
-
- uint32_t sapi;
-
- struct gprs_llc_llme *llme;
-
- enum gprs_llc_lle_state state;
-
- struct osmo_timer_list t200;
- struct osmo_timer_list t201; /* wait for acknowledgement */
-
- uint16_t v_sent;
- uint16_t v_ack;
- uint16_t v_recv;
-
- uint16_t vu_send;
- uint16_t vu_recv;
-
- /* non-standard LLC state */
- uint16_t vu_recv_last;
- uint16_t vu_recv_duplicates;
-
- /* Overflow Counter for ABM */
- uint32_t oc_i_send;
- uint32_t oc_i_recv;
-
- /* Overflow Counter for unconfirmed transfer */
- uint32_t oc_ui_send;
- uint32_t oc_ui_recv;
-
- unsigned int retrans_ctr;
-
- struct gprs_llc_params params;
-};
-
-#define NUM_SAPIS 16
-
-struct gprs_llc_llme {
- struct llist_head list;
-
- enum gprs_llc_llme_state state;
-
- uint32_t tlli;
- uint32_t old_tlli;
-
- /* Crypto parameters */
- enum gprs_ciph_algo algo;
- uint8_t kc[16];
- uint8_t cksn;
- /* 3GPP TS 44.064 § 8.9.2: */
- uint32_t iov_ui;
-
- /* over which BSSGP BTS ctx do we need to transmit */
- uint16_t bvci;
- uint16_t nsei;
- struct gprs_llc_lle lle[NUM_SAPIS];
-
- /* Copy of the XID fields we have sent with the last
- * network originated XID-Request. Since the phone
- * may strip the optional fields in the confirmation
- * we need to remeber those fields in order to be
- * able to create the compression entity. */
- struct llist_head *xid;
-
- /* Compression entities */
- struct {
- /* In these two list_heads we will store the
- * data and protocol compression entities,
- * together with their compression states */
- struct llist_head *proto;
- struct llist_head *data;
- } comp;
-
- /* Internal management */
- uint32_t age_timestamp;
-};
-
-#define GPRS_LLME_RESET_AGE (0)
-
-extern struct llist_head gprs_llc_llmes;
-
-/* LLC low level types */
-
-enum gprs_llc_cmd {
- GPRS_LLC_NULL,
- GPRS_LLC_RR,
- GPRS_LLC_ACK,
- GPRS_LLC_RNR,
- GPRS_LLC_SACK,
- GPRS_LLC_DM,
- GPRS_LLC_DISC,
- GPRS_LLC_UA,
- GPRS_LLC_SABM,
- GPRS_LLC_FRMR,
- GPRS_LLC_XID,
- GPRS_LLC_UI,
-};
-
-struct gprs_llc_hdr_parsed {
- uint8_t sapi;
- uint8_t is_cmd:1,
- ack_req:1,
- is_encrypted:1;
- uint32_t seq_rx;
- uint32_t seq_tx;
- uint32_t fcs;
- uint32_t fcs_calc;
- uint8_t *data;
- uint16_t data_len;
- uint16_t crc_length;
- enum gprs_llc_cmd cmd;
-};
-
-
-/* BSSGP-UL-UNITDATA.ind */
-int gprs_llc_rcvmsg(struct msgb *msg, struct tlv_parsed *tv);
-
-/* LL-UNITDATA.req */
-int gprs_llc_tx_ui(struct msgb *msg, uint8_t sapi, int command,
- struct sgsn_mm_ctx *mmctx, bool encryptable);
-
-/* Chapter 7.2.1.2 LLGMM-RESET.req */
-int gprs_llgmm_reset(struct gprs_llc_llme *llme);
-int gprs_llgmm_reset_oldmsg(struct msgb* oldmsg, uint8_t sapi,
- struct gprs_llc_llme *llme);
-
-/* Set of LL-XID negotiation (See also: TS 101 351, Section 7.2.2.4) */
-int gprs_ll_xid_req(struct gprs_llc_lle *lle,
- struct gprs_llc_xid_field *l3_xid_field);
-
-/* 04.64 Chapter 7.2.1.1 LLGMM-ASSIGN */
-int gprs_llgmm_assign(struct gprs_llc_llme *llme,
- uint32_t old_tlli, uint32_t new_tlli);
-int gprs_llgmm_unassign(struct gprs_llc_llme *llme);
-
-int gprs_llc_init(const char *cipher_plugin_path);
-int gprs_llc_vty_init(void);
-
-/**
- * \short Check if N(U) should be considered a retransmit
- *
- * Implements the range check as of GSM 04.64 8.4.2
- * Receipt of unacknowledged information.
- *
- * @returns Returns 1 if (V(UR)-32) <= N(U) < V(UR)
- * @param nu N(U) unconfirmed sequence number of the UI frame
- * @param vur V(UR) unconfirmend received state variable
- */
-static inline int gprs_llc_is_retransmit(uint16_t nu, uint16_t vur)
-{
- int delta = (vur - nu) & 0x1ff;
- return 0 < delta && delta < 32;
-}
-
-/* LLC low level functions */
-void gprs_llme_copy_key(struct sgsn_mm_ctx *mm, struct gprs_llc_llme *llme);
-
-/* parse a GPRS LLC header, also check for invalid frames */
-int gprs_llc_hdr_parse(struct gprs_llc_hdr_parsed *ghp,
- uint8_t *llc_hdr, int len);
-void gprs_llc_hdr_dump(struct gprs_llc_hdr_parsed *gph, struct gprs_llc_lle *lle);
-int gprs_llc_fcs(uint8_t *data, unsigned int len);
-
-
-/* LLME handling routines */
-struct llist_head *gprs_llme_list(void);
-struct gprs_llc_lle *gprs_lle_get_or_create(const uint32_t tlli, uint8_t sapi);
-
-
-#endif
diff --git a/include/openbsc/gprs_llc_xid.h b/include/openbsc/gprs_llc_xid.h
deleted file mode 100644
index d340d40b7..000000000
--- a/include/openbsc/gprs_llc_xid.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* GPRS LLC XID field encoding/decoding as per 3GPP TS 44.064 */
-
-/* (C) 2016 by sysmocom s.f.m.c. GmbH <info@sysmocom.de>
- * All Rights Reserved
- *
- * Author: Philipp Maier
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation; either version 3 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#pragma once
-
-#include <stdint.h>
-#include <osmocom/core/linuxlist.h>
-
-/* 3GPP TS 44.064 6.4.1.6 Exchange Identification (XID)
- command/response parameter field */
-struct gprs_llc_xid_field {
- struct llist_head list;
- uint8_t type; /* See also Table 6: LLC layer parameter
- negotiation */
- uint8_t *data; /* Payload data (memory is owned by the
- * creator of the struct) */
- unsigned int data_len; /* Payload length */
-};
-
-/* Transform a list with XID fields into a XID message (dst) */
-int gprs_llc_compile_xid(uint8_t *dst, int dst_maxlen,
- const struct llist_head *xid_fields);
-
-/* Transform a XID message (dst) into a list of XID fields */
-struct llist_head *gprs_llc_parse_xid(const void *ctx, const uint8_t *src,
- int src_len);
-
-/* Create a duplicate of an XID-Field */
-struct gprs_llc_xid_field *gprs_llc_dup_xid_field(const void *ctx,
- const struct gprs_llc_xid_field *xid_field);
-
-/* Copy an llist with xid fields */
-struct llist_head *gprs_llc_copy_xid(const void *ctx,
- const struct llist_head *xid_fields);
-
-/* Dump a list with XID fields (Debug) */
-void gprs_llc_dump_xid_fields(const struct llist_head *xid_fields,
- unsigned int logl);
-
diff --git a/include/openbsc/gprs_sgsn.h b/include/openbsc/gprs_sgsn.h
deleted file mode 100644
index 57995e018..000000000
--- a/include/openbsc/gprs_sgsn.h
+++ /dev/null
@@ -1,478 +0,0 @@
-#ifndef _GPRS_SGSN_H
-#define _GPRS_SGSN_H
-
-#include <stdint.h>
-#include <netinet/in.h>
-
-#include <osmocom/core/timer.h>
-
-#include <osmocom/gsm/gsm48.h>
-
-#include <osmocom/crypt/gprs_cipher.h>
-#include <osmocom/gsm/protocol/gsm_23_003.h>
-
-#include <openbsc/gsm_data.h>
-
-#define GSM_EXTENSION_LENGTH 15
-#define GSM_APN_LENGTH 102
-
-struct gprs_llc_lle;
-struct ctrl_handle;
-struct gprs_subscr;
-
-enum gsm48_gsm_cause;
-
-/* TS 04.08 4.1.3.3 GMM mobility management states on the network side */
-enum gprs_gmm_state {
- GMM_DEREGISTERED, /* 4.1.3.3.1.1 */
- GMM_COMMON_PROC_INIT, /* 4.1.3.3.1.2 */
- GMM_REGISTERED_NORMAL, /* 4.1.3.3.2.1 */
- GMM_REGISTERED_SUSPENDED, /* 4.1.3.3.2.2 */
- GMM_DEREGISTERED_INIT, /* 4.1.3.3.1.4 */
-};
-
-/* TS 23.060 6.1.1 and 6.1.2 Mobility management states A/Gb and Iu mode */
-enum gprs_pmm_state {
- PMM_DETACHED,
- PMM_CONNECTED,
- PMM_IDLE,
- MM_IDLE,
- MM_READY,
- MM_STANDBY,
-};
-
-enum gprs_mm_ctr {
- GMM_CTR_PKTS_SIG_IN,
- GMM_CTR_PKTS_SIG_OUT,
- GMM_CTR_PKTS_UDATA_IN,
- GMM_CTR_PKTS_UDATA_OUT,
- GMM_CTR_BYTES_UDATA_IN,
- GMM_CTR_BYTES_UDATA_OUT,
- GMM_CTR_PDP_CTX_ACT,
- GMM_CTR_SUSPEND,
- GMM_CTR_PAGING_PS,
- GMM_CTR_PAGING_CS,
- GMM_CTR_RA_UPDATE,
-};
-
-enum gprs_pdp_ctx {
- PDP_CTR_PKTS_UDATA_IN,
- PDP_CTR_PKTS_UDATA_OUT,
- PDP_CTR_BYTES_UDATA_IN,
- PDP_CTR_BYTES_UDATA_OUT,
-};
-
-enum gprs_t3350_mode {
- GMM_T3350_MODE_NONE,
- GMM_T3350_MODE_ATT,
- GMM_T3350_MODE_RAU,
- GMM_T3350_MODE_PTMSI_REALL,
-};
-
-/* Authorization/ACL handling */
-enum sgsn_auth_state {
- SGSN_AUTH_UNKNOWN,
- SGSN_AUTH_AUTHENTICATE,
- SGSN_AUTH_UMTS_RESYNC,
- SGSN_AUTH_ACCEPTED,
- SGSN_AUTH_REJECTED
-};
-
-#define MS_RADIO_ACCESS_CAPA
-
-enum sgsn_ggsn_lookup_state {
- SGSN_GGSN_2DIGIT,
- SGSN_GGSN_3DIGIT,
-};
-
-struct sgsn_ggsn_lookup {
- int state;
-
- struct sgsn_mm_ctx *mmctx;
-
- /* APN string */
- char apn_str[GSM_APN_LENGTH];
-
- /* the original data */
- struct msgb *orig_msg;
- struct tlv_parsed tp;
-
- /* for dealing with re-transmissions */
- uint8_t nsapi;
- uint8_t sapi;
- uint8_t ti;
-};
-
-enum sgsn_ran_type {
- /* GPRS/EDGE via Gb */
- MM_CTX_T_GERAN_Gb,
- /* UMTS via Iu */
- MM_CTX_T_UTRAN_Iu,
- /* GPRS/EDGE via Iu */
- MM_CTX_T_GERAN_Iu,
-};
-
-struct service_info {
- uint8_t type;
- uint16_t pdp_status;
-};
-
-struct ranap_ue_conn_ctx;
-
-/* According to TS 03.60, Table 5: SGSN MM and PDP Contexts */
-/* Extended by 3GPP TS 23.060, Table 6: SGSN MM and PDP Contexts */
-struct sgsn_mm_ctx {
- struct llist_head list;
-
- enum sgsn_ran_type ran_type;
-
- char imsi[GSM23003_IMSI_MAX_DIGITS+1];
- enum gprs_gmm_state gmm_state;
- enum gprs_pmm_state pmm_state; /* Iu: page when in PMM-IDLE mode */
- uint32_t p_tmsi;
- uint32_t p_tmsi_old; /* old P-TMSI before new is confirmed */
- uint32_t p_tmsi_sig;
- char imei[GSM23003_IMEISV_NUM_DIGITS+1];
- /* Opt: Software Version Numbber / TS 23.195 */
- char msisdn[GSM_EXTENSION_LENGTH];
- struct gprs_ra_id ra;
- struct {
- uint16_t cell_id; /* Gb only */
- uint32_t cell_id_age; /* Gb only */
- uint8_t radio_prio_sms;
-
- /* Additional bits not present in the GSM TS */
- uint16_t nsei;
- uint16_t bvci;
- struct gprs_llc_llme *llme;
- uint32_t tlli;
- uint32_t tlli_new;
- } gb;
- struct {
- int new_key;
- uint16_t sac; /* Iu: Service Area Code */
- uint32_t sac_age; /* Iu: Service Area Code age */
- /* CSG ID */
- /* CSG Membership */
- /* Access Mode */
- /* Seelected CN Operator ID (TS 23.251) */
- /* CSG Subscription Data */
- /* LIPA Allowed */
- /* Voice Support Match Indicator */
- struct ranap_ue_conn_ctx *ue_ctx;
- struct service_info service;
- } iu;
- /* VLR number */
- uint32_t new_sgsn_addr;
- /* Authentication Triplet */
- struct gsm_auth_tuple auth_triplet;
- /* Kc */
- /* Iu: CK, IK, KSI */
- /* CKSN */
- enum gprs_ciph_algo ciph_algo;
- /* Auth & Ciphering Request reference from 3GPP TS 24.008 § 10.5.5.19: */
- uint8_t ac_ref_nr_used;
-
- struct {
- uint8_t len;
- uint8_t buf[50]; /* GSM 04.08 10.5.5.12a, extended in TS 24.008 */
- } ms_radio_access_capa;
- /* Supported Codecs (SRVCC) */
- struct {
- uint8_t len;
- uint8_t buf[8]; /* GSM 04.08 10.5.5.12, extended in TS 24.008 */
- } ms_network_capa;
- /* UE Netowrk Capability (E-UTRAN) */
- uint16_t drx_parms;
- /* Active Time value for PSM */
- int mnrg; /* MS reported to HLR? */
- int ngaf; /* MS reported to MSC/VLR? */
- int ppf; /* paging for GPRS + non-GPRS? */
- /* Subscribed Charging Characteristics */
- /* Trace Reference */
- /* Trace Type */
- /* Trigger ID */
- /* OMC Identity */
- /* SMS Parameters */
- int recovery;
- /* Access Restriction */
- /* GPRS CSI (CAMEL) */
- /* MG-CSI (CAMEL) */
- /* Subscribed UE-AMBR */
- /* UE-AMBR */
- /* APN Subscribed */
-
- struct llist_head pdp_list;
-
- struct rate_ctr_group *ctrg;
- struct osmo_timer_list timer;
- unsigned int T; /* Txxxx number */
- unsigned int num_T_exp; /* number of consecutive T expirations */
-
- enum gprs_t3350_mode t3350_mode;
- uint8_t t3370_id_type;
- uint8_t pending_req; /* the request's message type */
- /* TODO: There isn't much semantic difference between t3350_mode
- * (refers to the timer) and pending_req (refers to the procedure),
- * where mm->T == 3350 => mm->t3350_mode == f(mm->pending_req). Check
- * whether one of them can be dropped. */
-
- enum sgsn_auth_state auth_state;
- int is_authenticated;
-
- /* the string representation of the current hlr */
- char hlr[GSM_EXTENSION_LENGTH];
-
- /* the current GGSN look-up operation */
- struct sgsn_ggsn_lookup *ggsn_lookup;
-
- struct gprs_subscr *subscr;
-};
-
-#define LOGMMCTXP(level, mm, fmt, args...) \
- LOGP(DMM, level, "MM(%s/%08x) " fmt, (mm) ? (mm)->imsi : "---", \
- (mm) ? (mm)->p_tmsi : GSM_RESERVED_TMSI, ## args)
-
-/* look-up a SGSN MM context based on TLLI + RAI */
-struct sgsn_mm_ctx *sgsn_mm_ctx_by_tlli(uint32_t tlli,
- const struct gprs_ra_id *raid);
-struct sgsn_mm_ctx *sgsn_mm_ctx_by_ptmsi(uint32_t tmsi);
-struct sgsn_mm_ctx *sgsn_mm_ctx_by_imsi(const char *imsi);
-struct sgsn_mm_ctx *sgsn_mm_ctx_by_ue_ctx(const void *uectx);
-
-/* look-up by matching TLLI and P-TMSI (think twice before using this) */
-struct sgsn_mm_ctx *sgsn_mm_ctx_by_tlli_and_ptmsi(uint32_t tlli,
- const struct gprs_ra_id *raid);
-
-/* Allocate a new SGSN MM context */
-struct sgsn_mm_ctx *sgsn_mm_ctx_alloc_gb(uint32_t tlli,
- const struct gprs_ra_id *raid);
-struct sgsn_mm_ctx *sgsn_mm_ctx_alloc_iu(void *uectx);
-
-void sgsn_mm_ctx_cleanup_free(struct sgsn_mm_ctx *ctx);
-
-struct sgsn_ggsn_ctx *sgsn_mm_ctx_find_ggsn_ctx(struct sgsn_mm_ctx *mmctx,
- struct tlv_parsed *tp,
- enum gsm48_gsm_cause *gsm_cause,
- char *apn_str);
-
-enum pdp_ctx_state {
- PDP_STATE_NONE,
- PDP_STATE_CR_REQ,
- PDP_STATE_CR_CONF,
-
- /* 04.08 / Figure 6.2 / 6.1.2.2 */
- PDP_STATE_INACT_PEND,
- PDP_STATE_INACTIVE = PDP_STATE_NONE,
-};
-
-enum pdp_type {
- PDP_TYPE_NONE,
- PDP_TYPE_ETSI_PPP,
- PDP_TYPE_IANA_IPv4,
- PDP_TYPE_IANA_IPv6,
-};
-
-struct sgsn_pdp_ctx {
- struct llist_head list; /* list_head for mmctx->pdp_list */
- struct llist_head g_list; /* list_head for global list */
- struct sgsn_mm_ctx *mm; /* back pointer to MM CTX */
- int destroy_ggsn; /* destroy it on destruction */
- struct sgsn_ggsn_ctx *ggsn; /* which GGSN serves this PDP */
- struct rate_ctr_group *ctrg;
-
- //unsigned int id;
- struct pdp_t *lib; /* pointer to libgtp PDP ctx */
- enum pdp_ctx_state state;
- enum pdp_type type;
- uint32_t address;
- char *apn_subscribed;
- //char *apn_used;
- uint16_t nsapi; /* SNDCP */
- uint16_t sapi; /* LLC */
- uint8_t ti; /* transaction identifier */
- int vplmn_allowed;
- uint32_t qos_profile_subscr;
- //uint32_t qos_profile_req;
- //uint32_t qos_profile_neg;
- uint8_t radio_prio;
- //uint32_t charging_id;
-
- struct osmo_timer_list timer;
- unsigned int T; /* Txxxx number */
- unsigned int num_T_exp; /* number of consecutive T expirations */
-
- struct osmo_timer_list cdr_timer; /* CDR record wird timer */
- struct timespec cdr_start; /* The start of the CDR */
- uint64_t cdr_bytes_in;
- uint64_t cdr_bytes_out;
- uint32_t cdr_charging_id;
-};
-
-#define LOGPDPCTXP(level, pdp, fmt, args...) \
- LOGP(DGPRS, level, "PDP(%s/%u) " \
- fmt, (pdp)->mm ? (pdp)->mm->imsi : "---", (pdp)->ti, ## args)
-
-/* look up PDP context by MM context and NSAPI */
-struct sgsn_pdp_ctx *sgsn_pdp_ctx_by_nsapi(const struct sgsn_mm_ctx *mm,
- uint8_t nsapi);
-/* look up PDP context by MM context and transaction ID */
-struct sgsn_pdp_ctx *sgsn_pdp_ctx_by_tid(const struct sgsn_mm_ctx *mm,
- uint8_t tid);
-
-struct sgsn_pdp_ctx *sgsn_pdp_ctx_alloc(struct sgsn_mm_ctx *mm,
- uint8_t nsapi);
-void sgsn_pdp_ctx_terminate(struct sgsn_pdp_ctx *pdp);
-void sgsn_pdp_ctx_free(struct sgsn_pdp_ctx *pdp);
-
-
-struct sgsn_ggsn_ctx {
- struct llist_head list;
- uint32_t id;
- unsigned int gtp_version;
- struct in_addr remote_addr;
- int remote_restart_ctr;
- struct gsn_t *gsn;
-};
-struct sgsn_ggsn_ctx *sgsn_ggsn_ctx_alloc(uint32_t id);
-void sgsn_ggsn_ctx_free(struct sgsn_ggsn_ctx *ggc);
-struct sgsn_ggsn_ctx *sgsn_ggsn_ctx_by_id(uint32_t id);
-struct sgsn_ggsn_ctx *sgsn_ggsn_ctx_by_addr(struct in_addr *addr);
-struct sgsn_ggsn_ctx *sgsn_ggsn_ctx_find_alloc(uint32_t id);
-
-struct apn_ctx {
- struct llist_head list;
- struct sgsn_ggsn_ctx *ggsn;
- char *name;
- char *imsi_prefix;
- char *description;
-};
-
-struct apn_ctx *sgsn_apn_ctx_find_alloc(const char *name, const char *imsi_prefix);
-void sgsn_apn_ctx_free(struct apn_ctx *actx);
-struct apn_ctx *sgsn_apn_ctx_by_name(const char *name, const char *imsi_prefix);
-struct apn_ctx *sgsn_apn_ctx_match(const char *name, const char *imsi_prefix);
-
-extern struct llist_head sgsn_mm_ctxts;
-extern struct llist_head sgsn_ggsn_ctxts;
-extern struct llist_head sgsn_apn_ctxts;
-extern struct llist_head sgsn_pdp_ctxts;
-
-uint32_t sgsn_alloc_ptmsi(void);
-void sgsn_inst_init(void);
-
-/* High-level function to be called in case a GGSN has disappeared or
- * ottherwise lost state (recovery procedure) */
-int drop_all_pdp_for_ggsn(struct sgsn_ggsn_ctx *ggsn);
-
-char *gprs_pdpaddr2str(uint8_t *pdpa, uint8_t len);
-
-/*
- * ctrl interface related work
- */
-struct gsm_network;
-struct ctrl_handle *sgsn_controlif_setup(struct gsm_network *,
- const char *bind_addr, uint16_t port);
-int sgsn_ctrl_cmds_install(void);
-
-/*
- * Authorization/ACL handling
- */
-struct imsi_acl_entry {
- struct llist_head list;
- char imsi[16+1];
-};
-
-/* see GSM 09.02, 17.7.1, PDP-Context and GPRSSubscriptionData */
-/* see GSM 09.02, B.1, gprsSubscriptionData */
-struct sgsn_subscriber_pdp_data {
- struct llist_head list;
-
- unsigned int context_id;
- uint16_t pdp_type;
- char apn_str[GSM_APN_LENGTH];
- uint8_t qos_subscribed[20];
- size_t qos_subscribed_len;
- uint8_t pdp_charg[2];
- bool has_pdp_charg;
-};
-
-struct sgsn_subscriber_data {
- struct sgsn_mm_ctx *mm;
- struct gsm_auth_tuple auth_triplets[5];
- int auth_triplets_updated;
- struct llist_head pdp_list;
- int error_cause;
-
- uint8_t msisdn[9];
- size_t msisdn_len;
-
- uint8_t hlr[9];
- size_t hlr_len;
-
- uint8_t pdp_charg[2];
- bool has_pdp_charg;
-};
-
-#define SGSN_ERROR_CAUSE_NONE (-1)
-
-#define LOGGSUBSCRP(level, subscr, fmt, args...) \
- LOGP(DGPRS, level, "SUBSCR(%s) " fmt, \
- (subscr) ? (subscr)->imsi : "---", \
- ## args)
-
-struct sgsn_config;
-struct sgsn_instance;
-extern const struct value_string *sgsn_auth_state_names;
-
-void sgsn_auth_init(void);
-struct imsi_acl_entry *sgsn_acl_lookup(const char *imsi, struct sgsn_config *cfg);
-int sgsn_acl_add(const char *imsi, struct sgsn_config *cfg);
-int sgsn_acl_del(const char *imsi, struct sgsn_config *cfg);
-/* Request authorization */
-int sgsn_auth_request(struct sgsn_mm_ctx *mm);
-enum sgsn_auth_state sgsn_auth_state(struct sgsn_mm_ctx *mm);
-void sgsn_auth_update(struct sgsn_mm_ctx *mm);
-struct gsm_auth_tuple *sgsn_auth_get_tuple(struct sgsn_mm_ctx *mmctx,
- unsigned key_seq);
-
-/*
- * GPRS subscriber data
- */
-#define GPRS_SUBSCRIBER_FIRST_CONTACT 0x00000001
-#define GPRS_SUBSCRIBER_UPDATE_AUTH_INFO_PENDING (1 << 16)
-#define GPRS_SUBSCRIBER_UPDATE_LOCATION_PENDING (1 << 17)
-#define GPRS_SUBSCRIBER_CANCELLED (1 << 18)
-#define GPRS_SUBSCRIBER_ENABLE_PURGE (1 << 19)
-
-#define GPRS_SUBSCRIBER_UPDATE_PENDING_MASK ( \
- GPRS_SUBSCRIBER_UPDATE_LOCATION_PENDING | \
- GPRS_SUBSCRIBER_UPDATE_AUTH_INFO_PENDING \
-)
-
-int gprs_subscr_init(struct sgsn_instance *sgi);
-int gprs_subscr_request_update_location(struct sgsn_mm_ctx *mmctx);
-int gprs_subscr_request_auth_info(struct sgsn_mm_ctx *mmctx,
- const uint8_t *auts,
- const uint8_t *auts_rand);
-int gprs_subscr_auth_sync(struct gprs_subscr *subscr,
- const uint8_t *auts, const uint8_t *auts_rand);
-void gprs_subscr_cleanup(struct gprs_subscr *subscr);
-struct gprs_subscr *gprs_subscr_get_or_create(const char *imsi);
-struct gprs_subscr *gprs_subscr_get_or_create_by_mmctx( struct sgsn_mm_ctx *mmctx);
-struct gprs_subscr *gprs_subscr_get_by_imsi(const char *imsi);
-void gprs_subscr_cancel(struct gprs_subscr *subscr);
-void gprs_subscr_update(struct gprs_subscr *subscr);
-void gprs_subscr_update_auth_info(struct gprs_subscr *subscr);
-int gprs_subscr_rx_gsup_message(struct msgb *msg);
-
-/* Called on subscriber data updates */
-void sgsn_update_subscriber_data(struct sgsn_mm_ctx *mmctx);
-
-int gprs_sndcp_vty_init(void);
-struct sgsn_instance;
-int sgsn_gtp_init(struct sgsn_instance *sgi);
-
-void sgsn_rate_ctr_init();
-
-#endif /* _GPRS_SGSN_H */
diff --git a/include/openbsc/gprs_sndcp.h b/include/openbsc/gprs_sndcp.h
deleted file mode 100644
index d970240e4..000000000
--- a/include/openbsc/gprs_sndcp.h
+++ /dev/null
@@ -1,79 +0,0 @@
-#ifndef _INT_SNDCP_H
-#define _INT_SNDCP_H
-
-#include <stdint.h>
-#include <osmocom/core/linuxlist.h>
-
-/* A fragment queue header, maintaining list of fragments for one N-PDU */
-struct defrag_state {
- /* PDU number for which the defragmentation state applies */
- uint16_t npdu;
- /* highest segment number we have received so far */
- uint8_t highest_seg;
- /* bitmask of the segments we already have */
- uint32_t seg_have;
- /* do we still expect more segments? */
- unsigned int no_more;
- /* total length of all segments together */
- unsigned int tot_len;
-
- /* linked list of defrag_queue_entry: one for each fragment */
- struct llist_head frag_list;
-
- struct osmo_timer_list timer;
-
- /* Holds state to know which compression mode is used
- * when the packet is re-assembled */
- uint8_t pcomp;
- uint8_t dcomp;
-
- /* Holds the pointers to the compression entity list
- * that is used when the re-assembled packet is decompressed */
- struct llist_head *proto;
- struct llist_head *data;
-};
-
-/* See 6.7.1.2 Reassembly */
-enum sndcp_rx_state {
- SNDCP_RX_S_FIRST,
- SNDCP_RX_S_SUBSEQ,
- SNDCP_RX_S_DISCARD,
-};
-
-struct gprs_sndcp_entity {
- struct llist_head list;
-
- /* FIXME: move this RA_ID up to the LLME or even higher */
- struct gprs_ra_id ra_id;
- /* reference to the LLC Entity below this SNDCP entity */
- struct gprs_llc_lle *lle;
- /* The NSAPI we shall use on top of LLC */
- uint8_t nsapi;
-
- /* NPDU number for the GTP->SNDCP side */
- uint16_t tx_npdu_nr;
- /* SNDCP eeceiver state */
- enum sndcp_rx_state rx_state;
- /* The defragmentation queue */
- struct defrag_state defrag;
-};
-
-extern struct llist_head gprs_sndcp_entities;
-
-/* Set of SNDCP-XID negotiation (See also: TS 144 065,
- * Section 6.8 XID parameter negotiation) */
-int sndcp_sn_xid_req(struct gprs_llc_lle *lle, uint8_t nsapi);
-
-/* Process SNDCP-XID indication (See also: TS 144 065,
- * Section 6.8 XID parameter negotiation) */
-int sndcp_sn_xid_ind(struct gprs_llc_xid_field *xid_field_indication,
- struct gprs_llc_xid_field *xid_field_response,
- struct gprs_llc_lle *lle);
-
-/* Process SNDCP-XID indication
- * (See also: TS 144 065, Section 6.8 XID parameter negotiation) */
-int sndcp_sn_xid_conf(struct gprs_llc_xid_field *xid_field_conf,
- struct gprs_llc_xid_field *xid_field_request,
- struct gprs_llc_lle *lle);
-
-#endif /* INT_SNDCP_H */
diff --git a/include/openbsc/gprs_sndcp_comp.h b/include/openbsc/gprs_sndcp_comp.h
deleted file mode 100644
index 87ab6382a..000000000
--- a/include/openbsc/gprs_sndcp_comp.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/* GPRS SNDCP header compression entity management tools */
-
-/* (C) 2016 by sysmocom s.f.m.c. GmbH <info@sysmocom.de>
- * All Rights Reserved
- *
- * Author: Philipp Maier
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation; either version 3 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#pragma once
-
-#include <stdint.h>
-#include <osmocom/core/linuxlist.h>
-#include <openbsc/gprs_sndcp_xid.h>
-
-/* Header / Data compression entity */
-struct gprs_sndcp_comp {
- struct llist_head list;
-
- /* Serves as an ID in case we want to delete this entity later */
- unsigned int entity; /* see also: 6.5.1.1.3 and 6.6.1.1.3 */
-
- /* Specifies to which NSAPIs the compression entity is assigned */
- uint8_t nsapi_len; /* Number of applicable NSAPIs (default 0) */
- uint8_t nsapi[MAX_NSAPI]; /* Applicable NSAPIs (default 0) */
-
- /* Assigned pcomp values */
- uint8_t comp_len; /* Number of contained PCOMP / DCOMP values */
- uint8_t comp[MAX_COMP]; /* see also: 6.5.1.1.5 and 6.6.1.1.5 */
-
- /* Algorithm parameters */
- int algo; /* Algorithm type (see gprs_sndcp_xid.h) */
- int compclass; /* See gprs_sndcp_xid.h/c */
- void *state; /* Algorithm status and parameters */
-};
-
-#define MAX_COMP 16 /* Maximum number of possible pcomp/dcomp values */
-#define MAX_NSAPI 11 /* Maximum number usable NSAPIs */
-
-/* Allocate a compression enitiy list */
-struct llist_head *gprs_sndcp_comp_alloc(const void *ctx);
-
-/* Free a compression entitiy list */
-void gprs_sndcp_comp_free(struct llist_head *comp_entities);
-
-/* Delete a compression entity */
-void gprs_sndcp_comp_delete(struct llist_head *comp_entities, unsigned int entity);
-
-/* Create and Add a new compression entity
- * (returns a pointer to the compression entity that has just been created) */
-struct gprs_sndcp_comp *gprs_sndcp_comp_add(const void *ctx,
- struct llist_head *comp_entities,
- const struct gprs_sndcp_comp_field
- *comp_field);
-
-/* Find which compression entity handles the specified pcomp/dcomp */
-struct gprs_sndcp_comp *gprs_sndcp_comp_by_comp(const struct llist_head
- *comp_entities, uint8_t comp);
-
-/* Find which compression entity handles the specified nsapi */
-struct gprs_sndcp_comp *gprs_sndcp_comp_by_nsapi(const struct llist_head
- *comp_entities, uint8_t nsapi);
-
-/* Find a comp_index for a given pcomp/dcomp value */
-uint8_t gprs_sndcp_comp_get_idx(const struct gprs_sndcp_comp *comp_entity,
- uint8_t comp);
-
-/* Find a pcomp/dcomp value for a given comp_index */
-uint8_t gprs_sndcp_comp_get_comp(const struct gprs_sndcp_comp *comp_entity,
- uint8_t comp_index);
diff --git a/include/openbsc/gprs_sndcp_dcomp.h b/include/openbsc/gprs_sndcp_dcomp.h
deleted file mode 100644
index a76b4a4b3..000000000
--- a/include/openbsc/gprs_sndcp_dcomp.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* GPRS SNDCP data compression handler */
-
-/* (C) 2016 by sysmocom s.f.m.c. GmbH <info@sysmocom.de>
- * All Rights Reserved
- *
- * Author: Philipp Maier
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation; either version 3 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#pragma once
-
-#include <stdint.h>
-#include <osmocom/core/linuxlist.h>
-#include <openbsc/gprs_sndcp_comp.h>
-
-/* Note: The decompressed packet may have a maximum size of:
- * Return value * MAX_DATADECOMPR_FAC */
-#define MAX_DATADECOMPR_FAC 10
-
-/* Note: In unacknowledged mode (SN_UNITDATA), the comression state is reset
- * for every NPDU. The compressor needs a reasonably large payload to operate
- * effectively (yield positive compression gain). For packets shorter than 100
- * byte, no positive compression gain can be expected so we will skip the
- * compression for short packets. */
-#define MIN_COMPR_PAYLOAD 100
-
-/* Initalize data compression */
-int gprs_sndcp_dcomp_init(const void *ctx, struct gprs_sndcp_comp *comp_entity,
- const struct gprs_sndcp_comp_field *comp_field);
-
-/* Terminate data compression */
-void gprs_sndcp_dcomp_term(struct gprs_sndcp_comp *comp_entity);
-
-/* Expand packet */
-int gprs_sndcp_dcomp_expand(uint8_t *data, unsigned int len, uint8_t pcomp,
- const struct llist_head *comp_entities);
-
-/* Compress packet */
-int gprs_sndcp_dcomp_compress(uint8_t *data, unsigned int len, uint8_t *pcomp,
- const struct llist_head *comp_entities,
- uint8_t nsapi);
diff --git a/include/openbsc/gprs_sndcp_pcomp.h b/include/openbsc/gprs_sndcp_pcomp.h
deleted file mode 100644
index 4e15b9be2..000000000
--- a/include/openbsc/gprs_sndcp_pcomp.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/* GPRS SNDCP header compression handler */
-
-/* (C) 2016 by sysmocom s.f.m.c. GmbH <info@sysmocom.de>
- * All Rights Reserved
- *
- * Author: Philipp Maier
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation; either version 3 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#pragma once
-
-#include <stdint.h>
-#include <osmocom/core/linuxlist.h>
-#include <openbsc/gprs_sndcp_comp.h>
-
-/* Note: The decompressed packet may have a maximum size of:
- * Return value + MAX_DECOMPR_INCR */
-#define MAX_HDRDECOMPR_INCR 64
-
-/* Initalize header compression */
-int gprs_sndcp_pcomp_init(const void *ctx, struct gprs_sndcp_comp *comp_entity,
- const struct gprs_sndcp_comp_field *comp_field);
-
-/* Terminate header compression */
-void gprs_sndcp_pcomp_term(struct gprs_sndcp_comp *comp_entity);
-
-/* Expand packet header */
-int gprs_sndcp_pcomp_expand(uint8_t *data, unsigned int len, uint8_t pcomp,
- const struct llist_head *comp_entities);
-
-/* Compress packet header */
-int gprs_sndcp_pcomp_compress(uint8_t *data, unsigned int len, uint8_t *pcomp,
- const struct llist_head *comp_entities,
- uint8_t nsapi);
diff --git a/include/openbsc/gprs_sndcp_xid.h b/include/openbsc/gprs_sndcp_xid.h
deleted file mode 100644
index e64bc5237..000000000
--- a/include/openbsc/gprs_sndcp_xid.h
+++ /dev/null
@@ -1,218 +0,0 @@
-/* GPRS SNDCP XID field encoding/decoding as per 3GPP TS 44.065 */
-
-/* (C) 2016 by sysmocom s.f.m.c. GmbH <info@sysmocom.de>
- * All Rights Reserved
- *
- * Author: Philipp Maier
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation; either version 3 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#pragma once
-
-#include <stdint.h>
-#include <osmocom/core/linuxlist.h>
-
-#define DEFAULT_SNDCP_VERSION 0 /* See 3GPP TS 44.065, clause 8 */
-#define MAX_ENTITIES 32 /* 3GPP TS 44.065 reserves 5 bit
- * for compression enitity number */
-
-#define MAX_COMP 16 /* Maximum number of possible pcomp/dcomp values */
-#define MAX_NSAPI 11 /* Maximum number usable NSAPIs */
-#define MAX_ROHC 16 /* Maximum number of ROHC compression profiles */
-
-/* According to: 3GPP TS 44.065, 6.5.1.1 Format of the protocol control
- * information compression field (Figure 7) and 3GPP TS 44.065,
- * 6.6.1.1 Format of the data compression field (Figure 9) */
-struct gprs_sndcp_comp_field {
- struct llist_head list;
-
- /* Propose bit (P), see also: 6.5.1.1.2 and 6.6.1.1.2 */
- unsigned int p;
-
- /* Entity number, see also: 6.5.1.1.3 and 6.6.1.1.3 */
- unsigned int entity;
-
- /* Algorithm identifier, see also: 6.5.1.1.4 and 6.6.1.1.4 */
- int algo;
-
- /* Number of contained PCOMP / DCOMP values */
- uint8_t comp_len;
-
- /* PCOMP / DCOMP values, see also: 6.5.1.1.5 and 6.6.1.1.5 */
- uint8_t comp[MAX_COMP];
-
- /* Note: Only one of the following struct pointers may,
- be used. Unused pointers must be set to NULL! */
- struct gprs_sndcp_pcomp_rfc1144_params *rfc1144_params;
- struct gprs_sndcp_pcomp_rfc2507_params *rfc2507_params;
- struct gprs_sndcp_pcomp_rohc_params *rohc_params;
- struct gprs_sndcp_dcomp_v42bis_params *v42bis_params;
- struct gprs_sndcp_dcomp_v44_params *v44_params;
-};
-
-/* According to: 3GPP TS 44.065, 6.5.1.1.4 Algorithm identifier */
-enum gprs_sndcp_hdr_comp_algo {
- RFC_1144, /* TCP/IP header compression, see also 6.5.2 */
- RFC_2507, /* TCP/UDP/IP header compression, see also: 6.5.3 */
- ROHC /* Robust Header Compression, see also 6.5.4 */
-};
-
-/* According to: 3GPP TS 44.065, 6.5.1.1.4 Algorithm identifier */
-enum gprs_sndcp_data_comp_algo {
- V42BIS, /* V.42bis data compression, see also 6.6.2 */
- V44 /* V44 data compression, see also: 6.6.3 */
-};
-
-/* According to: 3GPP TS 44.065, 8 SNDCP XID parameters */
-enum gprs_sndcp_xid_param_types {
- SNDCP_XID_VERSION_NUMBER,
- SNDCP_XID_DATA_COMPRESSION, /* See also: subclause 6.6.1 */
- SNDCP_XID_PROTOCOL_COMPRESSION, /* See also: subclause 6.5.1 */
-};
-
-/* According to: 3GPP TS 44.065, 6.5.2.1 Parameters (Table 5) */
-struct gprs_sndcp_pcomp_rfc1144_params {
- uint8_t nsapi_len; /* Number of applicable NSAPIs
- * (default 0) */
- uint8_t nsapi[MAX_NSAPI]; /* Applicable NSAPIs (default 0) */
- int s01; /* (default 15) */
-};
-
-/* According to: 3GPP TS 44.065, 6.5.2.2 Assignment of PCOMP values */
-enum gprs_sndcp_pcomp_rfc1144_pcomp {
- RFC1144_PCOMP1, /* Uncompressed TCP */
- RFC1144_PCOMP2, /* Compressed TCP */
- RFC1144_PCOMP_NUM /* Number of pcomp values */
-};
-
-/* According to: 3GPP TS 44.065, 6.5.3.1 Parameters (Table 6) */
-struct gprs_sndcp_pcomp_rfc2507_params {
- uint8_t nsapi_len; /* Number of applicable NSAPIs
- * (default 0) */
- uint8_t nsapi[MAX_NSAPI]; /* Applicable NSAPIs (default 0) */
- int f_max_period; /* (default 256) */
- int f_max_time; /* (default 5) */
- int max_header; /* (default 168) */
- int tcp_space; /* (default 15) */
- int non_tcp_space; /* (default 15) */
-};
-
-/* According to: 3GPP TS 44.065, 6.5.3.2 Assignment of PCOMP values for RFC2507 */
-enum gprs_sndcp_pcomp_rfc2507_pcomp {
- RFC2507_PCOMP1, /* Full Header */
- RFC2507_PCOMP2, /* Compressed TCP */
- RFC2507_PCOMP3, /* Compressed TCP non delta */
- RFC2507_PCOMP4, /* Compressed non TCP */
- RFC2507_PCOMP5, /* Context state */
- RFC2507_PCOMP_NUM /* Number of pcomp values */
-};
-
-/* According to: 3GPP TS 44.065, 6.5.4.1 Parameter (Table 10) */
-struct gprs_sndcp_pcomp_rohc_params {
- uint8_t nsapi_len; /* Number of applicable NSAPIs
- * (default 0) */
- uint8_t nsapi[MAX_NSAPI]; /* Applicable NSAPIs (default 0) */
- int max_cid; /* (default 15) */
- int max_header; /* (default 168) */
- uint8_t profile_len; /* (default 1) */
- uint16_t profile[MAX_ROHC]; /* (default 0, ROHC uncompressed) */
-};
-
-/* According to: 3GPP TS 44.065, 6.5.4.2 Assignment of PCOMP values for ROHC */
-enum gprs_sndcp_pcomp_rohc_pcomp {
- ROHC_PCOMP1, /* ROHC small CIDs */
- ROHC_PCOMP2, /* ROHC large CIDs */
- ROHC_PCOMP_NUM /* Number of pcomp values */
-};
-
-/* ROHC compression profiles, see also:
- http://www.iana.org/assignments/rohc-pro-ids/rohc-pro-ids.xhtml */
-enum gprs_sndcp_xid_rohc_profiles {
- ROHC_UNCOMPRESSED = 0x0000, /* ROHC uncompressed [RFC5795] */
- ROHC_RTP = 0x0001, /* ROHC RTP [RFC3095] */
- ROHCV2_RTP = 0x0101, /* ROHCv2 RTP [RFC5225] */
- ROHC_UDP = 0x0002, /* ROHC UDP [RFC3095] */
- ROHCv2_UDP = 0x0102, /* ROHCv2 UDP [RFC5225] */
- ROHC_ESP = 0x0003, /* ROHC ESP [RFC3095] */
- ROHCV2_ESP = 0x0103, /* ROHCv2 ESP [RFC5225] */
- ROHC_IP = 0x0004, /* ROHC IP [RFC3843] */
- ROHCV2_IP = 0x0104, /* ROHCv2 IP [RFC5225] */
- ROHC_LLA = 0x0005, /* ROHC LLA [RFC4362] */
- ROHC_LLA_WITH_R_MODE = 0x0105, /* ROHC LLA with R-mode [RFC3408] */
- ROHC_TCP = 0x0006, /* ROHC TCP [RFC6846] */
- ROHC_RTP_UDP_LITE = 0x0007, /* ROHC RTP/UDP-Lite [RFC4019] */
- ROHCV2_RTP_UDP_LITE = 0x0107, /* ROHCv2 RTP/UDP-Lite [RFC5225] */
- ROHC_UDP_LITE = 0x0008, /* ROHC UDP-Lite [RFC4019] */
- ROHCV2_UDP_LITE = 0x0108, /* ROHCv2 UDP-Lite [RFC5225] */
-};
-
-/* According to: 3GPP TS 44.065, 6.6.2.1 Parameters (Table 7a) */
-struct gprs_sndcp_dcomp_v42bis_params {
- uint8_t nsapi_len; /* Number of applicable NSAPIs
- * (default 0) */
- uint8_t nsapi[MAX_NSAPI]; /* Applicable NSAPIs (default 0) */
- int p0; /* (default 3) */
- int p1; /* (default 2048) */
- int p2; /* (default 20) */
-
-};
-
-/* According to: 3GPP TS 44.065, 6.6.2.2 Assignment of DCOMP values */
-enum gprs_sndcp_dcomp_v42bis_dcomp {
- V42BIS_DCOMP1, /* V.42bis enabled */
- V42BIS_DCOMP_NUM /* Number of dcomp values */
-};
-
-/* According to: 3GPP TS 44.065, 6.6.3.1 Parameters (Table 7c) */
-struct gprs_sndcp_dcomp_v44_params {
- uint8_t nsapi_len; /* Number of applicable NSAPIs
- * (default 0) */
- uint8_t nsapi[MAX_NSAPI]; /* Applicable NSAPIs (default 0) */
- int c0; /* (default 10000000) */
- int p0; /* (default 3) */
- int p1t; /* Refer to subclause 6.6.3.1.4 */
- int p1r; /* Refer to subclause 6.6.3.1.5 */
- int p3t; /* (default 3 x p1t) */
- int p3r; /* (default 3 x p1r) */
-};
-
-/* According to: 3GPP TS 44.065, 6.6.3.2 Assignment of DCOMP values */
-enum gprs_sndcp_dcomp_v44_dcomp {
- V44_DCOMP1, /* Packet method compressed */
- V44_DCOMP2, /* Multi packet method compressed */
- V44_DCOMP_NUM /* Number of dcomp values */
-};
-
-/* Transform a list with compression fields into an SNDCP-XID message (dst) */
-int gprs_sndcp_compile_xid(uint8_t *dst, unsigned int dst_maxlen,
- const struct llist_head *comp_fields, int version);
-
-/* Transform an SNDCP-XID message (src) into a list of SNDCP-XID fields */
-struct llist_head *gprs_sndcp_parse_xid(int *version,
- const void *ctx,
- const uint8_t *src,
- unsigned int src_len,
- const struct llist_head
- *comp_fields_req);
-
-/* Find out to which compression class the specified comp-field belongs
- * (header compression or data compression?) */
-int gprs_sndcp_get_compression_class(
- const struct gprs_sndcp_comp_field *comp_field);
-
-/* Dump a list with SNDCP-XID fields (Debug) */
-void gprs_sndcp_dump_comp_fields(const struct llist_head *comp_fields,
- unsigned int logl);
-
diff --git a/include/openbsc/gprs_subscriber.h b/include/openbsc/gprs_subscriber.h
deleted file mode 100644
index be78febff..000000000
--- a/include/openbsc/gprs_subscriber.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/* GPRS subscriber details for use in SGSN land */
-#pragma once
-
-#include <stdint.h>
-
-#include <osmocom/core/linuxlist.h>
-#include <osmocom/gsm/protocol/gsm_23_003.h>
-
-extern struct llist_head * const gprs_subscribers;
-
-struct gprs_subscr {
- struct llist_head entry;
- int use_count;
-
- char imsi[GSM23003_IMSI_MAX_DIGITS+1];
- uint32_t tmsi;
- char imei[GSM23003_IMEISV_NUM_DIGITS+1];
- bool authorized;
- bool keep_in_ram;
- uint32_t flags;
- uint16_t lac;
-
- struct sgsn_subscriber_data *sgsn_data;
-};
-
-struct gprs_subscr *_gprs_subscr_get(struct gprs_subscr *gsub,
- const char *file, int line);
-struct gprs_subscr *_gprs_subscr_put(struct gprs_subscr *gsub,
- const char *file, int line);
-#define gprs_subscr_get(gsub) _gprs_subscr_get(gsub, __BASE_FILE__, __LINE__)
-#define gprs_subscr_put(gsub) _gprs_subscr_put(gsub, __BASE_FILE__, __LINE__)
diff --git a/include/openbsc/gprs_utils.h b/include/openbsc/gprs_utils.h
deleted file mode 100644
index 574f5c50c..000000000
--- a/include/openbsc/gprs_utils.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* GPRS utility functions */
-
-/* (C) 2010 by Harald Welte <laforge@gnumonks.org>
- * (C) 2010-2014 by On-Waves
- * (C) 2013 by Holger Hans Peter Freyther
- * All Rights Reserved
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation; either version 3 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-#pragma once
-
-#include <stdint.h>
-#include <sys/types.h>
-
-struct msgb;
-struct gprs_ra_id;
-
-struct msgb *gprs_msgb_copy(const struct msgb *msg, const char *name);
-int gprs_msgb_resize_area(struct msgb *msg, uint8_t *area,
- size_t old_size, size_t new_size);
-int gprs_str_to_apn(uint8_t *apn_enc, size_t max_len, const char *str);
-
-/* GSM 04.08, 10.5.7.3 GPRS Timer */
-int gprs_tmr_to_secs(uint8_t tmr);
-uint8_t gprs_secs_to_tmr_floor(int secs);
-
-int gprs_is_mi_tmsi(const uint8_t *value, size_t value_len);
-int gprs_is_mi_imsi(const uint8_t *value, size_t value_len);
-int gprs_parse_mi_tmsi(const uint8_t *value, size_t value_len, uint32_t *tmsi);
-void gprs_parse_tmsi(const uint8_t *value, uint32_t *tmsi);
-
-int gprs_ra_id_equals(const struct gprs_ra_id *id1, const struct gprs_ra_id *id2);
diff --git a/include/openbsc/nat_rewrite_trie.h b/include/openbsc/nat_rewrite_trie.h
deleted file mode 100644
index 0571099c6..000000000
--- a/include/openbsc/nat_rewrite_trie.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * (C) 2013 by On-Waves
- * (C) 2013 by Holger Hans Peter Freyther <zecke@selfish.org>
- * All Rights Reserved
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation; either version 3 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-#ifndef NAT_REWRITE_FILE_H
-#define NAT_REWRITE_FILE_H
-
-#include <osmocom/core/linuxrbtree.h>
-
-struct vty;
-
-struct nat_rewrite_rule {
- /* For digits 0-9 and + */
- struct nat_rewrite_rule *rules[11];
-
- char empty;
- char prefix[14];
- char rewrite[6];
-};
-
-struct nat_rewrite {
- struct nat_rewrite_rule rule;
- size_t prefixes;
-};
-
-
-struct nat_rewrite *nat_rewrite_parse(void *ctx, const char *filename);
-struct nat_rewrite_rule *nat_rewrite_lookup(struct nat_rewrite *, const char *prefix);
-void nat_rewrite_dump(struct nat_rewrite *rewr);
-void nat_rewrite_dump_vty(struct vty *vty, struct nat_rewrite *rewr);
-
-#endif
diff --git a/include/openbsc/paging.h b/include/openbsc/paging.h
index 7dd8500ac..049da1402 100644
--- a/include/openbsc/paging.h
+++ b/include/openbsc/paging.h
@@ -27,7 +27,6 @@
#include <osmocom/core/timer.h>
#include <openbsc/gsm_data.h>
-#include <openbsc/bsc_subscriber.h>
/**
* A pending paging request
diff --git a/include/openbsc/pcu_if.h b/include/openbsc/pcu_if.h
deleted file mode 100644
index 1f398b4aa..000000000
--- a/include/openbsc/pcu_if.h
+++ /dev/null
@@ -1,35 +0,0 @@
-#ifndef _PCU_IF_H
-#define _PCU_IF_H
-
-#include <osmocom/gsm/l1sap.h>
-
-extern int pcu_direct;
-
-struct pcu_sock_state {
- struct gsm_network *net;
- struct osmo_fd listen_bfd; /* fd for listen socket */
- struct osmo_fd conn_bfd; /* fd for connection to lcr */
- struct llist_head upqueue; /* queue for sending messages */
-};
-
-/* PCU relevant information has changed; Inform PCU (if connected) */
-void pcu_info_update(struct gsm_bts *bts);
-
-/* Forward rach indication to PCU */
-int pcu_tx_rach_ind(struct gsm_bts *bts, int16_t qta, uint16_t ra, uint32_t fn,
- uint8_t is_11bit, enum ph_burst_type burst_type);
-
-/* Confirm the sending of an immediate assignment to the pcu */
-int pcu_tx_imm_ass_sent(struct gsm_bts *bts, uint32_t tlli);
-
-
-/* Confirm the sending of an immediate assignment to the pcu */
-int pcu_tx_imm_ass_sent(struct gsm_bts *bts, uint32_t tlli);
-
-/* Open connection to PCU */
-int pcu_sock_init(const char *path, struct gsm_bts *bts);
-
-/* Close connection to PCU */
-void pcu_sock_exit(struct gsm_bts *bts);
-
-#endif /* _PCU_IF_H */
diff --git a/include/openbsc/pcuif_proto.h b/include/openbsc/pcuif_proto.h
deleted file mode 100644
index eb28d66bc..000000000
--- a/include/openbsc/pcuif_proto.h
+++ /dev/null
@@ -1,176 +0,0 @@
-#ifndef _PCUIF_PROTO_H
-#define _PCUIF_PROTO_H
-
-#define PCU_IF_VERSION 0x08
-
-/* msg_type */
-#define PCU_IF_MSG_DATA_REQ 0x00 /* send data to given channel */
-#define PCU_IF_MSG_DATA_CNF 0x01 /* confirm (e.g. transmission on PCH) */
-#define PCU_IF_MSG_DATA_IND 0x02 /* receive data from given channel */
-#define PCU_IF_MSG_DATA_CNF_DT 0x11 /* confirm (with direct tlli) */
-#define PCU_IF_MSG_RTS_REQ 0x10 /* ready to send request */
-#define PCU_IF_MSG_RACH_IND 0x22 /* receive RACH */
-#define PCU_IF_MSG_INFO_IND 0x32 /* retrieve BTS info */
-#define PCU_IF_MSG_ACT_REQ 0x40 /* activate/deactivate PDCH */
-#define PCU_IF_MSG_TIME_IND 0x52 /* GSM time indication */
-#define PCU_IF_MSG_PAG_REQ 0x60 /* paging request */
-
-/* sapi */
-#define PCU_IF_SAPI_RACH 0x01 /* channel request on CCCH */
-#define PCU_IF_SAPI_AGCH 0x02 /* assignment on AGCH */
-#define PCU_IF_SAPI_PCH 0x03 /* paging/assignment on PCH */
-#define PCU_IF_SAPI_BCCH 0x04 /* SI on BCCH */
-#define PCU_IF_SAPI_PDTCH 0x05 /* packet data/control/ccch block */
-#define PCU_IF_SAPI_PRACH 0x06 /* packet random access channel */
-#define PCU_IF_SAPI_PTCCH 0x07 /* packet TA control channel */
-#define PCU_IF_SAPI_AGCH_DT 0x08 /* assignment on AGCH but with additional TLLI */
-
-/* flags */
-#define PCU_IF_FLAG_ACTIVE (1 << 0)/* BTS is active */
-#define PCU_IF_FLAG_SYSMO (1 << 1)/* access PDCH of sysmoBTS directly */
-#define PCU_IF_FLAG_CS1 (1 << 16)
-#define PCU_IF_FLAG_CS2 (1 << 17)
-#define PCU_IF_FLAG_CS3 (1 << 18)
-#define PCU_IF_FLAG_CS4 (1 << 19)
-#define PCU_IF_FLAG_MCS1 (1 << 20)
-#define PCU_IF_FLAG_MCS2 (1 << 21)
-#define PCU_IF_FLAG_MCS3 (1 << 22)
-#define PCU_IF_FLAG_MCS4 (1 << 23)
-#define PCU_IF_FLAG_MCS5 (1 << 24)
-#define PCU_IF_FLAG_MCS6 (1 << 25)
-#define PCU_IF_FLAG_MCS7 (1 << 26)
-#define PCU_IF_FLAG_MCS8 (1 << 27)
-#define PCU_IF_FLAG_MCS9 (1 << 28)
-
-struct gsm_pcu_if_data {
- uint8_t sapi;
- uint8_t len;
- uint8_t data[162];
- uint32_t fn;
- uint16_t arfcn;
- uint8_t trx_nr;
- uint8_t ts_nr;
- uint8_t block_nr;
- int8_t rssi;
- uint16_t ber10k; /*!< \brief BER in units of 0.01% */
- int16_t ta_offs_qbits; /* !< \brief Burst TA Offset in quarter bits */
- int16_t lqual_cb; /* !< \brief Link quality in centiBel */
-} __attribute__ ((packed));
-
-/* data confirmation with direct tlli (instead of raw mac block with tlli) */
-struct gsm_pcu_if_data_cnf_dt {
- uint8_t sapi;
- uint32_t tlli;
- uint32_t fn;
- uint16_t arfcn;
- uint8_t trx_nr;
- uint8_t ts_nr;
- uint8_t block_nr;
- int8_t rssi;
- uint16_t ber10k; /*!< \brief BER in units of 0.01% */
- int16_t ta_offs_qbits; /* !< \brief Burst TA Offset in quarter bits */
- int16_t lqual_cb; /* !< \brief Link quality in centiBel */
-} __attribute__ ((packed));
-
-struct gsm_pcu_if_rts_req {
- uint8_t sapi;
- uint8_t spare[3];
- uint32_t fn;
- uint16_t arfcn;
- uint8_t trx_nr;
- uint8_t ts_nr;
- uint8_t block_nr;
-} __attribute__ ((packed));
-
-struct gsm_pcu_if_rach_ind {
- uint8_t sapi;
- uint16_t ra;
- int16_t qta;
- uint32_t fn;
- uint16_t arfcn;
- uint8_t is_11bit;
- uint8_t burst_type;
-} __attribute__ ((packed));
-
-struct gsm_pcu_if_info_trx {
- uint16_t arfcn;
- uint8_t pdch_mask; /* PDCH channels per TS */
- uint8_t spare;
- uint8_t tsc[8]; /* TSC per channel */
- uint32_t hlayer1;
-} __attribute__ ((packed));
-
-struct gsm_pcu_if_info_ind {
- uint32_t version;
- uint32_t flags;
- struct gsm_pcu_if_info_trx trx[8]; /* TRX infos per BTS */
- uint8_t bsic;
- /* RAI */
- uint16_t mcc, mnc, lac, rac;
- /* NSE */
- uint16_t nsei;
- uint8_t nse_timer[7];
- uint8_t cell_timer[11];
- /* cell */
- uint16_t cell_id;
- uint16_t repeat_time;
- uint8_t repeat_count;
- uint16_t bvci;
- uint8_t t3142;
- uint8_t t3169;
- uint8_t t3191;
- uint8_t t3193_10ms;
- uint8_t t3195;
- uint8_t n3101;
- uint8_t n3103;
- uint8_t n3105;
- uint8_t cv_countdown;
- uint16_t dl_tbf_ext;
- uint16_t ul_tbf_ext;
- uint8_t initial_cs;
- uint8_t initial_mcs;
- /* NSVC */
- uint16_t nsvci[2];
- uint16_t local_port[2];
- uint16_t remote_port[2];
- uint32_t remote_ip[2];
-} __attribute__ ((packed));
-
-struct gsm_pcu_if_act_req {
- uint8_t activate;
- uint8_t trx_nr;
- uint8_t ts_nr;
- uint8_t spare;
-} __attribute__ ((packed));
-
-struct gsm_pcu_if_time_ind {
- uint32_t fn;
-} __attribute__ ((packed));
-
-struct gsm_pcu_if_pag_req {
- uint8_t sapi;
- uint8_t chan_needed;
- uint8_t identity_lv[9];
-} __attribute__ ((packed));
-
-struct gsm_pcu_if {
- /* context based information */
- uint8_t msg_type; /* message type */
- uint8_t bts_nr; /* bts number */
- uint8_t spare[2];
-
- union {
- struct gsm_pcu_if_data data_req;
- struct gsm_pcu_if_data data_cnf;
- struct gsm_pcu_if_data_cnf_dt data_cnf_dt;
- struct gsm_pcu_if_data data_ind;
- struct gsm_pcu_if_rts_req rts_req;
- struct gsm_pcu_if_rach_ind rach_ind;
- struct gsm_pcu_if_info_ind info_ind;
- struct gsm_pcu_if_act_req act_req;
- struct gsm_pcu_if_time_ind time_ind;
- struct gsm_pcu_if_pag_req pag_req;
- } u;
-} __attribute__ ((packed));
-
-#endif /* _PCUIF_PROTO_H */
diff --git a/include/openbsc/sgsn.h b/include/openbsc/sgsn.h
deleted file mode 100644
index f371dc695..000000000
--- a/include/openbsc/sgsn.h
+++ /dev/null
@@ -1,191 +0,0 @@
-#ifndef _SGSN_H
-#define _SGSN_H
-
-
-#include <osmocom/core/msgb.h>
-#include <osmocom/crypt/gprs_cipher.h>
-#include <osmocom/gprs/gprs_ns.h>
-#include <openbsc/gprs_sgsn.h>
-#include <openbsc/oap_client.h>
-#include <openbsc/common.h>
-
-#include <ares.h>
-
-struct gprs_gsup_client;
-struct hostent;
-
-enum sgsn_auth_policy {
- SGSN_AUTH_POLICY_OPEN,
- SGSN_AUTH_POLICY_CLOSED,
- SGSN_AUTH_POLICY_ACL_ONLY,
- SGSN_AUTH_POLICY_REMOTE
-};
-
-
-enum sgsn_rate_ctr_keys {
- CTR_LLC_DL_BYTES,
- CTR_LLC_UL_BYTES,
- CTR_LLC_DL_PACKETS,
- CTR_LLC_UL_PACKETS,
- CTR_GPRS_ATTACH_REQUEST,
- CTR_GPRS_ATTACH_ACKED,
- CTR_GPRS_ATTACH_REJECTED,
- CTR_GPRS_DETACH_REQUEST,
- CTR_GPRS_DETACH_ACKED,
- CTR_GPRS_ROUTING_AREA_REQUEST,
- CTR_GPRS_ROUTING_AREA_ACKED,
- CTR_GPRS_ROUTING_AREA_REJECT,
- /* PDP single packet counter / GSM 04.08 9.5.1 - 9.5.9 */
- CTR_PDP_ACTIVATE_REQUEST,
- CTR_PDP_ACTIVATE_REJECT,
- CTR_PDP_ACTIVATE_ACCEPT,
- CTR_PDP_REQUEST_ACTIVATE, /* unused */
- CTR_PDP_REQUEST_ACTIVATE_REJ, /* unused */
- CTR_PDP_MODIFY_REQUEST, /* unsued */
- CTR_PDP_MODIFY_ACCEPT, /* unused */
- CTR_PDP_DL_DEACTIVATE_REQUEST,
- CTR_PDP_DL_DEACTIVATE_ACCEPT,
- CTR_PDP_UL_DEACTIVATE_REQUEST,
- CTR_PDP_UL_DEACTIVATE_ACCEPT,
-};
-
-struct sgsn_cdr {
- char *filename;
- int interval;
-};
-
-struct sgsn_config {
- /* parsed from config file */
-
- char *gtp_statedir;
- struct sockaddr_in gtp_listenaddr;
-
- /* misc */
- struct gprs_ns_inst *nsi;
-
- enum sgsn_auth_policy auth_policy;
- enum gprs_ciph_algo cipher;
- struct llist_head imsi_acl;
-
- struct sockaddr_in gsup_server_addr;
- int gsup_server_port;
-
- int require_authentication;
- int require_update_location;
-
- /* CDR configuration */
- struct sgsn_cdr cdr;
-
- struct {
- int T3312;
- int T3322;
- int T3350;
- int T3360;
- int T3370;
- int T3313;
- int T3314;
- int T3316;
- int T3385;
- int T3386;
- int T3395;
- int T3397;
- } timers;
-
- int dynamic_lookup;
-
- struct oap_client_config oap;
-
- /* RFC1144 TCP/IP header compression */
- struct {
- int active;
- int passive;
- int s01;
- } pcomp_rfc1144;
-
- /* V.42vis data compression */
- struct {
- int active;
- int passive;
- int p0;
- int p1;
- int p2;
- } dcomp_v42bis;
-
- struct {
- int rab_assign_addr_enc;
- } iu;
-};
-
-struct sgsn_instance {
- char *config_file;
- struct sgsn_config cfg;
- /* File descriptor wrappers for LibGTP */
- struct osmo_fd gtp_fd0;
- struct osmo_fd gtp_fd1c;
- struct osmo_fd gtp_fd1u;
- /* Timer for libGTP */
- struct osmo_timer_list gtp_timer;
- /* GSN instance for libgtp */
- struct gsn_t *gsn;
- /* Subscriber */
- struct gsup_client *gsup_client;
- /* LLME inactivity timer */
- struct osmo_timer_list llme_timer;
-
- /* c-ares event loop integration */
- struct osmo_timer_list ares_timer;
- struct llist_head ares_fds;
- ares_channel ares_channel;
- struct ares_addr_node *ares_servers;
-
- struct rate_ctr_group *rate_ctrs;
-};
-
-extern struct sgsn_instance *sgsn;
-
-/* sgsn_vty.c */
-
-int sgsn_vty_init(struct sgsn_config *cfg);
-int sgsn_parse_config(const char *config_file);
-
-/* sgsn.c */
-
-/* Main input function for Gb proxy */
-int sgsn_rcvmsg(struct msgb *msg, struct gprs_nsvc *nsvc, uint16_t ns_bvci);
-
-
-struct sgsn_pdp_ctx *sgsn_create_pdp_ctx(struct sgsn_ggsn_ctx *ggsn,
- struct sgsn_mm_ctx *mmctx,
- uint16_t nsapi,
- struct tlv_parsed *tp);
-int sgsn_delete_pdp_ctx(struct sgsn_pdp_ctx *pctx);
-void sgsn_pdp_upd_gtp_u(struct sgsn_pdp_ctx *pdp, void *addr, size_t alen);
-
-/* gprs_sndcp.c */
-
-/* Entry point for the SNSM-ACTIVATE.indication */
-int sndcp_sm_activate_ind(struct gprs_llc_lle *lle, uint8_t nsapi);
-/* Entry point for the SNSM-DEACTIVATE.indication */
-int sndcp_sm_deactivate_ind(struct gprs_llc_lle *lle, uint8_t nsapi);
-/* Called by SNDCP when it has received/re-assembled a N-PDU */
-int sgsn_rx_sndcp_ud_ind(struct gprs_ra_id *ra_id, int32_t tlli, uint8_t nsapi,
- struct msgb *msg, uint32_t npdu_len, uint8_t *npdu);
-int sndcp_unitdata_req(struct msgb *msg, struct gprs_llc_lle *lle, uint8_t nsapi,
- void *mmcontext);
-int sndcp_llunitdata_ind(struct msgb *msg, struct gprs_llc_lle *lle,
- uint8_t *hdr, uint16_t len);
-
-
-/*
- * CDR related functionality
- */
-int sgsn_cdr_init(struct sgsn_instance *sgsn);
-
-
-/*
- * C-ARES related functionality
- */
-int sgsn_ares_init(struct sgsn_instance *sgsn);
-int sgsn_ares_query(struct sgsn_instance *sgsm, const char *name, ares_host_callback cb, void *data);
-
-#endif
diff --git a/include/openbsc/v42bis.h b/include/openbsc/v42bis.h
deleted file mode 100644
index 607a58e51..000000000
--- a/include/openbsc/v42bis.h
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * SpanDSP - a series of DSP components for telephony
- *
- * v42bis.h
- *
- * Written by Steve Underwood <steveu@coppice.org>
- *
- * Copyright (C) 2005, 2011 Steve Underwood
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 2.1,
- * as published by the Free Software Foundation.
- *
- * 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 Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-/*! \page v42bis_page V.42bis modem data compression
-\section v42bis_page_sec_1 What does it do?
-The v.42bis specification defines a data compression scheme, to work in
-conjunction with the error correction scheme defined in V.42.
-
-\section v42bis_page_sec_2 How does it work?
-*/
-
-#include <stdint.h>
-
-#if !defined(_SPANDSP_V42BIS_H_)
-#define _SPANDSP_V42BIS_H_
-
-#define SPAN_DECLARE(x) x
-
-#define V42BIS_MIN_STRING_SIZE 6
-#define V42BIS_MAX_STRING_SIZE 250
-#define V42BIS_MIN_DICTIONARY_SIZE 512
-#define V42BIS_MAX_BITS 12
-#define V42BIS_MAX_CODEWORDS 4096 /* 2^V42BIS_MAX_BITS */
-#define V42BIS_MAX_OUTPUT_LENGTH 1024
-
-enum
-{
- V42BIS_P0_NEITHER_DIRECTION = 0,
- V42BIS_P0_INITIATOR_RESPONDER,
- V42BIS_P0_RESPONDER_INITIATOR,
- V42BIS_P0_BOTH_DIRECTIONS
-};
-
-enum
-{
- V42BIS_COMPRESSION_MODE_DYNAMIC = 0,
- V42BIS_COMPRESSION_MODE_ALWAYS,
- V42BIS_COMPRESSION_MODE_NEVER
-};
-
-typedef void (*put_msg_func_t)(void *user_data, const uint8_t *msg, int len);
-
-/*!
- V.42bis compression/decompression descriptor. This defines the working state for a
- single instance of V.42bis compress/decompression.
-*/
-typedef struct v42bis_state_s v42bis_state_t;
-
-#if defined(__cplusplus)
-extern "C"
-{
-#endif
-
-/*! Compress a block of octets.
- \param s The V.42bis context.
- \param buf The data to be compressed.
- \param len The length of the data buffer.
- \return 0 */
-SPAN_DECLARE(int) v42bis_compress(v42bis_state_t *s, const uint8_t buf[], int len);
-
-/*! Flush out any data remaining in a compression buffer.
- \param s The V.42bis context.
- \return 0 */
-SPAN_DECLARE(int) v42bis_compress_flush(v42bis_state_t *s);
-
-/*! Decompress a block of octets.
- \param s The V.42bis context.
- \param buf The data to be decompressed.
- \param len The length of the data buffer.
- \return 0 */
-SPAN_DECLARE(int) v42bis_decompress(v42bis_state_t *s, const uint8_t buf[], int len);
-
-/*! Flush out any data remaining in the decompression buffer.
- \param s The V.42bis context.
- \return 0 */
-SPAN_DECLARE(int) v42bis_decompress_flush(v42bis_state_t *s);
-
-/*! Set the compression mode.
- \param s The V.42bis context.
- \param mode One of the V.42bis compression modes -
- V42BIS_COMPRESSION_MODE_DYNAMIC,
- V42BIS_COMPRESSION_MODE_ALWAYS,
- V42BIS_COMPRESSION_MODE_NEVER */
-SPAN_DECLARE(void) v42bis_compression_control(v42bis_state_t *s, int mode);
-
-/*! Initialise a V.42bis context.
- \param s The V.42bis context.
- \param negotiated_p0 The negotiated P0 parameter, from the V.42bis spec.
- \param negotiated_p1 The negotiated P1 parameter, from the V.42bis spec.
- \param negotiated_p2 The negotiated P2 parameter, from the V.42bis spec.
- \param encode_handler Encode callback handler.
- \param encode_user_data An opaque pointer passed to the encode callback handler.
- \param max_encode_len The maximum length that should be passed to the encode handler.
- \param decode_handler Decode callback handler.
- \param decode_user_data An opaque pointer passed to the decode callback handler.
- \param max_decode_len The maximum length that should be passed to the decode handler.
- \return The V.42bis context. */
-SPAN_DECLARE(v42bis_state_t *) v42bis_init(const void *ctx,
- v42bis_state_t *s,
- int negotiated_p0,
- int negotiated_p1,
- int negotiated_p2,
- put_msg_func_t encode_handler,
- void *encode_user_data,
- int max_encode_len,
- put_msg_func_t decode_handler,
- void *decode_user_data,
- int max_decode_len);
-
-/*! Release a V.42bis context.
- \param s The V.42bis context.
- \return 0 if OK */
-SPAN_DECLARE(int) v42bis_release(v42bis_state_t *s);
-
-/*! Free a V.42bis context.
- \param s The V.42bis context.
- \return 0 if OK */
-SPAN_DECLARE(int) v42bis_free(v42bis_state_t *s);
-
-#if defined(__cplusplus)
-}
-#endif
-
-#endif
-/*- End of file ------------------------------------------------------------*/
diff --git a/include/openbsc/v42bis_private.h b/include/openbsc/v42bis_private.h
deleted file mode 100644
index daa5ea315..000000000
--- a/include/openbsc/v42bis_private.h
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * SpanDSP - a series of DSP components for telephony
- *
- * private/v42bis.h
- *
- * Written by Steve Underwood <steveu@coppice.org>
- *
- * Copyright (C) 2005 Steve Underwood
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 2.1,
- * as published by the Free Software Foundation.
- *
- * 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 Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#if !defined(_SPANDSP_PRIVATE_V42BIS_H_)
-#define _SPANDSP_PRIVATE_V42BIS_H_
-
-/*!
- V.42bis dictionary node.
- Note that 0 is not a valid node to point to (0 is always a control code), so 0 is used
- as a "no such value" marker in this structure.
-*/
-typedef struct
-{
- /*! \brief The value of the octet represented by the current dictionary node */
- uint8_t node_octet;
- /*! \brief The parent of this node */
- uint16_t parent;
- /*! \brief The first child of this node */
- uint16_t child;
- /*! \brief The next node at the same depth */
- uint16_t next;
-} v42bis_dict_node_t;
-
-/*!
- V.42bis compression or decompression. This defines the working state for a single instance
- of V.42bis compression or decompression.
-*/
-typedef struct
-{
- /*! \brief Compression enabled. */
- int v42bis_parm_p0;
- /*! \brief Compression mode. */
- int compression_mode;
- /*! \brief Callback function to handle output data. */
- put_msg_func_t handler;
- /*! \brief An opaque pointer passed in calls to the data handler. */
- void *user_data;
- /*! \brief The maximum amount to be passed to the data handler. */
- int max_output_len;
-
- /*! \brief TRUE if we are in transparent (i.e. uncompressable) mode */
- int transparent;
- /*! \brief Next empty dictionary entry */
- uint16_t v42bis_parm_c1;
- /*! \brief Current codeword size */
- uint16_t v42bis_parm_c2;
- /*! \brief Threshold for codeword size change */
- uint16_t v42bis_parm_c3;
- /*! \brief The current update point in the dictionary */
- uint16_t update_at;
- /*! \brief The last entry matched in the dictionary */
- uint16_t last_matched;
- /*! \brief The last entry added to the dictionary */
- uint16_t last_added;
- /*! \brief Total number of codewords in the dictionary */
- int v42bis_parm_n2;
- /*! \brief Maximum permitted string length */
- int v42bis_parm_n7;
- /*! \brief The dictionary */
- v42bis_dict_node_t dict[V42BIS_MAX_CODEWORDS];
-
- /*! \brief The octet string in progress */
- uint8_t string[V42BIS_MAX_STRING_SIZE];
- /*! \brief The current length of the octet string in progress */
- int string_length;
- /*! \brief The amount of the octet string in progress which has already
- been flushed out of the buffer */
- int flushed_length;
-
- /*! \brief Compression performance metric */
- uint16_t compression_performance;
-
- /*! \brief Outgoing bit buffer (compression), or incoming bit buffer (decompression) */
- uint32_t bit_buffer;
- /*! \brief Outgoing bit count (compression), or incoming bit count (decompression) */
- int bit_count;
-
- /*! \brief The output composition buffer */
- uint8_t output_buf[V42BIS_MAX_OUTPUT_LENGTH];
- /*! \brief The length of the contents of the output composition buffer */
- int output_octet_count;
-
- /*! \brief The current value of the escape code */
- uint8_t escape_code;
- /*! \brief TRUE if we just hit an escape code, and are waiting for the following octet */
- int escaped;
-} v42bis_comp_state_t;
-
-/*!
- V.42bis compression/decompression descriptor. This defines the working state for a
- single instance of V.42bis compress/decompression.
-*/
-struct v42bis_state_s
-{
- /*! \brief Compression state. */
- v42bis_comp_state_t compress;
- /*! \brief Decompression state. */
- v42bis_comp_state_t decompress;
-
- /*! \brief Error and flow logging control */
-};
-
-#endif
-/*- End of file ------------------------------------------------------------*/