Holger Hans Peter Freyther | f67945f | 2009-10-09 07:08:11 +0200 | [diff] [blame] | 1 | /* 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 Freyther | 92026f1 | 2010-02-03 18:10:07 +0100 | [diff] [blame] | 5 | * (C) 2009 by On-Waves |
Holger Hans Peter Freyther | f67945f | 2009-10-09 07:08:11 +0200 | [diff] [blame] | 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 | |
Holger Hans Peter Freyther | 62e836c | 2010-02-03 11:03:45 +0100 | [diff] [blame] | 24 | #ifndef OPENBSC_MGCP_H |
| 25 | #define OPENBSC_MGCP_H |
| 26 | |
Harald Welte | dfe6c7d | 2010-02-20 16:24:02 +0100 | [diff] [blame^] | 27 | #include <osmocore/msgb.h> |
Holger Hans Peter Freyther | 62e836c | 2010-02-03 11:03:45 +0100 | [diff] [blame] | 28 | |
Holger Hans Peter Freyther | e095502 | 2010-02-03 08:50:33 +0100 | [diff] [blame] | 29 | #define RTP_PORT_DEFAULT 4000 |
| 30 | extern unsigned int rtp_base_port; |
Holger Hans Peter Freyther | f67945f | 2009-10-09 07:08:11 +0200 | [diff] [blame] | 31 | |
| 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 Freyther | e095502 | 2010-02-03 08:50:33 +0100 | [diff] [blame] | 51 | static inline int rtp_calculate_port(int multiplex, int base) |
Holger Hans Peter Freyther | f67945f | 2009-10-09 07:08:11 +0200 | [diff] [blame] | 52 | { |
| 53 | return base + (multiplex * 2); |
| 54 | } |
Holger Hans Peter Freyther | e095502 | 2010-02-03 08:50:33 +0100 | [diff] [blame] | 55 | |
| 56 | int mgcp_parse_config(const char *config_file, struct gsm_network *dummy_network); |
Holger Hans Peter Freyther | 62e836c | 2010-02-03 11:03:45 +0100 | [diff] [blame] | 57 | |
| 58 | struct msgb *mgcp_handle_message(struct msgb *msg); |
| 59 | struct msgb *mgcp_create_rsip(void); |
Holger Hans Peter Freyther | e095502 | 2010-02-03 08:50:33 +0100 | [diff] [blame] | 60 | int mgcp_vty_init(void); |
Holger Hans Peter Freyther | 77f7afe | 2010-02-03 09:54:43 +0100 | [diff] [blame] | 61 | |
| 62 | /* endpoint managed */ |
| 63 | #define MGCP_ENDP_CRCX 1 |
| 64 | #define MGCP_ENDP_DLCX 2 |
| 65 | #define MGCP_ENDP_MDCX 3 |
| 66 | |
| 67 | typedef int (*mgcp_change)(int endpoint, int state, int local_rtp, void *); |
| 68 | void mgcp_set_change_cb(mgcp_change cb, void *data); |
Holger Hans Peter Freyther | 62e836c | 2010-02-03 11:03:45 +0100 | [diff] [blame] | 69 | |
| 70 | #endif |