Holger Hans Peter Freyther | 7bdc637 | 2010-02-20 21:21:02 +0100 | [diff] [blame] | 1 | /* 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 | |
Holger Hans Peter Freyther | 1ebad74 | 2010-02-26 20:16:37 +0100 | [diff] [blame] | 27 | #include <osmocore/select.h> |
Holger Hans Peter Freyther | 7bdc637 | 2010-02-20 21:21:02 +0100 | [diff] [blame] | 28 | |
| 29 | #define CI_UNUSED 0 |
| 30 | |
Holger Hans Peter Freyther | 98a3877 | 2010-08-03 02:27:21 +0800 | [diff] [blame] | 31 | enum mgcp_connection_mode { |
| 32 | MGCP_CONN_NONE = 0, |
| 33 | MGCP_CONN_RECV_ONLY = 1, |
| 34 | MGCP_CONN_SEND_ONLY = 2, |
| 35 | MGCP_CONN_RECV_SEND = MGCP_CONN_RECV_ONLY | MGCP_CONN_SEND_ONLY, |
| 36 | MGCP_CONN_LOOPBACK = 4, |
| 37 | }; |
| 38 | |
Holger Hans Peter Freyther | 3186892 | 2010-08-03 11:59:04 +0000 | [diff] [blame] | 39 | struct mgcp_rtp_state { |
| 40 | int initialized; |
Holger Hans Peter Freyther | 5c1e6cf | 2010-08-03 15:36:57 +0000 | [diff] [blame^] | 41 | int patch; |
Holger Hans Peter Freyther | 3186892 | 2010-08-03 11:59:04 +0000 | [diff] [blame] | 42 | |
Holger Hans Peter Freyther | 6aa882b | 2010-08-03 14:35:50 +0000 | [diff] [blame] | 43 | uint32_t orig_ssrc; |
| 44 | uint32_t ssrc; |
Holger Hans Peter Freyther | 3186892 | 2010-08-03 11:59:04 +0000 | [diff] [blame] | 45 | uint16_t seq_no; |
| 46 | int lost_no; |
Holger Hans Peter Freyther | 6aa882b | 2010-08-03 14:35:50 +0000 | [diff] [blame] | 47 | int seq_offset; |
| 48 | uint32_t last_timestamp; |
| 49 | int32_t timestamp_offset; |
Holger Hans Peter Freyther | 3186892 | 2010-08-03 11:59:04 +0000 | [diff] [blame] | 50 | }; |
Holger Hans Peter Freyther | 98a3877 | 2010-08-03 02:27:21 +0800 | [diff] [blame] | 51 | |
Holger Hans Peter Freyther | 7bdc637 | 2010-02-20 21:21:02 +0100 | [diff] [blame] | 52 | struct mgcp_endpoint { |
| 53 | int ci; |
| 54 | char *callid; |
| 55 | char *local_options; |
| 56 | int conn_mode; |
Holger Hans Peter Freyther | c597a4e | 2010-08-03 02:57:02 +0800 | [diff] [blame] | 57 | int orig_mode; |
Holger Hans Peter Freyther | 7bdc637 | 2010-02-20 21:21:02 +0100 | [diff] [blame] | 58 | |
Holger Hans Peter Freyther | ef6bb25 | 2010-02-26 13:41:22 +0100 | [diff] [blame] | 59 | int bts_payload_type; |
| 60 | int net_payload_type; |
| 61 | |
Holger Hans Peter Freyther | 7bdc637 | 2010-02-20 21:21:02 +0100 | [diff] [blame] | 62 | /* the local rtp port we are binding to */ |
| 63 | int rtp_port; |
| 64 | |
| 65 | /* |
| 66 | * RTP mangling: |
| 67 | * - we get RTP and RTCP to us and need to forward to the BTS |
| 68 | * - we get RTP and RTCP from the BTS and forward to the network |
| 69 | */ |
| 70 | struct bsc_fd local_rtp; |
| 71 | struct bsc_fd local_rtcp; |
| 72 | |
| 73 | struct in_addr remote; |
| 74 | struct in_addr bts; |
| 75 | |
| 76 | /* in network byte order */ |
| 77 | int net_rtp, net_rtcp; |
| 78 | int bts_rtp, bts_rtcp; |
| 79 | |
| 80 | /* backpointer */ |
| 81 | struct mgcp_config *cfg; |
Holger Hans Peter Freyther | b4b135e | 2010-04-07 09:37:17 +0200 | [diff] [blame] | 82 | |
| 83 | /* statistics */ |
| 84 | unsigned int in_bts; |
| 85 | unsigned int in_remote; |
Holger Hans Peter Freyther | 380b871 | 2010-07-29 02:38:39 +0800 | [diff] [blame] | 86 | |
| 87 | /* sequence bits */ |
Holger Hans Peter Freyther | 3186892 | 2010-08-03 11:59:04 +0000 | [diff] [blame] | 88 | struct mgcp_rtp_state net_state; |
| 89 | struct mgcp_rtp_state bts_state; |
Holger Hans Peter Freyther | 7bdc637 | 2010-02-20 21:21:02 +0100 | [diff] [blame] | 90 | }; |
| 91 | |
| 92 | #define ENDPOINT_NUMBER(endp) abs(endp - endp->cfg->endpoints) |
| 93 | |
Holger Hans Peter Freyther | f2f1591 | 2010-04-01 03:27:04 +0200 | [diff] [blame] | 94 | struct mgcp_msg_ptr { |
| 95 | unsigned int start; |
| 96 | unsigned int length; |
| 97 | }; |
| 98 | |
| 99 | int mgcp_analyze_header(struct mgcp_config *cfg, struct msgb *msg, |
| 100 | struct mgcp_msg_ptr *ptr, int size, |
| 101 | const char **transaction_id, struct mgcp_endpoint **endp); |
Holger Hans Peter Freyther | b844b87 | 2010-04-21 21:25:13 +0800 | [diff] [blame] | 102 | int mgcp_send_dummy(struct mgcp_endpoint *endp); |
Holger Hans Peter Freyther | f2f1591 | 2010-04-01 03:27:04 +0200 | [diff] [blame] | 103 | |
Holger Hans Peter Freyther | 7bdc637 | 2010-02-20 21:21:02 +0100 | [diff] [blame] | 104 | #endif |