Holger Hans Peter Freyther | eef86b5 | 2010-06-15 18:45:06 +0800 | [diff] [blame] | 1 | /* Routines to talk to the MSC using the IPA Protocol */ |
| 2 | /* |
| 3 | * (C) 2010 by Holger Hans Peter Freyther <zecke@selfish.org> |
Holger Hans Peter Freyther | df6143a | 2010-06-15 18:46:56 +0800 | [diff] [blame] | 4 | * (C) 2010 by On-Waves |
Holger Hans Peter Freyther | eef86b5 | 2010-06-15 18:45:06 +0800 | [diff] [blame] | 5 | * All Rights Reserved |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
Harald Welte | 9af6ddf | 2011-01-01 15:25:50 +0100 | [diff] [blame] | 8 | * it under the terms of the GNU Affero General Public License as published by |
| 9 | * the Free Software Foundation; either version 3 of the License, or |
Holger Hans Peter Freyther | eef86b5 | 2010-06-15 18:45:06 +0800 | [diff] [blame] | 10 | * (at your option) any later version. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
Harald Welte | 9af6ddf | 2011-01-01 15:25:50 +0100 | [diff] [blame] | 15 | * GNU Affero General Public License for more details. |
Holger Hans Peter Freyther | eef86b5 | 2010-06-15 18:45:06 +0800 | [diff] [blame] | 16 | * |
Harald Welte | 9af6ddf | 2011-01-01 15:25:50 +0100 | [diff] [blame] | 17 | * You should have received a copy of the GNU Affero General Public License |
| 18 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
Holger Hans Peter Freyther | eef86b5 | 2010-06-15 18:45:06 +0800 | [diff] [blame] | 19 | * |
| 20 | */ |
| 21 | |
| 22 | #ifndef BSC_MSC_H |
| 23 | #define BSC_MSC_H |
| 24 | |
Pablo Neira Ayuso | 136f453 | 2011-03-22 16:47:59 +0100 | [diff] [blame] | 25 | #include <osmocom/core/write_queue.h> |
| 26 | #include <osmocom/core/timer.h> |
Philipp Maier | fbf6610 | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 27 | #include <osmocom/sigtran/sccp_sap.h> |
Neels Hofmeyr | 9084396 | 2017-09-04 15:04:35 +0200 | [diff] [blame] | 28 | #include <osmocom/msc/a_reset.h> |
Holger Hans Peter Freyther | eef86b5 | 2010-06-15 18:45:06 +0800 | [diff] [blame] | 29 | |
Nikola Kolev | b9f4598 | 2014-05-08 12:44:47 +0300 | [diff] [blame] | 30 | #include <netinet/in.h> |
| 31 | |
Holger Hans Peter Freyther | e1880105 | 2011-04-23 23:31:31 +0200 | [diff] [blame] | 32 | struct bsc_msc_dest { |
| 33 | struct llist_head list; |
| 34 | |
| 35 | char *ip; |
| 36 | int port; |
| 37 | int dscp; |
| 38 | }; |
| 39 | |
| 40 | |
Holger Hans Peter Freyther | baf2abe | 2010-06-15 18:47:29 +0800 | [diff] [blame] | 41 | struct bsc_msc_connection { |
Philipp Maier | fbf6610 | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 42 | /* FIXME: Remove stuff that is no longer needed! */ |
Pablo Neira Ayuso | e1273b1 | 2011-05-06 12:09:47 +0200 | [diff] [blame] | 43 | struct osmo_wqueue write_queue; |
Holger Hans Peter Freyther | baf2abe | 2010-06-15 18:47:29 +0800 | [diff] [blame] | 44 | int is_connected; |
Holger Hans Peter Freyther | 8bdcf55 | 2010-06-15 18:50:48 +0800 | [diff] [blame] | 45 | int is_authenticated; |
Holger Hans Peter Freyther | bec411b | 2010-07-05 14:14:18 +0800 | [diff] [blame] | 46 | int first_contact; |
Holger Hans Peter Freyther | e1880105 | 2011-04-23 23:31:31 +0200 | [diff] [blame] | 47 | |
| 48 | struct llist_head *dests; |
Holger Hans Peter Freyther | baf2abe | 2010-06-15 18:47:29 +0800 | [diff] [blame] | 49 | |
Holger Hans Peter Freyther | c1a8687 | 2013-09-02 13:07:45 +0200 | [diff] [blame] | 50 | const char *name; |
| 51 | |
Holger Hans Peter Freyther | baf2abe | 2010-06-15 18:47:29 +0800 | [diff] [blame] | 52 | void (*connection_loss) (struct bsc_msc_connection *); |
| 53 | void (*connected) (struct bsc_msc_connection *); |
Pablo Neira Ayuso | bf540cb | 2011-05-06 12:11:06 +0200 | [diff] [blame] | 54 | struct osmo_timer_list reconnect_timer; |
| 55 | struct osmo_timer_list timeout_timer; |
Jacob Erlbeck | e827812 | 2014-03-31 13:42:11 +0200 | [diff] [blame] | 56 | |
| 57 | struct msgb *pending_msg; |
Philipp Maier | fbf6610 | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 58 | |
| 59 | /* Sigtran connection data */ |
| 60 | struct osmo_sccp_instance *sccp; |
| 61 | struct osmo_sccp_user *sccp_user; |
| 62 | struct osmo_sccp_addr g_calling_addr; |
| 63 | struct osmo_sccp_addr g_called_addr; |
| 64 | struct a_reset_ctx *reset; |
| 65 | |
| 66 | int conn_id_counter; |
Holger Hans Peter Freyther | baf2abe | 2010-06-15 18:47:29 +0800 | [diff] [blame] | 67 | }; |
| 68 | |
Holger Hans Peter Freyther | e1880105 | 2011-04-23 23:31:31 +0200 | [diff] [blame] | 69 | struct bsc_msc_connection *bsc_msc_create(void *ctx, struct llist_head *dest); |
Holger Hans Peter Freyther | baf2abe | 2010-06-15 18:47:29 +0800 | [diff] [blame] | 70 | int bsc_msc_connect(struct bsc_msc_connection *); |
| 71 | void bsc_msc_schedule_connect(struct bsc_msc_connection *); |
| 72 | |
| 73 | void bsc_msc_lost(struct bsc_msc_connection *); |
Holger Hans Peter Freyther | eef86b5 | 2010-06-15 18:45:06 +0800 | [diff] [blame] | 74 | |
Holger Hans Peter Freyther | e2ac6b7 | 2015-06-08 18:02:10 +0200 | [diff] [blame] | 75 | struct msgb *bsc_msc_id_get_resp(int fixed, const char *token, const uint8_t *res, int len); |
Holger Hans Peter Freyther | f76e7ef | 2010-06-15 18:52:05 +0800 | [diff] [blame] | 76 | |
Holger Hans Peter Freyther | eef86b5 | 2010-06-15 18:45:06 +0800 | [diff] [blame] | 77 | #endif |