aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/include
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2015-11-08 20:34:47 +0100
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2015-11-16 15:16:30 +0100
commit30f7bcbd79ad1b661dff844a43f0ccbf4f07cebf (patch)
tree68715097523724d61c56a99f2db6f947fac2f55b /openbsc/include
parentc8a614d2e9c56fe13c22f239be82f2a2c958e039 (diff)
gtphub: add first bits of GRX ares
For the resolving function, change the function signature to return a gtphub_peer_port. In consequence, publish two functions concerned with gtphub_peer_port instances for use in test and gtphub_ext.c. Add GGSN resolution queue, callback and cache. Simple implementation: if an SGSN asks for a GGSN, it will first get no answer, and I hope it will ask again once the GGSN is in the cache. Within gtphub_ext.c, have a dummy sgsn struct, as the sgsn_ares code currently depends on it (half the functions pass an sgsn instance pointer around, but the other half use the global one). In the unit tests, wrap away the ares initialization so that they can work without a DNS server around. The netcat test breaks because of this, will remove it. Using sgsn_ares, implement the gtphub_resolve_ggsn_addr() function, I hope: untested. Minor cosmetics just to see if you're paying attention... ;) Sponsored-by: On-Waves ehi
Diffstat (limited to 'openbsc/include')
-rw-r--r--openbsc/include/openbsc/gtphub.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/openbsc/include/openbsc/gtphub.h b/openbsc/include/openbsc/gtphub.h
index 5298505db..05eee851e 100644
--- a/openbsc/include/openbsc/gtphub.h
+++ b/openbsc/include/openbsc/gtphub.h
@@ -27,6 +27,8 @@
#include <osmocom/core/select.h>
#include <osmocom/core/timer.h>
+#include <openbsc/gprs_sgsn.h>
+
/* support */
@@ -363,6 +365,18 @@ struct gtphub_bind {
struct llist_head peers;
};
+struct gtphub_resolved_ggsn {
+ struct llist_head entry;
+ struct expiring_item expiry_entry;
+
+ /* The APN OI, the Operator Identifier, is the combined address,
+ * including parts of the IMSI and APN NI, and ending with ".gprs". */
+ char apn_oi_str[GSM_APN_LENGTH];
+
+ /* Which address and port we resolved that to. */
+ struct gtphub_peer_port *peer;
+};
+
struct gtphub {
struct gtphub_bind to_sgsns[GTPH_PLANE_N];
struct gtphub_bind to_ggsns[GTPH_PLANE_N];
@@ -376,6 +390,9 @@ struct gtphub {
struct nr_map tei_map[GTPH_PLANE_N];
struct nr_pool tei_pool[GTPH_PLANE_N];
+ struct llist_head ggsn_lookups; /* opaque (gtphub_ext.c) */
+ struct llist_head resolved_ggsns; /* struct gtphub_resolved_ggsn */
+
struct osmo_timer_list gc_timer;
struct expiry expire_seq_maps;
struct expiry expire_tei_maps;
@@ -420,5 +437,16 @@ int gtphub_from_ggsns_handle_buf(struct gtphub *hub,
struct osmo_fd **to_ofd,
struct osmo_sockaddr *to_addr);
+struct gtphub_peer_port *gtphub_port_have(struct gtphub *hub,
+ struct gtphub_bind *bind,
+ const struct gsn_addr *addr,
+ uint16_t port);
+
struct gtphub_peer_port *gtphub_port_find_sa(const struct gtphub_bind *bind,
const struct osmo_sockaddr *addr);
+
+void gtphub_resolved_ggsn(struct gtphub *hub, const char *apn_oi_str,
+ struct gsn_addr *resolved_addr,
+ time_t now);
+
+const char *gtphub_port_str(struct gtphub_peer_port *port);