blob: b156aeaa98dfeded7d46130ab6a3518fb34ba3f1 [file] [log] [blame]
Holger Hans Peter Freyther97f66e22010-07-28 03:32:52 +08001/* MGCP Private Data */
2
3/*
4 * (C) 2009-2010 by Holger Hans Peter Freyther <zecke@selfish.org>
5 * (C) 2009-2010 by On-Waves
6 * All Rights Reserved
7 *
Holger Hans Peter Freytherde56c222011-01-16 17:45:14 +01008 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU Affero General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
Holger Hans Peter Freyther97f66e22010-07-28 03:32:52 +080011 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Holger Hans Peter Freytherde56c222011-01-16 17:45:14 +010016 * GNU Affero General Public License for more details.
Holger Hans Peter Freyther97f66e22010-07-28 03:32:52 +080017 *
Holger Hans Peter Freytherde56c222011-01-16 17:45:14 +010018 * You should have received a copy of the GNU Affero General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
Holger Hans Peter Freyther97f66e22010-07-28 03:32:52 +080020 *
21 */
22
23#ifndef OPENBSC_MGCP_DATA_H
24#define OPENBSC_MGCP_DATA_H
25
Holger Hans Peter Freythercbf7d182010-07-31 05:25:35 +080026#include <osmocore/select.h>
Holger Hans Peter Freyther97f66e22010-07-28 03:32:52 +080027
28#define CI_UNUSED 0
29
Holger Hans Peter Freyther97f66e22010-07-28 03:32:52 +080030enum mgcp_connection_mode {
31 MGCP_CONN_NONE = 0,
32 MGCP_CONN_RECV_ONLY = 1,
33 MGCP_CONN_SEND_ONLY = 2,
34 MGCP_CONN_RECV_SEND = MGCP_CONN_RECV_ONLY | MGCP_CONN_SEND_ONLY,
Holger Hans Peter Freytherd86208d2010-08-04 06:11:27 +080035 MGCP_CONN_LOOPBACK = 4,
36};
37
38struct mgcp_rtp_state {
39 int initialized;
40 int patch;
41
42 uint32_t orig_ssrc;
43 uint32_t ssrc;
44 uint16_t seq_no;
45 int lost_no;
46 int seq_offset;
47 uint32_t last_timestamp;
48 int32_t timestamp_offset;
Holger Hans Peter Freyther97f66e22010-07-28 03:32:52 +080049};
50
51struct mgcp_endpoint {
Holger Hans Peter Freyther5b084012010-08-08 07:51:51 +080052 uint32_t ci;
Holger Hans Peter Freyther97f66e22010-07-28 03:32:52 +080053 char *callid;
54 char *local_options;
55 int conn_mode;
Holger Hans Peter Freytherd86208d2010-08-04 06:11:27 +080056 int orig_mode;
Holger Hans Peter Freyther97f66e22010-07-28 03:32:52 +080057
58 int bts_payload_type;
59 int net_payload_type;
60
61 /* the local rtp port we are binding to */
62 int rtp_port;
63
64 /*
65 * RTP mangling:
66 * - we get RTP and RTCP to us and need to forward to the BTS
67 * - we get RTP and RTCP from the BTS and forward to the network
68 */
69 struct bsc_fd local_rtp;
70 struct bsc_fd local_rtcp;
71
72 struct in_addr remote;
73 struct in_addr bts;
74
75 /* in network byte order */
76 int net_rtp, net_rtcp;
77 int bts_rtp, bts_rtcp;
78
79 /* backpointer */
80 struct mgcp_config *cfg;
81
82 /* statistics */
83 unsigned int in_bts;
84 unsigned int in_remote;
Holger Hans Peter Freytherd86208d2010-08-04 06:11:27 +080085
86 /* sequence bits */
87 struct mgcp_rtp_state net_state;
88 struct mgcp_rtp_state bts_state;
Holger Hans Peter Freyther97f66e22010-07-28 03:32:52 +080089};
90
91#define ENDPOINT_NUMBER(endp) abs(endp - endp->cfg->endpoints)
92
93struct mgcp_msg_ptr {
94 unsigned int start;
95 unsigned int length;
96};
97
98int mgcp_analyze_header(struct mgcp_config *cfg, struct msgb *msg,
99 struct mgcp_msg_ptr *ptr, int size,
100 const char **transaction_id, struct mgcp_endpoint **endp);
101int mgcp_send_dummy(struct mgcp_endpoint *endp);
102
103#endif