aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2011-02-15 20:01:47 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2011-02-17 19:34:27 +0100
commit84ec8714b21a766471129282b98a8bcbfef799f0 (patch)
tree685957259921822b00a661bad164e8e5e1e35a3e /include
parentf7ce2c6417b2cda3b0672d84f1ac9085c6f86f3a (diff)
msc: Move the MSC Connection into a new header file
This is in preparation of splitting the MSC part and the nat logic for the upcoming config rewriting.
Diffstat (limited to 'include')
-rw-r--r--include/Makefile.am2
-rw-r--r--include/bsc_data.h68
-rw-r--r--include/bsc_sccp.h10
-rw-r--r--include/bsc_ussd.h6
-rw-r--r--include/msc_connection.h84
-rw-r--r--include/mtp_data.h4
6 files changed, 102 insertions, 72 deletions
diff --git a/include/Makefile.am b/include/Makefile.am
index 1dbaef7..ce617e7 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -1,6 +1,6 @@
noinst_HEADERS = mtp_level3.h mtp_data.h ipaccess.h thread.h mtp_pcap.h \
mgcp_ss7.h bss_patch.h bssap_sccp.h bsc_data.h udp_input.h \
snmp_mtp.h cellmgr_debug.h bsc_sccp.h bsc_ussd.h sctp_m2ua.h \
- isup_types.h counter.h
+ isup_types.h counter.h msc_connection.h
SUBDIRS = mgcp
diff --git a/include/bsc_data.h b/include/bsc_data.h
index 6fb5b26..ac799f1 100644
--- a/include/bsc_data.h
+++ b/include/bsc_data.h
@@ -39,53 +39,9 @@
struct bsc_data;
struct snmp_mtp_session;
+struct msc_connection;
struct mtp_m2ua_transport;
-/**
- * Struct holding the BSC to MSC forwarding state.
- */
-struct bsc_msc_forward {
- /* back pointer */
- struct bsc_data *bsc_data;
-
- /* the linkset we are using here */
- struct mtp_link_set *bsc;
-
- /* MSC */
- char *msc_address;
- struct write_queue msc_connection;
- struct timer_list reconnect_timer;
- int first_contact;
- int msc_time;
- struct timer_list msc_timeout;
- int msc_ip_dscp;
-
- int msc_link_down;
- struct llist_head sccp_connections;
- int reset_count;
-
- /* LAC of the cell */
- struct gsm48_loc_area_id lai;
- uint16_t mcc;
- uint16_t mnc;
- uint16_t lac;
-
- const char *token;
-
- /* timeouts for the msc connection */
- int ping_time;
- int pong_time;
- struct timer_list ping_timeout;
- struct timer_list pong_timeout;
- struct timer_list reset_timeout;
-
- /* mgcp messgaes */
- struct write_queue mgcp_agent;
-
- /* do nothing with the data coming from the MSC */
- int forward_only;
-};
-
struct mtp_udp_data {
struct write_queue write_queue;
struct timer_list snmp_poll;
@@ -154,29 +110,22 @@ struct bsc_data {
struct bsc_fd inject_fd;
struct llist_head inject_list;
- /* MSC related data... currently only one is supported */
- struct bsc_msc_forward msc_forward;
-
/* m2ua code */
struct sctp_m2ua_transport *m2ua_trans;
+
+ /* MSCs */
+ struct llist_head mscs;
+ int num_mscs;
};
/* bsc related functions */
-void release_bsc_resources(struct bsc_msc_forward *fw);
+void release_bsc_resources(struct msc_connection *fw);
void mtp_linkset_down(struct mtp_link_set *);
void mtp_linkset_up(struct mtp_link_set *);
-/* msc related functions */
-int msc_init(struct bsc_msc_forward *bsc, int mgcp);
-void msc_send_rlc(struct bsc_msc_forward *bsc, struct sccp_source_reference *src, struct sccp_source_reference *dest);
-void msc_send_reset(struct bsc_msc_forward *bsc);
-void msc_send_msg(struct bsc_msc_forward *bsc, int rc, struct sccp_parse_result *, struct msgb *msg);
-void msc_send_direct(struct bsc_msc_forward *bsc, struct msgb *msg);
-void msc_close_connection(struct bsc_msc_forward *data);
-
/* connection tracking and action */
-void update_con_state(struct bsc_msc_forward *fw, int rc, struct sccp_parse_result *result, struct msgb *msg, int from_msc, int sls);
+void update_con_state(struct msc_connection *msc, int rc, struct sccp_parse_result *result, struct msgb *msg, int from_msc, int sls);
/* udp init */
int link_global_init(struct mtp_udp_data *data, int src_port);
@@ -186,9 +135,6 @@ int link_shutdown_all(struct mtp_link_set *);
int link_reset_all(struct mtp_link_set *);
int link_clear_all(struct mtp_link_set *);
-/* MGCP */
-void mgcp_forward(struct bsc_msc_forward *bsc, const uint8_t *data, unsigned int length);
-
/* pcap */
enum {
NET_IN,
diff --git a/include/bsc_sccp.h b/include/bsc_sccp.h
index 833257d..9c3bb11 100644
--- a/include/bsc_sccp.h
+++ b/include/bsc_sccp.h
@@ -30,7 +30,7 @@
#include <osmocom/sccp/sccp.h>
-struct bsc_msc_forward;
+struct msc_connection;
/*
* One SCCP connection.
@@ -63,10 +63,10 @@ struct active_sccp_con {
};
void free_con(struct active_sccp_con *con);
-struct active_sccp_con *find_con_by_dest_ref(struct bsc_msc_forward *, struct sccp_source_reference *ref);
-struct active_sccp_con *find_con_by_src_ref(struct bsc_msc_forward *,struct sccp_source_reference *src_ref);
-struct active_sccp_con *find_con_by_src_dest_ref(struct bsc_msc_forward *, struct sccp_source_reference *src_ref,
+struct active_sccp_con *find_con_by_dest_ref(struct msc_connection *, struct sccp_source_reference *ref);
+struct active_sccp_con *find_con_by_src_ref(struct msc_connection *,struct sccp_source_reference *src_ref);
+struct active_sccp_con *find_con_by_src_dest_ref(struct msc_connection *, struct sccp_source_reference *src_ref,
struct sccp_source_reference *dst_ref);
-unsigned int sls_for_src_ref(struct bsc_msc_forward *, struct sccp_source_reference *ref);
+unsigned int sls_for_src_ref(struct msc_connection *, struct sccp_source_reference *ref);
#endif
diff --git a/include/bsc_ussd.h b/include/bsc_ussd.h
index 988b7ab..23ec40f 100644
--- a/include/bsc_ussd.h
+++ b/include/bsc_ussd.h
@@ -21,10 +21,10 @@
#ifndef bsc_ussd_h
#define bsc_ussd_h
-struct bsc_msc_forward;
+struct msc_connection;
-int bsc_ussd_handle_out_msg(struct bsc_msc_forward *, struct sccp_parse_result *result, struct msgb *msg);
+int bsc_ussd_handle_out_msg(struct msc_connection *, struct sccp_parse_result *result, struct msgb *msg);
-int bsc_ussd_handle_in_msg(struct bsc_msc_forward *, struct sccp_parse_result *res, struct msgb *msg);
+int bsc_ussd_handle_in_msg(struct msc_connection *, struct sccp_parse_result *res, struct msgb *msg);
#endif
diff --git a/include/msc_connection.h b/include/msc_connection.h
new file mode 100644
index 0000000..3770452
--- /dev/null
+++ b/include/msc_connection.h
@@ -0,0 +1,84 @@
+/*
+ * (C) 2010-2011 by Holger Hans Peter Freyther <zecke@selfish.org>
+ * (C) 2010-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 MSC_CONNECTION_H
+#define MSC_CONNECTION_H
+
+#include <osmocore/linuxlist.h>
+#include <osmocore/write_queue.h>
+#include <osmocore/timer.h>
+
+#include <osmocom/sccp/sccp.h>
+
+struct bsc_data;
+struct ss7_application;
+
+struct msc_connection {
+ /* management */
+ struct llist_head entry;
+ int nr;
+ char *name;
+
+ /* ip management */
+ int dscp;
+ char *ip;
+ char *token;
+
+ /* connection management */
+ int msc_link_down;
+ struct write_queue msc_connection;
+ struct timer_list reconnect_timer;
+ int first_contact;
+
+ /* time to wait for first message from MSC */
+ struct timer_list msc_timeout;
+ int msc_time;
+
+ /* timeouts for the msc connection */
+ int ping_time;
+ int pong_time;
+ struct timer_list ping_timeout;
+ struct timer_list pong_timeout;
+ struct timer_list reset_timeout;
+
+ /* mgcp messgaes */
+ struct write_queue mgcp_agent;
+
+ /* application pointer */
+ struct llist_head sccp_connections;
+ struct mtp_link_set *target_link;
+ int forward_only;
+ int reset_count;
+};
+
+/* msc related functions */
+void msc_send_rlc(struct msc_connection *bsc, struct sccp_source_reference *src, struct sccp_source_reference *dest);
+void msc_send_reset(struct msc_connection *bsc);
+void msc_send_msg(struct msc_connection *bsc, int rc, struct sccp_parse_result *, struct msgb *msg);
+void msc_send_direct(struct msc_connection *bsc, struct msgb *msg);
+void msc_close_connection(struct msc_connection *data);
+
+struct msc_connection *msc_connection_create(struct bsc_data *bsc, int mgcp);
+struct msc_connection *msc_connection_num(struct bsc_data *bsc, int num);
+int msc_connection_start(struct msc_connection *msc);
+
+/* MGCP */
+void mgcp_forward(struct msc_connection *msc, const uint8_t *data, unsigned int length);
+
+#endif
diff --git a/include/mtp_data.h b/include/mtp_data.h
index d054de8..6ed31c3 100644
--- a/include/mtp_data.h
+++ b/include/mtp_data.h
@@ -25,7 +25,7 @@
#include <osmocore/utils.h>
struct bsc_data;
-struct bsc_msc_forward;
+struct msc_connection;
struct mtp_link;
struct mtp_level_3_mng *mng;
struct rate_ctr_group;
@@ -76,7 +76,7 @@ struct mtp_link_set {
/* custom data */
struct bsc_data *bsc;
- struct bsc_msc_forward *fw;
+ struct msc_connection *fw;
struct mtp_link_set *forward;
};