blob: 39258d364db351faf9971d6d60e3e60d34cda99e [file] [log] [blame]
Holger Hans Peter Freythereef86b52010-06-15 18:45:06 +08001/* 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 Freytherdf6143a2010-06-15 18:46:56 +08004 * (C) 2010 by On-Waves
Holger Hans Peter Freythereef86b52010-06-15 18:45:06 +08005 * All Rights Reserved
6 *
7 * This program is free software; you can redistribute it and/or modify
Harald Welte9af6ddf2011-01-01 15:25:50 +01008 * 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 Freythereef86b52010-06-15 18:45:06 +080010 * (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 Welte9af6ddf2011-01-01 15:25:50 +010015 * GNU Affero General Public License for more details.
Holger Hans Peter Freythereef86b52010-06-15 18:45:06 +080016 *
Harald Welte9af6ddf2011-01-01 15:25:50 +010017 * 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 Freythereef86b52010-06-15 18:45:06 +080019 *
20 */
21
22#ifndef BSC_MSC_H
23#define BSC_MSC_H
24
Pablo Neira Ayuso136f4532011-03-22 16:47:59 +010025#include <osmocom/core/write_queue.h>
26#include <osmocom/core/timer.h>
Holger Hans Peter Freythereef86b52010-06-15 18:45:06 +080027
Nikola Kolevb9f45982014-05-08 12:44:47 +030028#include <netinet/in.h>
29
Holger Hans Peter Freythere18801052011-04-23 23:31:31 +020030struct bsc_msc_dest {
31 struct llist_head list;
32
33 char *ip;
34 int port;
35 int dscp;
36};
37
38
Holger Hans Peter Freytherbaf2abe2010-06-15 18:47:29 +080039struct bsc_msc_connection {
Pablo Neira Ayusoe1273b12011-05-06 12:09:47 +020040 struct osmo_wqueue write_queue;
Holger Hans Peter Freytherbaf2abe2010-06-15 18:47:29 +080041 int is_connected;
Holger Hans Peter Freyther8bdcf552010-06-15 18:50:48 +080042 int is_authenticated;
Holger Hans Peter Freytherbec411b2010-07-05 14:14:18 +080043 int first_contact;
Holger Hans Peter Freythere18801052011-04-23 23:31:31 +020044
45 struct llist_head *dests;
Holger Hans Peter Freytherbaf2abe2010-06-15 18:47:29 +080046
Holger Hans Peter Freytherc1a86872013-09-02 13:07:45 +020047 const char *name;
48
Holger Hans Peter Freytherbaf2abe2010-06-15 18:47:29 +080049 void (*connection_loss) (struct bsc_msc_connection *);
50 void (*connected) (struct bsc_msc_connection *);
Pablo Neira Ayusobf540cb2011-05-06 12:11:06 +020051 struct osmo_timer_list reconnect_timer;
52 struct osmo_timer_list timeout_timer;
Jacob Erlbecke8278122014-03-31 13:42:11 +020053
54 struct msgb *pending_msg;
Holger Hans Peter Freytherbaf2abe2010-06-15 18:47:29 +080055};
56
Holger Hans Peter Freythere18801052011-04-23 23:31:31 +020057struct bsc_msc_connection *bsc_msc_create(void *ctx, struct llist_head *dest);
Holger Hans Peter Freytherbaf2abe2010-06-15 18:47:29 +080058int bsc_msc_connect(struct bsc_msc_connection *);
59void bsc_msc_schedule_connect(struct bsc_msc_connection *);
60
61void bsc_msc_lost(struct bsc_msc_connection *);
Holger Hans Peter Freythereef86b52010-06-15 18:45:06 +080062
Holger Hans Peter Freythere2ac6b72015-06-08 18:02:10 +020063struct msgb *bsc_msc_id_get_resp(int fixed, const char *token, const uint8_t *res, int len);
Holger Hans Peter Freytherf76e7ef2010-06-15 18:52:05 +080064
Holger Hans Peter Freythereef86b52010-06-15 18:45:06 +080065#endif