ipa: Only use one IPA number for Osmo extensions

Instead of using more numbers from the proto range we will
use the 0xee and then have a mini header with our new proto
id in there. For a start rename the use types to _OLD.
This commit is contained in:
Holger Hans Peter Freyther 2011-01-07 16:54:46 +01:00
parent 45c2184c7e
commit 368a0a73d4
7 changed files with 17 additions and 10 deletions

View File

@ -14,14 +14,21 @@ struct ipaccess_head {
u_int8_t data[0]; u_int8_t data[0];
} __attribute__ ((packed)); } __attribute__ ((packed));
struct ipaccess_head_ext {
uint8_t proto;
uint8_t data[0];
} __attribute__ ((packed));
enum ipaccess_proto { enum ipaccess_proto {
IPAC_PROTO_RSL = 0x00, IPAC_PROTO_RSL = 0x00,
IPAC_PROTO_IPACCESS = 0xfe, IPAC_PROTO_IPACCESS = 0xfe,
IPAC_PROTO_SCCP = 0xfd, IPAC_PROTO_SCCP = 0xfd,
IPAC_PROTO_OML = 0xff, IPAC_PROTO_OML = 0xff,
/* OpenBSC extensions */ /* OpenBSC extensions */
IPAC_PROTO_MGCP = 0xfc, IPAC_PROTO_OSMO = 0xee,
IPAC_PROTO_MGCP_OLD = 0xfc,
}; };
enum ipaccess_msgtype { enum ipaccess_msgtype {
@ -32,7 +39,7 @@ enum ipaccess_msgtype {
IPAC_MSGT_ID_ACK = 0x06, IPAC_MSGT_ID_ACK = 0x06,
/* OpenBSC extension */ /* OpenBSC extension */
IPAC_MSGT_SCCP_STATE = 0xff, IPAC_MSGT_SCCP_OLD = 0xff,
}; };
enum ipaccess_id_tags { enum ipaccess_id_tags {

View File

@ -67,7 +67,7 @@ static int mgcp_do_read(struct bsc_fd *fd)
} }
mgcp->l2h = msgb_put(mgcp, ret); mgcp->l2h = msgb_put(mgcp, ret);
msc_queue_write(data->msc_con, mgcp, IPAC_PROTO_MGCP); msc_queue_write(data->msc_con, mgcp, IPAC_PROTO_MGCP_OLD);
return 0; return 0;
} }
@ -223,7 +223,7 @@ static int ipaccess_a_fd_cb(struct bsc_fd *bfd)
} }
} else if (hh->proto == IPAC_PROTO_SCCP) { } else if (hh->proto == IPAC_PROTO_SCCP) {
sccp_system_incoming(msg); sccp_system_incoming(msg);
} else if (hh->proto == IPAC_PROTO_MGCP) { } else if (hh->proto == IPAC_PROTO_MGCP_OLD) {
mgcp_forward(data, msg); mgcp_forward(data, msg);
} }

View File

@ -69,7 +69,7 @@ static struct bsc_pkt_filter white_list[] = {
{ IPAC_PROTO_SCCP, ALLOW_ANY, ALLOW_ANY, ALLOW_ANY, FILTER_TO_BOTH }, { IPAC_PROTO_SCCP, ALLOW_ANY, ALLOW_ANY, ALLOW_ANY, FILTER_TO_BOTH },
/* allow MGCP messages to both sides */ /* allow MGCP messages to both sides */
{ IPAC_PROTO_MGCP, ALLOW_ANY, ALLOW_ANY, ALLOW_ANY, FILTER_TO_BOTH }, { IPAC_PROTO_MGCP_OLD, ALLOW_ANY, ALLOW_ANY, ALLOW_ANY, FILTER_TO_BOTH },
}; };
struct bsc_nat_parsed *bsc_nat_parse(struct msgb *msg) struct bsc_nat_parsed *bsc_nat_parse(struct msgb *msg)

View File

@ -303,7 +303,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 */ /* send the message and a fake MDCX to force sending of a dummy packet */
bsc_write(sccp->bsc, bsc_msg, IPAC_PROTO_MGCP); bsc_write(sccp->bsc, bsc_msg, IPAC_PROTO_MGCP_OLD);
bsc_mgcp_send_mdcx(sccp->bsc, sccp->bsc_endp, mgcp_endp); bsc_mgcp_send_mdcx(sccp->bsc, sccp->bsc_endp, mgcp_endp);
return MGCP_POLICY_DEFER; return MGCP_POLICY_DEFER;
} else if (state == MGCP_ENDP_DLCX) { } else if (state == MGCP_ENDP_DLCX) {
@ -312,7 +312,7 @@ int bsc_mgcp_policy_cb(struct mgcp_config *cfg, int endpoint, int state, const c
bsc_mgcp_dlcx(sccp); bsc_mgcp_dlcx(sccp);
return MGCP_POLICY_CONT; return MGCP_POLICY_CONT;
} else { } else {
bsc_write(sccp->bsc, bsc_msg, IPAC_PROTO_MGCP); bsc_write(sccp->bsc, bsc_msg, IPAC_PROTO_MGCP_OLD);
return MGCP_POLICY_DEFER; return MGCP_POLICY_DEFER;
} }
} }

View File

@ -958,7 +958,7 @@ static int forward_sccp_to_msc(struct bsc_connection *bsc, struct msgb *msg)
goto exit2; goto exit2;
break; break;
} }
} else if (parsed->ipa_proto == IPAC_PROTO_MGCP) { } else if (parsed->ipa_proto == IPAC_PROTO_MGCP_OLD) {
bsc_mgcp_forward(bsc, msg); bsc_mgcp_forward(bsc, msg);
goto exit2; goto exit2;
} else { } else {

View File

@ -262,7 +262,7 @@ int bsc_write_mgcp(struct bsc_connection *bsc, const uint8_t *data, unsigned int
msg->l3h = msgb_put(msg, length); msg->l3h = msgb_put(msg, length);
memcpy(msg->l3h, data, length); memcpy(msg->l3h, data, length);
return bsc_write(bsc, msg, IPAC_PROTO_MGCP); return bsc_write(bsc, msg, IPAC_PROTO_MGCP_OLD);
} }
int bsc_write(struct bsc_connection *bsc, struct msgb *msg, int proto) int bsc_write(struct bsc_connection *bsc, struct msgb *msg, int proto)

View File

@ -281,7 +281,7 @@ static int forward_ussd(struct sccp_connections *con, const struct ussd_request
memcpy(copy->l2h, input->l2h, msgb_l2len(input)); memcpy(copy->l2h, input->l2h, msgb_l2len(input));
msg->l2h = msgb_put(msg, 1); msg->l2h = msgb_put(msg, 1);
msg->l2h[0] = IPAC_MSGT_SCCP_STATE; msg->l2h[0] = IPAC_MSGT_SCCP_OLD;
/* fill out the data */ /* fill out the data */
state = (struct ipac_msgt_sccp_state *) msgb_put(msg, sizeof(*state)); state = (struct ipac_msgt_sccp_state *) msgb_put(msg, sizeof(*state));