From 19c530c5e7be14c518c8c0e65855c658b78d0146 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Wed, 13 Oct 2010 23:52:01 +0200 Subject: ipaccess: Put our extensions to the protocol into the same enum Rename NAT_IPAC_PROTO_MGCP to IPAC_PROTO_MGCP and place it in the enum. We need to be prepared to change this number if IPA is ever going to use it for something else. --- openbsc/include/openbsc/bsc_nat.h | 2 -- openbsc/include/openbsc/ipaccess.h | 3 +++ openbsc/src/bsc/osmo_bsc_msc.c | 4 ++-- openbsc/src/nat/bsc_filter.c | 2 +- openbsc/src/nat/bsc_mgcp_utils.c | 5 +++-- openbsc/src/nat/bsc_nat.c | 2 +- openbsc/src/nat/bsc_nat_utils.c | 2 +- 7 files changed, 11 insertions(+), 9 deletions(-) diff --git a/openbsc/include/openbsc/bsc_nat.h b/openbsc/include/openbsc/bsc_nat.h index 4983af56d..7ac175dfc 100644 --- a/openbsc/include/openbsc/bsc_nat.h +++ b/openbsc/include/openbsc/bsc_nat.h @@ -38,8 +38,6 @@ #define DIR_BSC 1 #define DIR_MSC 2 -#define NAT_IPAC_PROTO_MGCP 0xfc - struct sccp_connections; struct bsc_nat_parsed; struct bsc_nat; diff --git a/openbsc/include/openbsc/ipaccess.h b/openbsc/include/openbsc/ipaccess.h index f8ddfd467..b36811ce3 100644 --- a/openbsc/include/openbsc/ipaccess.h +++ b/openbsc/include/openbsc/ipaccess.h @@ -18,6 +18,9 @@ enum ipaccess_proto { IPAC_PROTO_IPACCESS = 0xfe, IPAC_PROTO_SCCP = 0xfd, IPAC_PROTO_OML = 0xff, + + /* OpenBSC extensions */ + IPAC_PROTO_MGCP = 0xfc, }; enum ipaccess_msgtype { diff --git a/openbsc/src/bsc/osmo_bsc_msc.c b/openbsc/src/bsc/osmo_bsc_msc.c index 66449827a..0bdb71fee 100644 --- a/openbsc/src/bsc/osmo_bsc_msc.c +++ b/openbsc/src/bsc/osmo_bsc_msc.c @@ -68,7 +68,7 @@ static int mgcp_do_read(struct bsc_fd *fd) } mgcp->l2h = msgb_put(mgcp, ret); - msc_queue_write(data->msc_con, mgcp, NAT_IPAC_PROTO_MGCP); + msc_queue_write(data->msc_con, mgcp, IPAC_PROTO_MGCP); return 0; } @@ -225,7 +225,7 @@ static int ipaccess_a_fd_cb(struct bsc_fd *bfd) } } else if (hh->proto == IPAC_PROTO_SCCP) { sccp_system_incoming(msg); - } else if (hh->proto == NAT_IPAC_PROTO_MGCP) { + } else if (hh->proto == IPAC_PROTO_MGCP) { mgcp_forward(data, msg); } diff --git a/openbsc/src/nat/bsc_filter.c b/openbsc/src/nat/bsc_filter.c index e968fa22b..9c09a8311 100644 --- a/openbsc/src/nat/bsc_filter.c +++ b/openbsc/src/nat/bsc_filter.c @@ -70,7 +70,7 @@ static struct bsc_pkt_filter white_list[] = { { IPAC_PROTO_SCCP, ALLOW_ANY, ALLOW_ANY, ALLOW_ANY, FILTER_TO_BOTH }, /* allow MGCP messages to both sides */ - { NAT_IPAC_PROTO_MGCP, ALLOW_ANY, ALLOW_ANY, ALLOW_ANY, FILTER_TO_BOTH }, + { IPAC_PROTO_MGCP, ALLOW_ANY, ALLOW_ANY, ALLOW_ANY, FILTER_TO_BOTH }, }; struct bsc_nat_parsed *bsc_nat_parse(struct msgb *msg) diff --git a/openbsc/src/nat/bsc_mgcp_utils.c b/openbsc/src/nat/bsc_mgcp_utils.c index b84a26232..750975fdb 100644 --- a/openbsc/src/nat/bsc_mgcp_utils.c +++ b/openbsc/src/nat/bsc_mgcp_utils.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -296,7 +297,7 @@ int bsc_mgcp_policy_cb(struct mgcp_config *cfg, int endpoint, int state, const c } /* send the message and a fake MDCX to force sending of a dummy packet */ - bsc_write(sccp->bsc, bsc_msg, NAT_IPAC_PROTO_MGCP); + bsc_write(sccp->bsc, bsc_msg, IPAC_PROTO_MGCP); bsc_mgcp_send_mdcx(sccp->bsc, sccp->bsc_endp, mgcp_endp); return MGCP_POLICY_DEFER; } else if (state == MGCP_ENDP_DLCX) { @@ -305,7 +306,7 @@ int bsc_mgcp_policy_cb(struct mgcp_config *cfg, int endpoint, int state, const c bsc_mgcp_dlcx(sccp); return MGCP_POLICY_CONT; } else { - bsc_write(sccp->bsc, bsc_msg, NAT_IPAC_PROTO_MGCP); + bsc_write(sccp->bsc, bsc_msg, IPAC_PROTO_MGCP); return MGCP_POLICY_DEFER; } } diff --git a/openbsc/src/nat/bsc_nat.c b/openbsc/src/nat/bsc_nat.c index f5eca808d..ded05c6c8 100644 --- a/openbsc/src/nat/bsc_nat.c +++ b/openbsc/src/nat/bsc_nat.c @@ -874,7 +874,7 @@ static int forward_sccp_to_msc(struct bsc_connection *bsc, struct msgb *msg) goto exit2; break; } - } else if (parsed->ipa_proto == NAT_IPAC_PROTO_MGCP) { + } else if (parsed->ipa_proto == IPAC_PROTO_MGCP) { bsc_mgcp_forward(bsc, msg); goto exit2; } else { diff --git a/openbsc/src/nat/bsc_nat_utils.c b/openbsc/src/nat/bsc_nat_utils.c index 89d7d4b22..4fda517c2 100644 --- a/openbsc/src/nat/bsc_nat_utils.c +++ b/openbsc/src/nat/bsc_nat_utils.c @@ -260,7 +260,7 @@ int bsc_write_mgcp(struct bsc_connection *bsc, const uint8_t *data, unsigned int msg->l3h = msgb_put(msg, length); memcpy(msg->l3h, data, length); - return bsc_write(bsc, msg, NAT_IPAC_PROTO_MGCP); + return bsc_write(bsc, msg, IPAC_PROTO_MGCP); } int bsc_write(struct bsc_connection *bsc, struct msgb *msg, int proto) -- cgit v1.2.3