From 1f7315058abb7dc7d26852005809f30898772d07 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Mon, 18 Mar 2013 19:01:18 +0100 Subject: Work-In-Progress for M3UA/SCCPlite.. handling This is a bit of a dead-end. SCCPlite/M3UA should not use a mtp_linkset as this requires dealing with SLTM/SLTA.. routing data. Right now I can either add special code to the linkset to shut off parts of or bypass it in the SS7 application code.. --- TODO | 9 +++++++++ include/mtp_data.h | 1 + include/sccp_lite.h | 8 +++----- include/sctp_m2ua.h | 3 --- src/sccp_lite.c | 4 ++++ src/vty_interface.c | 41 ++++++++++++++++++++++++++++++++++++++++- 6 files changed, 57 insertions(+), 9 deletions(-) diff --git a/TODO b/TODO index ac0f578..96273f1 100644 --- a/TODO +++ b/TODO @@ -4,3 +4,12 @@ Implement proper routing as in Q.704. The 'applications' need to describe which PCs can be reached by the application (insert items in the routing table), during the MTP Restart one needs to collect the TRA and TFA for rachable points, then TFA for the reachable points to all adjacent links.. + +== Handling of Link Types == + +The support for the SCCPlite but also M3UA is difficult. Everything is going +through MTP and we would need a linkset base class and have a stub one and a +mtp one. Right now this is a a big hack. + +This should be done in the SS7_Application code. Like there are multiple +link types.. there should be multiple linksets types. diff --git a/include/mtp_data.h b/include/mtp_data.h index 3ef809c..c391787 100644 --- a/include/mtp_data.h +++ b/include/mtp_data.h @@ -42,6 +42,7 @@ enum ss7_link_type { SS7_LTYPE_NONE, SS7_LTYPE_UDP, SS7_LTYPE_M2UA, + SS7_LTYPE_SCCP_LITE, }; /** diff --git a/include/sccp_lite.h b/include/sccp_lite.h index 9abc1b9..ed1122c 100644 --- a/include/sccp_lite.h +++ b/include/sccp_lite.h @@ -20,13 +20,9 @@ #include "mtp_data.h" -struct sccp_lite_link { +struct mtp_sccp_lite_link { struct mtp_link *base; - int active; - int established; - struct sccp_lite_conn *conn; - /* token handling for pseudo-authentication */ char *token; @@ -37,4 +33,6 @@ struct sccp_lite_link { struct mtp_transport *sccp_lite_transp_create(struct bsc_data *bsc); int sccp_lite_transp_bind(struct mtp_transport *trans, const char *ip, int port); +struct mtp_sccp_lite_link *mtp_sccp_lite_link_init(struct mtp_link *); + #endif diff --git a/include/sctp_m2ua.h b/include/sctp_m2ua.h index cf89379..16c39ea 100644 --- a/include/sctp_m2ua.h +++ b/include/sctp_m2ua.h @@ -67,9 +67,6 @@ struct sctp_m2ua_conn { struct mtp_transport *sctp_m2ua_transp_create(struct bsc_data *bsc); int sctp_m2ua_transport_bind(struct mtp_transport *, const char *ip, int port); -struct mtp_m2ua_link *mtp_m2ua_link_create(struct mtp_transport *transport, - struct mtp_link_set *); - struct mtp_m2ua_link *mtp_m2ua_link_init(struct mtp_link *link); int sctp_m2ua_conn_count(struct mtp_transport *tran); diff --git a/src/sccp_lite.c b/src/sccp_lite.c index fb8c1d3..5f09f05 100644 --- a/src/sccp_lite.c +++ b/src/sccp_lite.c @@ -41,6 +41,10 @@ static int sccp_lite_transp_accept(struct osmo_fd *fd, unsigned int what) return 0; } +struct mtp_sccp_lite_link *mtp_sccp_lite_link_init(struct mtp_link *lnk) +{ +} + struct mtp_transport *sccp_lite_transp_create(struct bsc_data *bsc) { return mtp_transport_create(bsc); diff --git a/src/vty_interface.c b/src/vty_interface.c index 345c6c3..24e1e09 100644 --- a/src/vty_interface.c +++ b/src/vty_interface.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -160,6 +161,7 @@ static void write_link(struct vty *vty, struct mtp_link *link) const char *name = link->name ? link->name : ""; struct mtp_udp_link *ulnk; struct mtp_m2ua_link *m2ua; + struct mtp_sccp_lite_link *lite; vty_out(vty, " link %d%s", link->nr, VTY_NEWLINE); vty_out(vty, " description %s%s", name, VTY_NEWLINE); @@ -187,6 +189,13 @@ static void write_link(struct vty *vty, struct mtp_link *link) vty_out(vty, " m2ua link-index %d%s", m2ua->link_index, VTY_NEWLINE); break; + case SS7_LTYPE_SCCP_LITE: + lite = (struct mtp_sccp_lite_link *) link->data; + vty_out(vty, " ss7-transport sccp-lite%s", VTY_NEWLINE); + if (lite->token) + vty_out(vty, " sccp-lite token %s%s", + lite->token, VTY_NEWLINE); + break; case SS7_LTYPE_NONE: break; } @@ -590,7 +599,7 @@ DEFUN(cfg_linkset_link, cfg_linkset_link_cmd, } DEFUN(cfg_link_ss7_transport, cfg_link_ss7_transport_cmd, - "ss7-transport (none|udp|m2ua)", + "ss7-transport (none|udp|m2ua|sccp-lite)", "SS7 transport for the link\n" "No transport\n" "MTP over UDP\n" "SCTP M2UA\n") { @@ -603,12 +612,19 @@ DEFUN(cfg_link_ss7_transport, cfg_link_ss7_transport_cmd, wanted = SS7_LTYPE_UDP; else if (strcmp("m2ua", argv[0]) == 0) wanted = SS7_LTYPE_M2UA; + else if (strcmp("sccp-lite", argv[0]) == 0) + wanted = SS7_LTYPE_SCCP_LITE; if (link->type != wanted && link->type != SS7_LTYPE_NONE) { vty_out(vty, "%%Can not change the type of a link.\n"); return CMD_WARNING; } + if (link->nr > 0 && wanted == SS7_LTYPE_SCCP_LITE) { + vty_out(vty, "%%Can only have SCCP-lite as 0.\n"); + return CMD_WARNING; + } + switch (wanted) { case SS7_LTYPE_UDP: link->data = mtp_udp_link_init(link); @@ -616,6 +632,9 @@ DEFUN(cfg_link_ss7_transport, cfg_link_ss7_transport_cmd, case SS7_LTYPE_M2UA: link->data = mtp_m2ua_link_init(link); break; + case SS7_LTYPE_SCCP_LITE: + link->data = mtp_sccp_lite_link_init(link); + break; case SS7_LTYPE_NONE: /* nothing */ break; @@ -752,6 +771,25 @@ DEFUN(cfg_link_m2ua_link_index, cfg_link_m2ua_link_index_cmd, return CMD_SUCCESS; } +DEFUN(cfg_link_sccp_lite_token, cfg_link_sccp_lite_token_cmd, + "sccp-lite token TOKEN", + "SCCP-lite/MAP-lite related\n" "Token for pseudo-auth\n" "Token\n") +{ + struct mtp_link *link = vty->index; + struct mtp_sccp_lite_link *lite; + + if (link->type != SS7_LTYPE_SCCP_LITE) { + vty_out(vty, "%%This only applies to SCCP-lite links.%s", VTY_NEWLINE); + return CMD_WARNING; + } + + lite = link->data; + if (lite->token) + talloc_free(lite->token); + lite->token = talloc_strdup(lite, argv[0]); + return CMD_SUCCESS; +} + DEFUN(cfg_ss7_msc, cfg_ss7_msc_cmd, "msc <0-100>", "MSC Connection\n" "MSC Number\n") @@ -1106,6 +1144,7 @@ void cell_vty_init(void) install_element(LINK_NODE, &cfg_link_udp_link_index_cmd); install_element(LINK_NODE, &cfg_link_m2ua_as_cmd); install_element(LINK_NODE, &cfg_link_m2ua_link_index_cmd); + install_element(LINK_NODE, &cfg_link_sccp_lite_token_cmd); install_element(SS7_NODE, &cfg_ss7_msc_cmd); install_node(&msc_node, config_write_msc); -- cgit v1.2.3