aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/include
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-08-04 15:42:36 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-08-04 16:01:12 +0200
commiteece6277992a38559d6778badfb8840773f4108d (patch)
treeaf99c3669ef97c307f96c69c43d61f29bacdda50 /openbsc/include
parentfa7a8bc6eb78bc8d2e5356e3db5c9f6d6dbd33bb (diff)
gbproxy: Remove global state from the gbproxy
Global state prevents us from writing simple units tests for single routines. Go through the code and add pointers to the gbproxy configuration. Only the vty and the test code remain using the global gbproxy instance.
Diffstat (limited to 'openbsc/include')
-rw-r--r--openbsc/include/openbsc/gb_proxy.h13
1 files changed, 7 insertions, 6 deletions
diff --git a/openbsc/include/openbsc/gb_proxy.h b/openbsc/include/openbsc/gb_proxy.h
index eacd22104..7c38274dc 100644
--- a/openbsc/include/openbsc/gb_proxy.h
+++ b/openbsc/include/openbsc/gb_proxy.h
@@ -55,6 +55,9 @@ struct gbproxy_patch_state {
struct gbproxy_peer {
struct llist_head list;
+ /* point back to the config */
+ struct gbproxy_config *cfg;
+
/* NSEI of the peer entity */
uint16_t nsei;
@@ -81,8 +84,6 @@ struct gbproxy_tlli_info {
};
-extern struct gbproxy_config gbcfg;
-
/* gb_proxy_vty .c */
int gbproxy_vty_init(void);
@@ -93,7 +94,7 @@ int gbproxy_parse_config(const char *config_file, struct gbproxy_config *cfg);
int gbproxy_init_config(struct gbproxy_config *cfg);
/* Main input function for Gb proxy */
-int gbprox_rcvmsg(struct msgb *msg, uint16_t nsei, uint16_t ns_bvci, uint16_t nsvci);
+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);
@@ -101,14 +102,14 @@ int gbprox_signal(unsigned int subsys, unsigned int signal,
/* Reset all persistent NS-VC's */
int gbprox_reset_persistent_nsvcs(struct gprs_ns_inst *nsi);
-void gbprox_reset();
+void gbprox_reset(struct gbproxy_config *cfg);
int gbprox_set_patch_filter(const char *filter, const char **err_msg);
void gbprox_delete_tlli(struct gbproxy_peer *peer,
struct gbproxy_tlli_info *tlli_info);
int gbprox_remove_stale_tllis(struct gbproxy_peer *peer, time_t now);
-int gbprox_cleanup_peers(uint16_t nsei, uint16_t bvci);
+int gbprox_cleanup_peers(struct gbproxy_config *cfg, uint16_t nsei, uint16_t bvci);
-struct gbproxy_peer *gbprox_peer_by_nsei(uint16_t nsei);
+struct gbproxy_peer *gbprox_peer_by_nsei(struct gbproxy_config *cfg, uint16_t nsei);
#endif