aboutsummaryrefslogtreecommitdiffstats
path: root/include/msc_connection.h
blob: 74319b3827ef93345a45d5a5947dcbc40f4e3119 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*
 * (C) 2010-2011 by Holger Hans Peter Freyther <zecke@selfish.org>
 * (C) 2010-2011 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 Affero General Public License as published by
 * the Free Software Foundation, either version 3 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 Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef MSC_CONNECTION_H
#define MSC_CONNECTION_H

#include "mgcp_callagent.h"

#include <osmocom/core/linuxlist.h>
#include <osmocom/core/timer.h>

#include <osmocom/sccp/sccp.h>

struct bsc_data;
struct ss7_application;

struct msc_connection {
	/* management */
	struct llist_head entry;
	int nr;
	char *name;

	/* ip management */
	int dscp;
	char *ip;
	char *token;

	/* connection management */
	int msc_link_down;
	struct osmo_wqueue msc_connection;
	struct osmo_timer_list reconnect_timer;
	int first_contact;

	/* time to wait for first message from MSC */
	struct osmo_timer_list msc_timeout;
	int msc_time;

	/* timeouts for the msc connection */
	int ping_time;
	int pong_time;
	struct osmo_timer_list ping_timeout;
	struct osmo_timer_list pong_timeout;

	/* mgcp messgaes */
	struct mgcp_callagent mgcp_agent;

	/* application pointer */
	struct ss7_application *app;
};

/* msc related functions */
void msc_send_rlc(struct msc_connection *bsc, struct sccp_source_reference *src, struct sccp_source_reference *dest);
void msc_send_reset(struct msc_connection *bsc);
void msc_send_direct(struct msc_connection *bsc, struct msgb *msg);
void msc_close_connection(struct msc_connection *data);

struct msc_connection *msc_connection_create(struct bsc_data *bsc, int mgcp);
struct msc_connection *msc_connection_num(struct bsc_data *bsc, int num);
int msc_connection_start(struct msc_connection *msc);

/* MGCP */
void msc_mgcp_reset(struct msc_connection *msc);

/* Called by the MSC Connection */
void msc_dispatch_sccp(struct msc_connection *msc, struct msgb *msg);


#endif