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.
This commit is contained in:
Holger Hans Peter Freyther
2010-10-13 23:52:01 +02:00
parent 833fa0bafa
commit 19c530c5e7
7 changed files with 11 additions and 9 deletions

View File

@@ -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;

View File

@@ -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 {

View File

@@ -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);
}

View File

@@ -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)

View File

@@ -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;
}
}

View File

@@ -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 {

View File

@@ -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)