aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-10-16 16:35:00 +0200
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-10-19 16:40:17 +0200
commit3d38742d1ce756dcbebcdb197574f200f57f2a77 (patch)
tree2e21e4ceeb22a6bee06fbce807a5b6260aef4a4a
parentf961de1108407623aa2201df4710fecd9a3bf795 (diff)
nat: Find a connection by the real ref
-rw-r--r--openbsc/include/openbsc/bsc_nat.h2
-rw-r--r--openbsc/src/nat/bsc_sccp.c13
2 files changed, 15 insertions, 0 deletions
diff --git a/openbsc/include/openbsc/bsc_nat.h b/openbsc/include/openbsc/bsc_nat.h
index 280fa50f0..423f00942 100644
--- a/openbsc/include/openbsc/bsc_nat.h
+++ b/openbsc/include/openbsc/bsc_nat.h
@@ -38,6 +38,7 @@
#define DIR_BSC 1
#define DIR_MSC 2
+struct sccp_source_reference;
struct sccp_connections;
struct bsc_nat_parsed;
struct bsc_nat;
@@ -276,6 +277,7 @@ int update_sccp_src_ref(struct sccp_connections *sccp, struct bsc_nat_parsed *pa
void remove_sccp_src_ref(struct bsc_connection *bsc, struct msgb *msg, struct bsc_nat_parsed *parsed);
struct sccp_connections *patch_sccp_src_ref_to_bsc(struct msgb *, struct bsc_nat_parsed *, struct bsc_nat *);
struct sccp_connections *patch_sccp_src_ref_to_msc(struct msgb *, struct bsc_nat_parsed *, struct bsc_connection *);
+struct sccp_connections *bsc_nat_find_con_by_bsc(struct bsc_nat *, struct sccp_source_reference *);
/**
* MGCP/Audio handling
diff --git a/openbsc/src/nat/bsc_sccp.c b/openbsc/src/nat/bsc_sccp.c
index dae595049..a5c4f1bf4 100644
--- a/openbsc/src/nat/bsc_sccp.c
+++ b/openbsc/src/nat/bsc_sccp.c
@@ -235,3 +235,16 @@ struct sccp_connections *patch_sccp_src_ref_to_msc(struct msgb *msg,
return NULL;
}
+
+struct sccp_connections *bsc_nat_find_con_by_bsc(struct bsc_nat *nat,
+ struct sccp_source_reference *ref)
+{
+ struct sccp_connections *conn;
+
+ llist_for_each_entry(conn, &nat->sccp_connections, list_entry) {
+ if (memcmp(ref, &conn->real_ref, sizeof(*ref)) == 0)
+ return conn;
+ }
+
+ return NULL;
+}