blob: 969090669d1913a4d644c24b64165bb73cc89c4b [file] [log] [blame]
Holger Hans Peter Freyther84ec8712011-02-15 20:01:47 +01001/*
2 * (C) 2010-2011 by Holger Hans Peter Freyther <zecke@selfish.org>
3 * (C) 2010-2011 by On-Waves
4 * All Rights Reserved
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Affero General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Affero General Public License for more details.
15 *
16 * You should have received a copy of the GNU Affero General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef MSC_CONNECTION_H
21#define MSC_CONNECTION_H
22
23#include <osmocore/linuxlist.h>
24#include <osmocore/write_queue.h>
25#include <osmocore/timer.h>
26
27#include <osmocom/sccp/sccp.h>
28
29struct bsc_data;
30struct ss7_application;
31
32struct msc_connection {
33 /* management */
34 struct llist_head entry;
35 int nr;
36 char *name;
37
38 /* ip management */
39 int dscp;
40 char *ip;
41 char *token;
42
43 /* connection management */
44 int msc_link_down;
45 struct write_queue msc_connection;
46 struct timer_list reconnect_timer;
47 int first_contact;
48
49 /* time to wait for first message from MSC */
50 struct timer_list msc_timeout;
51 int msc_time;
52
53 /* timeouts for the msc connection */
54 int ping_time;
55 int pong_time;
56 struct timer_list ping_timeout;
57 struct timer_list pong_timeout;
58 struct timer_list reset_timeout;
59
60 /* mgcp messgaes */
61 struct write_queue mgcp_agent;
62
63 /* application pointer */
64 struct llist_head sccp_connections;
65 struct mtp_link_set *target_link;
66 int forward_only;
67 int reset_count;
68};
69
70/* msc related functions */
71void msc_send_rlc(struct msc_connection *bsc, struct sccp_source_reference *src, struct sccp_source_reference *dest);
72void msc_send_reset(struct msc_connection *bsc);
73void msc_send_msg(struct msc_connection *bsc, int rc, struct sccp_parse_result *, struct msgb *msg);
74void msc_send_direct(struct msc_connection *bsc, struct msgb *msg);
75void msc_close_connection(struct msc_connection *data);
76
77struct msc_connection *msc_connection_create(struct bsc_data *bsc, int mgcp);
78struct msc_connection *msc_connection_num(struct bsc_data *bsc, int num);
79int msc_connection_start(struct msc_connection *msc);
80
81/* MGCP */
82void mgcp_forward(struct msc_connection *msc, const uint8_t *data, unsigned int length);
83
Holger Hans Peter Freyther3d4d8c72011-02-15 21:14:09 +010084/* Called by the MSC Connection */
85void msc_dispatch_sccp(struct msc_connection *msc, struct msgb *msg);
86
87
Holger Hans Peter Freyther84ec8712011-02-15 20:01:47 +010088#endif