aboutsummaryrefslogtreecommitdiffstats
path: root/include/bsc_data.h
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-07-28 03:32:52 +0800
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-07-28 03:36:32 +0800
commit97f66e2b534e2a54c63360a3f8134a0189c54e25 (patch)
tree903e34443767b09ef1d11575f8a1502f6295c7fd /include/bsc_data.h
Public release of the cellmgr_ng code to convert E1 to IPA SCCP
Diffstat (limited to 'include/bsc_data.h')
-rw-r--r--include/bsc_data.h131
1 files changed, 131 insertions, 0 deletions
diff --git a/include/bsc_data.h b/include/bsc_data.h
new file mode 100644
index 0000000..6d61a22
--- /dev/null
+++ b/include/bsc_data.h
@@ -0,0 +1,131 @@
+/* Everything related to the BSC connection */
+/*
+ * (C) 2010 by Holger Hans Peter Freyther <zecke@selfish.org>
+ * (C) 2010 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 General Public License as published by
+ * the Free Software Foundation; either version 2 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ */
+
+#ifndef BSC_DATA_H
+#define BSC_DATA_H
+
+#include <laf0rge1/linuxlist.h>
+#include <laf0rge1/select.h>
+#include <laf0rge1/timer.h>
+
+#include <sccp/sccp.h>
+
+#include "write_queue.h"
+
+#include <netinet/in.h>
+#include <arpa/inet.h>
+
+struct bsc_data;
+struct snmp_mtp_session;
+
+/**
+ * A link to the underlying MTP2 library or such
+ */
+struct link_data {
+ union {
+ struct {
+ struct thread_notifier *notifier;
+ struct llist_head mtp_queue;
+ struct timer_list mtp_timeout;
+ } c7;
+ struct {
+ struct write_queue write_queue;
+ struct sockaddr_in remote;
+ struct snmp_mtp_session *session;
+ int reset_timeout;
+ } udp;
+ };
+
+ int pcap_fd;
+ struct bsc_data *bsc;
+ struct mtp_link *the_link;
+
+ struct timer_list link_activate;
+ int forced_down;
+
+ int (*start)(struct link_data *);
+ int (*write)(struct link_data *, struct msgb *msg);
+ int (*shutdown)(struct link_data *);
+ int (*reset)(struct link_data *data);
+ int (*clear_queue)(struct link_data *data);
+};
+
+
+struct bsc_data {
+ /* 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 ping_time;
+ int pong_time;
+ struct timer_list ping_timeout;
+ struct timer_list pong_timeout;
+
+ int closing;
+ struct llist_head sccp_connections;
+ struct timer_list reset_timeout;
+ int reset_count;
+
+ struct timer_list start_timer;
+
+ int setup;
+
+ struct link_data link;
+
+ const char *token;
+
+ /* mgcp messgaes */
+ struct write_queue mgcp_agent;
+};
+
+/* bsc related functions */
+void release_bsc_resources(struct bsc_data *bsc);
+void bsc_link_down(struct link_data *data);
+void bsc_link_up(struct link_data *data);
+
+/* msc related functions */
+int msc_init(struct bsc_data *bsc);
+void msc_schedule_reconnect(struct bsc_data *bsc);
+void msc_send_rlc(struct bsc_data *bsc, struct sccp_source_reference *src, struct sccp_source_reference *dest);
+void msc_send_reset(struct bsc_data *bsc);
+void msc_send_msg(struct bsc_data *bsc, int rc, struct sccp_parse_result *, struct msgb *msg);
+void msc_clear_queue(struct bsc_data *data);
+
+/* connection tracking and action */
+void update_con_state(int rc, struct sccp_parse_result *result, struct msgb *msg, int from_msc, int sls);
+unsigned int sls_for_src_ref(struct sccp_source_reference *ref);
+
+/* c7 init */
+int link_c7_init(struct link_data *data);
+
+/* udp init */
+int link_udp_init(struct link_data *data, int src_port, const char *dest_ip, int port);
+
+/* MGCP */
+void mgcp_forward(struct bsc_data *bsc, const u_int8_t *data, unsigned int length);
+
+#endif