blob: d1a65232baea037645cf19072d3063d93e55e356 [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 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (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
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 *
22 */
23
24#ifndef OPENBSC_MGCP_DATA_H
25#define OPENBSC_MGCP_DATA_H
26
27#include <laf0rge1/select.h>
28
29#define CI_UNUSED 0
30
31#ifndef ARRAY_SIZE
32#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
33#endif
34
35enum mgcp_connection_mode {
36 MGCP_CONN_NONE = 0,
37 MGCP_CONN_RECV_ONLY = 1,
38 MGCP_CONN_SEND_ONLY = 2,
39 MGCP_CONN_RECV_SEND = MGCP_CONN_RECV_ONLY | MGCP_CONN_SEND_ONLY,
40};
41
42struct mgcp_endpoint {
43 int ci;
44 char *callid;
45 char *local_options;
46 int conn_mode;
47
48 int bts_payload_type;
49 int net_payload_type;
50
51 /* the local rtp port we are binding to */
52 int rtp_port;
53
54 /*
55 * RTP mangling:
56 * - we get RTP and RTCP to us and need to forward to the BTS
57 * - we get RTP and RTCP from the BTS and forward to the network
58 */
59 struct bsc_fd local_rtp;
60 struct bsc_fd local_rtcp;
61
62 struct in_addr remote;
63 struct in_addr bts;
64
65 /* in network byte order */
66 int net_rtp, net_rtcp;
67 int bts_rtp, bts_rtcp;
68
69 /* backpointer */
70 struct mgcp_config *cfg;
71
72 /* statistics */
73 unsigned int in_bts;
74 unsigned int in_remote;
75};
76
77#define ENDPOINT_NUMBER(endp) abs(endp - endp->cfg->endpoints)
78
79struct mgcp_msg_ptr {
80 unsigned int start;
81 unsigned int length;
82};
83
84int mgcp_analyze_header(struct mgcp_config *cfg, struct msgb *msg,
85 struct mgcp_msg_ptr *ptr, int size,
86 const char **transaction_id, struct mgcp_endpoint **endp);
87int mgcp_send_dummy(struct mgcp_endpoint *endp);
88
89#endif