aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/nat/bsc_mgcp_utils.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-04-01 03:55:27 +0200
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-04-01 07:41:23 +0200
commit8cdfe9fc37819051187ad02dca20d8b75c701b0b (patch)
treefc88c8eaced4cc2abd2f04b6e098434d71f18376 /openbsc/src/nat/bsc_mgcp_utils.c
parent0959f8cbe6273b8580d6e0d46cefe1d8bfa019bd (diff)
nat: Add code to find a BSC connection by the given msc multiplex
Diffstat (limited to 'openbsc/src/nat/bsc_mgcp_utils.c')
-rw-r--r--openbsc/src/nat/bsc_mgcp_utils.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/openbsc/src/nat/bsc_mgcp_utils.c b/openbsc/src/nat/bsc_mgcp_utils.c
index e19010597..0f45a91a5 100644
--- a/openbsc/src/nat/bsc_mgcp_utils.c
+++ b/openbsc/src/nat/bsc_mgcp_utils.c
@@ -78,6 +78,23 @@ void bsc_mgcp_free_endpoints(struct bsc_nat *nat)
mgcp_free_endp(&nat->mgcp_cfg->endpoints[i]);
}
+struct bsc_connection *bsc_mgcp_find_con(struct bsc_nat *nat, int endpoint)
+{
+ struct sccp_connections *sccp;
+
+ llist_for_each_entry(sccp, &nat->sccp_connections, list_entry) {
+ if (sccp->msc_timeslot == -1)
+ continue;
+ if (mgcp_timeslot_to_endpoint(0, sccp->msc_timeslot) != endpoint)
+ continue;
+
+ return sccp->bsc;
+ }
+
+ LOGP(DMGCP, LOGL_ERROR, "Failed to find the connection.\n");
+ return NULL;
+}
+
static int mgcp_do_read(struct bsc_fd *fd)
{
struct bsc_nat *nat;