diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2011-01-01 13:34:58 +0100 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2011-01-01 13:34:58 +0100 |
commit | 7a7255657797ae9fa72a93cab4e1f1d71d094ca3 (patch) | |
tree | 63e5558c4675e12ce1c9fce1c9e8c14424a30d10 | |
parent | ff9cd6f8f6f0c4505b4c01d8746d490eb41d7fc5 (diff) |
mtp: Allow to have a different POC for SCCP
-rw-r--r-- | include/bsc_data.h | 1 | ||||
-rw-r--r-- | include/mtp_data.h | 2 | ||||
-rw-r--r-- | src/main.c | 2 | ||||
-rw-r--r-- | src/main_udt.c | 2 | ||||
-rw-r--r-- | src/mtp_layer3.c | 14 | ||||
-rw-r--r-- | src/vty_interface.c | 10 |
6 files changed, 23 insertions, 8 deletions
diff --git a/include/bsc_data.h b/include/bsc_data.h index a8ad738..2851151 100644 --- a/include/bsc_data.h +++ b/include/bsc_data.h @@ -105,6 +105,7 @@ struct bsc_data { int dpc; int opc; + int sccp_opc; int src_port; int udp_port; char *udp_ip; diff --git a/include/mtp_data.h b/include/mtp_data.h index 545c0f1..bd2a754 100644 --- a/include/mtp_data.h +++ b/include/mtp_data.h @@ -37,7 +37,7 @@ */ struct mtp_link { /* routing info.. */ - int dpc, opc; + int dpc, opc, sccp_opc; int ni; int spare; @@ -674,6 +674,7 @@ int main(int argc, char **argv) bsc.dpc = 1; bsc.opc = 0; + bsc.sccp_opc = -1; bsc.udp_port = 3456; bsc.udp_ip = NULL; bsc.src_port = 1313; @@ -726,6 +727,7 @@ int main(int argc, char **argv) bsc.link.the_link = mtp_link_alloc(); bsc.link.the_link->dpc = bsc.dpc; bsc.link.the_link->opc = bsc.opc; + bsc.link.the_link->sccp_opc = bsc.sccp_opc > -1 ? bsc.sccp_opc : bsc.opc; bsc.link.the_link->link = 0; bsc.link.the_link->sltm_once = bsc.once; bsc.link.the_link->ni = bsc.ni_ni; diff --git a/src/main_udt.c b/src/main_udt.c index 5246463..6a17f23 100644 --- a/src/main_udt.c +++ b/src/main_udt.c @@ -226,6 +226,7 @@ int main(int argc, char **argv) bsc.dpc = 1; bsc.opc = 0; + bsc.sccp_opc = -1; bsc.udp_port = 3456; bsc.udp_ip = NULL; bsc.src_port = 1313; @@ -279,6 +280,7 @@ int main(int argc, char **argv) bsc.link.the_link = mtp_link_alloc(); bsc.link.the_link->dpc = bsc.dpc; bsc.link.the_link->opc = bsc.opc; + bsc.link.the_link->sccp_opc = bsc.sccp_opc > -1 ? bsc.sccp_opc : bsc.opc; bsc.link.the_link->link = 0; bsc.link.the_link->sltm_once = bsc.once; bsc.link.the_link->ni = bsc.ni_ni; diff --git a/src/mtp_layer3.c b/src/mtp_layer3.c index 92682ea..ac2a509 100644 --- a/src/mtp_layer3.c +++ b/src/mtp_layer3.c @@ -34,7 +34,7 @@ static void *tall_mtp_ctx = NULL; -static int mtp_int_submit(struct mtp_link *link, int sls, int type, const uint8_t *data, unsigned int length); +static int mtp_int_submit(struct mtp_link *link, int pc, int sls, int type, const uint8_t *data, unsigned int length); static struct msgb *mtp_msg_alloc(struct mtp_link *link) { @@ -154,7 +154,7 @@ static struct msgb *mtp_sccp_alloc_scmg(struct mtp_link *link, hdr->ser_ind = MTP_SI_MNT_SCCP; /* this appears to be round robin or such.. */ - hdr->addr = MTP_ADDR(sls % 16, link->dpc, link->opc); + hdr->addr = MTP_ADDR(sls % 16, link->dpc, link->sccp_opc); /* generate the UDT message... libsccp does not offer formating yet */ udt = (struct sccp_data_unitdata *) msgb_put(out, sizeof(*udt)); @@ -440,7 +440,7 @@ static int mtp_link_sccp_data(struct mtp_link *link, struct mtp_level_3_hdr *hdr } prt = (struct sccp_con_ctrl_prt_mgt *) &msg->l3h[0]; - if (prt->apoc != MTP_MAKE_APOC(link->opc)) { + if (prt->apoc != MTP_MAKE_APOC(link->sccp_opc)) { LOGP(DINP, LOGL_ERROR, "Unknown APOC: %u/%u\n", ntohs(prt->apoc), prt->apoc); type = SCCP_SSP; @@ -513,16 +513,16 @@ int mtp_link_submit_sccp_data(struct mtp_link *link, int sls, const uint8_t *dat return -1; } - return mtp_int_submit(link, sls, MTP_SI_MNT_SCCP, data, length); + return mtp_int_submit(link, link->sccp_opc, sls, MTP_SI_MNT_SCCP, data, length); } int mtp_link_submit_isup_data(struct mtp_link *link, int sls, const uint8_t *data, unsigned int length) { - return mtp_int_submit(link, sls, MTP_SI_MNT_ISUP, data, length); + return mtp_int_submit(link, link->opc, sls, MTP_SI_MNT_ISUP, data, length); } -static int mtp_int_submit(struct mtp_link *link, int sls, int type, +static int mtp_int_submit(struct mtp_link *link, int pc, int sls, int type, const uint8_t *data, unsigned int length) { uint8_t *put_ptr; @@ -536,7 +536,7 @@ static int mtp_int_submit(struct mtp_link *link, int sls, int type, hdr = (struct mtp_level_3_hdr *) msg->l2h; hdr->ser_ind = type; - hdr->addr = MTP_ADDR(sls % 16, link->dpc, link->opc); + hdr->addr = MTP_ADDR(sls % 16, link->dpc, pc); /* copy the raw sccp data */ put_ptr = msgb_put(msg, length); diff --git a/src/vty_interface.c b/src/vty_interface.c index f3f711c..847b6a2 100644 --- a/src/vty_interface.c +++ b/src/vty_interface.c @@ -62,6 +62,7 @@ static int config_write_cell(struct vty *vty) vty_out(vty, "cellmgr%s", VTY_NEWLINE); vty_out(vty, " mtp dpc %d%s", bsc.dpc, VTY_NEWLINE); vty_out(vty, " mtp opc %d%s", bsc.opc, VTY_NEWLINE); + vty_out(vty, " mtp sccp-opc %d%s", bsc.sccp_opc, VTY_NEWLINE); vty_out(vty, " mtp ni %d%s", bsc.ni_ni, VTY_NEWLINE); vty_out(vty, " mtp spare %d%s", bsc.ni_spare, VTY_NEWLINE); vty_out(vty, " mtp sltm once %d%s", bsc.once, VTY_NEWLINE); @@ -103,6 +104,14 @@ DEFUN(cfg_net_opc, cfg_net_opc_cmd, return CMD_SUCCESS; } +DEFUN(cfg_net_sccp_opc, cfg_net_sccp_opc_cmd, + "mtp sccp-opc OPC_NR", + "Set the SCCP OPC to be used.") +{ + bsc.sccp_opc = atoi(argv[0]); + return CMD_SUCCESS; +} + DEFUN(cfg_net_mtp_ni, cfg_net_mtp_ni_cmd, "mtp ni NR", "Set the MTP NI to be used.\n" "NR") @@ -277,6 +286,7 @@ void cell_vty_init(void) install_element(CELLMGR_NODE, &cfg_net_dpc_cmd); install_element(CELLMGR_NODE, &cfg_net_opc_cmd); + install_element(CELLMGR_NODE, &cfg_net_sccp_opc_cmd); install_element(CELLMGR_NODE, &cfg_net_mtp_ni_cmd); install_element(CELLMGR_NODE, &cfg_net_mtp_spare_cmd); install_element(CELLMGR_NODE, &cfg_udp_dst_ip_cmd); |