blob: 18ed81f37a0f1e8396144727be6906c44aa5cdb7 [file] [log] [blame]
Harald Welteb77c6972010-05-01 11:28:43 +02001#ifndef _GB_PROXY_H
2#define _GB_PROXY_H
3
Harald Welteb77c6972010-05-01 11:28:43 +02004
Pablo Neira Ayuso136f4532011-03-22 16:47:59 +01005#include <osmocom/core/msgb.h>
Harald Welteb77c6972010-05-01 11:28:43 +02006
Harald Welteea34a4e2012-06-16 14:59:56 +08007#include <osmocom/gprs/gprs_ns.h>
Harald Welte4b037e42010-05-19 19:45:32 +02008#include <osmocom/vty/command.h>
Harald Welteb77c6972010-05-01 11:28:43 +02009
Jacob Erlbeck91fb6802014-05-28 10:59:10 +020010enum gbproxy_patch_mode {
11 GBPROX_PATCH_DEFAULT,
12 GBPROX_PATCH_BSSGP, /*!< BSGGP messages only */
13 GBPROX_PATCH_LLC_ATTACH_REQ, /*!< BSSGP and Attach Request */
14 GBPROX_PATCH_LLC_ATTACH, /*!< BSSGP and Attach Request/Response */
15 GBPROX_PATCH_LLC_GMM, /*!< BSSGP and all GMM msgs */
16 GBPROX_PATCH_LLC, /*!< BSSGP and all supported LLC msgs */
17};
18
Harald Welteb77c6972010-05-01 11:28:43 +020019struct gbproxy_config {
20 /* parsed from config file */
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020021 uint16_t nsip_sgsn_nsei;
Harald Welteb77c6972010-05-01 11:28:43 +020022
23 /* misc */
24 struct gprs_ns_inst *nsi;
Jacob Erlbeck67a44452014-05-19 10:14:58 +020025
26 /* force mcc/mnc */
27 int core_mnc;
28 int core_mcc;
Jacob Erlbeck91fb6802014-05-28 10:59:10 +020029 enum gbproxy_patch_mode patch_mode;
Harald Welteb77c6972010-05-01 11:28:43 +020030};
31
Harald Welte672f5c42010-05-03 18:54:58 +020032extern struct gbproxy_config gbcfg;
Harald Welte85801d02010-05-11 05:49:43 +020033extern struct cmd_element show_gbproxy_cmd;
Jacob Erlbeck4211d792013-10-24 12:48:23 +020034extern struct cmd_element delete_gb_bvci_cmd;
35extern struct cmd_element delete_gb_nsei_cmd;
Harald Welteb77c6972010-05-01 11:28:43 +020036
37/* gb_proxy_vty .c */
38
39int gbproxy_vty_init(void);
40int gbproxy_parse_config(const char *config_file, struct gbproxy_config *cfg);
41
42
43/* gb_proxy.c */
44
45/* Main input function for Gb proxy */
Jacob Erlbecke75fec62013-10-15 12:00:27 +020046int gbprox_rcvmsg(struct msgb *msg, uint16_t nsei, uint16_t ns_bvci, uint16_t nsvci);
Harald Welteb77c6972010-05-01 11:28:43 +020047
Harald Weltec1c1dd22010-05-11 06:34:24 +020048int gbprox_signal(unsigned int subsys, unsigned int signal,
49 void *handler_data, void *signal_data);
Harald Welte1ccbf442010-05-14 11:53:08 +000050
51/* Reset all persistent NS-VC's */
52int gbprox_reset_persistent_nsvcs(struct gprs_ns_inst *nsi);
53
Jacob Erlbeckb32d3c02014-07-07 10:45:59 +020054int gbprox_dump_global(FILE *stream, int indent);
55int gbprox_dump_peers(FILE *stream, int indent);
Jacob Erlbeck72b401f2013-10-24 12:48:55 +020056void gbprox_reset();
Harald Welteb77c6972010-05-01 11:28:43 +020057#endif