Neels Hofmeyr | f83ec56 | 2017-09-07 19:18:40 +0200 | [diff] [blame] | 1 | /* MGCP Private Data */ |
| 2 | |
| 3 | /* |
| 4 | * (C) 2009-2012 by Holger Hans Peter Freyther <zecke@selfish.org> |
| 5 | * (C) 2009-2012 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 Affero General Public License as published by |
| 10 | * the Free Software Foundation; either version 3 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 Affero General Public License for more details. |
| 17 | * |
| 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/>. |
| 20 | * |
| 21 | */ |
| 22 | |
| 23 | #pragma once |
| 24 | |
| 25 | #include <string.h> |
Philipp Maier | 87bd9be | 2017-08-22 16:35:41 +0200 | [diff] [blame] | 26 | #include <inttypes.h> |
Neels Hofmeyr | f83ec56 | 2017-09-07 19:18:40 +0200 | [diff] [blame] | 27 | #include <osmocom/core/select.h> |
Philipp Maier | 87bd9be | 2017-08-22 16:35:41 +0200 | [diff] [blame] | 28 | #include <osmocom/mgcp/mgcp.h> |
| 29 | #include <osmocom/core/linuxlist.h> |
Philipp Maier | c430d19 | 2018-03-16 12:11:18 +0100 | [diff] [blame] | 30 | #include <osmocom/core/counter.h> |
Philipp Maier | 9e1d164 | 2018-05-09 16:26:34 +0200 | [diff] [blame] | 31 | #include <osmocom/core/rate_ctr.h> |
Neels Hofmeyr | f83ec56 | 2017-09-07 19:18:40 +0200 | [diff] [blame] | 32 | |
| 33 | #define CI_UNUSED 0 |
| 34 | |
Neels Hofmeyr | f83ec56 | 2017-09-07 19:18:40 +0200 | [diff] [blame] | 35 | struct mgcp_rtp_stream_state { |
| 36 | uint32_t ssrc; |
| 37 | uint16_t last_seq; |
| 38 | uint32_t last_timestamp; |
Philipp Maier | 9e1d164 | 2018-05-09 16:26:34 +0200 | [diff] [blame] | 39 | struct rate_ctr *err_ts_ctr; |
Neels Hofmeyr | f83ec56 | 2017-09-07 19:18:40 +0200 | [diff] [blame] | 40 | int32_t last_tsdelta; |
| 41 | uint32_t last_arrival_time; |
| 42 | }; |
| 43 | |
| 44 | struct mgcp_rtp_state { |
Harald Welte | 3338135 | 2017-12-25 09:44:26 +0100 | [diff] [blame] | 45 | /* has this state structure been initialized? */ |
Neels Hofmeyr | f83ec56 | 2017-09-07 19:18:40 +0200 | [diff] [blame] | 46 | int initialized; |
Neels Hofmeyr | f83ec56 | 2017-09-07 19:18:40 +0200 | [diff] [blame] | 47 | |
Harald Welte | 3338135 | 2017-12-25 09:44:26 +0100 | [diff] [blame] | 48 | struct { |
| 49 | /* are we patching the SSRC value? */ |
| 50 | int patch_ssrc; |
| 51 | /* original SSRC (to which we shall patch any different SSRC) */ |
| 52 | uint32_t orig_ssrc; |
| 53 | /* offset to apply on the sequence number */ |
| 54 | int seq_offset; |
| 55 | /* offset to apply on the timestamp number */ |
| 56 | int32_t timestamp_offset; |
| 57 | } patch; |
Neels Hofmeyr | f83ec56 | 2017-09-07 19:18:40 +0200 | [diff] [blame] | 58 | |
Harald Welte | 3338135 | 2017-12-25 09:44:26 +0100 | [diff] [blame] | 59 | /* duration of a packet (FIXME: in which unit?) */ |
Neels Hofmeyr | f83ec56 | 2017-09-07 19:18:40 +0200 | [diff] [blame] | 60 | uint32_t packet_duration; |
| 61 | |
| 62 | struct mgcp_rtp_stream_state in_stream; |
| 63 | struct mgcp_rtp_stream_state out_stream; |
| 64 | |
| 65 | /* jitter and packet loss calculation */ |
Harald Welte | 49e3d5a | 2017-12-25 09:47:57 +0100 | [diff] [blame] | 66 | struct { |
| 67 | int initialized; |
| 68 | uint16_t base_seq; |
| 69 | uint16_t max_seq; |
| 70 | uint32_t ssrc; |
| 71 | uint32_t jitter; |
| 72 | int32_t transit; |
| 73 | int cycles; |
| 74 | } stats; |
| 75 | |
Neels Hofmeyr | f83ec56 | 2017-09-07 19:18:40 +0200 | [diff] [blame] | 76 | bool patched_first_rtp_payload; /* FIXME: drop this, see OS#2459 */ |
| 77 | }; |
| 78 | |
| 79 | struct mgcp_rtp_codec { |
| 80 | uint32_t rate; |
| 81 | int channels; |
| 82 | uint32_t frame_duration_num; |
| 83 | uint32_t frame_duration_den; |
| 84 | |
| 85 | int payload_type; |
| 86 | char *audio_name; |
| 87 | char *subtype_name; |
Philipp Maier | 228e591 | 2019-03-05 13:56:59 +0100 | [diff] [blame] | 88 | |
| 89 | bool param_present; |
| 90 | struct mgcp_codec_param param; |
Neels Hofmeyr | f83ec56 | 2017-09-07 19:18:40 +0200 | [diff] [blame] | 91 | }; |
| 92 | |
Harald Welte | 3f35a37 | 2017-12-26 15:48:46 +0100 | [diff] [blame] | 93 | /* 'mgcp_rtp_end': basically a wrapper around the RTP+RTCP ports */ |
Neels Hofmeyr | f83ec56 | 2017-09-07 19:18:40 +0200 | [diff] [blame] | 94 | struct mgcp_rtp_end { |
Harald Welte | 3f35a37 | 2017-12-26 15:48:46 +0100 | [diff] [blame] | 95 | /* local IP address of the RTP socket */ |
Neels Hofmeyr | f83ec56 | 2017-09-07 19:18:40 +0200 | [diff] [blame] | 96 | struct in_addr addr; |
| 97 | |
| 98 | /* in network byte order */ |
| 99 | int rtp_port, rtcp_port; |
| 100 | |
Philipp Maier | bc0346e | 2018-06-07 09:52:16 +0200 | [diff] [blame] | 101 | /* currently selected audio codec */ |
| 102 | struct mgcp_rtp_codec *codec; |
| 103 | |
| 104 | /* array with assigned audio codecs to choose from (SDP) */ |
| 105 | struct mgcp_rtp_codec codecs[MGCP_MAX_CODECS]; |
| 106 | |
| 107 | /* number of assigned audio codecs (SDP) */ |
| 108 | unsigned int codecs_assigned; |
Neels Hofmeyr | f83ec56 | 2017-09-07 19:18:40 +0200 | [diff] [blame] | 109 | |
| 110 | /* per endpoint data */ |
| 111 | int frames_per_packet; |
| 112 | uint32_t packet_duration_ms; |
Philipp Maier | bc0346e | 2018-06-07 09:52:16 +0200 | [diff] [blame] | 113 | int maximum_packet_time; /* -1: not set */ |
Neels Hofmeyr | f83ec56 | 2017-09-07 19:18:40 +0200 | [diff] [blame] | 114 | char *fmtp_extra; |
Harald Welte | 3f35a37 | 2017-12-26 15:48:46 +0100 | [diff] [blame] | 115 | /* are we transmitting packets (1) or dropping (0) outbound packets */ |
Neels Hofmeyr | f83ec56 | 2017-09-07 19:18:40 +0200 | [diff] [blame] | 116 | int output_enabled; |
Harald Welte | 3f35a37 | 2017-12-26 15:48:46 +0100 | [diff] [blame] | 117 | /* FIXME: This parameter can be set + printed, but is nowhere used! */ |
Neels Hofmeyr | f83ec56 | 2017-09-07 19:18:40 +0200 | [diff] [blame] | 118 | int force_output_ptime; |
| 119 | |
| 120 | /* RTP patching */ |
| 121 | int force_constant_ssrc; /* -1: always, 0: don't, 1: once */ |
Harald Welte | 3f35a37 | 2017-12-26 15:48:46 +0100 | [diff] [blame] | 122 | /* should we perform align_rtp_timestamp_offset() (1) or not (0) */ |
Neels Hofmeyr | f83ec56 | 2017-09-07 19:18:40 +0200 | [diff] [blame] | 123 | int force_aligned_timing; |
Philipp Maier | 9fc8a02 | 2019-02-20 12:26:52 +0100 | [diff] [blame] | 124 | bool rfc5993_hr_convert; |
Neels Hofmeyr | f83ec56 | 2017-09-07 19:18:40 +0200 | [diff] [blame] | 125 | |
Philipp Maier | 87bd9be | 2017-08-22 16:35:41 +0200 | [diff] [blame] | 126 | /* Each end has a separate socket for RTP and RTCP */ |
Neels Hofmeyr | f83ec56 | 2017-09-07 19:18:40 +0200 | [diff] [blame] | 127 | struct osmo_fd rtp; |
| 128 | struct osmo_fd rtcp; |
| 129 | |
Harald Welte | 3f35a37 | 2017-12-26 15:48:46 +0100 | [diff] [blame] | 130 | /* local UDP port number of the RTP socket; RTCP is +1 */ |
Neels Hofmeyr | f83ec56 | 2017-09-07 19:18:40 +0200 | [diff] [blame] | 131 | int local_port; |
Neels Hofmeyr | f83ec56 | 2017-09-07 19:18:40 +0200 | [diff] [blame] | 132 | }; |
| 133 | |
| 134 | struct mgcp_rtp_tap { |
Harald Welte | 3f35a37 | 2017-12-26 15:48:46 +0100 | [diff] [blame] | 135 | /* is this tap active (1) or not (0) */ |
Neels Hofmeyr | f83ec56 | 2017-09-07 19:18:40 +0200 | [diff] [blame] | 136 | int enabled; |
Harald Welte | 3f35a37 | 2017-12-26 15:48:46 +0100 | [diff] [blame] | 137 | /* IP/port to which we're forwarding the tapped data */ |
Neels Hofmeyr | f83ec56 | 2017-09-07 19:18:40 +0200 | [diff] [blame] | 138 | struct sockaddr_in forward; |
| 139 | }; |
| 140 | |
| 141 | struct mgcp_lco { |
| 142 | char *string; |
| 143 | char *codec; |
| 144 | int pkt_period_min; /* time in ms */ |
| 145 | int pkt_period_max; /* time in ms */ |
| 146 | }; |
| 147 | |
Philipp Maier | 87bd9be | 2017-08-22 16:35:41 +0200 | [diff] [blame] | 148 | /* Specific rtp connection type (see struct mgcp_conn_rtp) */ |
| 149 | enum mgcp_conn_rtp_type { |
Neels Hofmeyr | f83ec56 | 2017-09-07 19:18:40 +0200 | [diff] [blame] | 150 | MGCP_RTP_DEFAULT = 0, |
Neels Hofmeyr | f83ec56 | 2017-09-07 19:18:40 +0200 | [diff] [blame] | 151 | MGCP_OSMUX_BSC, |
| 152 | MGCP_OSMUX_BSC_NAT, |
| 153 | }; |
| 154 | |
Philipp Maier | 87bd9be | 2017-08-22 16:35:41 +0200 | [diff] [blame] | 155 | #include <osmocom/mgcp/osmux.h> |
| 156 | struct mgcp_conn; |
Neels Hofmeyr | f83ec56 | 2017-09-07 19:18:40 +0200 | [diff] [blame] | 157 | |
Philipp Maier | 87bd9be | 2017-08-22 16:35:41 +0200 | [diff] [blame] | 158 | /* MGCP connection (RTP) */ |
| 159 | struct mgcp_conn_rtp { |
Neels Hofmeyr | f83ec56 | 2017-09-07 19:18:40 +0200 | [diff] [blame] | 160 | |
Philipp Maier | 87bd9be | 2017-08-22 16:35:41 +0200 | [diff] [blame] | 161 | /* Backpointer to conn struct */ |
| 162 | struct mgcp_conn *conn; |
Neels Hofmeyr | f83ec56 | 2017-09-07 19:18:40 +0200 | [diff] [blame] | 163 | |
Philipp Maier | 87bd9be | 2017-08-22 16:35:41 +0200 | [diff] [blame] | 164 | /* Specific connection type */ |
| 165 | enum mgcp_conn_rtp_type type; |
Neels Hofmeyr | f83ec56 | 2017-09-07 19:18:40 +0200 | [diff] [blame] | 166 | |
Philipp Maier | 87bd9be | 2017-08-22 16:35:41 +0200 | [diff] [blame] | 167 | /* Port status */ |
| 168 | struct mgcp_rtp_end end; |
Neels Hofmeyr | f83ec56 | 2017-09-07 19:18:40 +0200 | [diff] [blame] | 169 | |
Philipp Maier | 87bd9be | 2017-08-22 16:35:41 +0200 | [diff] [blame] | 170 | /* Sequence bits */ |
| 171 | struct mgcp_rtp_state state; |
Neels Hofmeyr | f83ec56 | 2017-09-07 19:18:40 +0200 | [diff] [blame] | 172 | |
Harald Welte | 3f35a37 | 2017-12-26 15:48:46 +0100 | [diff] [blame] | 173 | /* taps for the rtp connection; one per direction */ |
Philipp Maier | 87bd9be | 2017-08-22 16:35:41 +0200 | [diff] [blame] | 174 | struct mgcp_rtp_tap tap_in; |
| 175 | struct mgcp_rtp_tap tap_out; |
Neels Hofmeyr | f83ec56 | 2017-09-07 19:18:40 +0200 | [diff] [blame] | 176 | |
Philipp Maier | 87bd9be | 2017-08-22 16:35:41 +0200 | [diff] [blame] | 177 | /* Osmux states (optional) */ |
Neels Hofmeyr | f83ec56 | 2017-09-07 19:18:40 +0200 | [diff] [blame] | 178 | struct { |
| 179 | /* Osmux state: disabled, activating, active */ |
| 180 | enum osmux_state state; |
Pau Espin Pedrol | 8de58e7 | 2019-04-24 13:33:46 +0200 | [diff] [blame] | 181 | /* Is cid holding valid data? is it allocated from pool? */ |
| 182 | bool cid_allocated; |
| 183 | /* Allocated Osmux circuit ID for this conn */ |
Neels Hofmeyr | f83ec56 | 2017-09-07 19:18:40 +0200 | [diff] [blame] | 184 | uint8_t cid; |
| 185 | /* handle to batch messages */ |
| 186 | struct osmux_in_handle *in; |
| 187 | /* handle to unbatch messages */ |
| 188 | struct osmux_out_handle out; |
| 189 | /* statistics */ |
| 190 | struct { |
| 191 | uint32_t chunks; |
| 192 | uint32_t octets; |
| 193 | } stats; |
| 194 | } osmux; |
Philipp Maier | 9e1d164 | 2018-05-09 16:26:34 +0200 | [diff] [blame] | 195 | |
| 196 | struct rate_ctr_group *rate_ctr_group; |
Neels Hofmeyr | f83ec56 | 2017-09-07 19:18:40 +0200 | [diff] [blame] | 197 | }; |
| 198 | |
Philipp Maier | 87bd9be | 2017-08-22 16:35:41 +0200 | [diff] [blame] | 199 | /*! Connection type, specifies which member of the union "u" in mgcp_conn |
| 200 | * contains a useful connection description (currently only RTP) */ |
| 201 | enum mgcp_conn_type { |
| 202 | MGCP_CONN_TYPE_RTP, |
| 203 | }; |
Neels Hofmeyr | f83ec56 | 2017-09-07 19:18:40 +0200 | [diff] [blame] | 204 | |
Philipp Maier | 87bd9be | 2017-08-22 16:35:41 +0200 | [diff] [blame] | 205 | /*! MGCP connection (untyped) */ |
| 206 | struct mgcp_conn { |
Neels Hofmeyr | 8838c62 | 2018-06-26 00:05:53 +0200 | [diff] [blame] | 207 | /*! list head */ |
Philipp Maier | 87bd9be | 2017-08-22 16:35:41 +0200 | [diff] [blame] | 208 | struct llist_head entry; |
Neels Hofmeyr | f83ec56 | 2017-09-07 19:18:40 +0200 | [diff] [blame] | 209 | |
Neels Hofmeyr | 8838c62 | 2018-06-26 00:05:53 +0200 | [diff] [blame] | 210 | /*! Backpointer to the endpoint where the conn belongs to */ |
Philipp Maier | 87bd9be | 2017-08-22 16:35:41 +0200 | [diff] [blame] | 211 | struct mgcp_endpoint *endp; |
Neels Hofmeyr | f83ec56 | 2017-09-07 19:18:40 +0200 | [diff] [blame] | 212 | |
Neels Hofmeyr | 8838c62 | 2018-06-26 00:05:53 +0200 | [diff] [blame] | 213 | /*! type of the connection (union) */ |
Philipp Maier | 87bd9be | 2017-08-22 16:35:41 +0200 | [diff] [blame] | 214 | enum mgcp_conn_type type; |
Neels Hofmeyr | f83ec56 | 2017-09-07 19:18:40 +0200 | [diff] [blame] | 215 | |
Neels Hofmeyr | 8838c62 | 2018-06-26 00:05:53 +0200 | [diff] [blame] | 216 | /*! mode of the connection */ |
Philipp Maier | 87bd9be | 2017-08-22 16:35:41 +0200 | [diff] [blame] | 217 | enum mgcp_connection_mode mode; |
Neels Hofmeyr | f83ec56 | 2017-09-07 19:18:40 +0200 | [diff] [blame] | 218 | |
Neels Hofmeyr | 8838c62 | 2018-06-26 00:05:53 +0200 | [diff] [blame] | 219 | /*! copy of the mode to restore the original setting (VTY) */ |
Philipp Maier | 87bd9be | 2017-08-22 16:35:41 +0200 | [diff] [blame] | 220 | enum mgcp_connection_mode mode_orig; |
Neels Hofmeyr | f83ec56 | 2017-09-07 19:18:40 +0200 | [diff] [blame] | 221 | |
Neels Hofmeyr | 8838c62 | 2018-06-26 00:05:53 +0200 | [diff] [blame] | 222 | /*! connection id to identify the connection */ |
Neels Hofmeyr | 55e0dcf | 2018-09-03 21:36:56 +0200 | [diff] [blame] | 223 | char id[MGCP_CONN_ID_MAXLEN]; |
Neels Hofmeyr | f83ec56 | 2017-09-07 19:18:40 +0200 | [diff] [blame] | 224 | |
Neels Hofmeyr | 8838c62 | 2018-06-26 00:05:53 +0200 | [diff] [blame] | 225 | /*! human readable name (vty, logging) */ |
Philipp Maier | 87bd9be | 2017-08-22 16:35:41 +0200 | [diff] [blame] | 226 | char name[256]; |
Neels Hofmeyr | f83ec56 | 2017-09-07 19:18:40 +0200 | [diff] [blame] | 227 | |
Oliver Smith | e36b775 | 2019-01-22 16:31:36 +0100 | [diff] [blame] | 228 | /*! activity tracker (for cleaning up inactive connections) */ |
| 229 | struct osmo_timer_list watchdog; |
| 230 | |
Neels Hofmeyr | 8838c62 | 2018-06-26 00:05:53 +0200 | [diff] [blame] | 231 | /*! union with connection description */ |
Philipp Maier | 87bd9be | 2017-08-22 16:35:41 +0200 | [diff] [blame] | 232 | union { |
| 233 | struct mgcp_conn_rtp rtp; |
| 234 | } u; |
Neels Hofmeyr | f83ec56 | 2017-09-07 19:18:40 +0200 | [diff] [blame] | 235 | |
Neels Hofmeyr | 8838c62 | 2018-06-26 00:05:53 +0200 | [diff] [blame] | 236 | /*! pointer to optional private data */ |
Philipp Maier | 87bd9be | 2017-08-22 16:35:41 +0200 | [diff] [blame] | 237 | void *priv; |
| 238 | }; |
| 239 | |
| 240 | #include <osmocom/mgcp/mgcp_conn.h> |
| 241 | |
| 242 | struct mgcp_endpoint_type; |
| 243 | |
Neels Hofmeyr | f83ec56 | 2017-09-07 19:18:40 +0200 | [diff] [blame] | 244 | |
| 245 | |
Philipp Maier | fdd603c | 2018-02-01 13:31:15 +0100 | [diff] [blame] | 246 | |
Neels Hofmeyr | f83ec56 | 2017-09-07 19:18:40 +0200 | [diff] [blame] | 247 | |
| 248 | /** |
| 249 | * Internal structure while parsing a request |
| 250 | */ |
| 251 | struct mgcp_parse_data { |
| 252 | struct mgcp_config *cfg; |
| 253 | struct mgcp_endpoint *endp; |
| 254 | char *trans; |
| 255 | char *save; |
Neels Hofmeyr | f83ec56 | 2017-09-07 19:18:40 +0200 | [diff] [blame] | 256 | }; |
| 257 | |
Philipp Maier | 87bd9be | 2017-08-22 16:35:41 +0200 | [diff] [blame] | 258 | int mgcp_send(struct mgcp_endpoint *endp, int is_rtp, struct sockaddr_in *addr, |
| 259 | char *buf, int rc, struct mgcp_conn_rtp *conn_src, |
| 260 | struct mgcp_conn_rtp *conn_dst); |
| 261 | int mgcp_send_dummy(struct mgcp_endpoint *endp, struct mgcp_conn_rtp *conn); |
| 262 | int mgcp_dispatch_rtp_bridge_cb(int proto, struct sockaddr_in *addr, char *buf, |
| 263 | unsigned int buf_size, struct mgcp_conn *conn); |
Philipp Maier | df5d219 | 2018-01-24 11:39:32 +0100 | [diff] [blame] | 264 | void mgcp_cleanup_rtp_bridge_cb(struct mgcp_endpoint *endp, struct mgcp_conn *conn); |
Philipp Maier | 87bd9be | 2017-08-22 16:35:41 +0200 | [diff] [blame] | 265 | int mgcp_bind_net_rtp_port(struct mgcp_endpoint *endp, int rtp_port, |
| 266 | struct mgcp_conn_rtp *conn); |
| 267 | void mgcp_free_rtp_port(struct mgcp_rtp_end *end); |
Neels Hofmeyr | f83ec56 | 2017-09-07 19:18:40 +0200 | [diff] [blame] | 268 | |
| 269 | /* For transcoding we need to manage an in and an output that are connected */ |
| 270 | static inline int endp_back_channel(int endpoint) |
| 271 | { |
| 272 | return endpoint + 60; |
| 273 | } |
| 274 | |
Philipp Maier | 3d7b58d | 2018-06-06 09:35:31 +0200 | [diff] [blame] | 275 | char *get_lco_identifier(const char *options); |
| 276 | int check_local_cx_options(void *ctx, const char *options); |
Neels Hofmeyr | f83ec56 | 2017-09-07 19:18:40 +0200 | [diff] [blame] | 277 | void mgcp_rtp_end_config(struct mgcp_endpoint *endp, int expect_ssrc_change, |
| 278 | struct mgcp_rtp_end *rtp); |
| 279 | uint32_t mgcp_rtp_packet_duration(struct mgcp_endpoint *endp, |
| 280 | struct mgcp_rtp_end *rtp); |
| 281 | |
Neels Hofmeyr | f83ec56 | 2017-09-07 19:18:40 +0200 | [diff] [blame] | 282 | /* payload processing default functions */ |
| 283 | int mgcp_rtp_processing_default(struct mgcp_endpoint *endp, struct mgcp_rtp_end *dst_end, |
| 284 | char *data, int *len, int buf_size); |
| 285 | |
| 286 | int mgcp_setup_rtp_processing_default(struct mgcp_endpoint *endp, |
Philipp Maier | acc1035 | 2018-07-19 18:07:57 +0200 | [diff] [blame] | 287 | struct mgcp_conn_rtp *conn_dst, |
| 288 | struct mgcp_conn_rtp *conn_src); |
Neels Hofmeyr | f83ec56 | 2017-09-07 19:18:40 +0200 | [diff] [blame] | 289 | |
| 290 | void mgcp_get_net_downlink_format_default(struct mgcp_endpoint *endp, |
Philipp Maier | 5812825 | 2019-03-06 11:28:18 +0100 | [diff] [blame] | 291 | const struct mgcp_rtp_codec **codec, |
| 292 | const char **fmtp_extra, |
Philipp Maier | 87bd9be | 2017-08-22 16:35:41 +0200 | [diff] [blame] | 293 | struct mgcp_conn_rtp *conn); |
Neels Hofmeyr | f83ec56 | 2017-09-07 19:18:40 +0200 | [diff] [blame] | 294 | |
| 295 | /* internal RTP Annex A counting */ |
| 296 | void mgcp_rtp_annex_count(struct mgcp_endpoint *endp, struct mgcp_rtp_state *state, |
| 297 | const uint16_t seq, const int32_t transit, |
| 298 | const uint32_t ssrc); |
| 299 | |
| 300 | int mgcp_set_ip_tos(int fd, int tos); |
| 301 | |
Pau Espin Pedrol | 497611a | 2019-05-06 15:41:53 +0200 | [diff] [blame] | 302 | /* Was conn configured to handle Osmux? */ |
| 303 | static inline bool mgcp_conn_rtp_is_osmux(const struct mgcp_conn_rtp *conn) { |
| 304 | return conn->type == MGCP_OSMUX_BSC || conn->type == MGCP_OSMUX_BSC_NAT; |
| 305 | } |
| 306 | |
Neels Hofmeyr | f83ec56 | 2017-09-07 19:18:40 +0200 | [diff] [blame] | 307 | enum { |
| 308 | MGCP_DEST_NET = 0, |
| 309 | MGCP_DEST_BTS, |
| 310 | }; |
| 311 | |
| 312 | |
| 313 | #define MGCP_DUMMY_LOAD 0x23 |
| 314 | |
| 315 | |
| 316 | /** |
| 317 | * SDP related information |
| 318 | */ |
| 319 | /* Assume audio frame length of 20ms */ |
| 320 | #define DEFAULT_RTP_AUDIO_FRAME_DUR_NUM 20 |
| 321 | #define DEFAULT_RTP_AUDIO_FRAME_DUR_DEN 1000 |
| 322 | #define DEFAULT_RTP_AUDIO_PACKET_DURATION_MS 20 |
| 323 | #define DEFAULT_RTP_AUDIO_DEFAULT_RATE 8000 |
| 324 | #define DEFAULT_RTP_AUDIO_DEFAULT_CHANNELS 1 |
| 325 | |
| 326 | #define PTYPE_UNDEFINED (-1) |
Neels Hofmeyr | f83ec56 | 2017-09-07 19:18:40 +0200 | [diff] [blame] | 327 | |
Philipp Maier | 1cb1e38 | 2017-11-02 17:16:04 +0100 | [diff] [blame] | 328 | void mgcp_get_local_addr(char *addr, struct mgcp_conn_rtp *conn); |
Oliver Smith | e36b775 | 2019-01-22 16:31:36 +0100 | [diff] [blame] | 329 | void mgcp_conn_watchdog_kick(struct mgcp_conn *conn); |