aboutsummaryrefslogtreecommitdiffstats
path: root/src/gsup_router.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gsup_router.c')
-rw-r--r--src/gsup_router.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/gsup_router.c b/src/gsup_router.c
index 4fedd38..df978ba 100644
--- a/src/gsup_router.c
+++ b/src/gsup_router.c
@@ -25,13 +25,7 @@
#include "logging.h"
#include "gsup_server.h"
-
-struct gsup_route {
- struct llist_head list;
-
- uint8_t *addr;
- struct osmo_gsup_conn *conn;
-};
+#include "gsup_router.h"
/*! Find a route for the given address.
* \param[in] gs gsup server
@@ -53,6 +47,22 @@ struct osmo_gsup_conn *gsup_route_find(struct osmo_gsup_server *gs,
return NULL;
}
+/*! Find a GSUP connection's route (to read the IPA address from the route).
+ * \param[in] conn GSUP connection
+ * \return GSUP route
+ */
+struct gsup_route *gsup_route_find_by_conn(const struct osmo_gsup_conn *conn)
+{
+ struct gsup_route *gr;
+
+ llist_for_each_entry(gr, &conn->server->routes, list) {
+ if (gr->conn == conn)
+ return gr;
+ }
+
+ return NULL;
+}
+
/* add a new route for the given address to the given conn */
int gsup_route_add(struct osmo_gsup_conn *conn, const uint8_t *addr, size_t addrlen)
{