sgsn: Integrate c-ares with the osmocom event loop
c-ares is an asynchronous DNS resolver and we need it to
resolve the GGSN address. This is integrating the library
into our infrastructure. We will create and maintain a list
of registered FDs (c-ares is currently only using one of
them) and (re-)schedule the timer after events occurred.
diff --git a/openbsc/include/openbsc/sgsn.h b/openbsc/include/openbsc/sgsn.h
index 0f9a59f..8e4d532 100644
--- a/openbsc/include/openbsc/sgsn.h
+++ b/openbsc/include/openbsc/sgsn.h
@@ -7,6 +7,8 @@
#include <osmocom/gprs/gprs_ns.h>
#include <openbsc/gprs_sgsn.h>
+#include <ares.h>
+
struct gprs_gsup_client;
enum sgsn_auth_policy {
@@ -58,6 +60,11 @@
struct gprs_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;
};
extern struct sgsn_instance *sgsn;
@@ -99,4 +106,11 @@
*/
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