vty: Add all mighty new vty interface for osmo-stp

This new interface allows to have multiple linksets, msc
connections and ways to connect those in one instance of
the osmo-stp. Forbid to reset linksets without an app.
diff --git a/include/bsc_data.h b/include/bsc_data.h
index 12e8e93..3588ac8 100644
--- a/include/bsc_data.h
+++ b/include/bsc_data.h
@@ -53,6 +53,7 @@
 	int link_index;
 	int reset_timeout;
 
+	char *dest;
 	struct sockaddr_in remote;
 
 	struct mtp_udp_data *data;
@@ -69,11 +70,13 @@
 	/* udp code */
 	struct mtp_udp_data udp_data;
 
-	int src_port;
+	int udp_src_port;
 	int udp_port;
 	char *udp_ip;
 	int udp_nr_links;
 
+	int m2ua_src_port;
+
 	/* MTP Links */
 	struct llist_head linksets;
 	int num_linksets;
@@ -104,7 +107,8 @@
 
 /* udp init */
 struct mtp_link_set *link_set_create(struct bsc_data *bsc);
-int link_global_init(struct mtp_udp_data *data, int src_port);
+int link_global_init(struct mtp_udp_data *data);
+int link_global_bind(struct mtp_udp_data *data, int src_port);
 int link_udp_init(struct mtp_udp_link *data, char *dest_ip, int port);
 int link_init(struct bsc_data *bsc, struct mtp_link_set *set);
 int link_shutdown_all(struct mtp_link_set *);
@@ -120,4 +124,6 @@
 
 struct bsc_data *bsc_data_create();
 
+struct mtp_udp_link *mtp_udp_link_init(struct mtp_link *link);
+
 #endif
diff --git a/include/mtp_data.h b/include/mtp_data.h
index 969a4de..bbd013e 100644
--- a/include/mtp_data.h
+++ b/include/mtp_data.h
@@ -84,6 +84,7 @@
 	struct rate_ctr_group *ctrg;
 
 	/* custom data */
+	struct bsc_data *bsc;
 	struct ss7_application *app;
 };
 
diff --git a/include/sctp_m2ua.h b/include/sctp_m2ua.h
index 34c8666..2ae1472 100644
--- a/include/sctp_m2ua.h
+++ b/include/sctp_m2ua.h
@@ -57,6 +57,8 @@
 	int link_index;
 	struct llist_head entry;
 	struct sctp_m2ua_transport *transport;
+
+	char *as;
 };
 
 /*
@@ -71,8 +73,11 @@
 	struct sctp_m2ua_transport *trans;
 };
 
-struct sctp_m2ua_transport *sctp_m2ua_transp_create(const char *ip, int port);
+struct sctp_m2ua_transport *sctp_m2ua_transp_create(struct bsc_data *bsc);
+int sctp_m2ua_transport_bind(struct sctp_m2ua_transport *, const char *ip, int port);
 struct mtp_m2ua_link *mtp_m2ua_link_create(struct sctp_m2ua_transport *transport,
 					   struct mtp_link_set *);
 
+struct mtp_m2ua_link *mtp_m2ua_link_init(struct mtp_link *link);
+
 #endif
diff --git a/include/snmp_mtp.h b/include/snmp_mtp.h
index 8c15df7..0c3075f 100644
--- a/include/snmp_mtp.h
+++ b/include/snmp_mtp.h
@@ -49,7 +49,8 @@
 	SNMP_STATUS_TIMEOUT,
 };
 
-struct snmp_mtp_session *snmp_mtp_session_create(char *host);
+struct snmp_mtp_session *snmp_mtp_session_create(void);
+int snmp_mtp_peer_name(struct snmp_mtp_session *, char *name);
 void snmp_mtp_deactivate(struct snmp_mtp_session *, int link_id);
 void snmp_mtp_activate(struct snmp_mtp_session *, int link_id);
 void snmp_mtp_poll();
diff --git a/include/ss7_application.h b/include/ss7_application.h
index 66ddd87..084a8f7 100644
--- a/include/ss7_application.h
+++ b/include/ss7_application.h
@@ -35,6 +35,7 @@
 };
 
 enum ss7_app_type {
+	APP_NONE,
 	APP_CELLMGR,
 	APP_RELAY,
 	APP_STP,
@@ -59,6 +60,7 @@
 	int type;
 
 	/* for the routing */
+	int route_is_set;
 	struct ss7_application_route route_src;
 	struct ss7_application_route route_dst;
 
diff --git a/include/ss7_vty.h b/include/ss7_vty.h
new file mode 100644
index 0000000..48dbb48
--- /dev/null
+++ b/include/ss7_vty.h
@@ -0,0 +1,42 @@
+/*
+ * (C) 2011 by Holger Hans Peter Freyther <zecke@selfish.org>
+ * (C) 2011 by On-Waves
+ * All Rights Reserved
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef SS7_VTY_H
+#define SS7_VTY_H
+
+#include <osmocom/vty/vty.h>
+#include <osmocom/vty/buffer.h>
+#include <osmocom/vty/command.h>
+
+enum ss7_vty_node {
+	MGCP_NODE = _LAST_OSMOVTY_NODE + 1,
+	CELLMGR_NODE,
+	SS7_NODE,
+	LINKSETS_NODE,
+	LINK_NODE,
+	MSC_NODE,
+	APP_NODE,
+};
+
+extern struct cmd_element cfg_description_cmd;
+extern struct cmd_element cfg_no_description_cmd;
+
+
+#endif