blob: 2416fadecf6709185c6ff4bd8745a01a5fa42ef3 [file] [log] [blame]
Holger Hans Peter Freytherf67945f2009-10-09 07:08:11 +02001/* A Media Gateway Control Protocol Media Gateway: RFC 3435 */
2
3/*
4 * (C) 2009 by Holger Hans Peter Freyther <zecke@selfish.org>
Holger Hans Peter Freyther92026f12010-02-03 18:10:07 +01005 * (C) 2009 by On-Waves
Holger Hans Peter Freytherf67945f2009-10-09 07:08:11 +02006 * 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
Holger Hans Peter Freyther62e836c2010-02-03 11:03:45 +010024#ifndef OPENBSC_MGCP_H
25#define OPENBSC_MGCP_H
26
Harald Weltedfe6c7d2010-02-20 16:24:02 +010027#include <osmocore/msgb.h>
Holger Hans Peter Freyther62e836c2010-02-03 11:03:45 +010028
Holger Hans Peter Freythere0955022010-02-03 08:50:33 +010029#define RTP_PORT_DEFAULT 4000
30extern unsigned int rtp_base_port;
Holger Hans Peter Freytherf67945f2009-10-09 07:08:11 +020031
32/**
33 * Calculate the RTP audio port for the given multiplex
34 * and the direction. This allows a semi static endpoint
35 * to port calculation removing the need for the BSC
36 * and the MediaGateway to communicate.
37 *
38 * Port usage explained:
39 * base + (multiplex * 2) + 0 == local port to wait for network packets
40 * base + (multiplex * 2) + 1 == local port for rtcp
41 *
42 * The above port will receive packets from the BTS that need
43 * to be patched and forwarded to the network.
44 * The above port will receive packets from the network that
45 * need to be patched and forwarded to the BTS.
46 *
47 * We assume to have a static BTS IP address so we can differentiate
48 * network and BTS.
49 *
50 */
Holger Hans Peter Freythere0955022010-02-03 08:50:33 +010051static inline int rtp_calculate_port(int multiplex, int base)
Holger Hans Peter Freytherf67945f2009-10-09 07:08:11 +020052{
53 return base + (multiplex * 2);
54}
Holger Hans Peter Freythere0955022010-02-03 08:50:33 +010055
56int mgcp_parse_config(const char *config_file, struct gsm_network *dummy_network);
Holger Hans Peter Freyther62e836c2010-02-03 11:03:45 +010057
58struct msgb *mgcp_handle_message(struct msgb *msg);
59struct msgb *mgcp_create_rsip(void);
Holger Hans Peter Freythere0955022010-02-03 08:50:33 +010060int mgcp_vty_init(void);
Holger Hans Peter Freyther77f7afe2010-02-03 09:54:43 +010061
62/* endpoint managed */
63#define MGCP_ENDP_CRCX 1
64#define MGCP_ENDP_DLCX 2
65#define MGCP_ENDP_MDCX 3
66
67typedef int (*mgcp_change)(int endpoint, int state, int local_rtp, void *);
68void mgcp_set_change_cb(mgcp_change cb, void *data);
Holger Hans Peter Freyther62e836c2010-02-03 11:03:45 +010069
70#endif