Holger Hans Peter Freyther | 97f66e2 | 2010-07-28 03:32:52 +0800 | [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 | * |
Holger Hans Peter Freyther | de56c22 | 2011-01-16 17:45:14 +0100 | [diff] [blame] | 8 | * 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 Freyther | 97f66e2 | 2010-07-28 03:32:52 +0800 | [diff] [blame] | 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 |
Holger Hans Peter Freyther | de56c22 | 2011-01-16 17:45:14 +0100 | [diff] [blame] | 16 | * GNU Affero General Public License for more details. |
Holger Hans Peter Freyther | 97f66e2 | 2010-07-28 03:32:52 +0800 | [diff] [blame] | 17 | * |
Holger Hans Peter Freyther | de56c22 | 2011-01-16 17:45:14 +0100 | [diff] [blame] | 18 | * 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 Freyther | 97f66e2 | 2010-07-28 03:32:52 +0800 | [diff] [blame] | 20 | * |
| 21 | */ |
| 22 | |
| 23 | #ifndef OPENBSC_MGCP_DATA_H |
| 24 | #define OPENBSC_MGCP_DATA_H |
| 25 | |
Holger Hans Peter Freyther | cbf7d18 | 2010-07-31 05:25:35 +0800 | [diff] [blame] | 26 | #include <osmocore/select.h> |
Holger Hans Peter Freyther | 97f66e2 | 2010-07-28 03:32:52 +0800 | [diff] [blame] | 27 | |
| 28 | #define CI_UNUSED 0 |
| 29 | |
Holger Hans Peter Freyther | 97f66e2 | 2010-07-28 03:32:52 +0800 | [diff] [blame] | 30 | enum 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 Freyther | d86208d | 2010-08-04 06:11:27 +0800 | [diff] [blame] | 35 | MGCP_CONN_LOOPBACK = 4, |
| 36 | }; |
| 37 | |
| 38 | struct 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 Freyther | 97f66e2 | 2010-07-28 03:32:52 +0800 | [diff] [blame] | 49 | }; |
| 50 | |
| 51 | struct mgcp_endpoint { |
Holger Hans Peter Freyther | 5b08401 | 2010-08-08 07:51:51 +0800 | [diff] [blame] | 52 | uint32_t ci; |
Holger Hans Peter Freyther | 97f66e2 | 2010-07-28 03:32:52 +0800 | [diff] [blame] | 53 | char *callid; |
| 54 | char *local_options; |
| 55 | int conn_mode; |
Holger Hans Peter Freyther | d86208d | 2010-08-04 06:11:27 +0800 | [diff] [blame] | 56 | int orig_mode; |
Holger Hans Peter Freyther | 97f66e2 | 2010-07-28 03:32:52 +0800 | [diff] [blame] | 57 | |
| 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 Freyther | d86208d | 2010-08-04 06:11:27 +0800 | [diff] [blame] | 85 | |
| 86 | /* sequence bits */ |
| 87 | struct mgcp_rtp_state net_state; |
| 88 | struct mgcp_rtp_state bts_state; |
Holger Hans Peter Freyther | 97f66e2 | 2010-07-28 03:32:52 +0800 | [diff] [blame] | 89 | }; |
| 90 | |
| 91 | #define ENDPOINT_NUMBER(endp) abs(endp - endp->cfg->endpoints) |
| 92 | |
| 93 | struct mgcp_msg_ptr { |
| 94 | unsigned int start; |
| 95 | unsigned int length; |
| 96 | }; |
| 97 | |
| 98 | int 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); |
| 101 | int mgcp_send_dummy(struct mgcp_endpoint *endp); |
| 102 | |
| 103 | #endif |