From a78b6026c95b7db80d71efa039eb3eecd626aec9 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Sat, 23 Apr 2011 15:58:24 +0200 Subject: bsc: Handle MGCP coming from Osmo Extensions header Start using the new Osmo Extension header and forward MGCP to the MGCP GW. --- openbsc/src/osmo-bsc/osmo_bsc_msc.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'openbsc/src/osmo-bsc/osmo_bsc_msc.c') diff --git a/openbsc/src/osmo-bsc/osmo_bsc_msc.c b/openbsc/src/osmo-bsc/osmo_bsc_msc.c index 135779eaa..91d9f7322 100644 --- a/openbsc/src/osmo-bsc/osmo_bsc_msc.c +++ b/openbsc/src/osmo-bsc/osmo_bsc_msc.c @@ -188,6 +188,24 @@ static int msc_alink_do_write(struct bsc_fd *fd, struct msgb *msg) return ret; } +static void osmo_ext_handle(struct osmo_msc_data *msc, struct msgb *msg) +{ + struct ipaccess_head *hh; + struct ipaccess_head_ext *hh_ext; + + hh = (struct ipaccess_head *) msg->data; + hh_ext = (struct ipaccess_head_ext *) hh->data; + if (msg->len < sizeof(*hh) + sizeof(*hh_ext)) { + LOGP(DMSC, LOGL_ERROR, "Packet too short for extended header.\n"); + return; + } + + msg->l2h = hh_ext->data; + if (hh_ext->proto == IPAC_PROTO_EXT_MGCP) + mgcp_forward(msc, msg); + +} + static int ipaccess_a_fd_cb(struct bsc_fd *bfd) { int error; @@ -225,6 +243,8 @@ static int ipaccess_a_fd_cb(struct bsc_fd *bfd) sccp_system_incoming(msg); } else if (hh->proto == IPAC_PROTO_MGCP_OLD) { mgcp_forward(data, msg); + } else if (hh->proto == IPAC_PROTO_OSMO) { + osmo_ext_handle(data, msg); } msgb_free(msg); -- cgit v1.2.3