aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-10-13 23:52:01 +0200
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-10-13 23:55:32 +0200
commit19c530c5e7be14c518c8c0e65855c658b78d0146 (patch)
tree682d801b15fdfae5754021d13c0e92482cb151d1
parent833fa0bafa0e541cdb3168d6d60732fef90b8372 (diff)
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.
-rw-r--r--openbsc/include/openbsc/bsc_nat.h2
-rw-r--r--openbsc/include/openbsc/ipaccess.h3
-rw-r--r--openbsc/src/bsc/osmo_bsc_msc.c4
-rw-r--r--openbsc/src/nat/bsc_filter.c2
-rw-r--r--openbsc/src/nat/bsc_mgcp_utils.c5
-rw-r--r--openbsc/src/nat/bsc_nat.c2
-rw-r--r--openbsc/src/nat/bsc_nat_utils.c2
7 files changed, 11 insertions, 9 deletions
diff --git a/openbsc/include/openbsc/bsc_nat.h b/openbsc/include/openbsc/bsc_nat.h
index 4983af56..7ac175df 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 f8ddfd46..b36811ce 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 66449827..0bdb71fe 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 e968fa22..9c09a831 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 b84a2623..750975fd 100644
--- a/openbsc/src/nat/bsc_mgcp_utils.c
+++ b/openbsc/src/nat/bsc_mgcp_utils.c
@@ -23,6 +23,7 @@
#include <openbsc/bsc_nat_sccp.h>
#include <openbsc/gsm_data.h>
#include <openbsc/debug.h>
+#include <openbsc/ipaccess.h>
#include <openbsc/mgcp.h>
#include <openbsc/mgcp_internal.h>
@@ -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 f5eca808..ded05c6c 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 89d7d4b2..4fda517c 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)