aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2011-01-01 13:34:58 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2011-01-01 13:34:58 +0100
commit7a7255657797ae9fa72a93cab4e1f1d71d094ca3 (patch)
tree63e5558c4675e12ce1c9fce1c9e8c14424a30d10 /src
parentff9cd6f8f6f0c4505b4c01d8746d490eb41d7fc5 (diff)
mtp: Allow to have a different POC for SCCP
Diffstat (limited to 'src')
-rw-r--r--src/main.c2
-rw-r--r--src/main_udt.c2
-rw-r--r--src/mtp_layer3.c14
-rw-r--r--src/vty_interface.c10
4 files changed, 21 insertions, 7 deletions
diff --git a/src/main.c b/src/main.c
index 1849b05..cf78165 100644
--- a/src/main.c
+++ b/src/main.c
@@ -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);