Holger Hans Peter Freyther | 4f448c9 | 2010-07-05 16:02:04 +0800 | [diff] [blame] | 1 | /* OpenBSC BSC code */ |
| 2 | |
| 3 | #ifndef OSMO_BSC_H |
| 4 | #define OSMO_BSC_H |
| 5 | |
| 6 | #include "bsc_api.h" |
Holger Hans Peter Freyther | d633280 | 2015-04-05 19:46:20 +0200 | [diff] [blame] | 7 | #include "bsc_msg_filter.h" |
Holger Hans Peter Freyther | 4f448c9 | 2010-07-05 16:02:04 +0800 | [diff] [blame] | 8 | |
Holger Hans Peter Freyther | d2361d9 | 2012-12-03 15:32:54 +0100 | [diff] [blame] | 9 | #define BSS_SEND_USSD 1 |
| 10 | |
Jacob Erlbeck | 56595f8 | 2013-09-11 10:46:55 +0200 | [diff] [blame] | 11 | enum bsc_con { |
| 12 | BSC_CON_SUCCESS, |
| 13 | BSC_CON_REJECT_NO_LINK, |
| 14 | BSC_CON_REJECT_RF_GRACE, |
| 15 | BSC_CON_NO_MEM, |
| 16 | }; |
| 17 | |
Holger Hans Peter Freyther | b8781d2 | 2010-11-06 18:08:43 +0100 | [diff] [blame] | 18 | struct sccp_connection; |
Neels Hofmeyr | a369e24 | 2017-02-23 21:57:23 +0100 | [diff] [blame] | 19 | struct bsc_msc_data; |
Holger Hans Peter Freyther | 4cdb050 | 2011-06-04 14:51:51 +0200 | [diff] [blame] | 20 | struct bsc_msc_connection; |
Holger Hans Peter Freyther | b8781d2 | 2010-11-06 18:08:43 +0100 | [diff] [blame] | 21 | |
Holger Hans Peter Freyther | d65305f | 2010-11-05 11:31:08 +0100 | [diff] [blame] | 22 | struct osmo_bsc_sccp_con { |
Holger Hans Peter Freyther | b8781d2 | 2010-11-06 18:08:43 +0100 | [diff] [blame] | 23 | struct llist_head entry; |
| 24 | |
Holger Hans Peter Freyther | fae3c65 | 2010-11-10 09:44:34 +0100 | [diff] [blame] | 25 | int ciphering_handled; |
Holger Hans Peter Freyther | 93dfa24 | 2014-08-08 21:06:30 +0200 | [diff] [blame] | 26 | |
| 27 | /* for audio handling */ |
| 28 | uint16_t cic; |
Philipp Maier | efe85d3 | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 29 | uint32_t rtp_ip; |
Holger Hans Peter Freyther | 50c579b | 2010-11-10 10:07:30 +0100 | [diff] [blame] | 30 | int rtp_port; |
Holger Hans Peter Freyther | fae3c65 | 2010-11-10 09:44:34 +0100 | [diff] [blame] | 31 | |
Holger Hans Peter Freyther | 56cb729 | 2014-09-02 17:28:40 +0200 | [diff] [blame] | 32 | /* for advanced ping/pong */ |
| 33 | int send_ping; |
| 34 | |
Holger Hans Peter Freyther | b8781d2 | 2010-11-06 18:08:43 +0100 | [diff] [blame] | 35 | /* SCCP connection realted */ |
| 36 | struct sccp_connection *sccp; |
Neels Hofmeyr | a369e24 | 2017-02-23 21:57:23 +0100 | [diff] [blame] | 37 | struct bsc_msc_data *msc; |
Pablo Neira Ayuso | bf540cb | 2011-05-06 12:11:06 +0200 | [diff] [blame] | 38 | struct osmo_timer_list sccp_it_timeout; |
| 39 | struct osmo_timer_list sccp_cc_timeout; |
Holger Hans Peter Freyther | b8781d2 | 2010-11-06 18:08:43 +0100 | [diff] [blame] | 40 | |
Holger Hans Peter Freyther | b4e72f8 | 2010-11-15 10:31:53 +0100 | [diff] [blame] | 41 | struct llist_head sccp_queue; |
| 42 | unsigned int sccp_queue_size; |
| 43 | |
Holger Hans Peter Freyther | 7e90108 | 2010-11-06 20:15:17 +0100 | [diff] [blame] | 44 | struct gsm_subscriber_connection *conn; |
Holger Hans Peter Freyther | d65305f | 2010-11-05 11:31:08 +0100 | [diff] [blame] | 45 | uint8_t new_subscriber; |
Holger Hans Peter Freyther | d633280 | 2015-04-05 19:46:20 +0200 | [diff] [blame] | 46 | |
| 47 | struct bsc_filter_state filter_state; |
Philipp Maier | efe85d3 | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 48 | |
| 49 | /* Sigtran connection ID */ |
| 50 | int conn_id; |
Holger Hans Peter Freyther | d65305f | 2010-11-05 11:31:08 +0100 | [diff] [blame] | 51 | }; |
| 52 | |
Holger Hans Peter Freyther | 4f448c9 | 2010-07-05 16:02:04 +0800 | [diff] [blame] | 53 | struct bsc_api *osmo_bsc_api(); |
| 54 | |
Holger Hans Peter Freyther | 863a55d | 2010-11-10 09:31:41 +0100 | [diff] [blame] | 55 | int bsc_queue_for_msc(struct osmo_bsc_sccp_con *conn, struct msgb *msg); |
Holger Hans Peter Freyther | 7e90108 | 2010-11-06 20:15:17 +0100 | [diff] [blame] | 56 | int bsc_open_connection(struct osmo_bsc_sccp_con *sccp, struct msgb *msg); |
Jacob Erlbeck | 56595f8 | 2013-09-11 10:46:55 +0200 | [diff] [blame] | 57 | enum bsc_con bsc_create_new_connection(struct gsm_subscriber_connection *conn, |
Neels Hofmeyr | a369e24 | 2017-02-23 21:57:23 +0100 | [diff] [blame] | 58 | struct bsc_msc_data *msc, int send_ping); |
Holger Hans Peter Freyther | 7e90108 | 2010-11-06 20:15:17 +0100 | [diff] [blame] | 59 | int bsc_delete_connection(struct osmo_bsc_sccp_con *sccp); |
Holger Hans Peter Freyther | 4582586 | 2010-11-04 11:48:49 +0100 | [diff] [blame] | 60 | |
Neels Hofmeyr | a369e24 | 2017-02-23 21:57:23 +0100 | [diff] [blame] | 61 | struct bsc_msc_data *bsc_find_msc(struct gsm_subscriber_connection *conn, struct msgb *); |
Holger Hans Peter Freyther | 5bb874d | 2010-11-05 11:21:18 +0100 | [diff] [blame] | 62 | int bsc_scan_bts_msg(struct gsm_subscriber_connection *conn, struct msgb *msg); |
Holger Hans Peter Freyther | a54732d | 2010-11-05 18:11:19 +0100 | [diff] [blame] | 63 | int bsc_scan_msc_msg(struct gsm_subscriber_connection *conn, struct msgb *msg); |
Holger Hans Peter Freyther | d2361d9 | 2012-12-03 15:32:54 +0100 | [diff] [blame] | 64 | int bsc_send_welcome_ussd(struct gsm_subscriber_connection *conn); |
Holger Hans Peter Freyther | 5bb874d | 2010-11-05 11:21:18 +0100 | [diff] [blame] | 65 | |
Neels Hofmeyr | a369e24 | 2017-02-23 21:57:23 +0100 | [diff] [blame] | 66 | int bsc_handle_udt(struct bsc_msc_data *msc, struct msgb *msg, unsigned int length); |
Philipp Maier | efe85d3 | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 67 | int bsc_handle_dt(struct osmo_bsc_sccp_con *conn, struct msgb *msg, unsigned int len); |
Holger Hans Peter Freyther | 3485feb | 2010-11-09 23:28:33 +0100 | [diff] [blame] | 68 | |
Daniel Willmann | 5e95f45 | 2011-08-05 12:22:35 +0200 | [diff] [blame] | 69 | int bsc_ctrl_cmds_install(); |
Holger Hans Peter Freyther | 00f4cc2 | 2010-11-06 23:50:06 +0100 | [diff] [blame] | 70 | |
Holger Hans Peter Freyther | 98258db | 2014-02-22 10:30:32 +0100 | [diff] [blame] | 71 | void bsc_gen_location_state_trap(struct gsm_bts *bts); |
| 72 | |
Holger Hans Peter Freyther | ec0cb7c | 2015-04-05 20:53:42 +0200 | [diff] [blame] | 73 | struct llist_head *bsc_access_lists(void); |
| 74 | |
Holger Hans Peter Freyther | 4f448c9 | 2010-07-05 16:02:04 +0800 | [diff] [blame] | 75 | #endif |