aboutsummaryrefslogtreecommitdiffstats
path: root/include/bsc_data.h
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2011-02-10 15:32:14 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2011-02-10 20:09:09 +0100
commite86c02e107d9bef11a69ecef85d923ae4f523ef3 (patch)
tree7797afa28ff03963e8f84f254b9b91b311b89ad0 /include/bsc_data.h
parentee63d7d15e14ca0b653086043e7a6d1d537a89a1 (diff)
bsc: Move the BSC<->MSC variables to a new struct.
Move the MSC related information out of the bsc_data and update the code to use this BSC configuration. This is greatly cleaning up the code and in theory there might now be two BSC and two MSCs that one application can handle (minus the missing VTY config)
Diffstat (limited to 'include/bsc_data.h')
-rw-r--r--include/bsc_data.h100
1 files changed, 57 insertions, 43 deletions
diff --git a/include/bsc_data.h b/include/bsc_data.h
index b0dc6f8..a72ea6a 100644
--- a/include/bsc_data.h
+++ b/include/bsc_data.h
@@ -40,6 +40,51 @@
struct bsc_data;
struct snmp_mtp_session;
+/**
+ * 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;
@@ -74,39 +119,13 @@ enum {
struct bsc_data {
int app;
- /* 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 msc_link_down;
- struct llist_head sccp_connections;
- struct timer_list reset_timeout;
- int reset_count;
-
struct timer_list start_timer;
-
int setup;
-
int pcap_fd;
int udp_reset_timeout;
struct mtp_link_set *link_set;
struct mtp_link_set *m2ua_set;
- const char *token;
-
- /* mgcp messgaes */
- struct write_queue mgcp_agent;
-
/* udp code */
struct mtp_udp_data udp_data;
@@ -127,37 +146,32 @@ struct bsc_data {
/* isup handling */
int isup_pass;
- /* LAC of the cell */
- struct gsm48_loc_area_id lai;
- uint16_t mcc;
- uint16_t mnc;
- uint16_t lac;
-
- int forward_only;
/* inject */
int allow_inject;
struct bsc_fd inject_fd;
struct llist_head inject_list;
+
+ /* MSC related data... currently only one is supported */
+ struct bsc_msc_forward msc_forward;
};
/* bsc related functions */
-void release_bsc_resources(struct bsc_data *bsc);
+void release_bsc_resources(struct bsc_msc_forward *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_data *bsc, int mgcp);
-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_send_direct(struct bsc_data *bsc, struct msgb *msg);
-void msc_close_connection(struct bsc_data *data);
+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 mtp_link_set *link, 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);
+void update_con_state(struct bsc_msc_forward *fw, 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);
@@ -168,7 +182,7 @@ int link_reset_all(struct mtp_link_set *);
int link_clear_all(struct mtp_link_set *);
/* MGCP */
-void mgcp_forward(struct bsc_data *bsc, const uint8_t *data, unsigned int length);
+void mgcp_forward(struct bsc_msc_forward *bsc, const uint8_t *data, unsigned int length);
/* pcap */
enum {