Philipp Maier | c66ab2c | 2020-06-02 20:55:34 +0200 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Philipp Maier | 889fe7f | 2020-07-06 17:44:12 +0200 | [diff] [blame] | 3 | #include <osmocom/gsm/i460_mux.h> |
| 4 | |
| 5 | #define LOGPTRUNK(trunk, cat, level, fmt, args...) \ |
| 6 | LOGP(cat, level, "trunk:%u " fmt, \ |
| 7 | trunk ? trunk->trunk_nr : 0, \ |
| 8 | ## args) |
| 9 | |
| 10 | |
Philipp Maier | bea5678 | 2020-07-01 23:18:58 +0200 | [diff] [blame] | 11 | enum mgcp_trunk_type { |
| 12 | MGCP_TRUNK_VIRTUAL, |
| 13 | MGCP_TRUNK_E1, |
| 14 | }; |
| 15 | |
Philipp Maier | c66ab2c | 2020-06-02 20:55:34 +0200 | [diff] [blame] | 16 | struct mgcp_trunk { |
| 17 | struct llist_head entry; |
| 18 | |
| 19 | struct mgcp_config *cfg; |
| 20 | |
| 21 | int trunk_nr; |
Philipp Maier | 04bbb9d | 2020-07-02 21:21:26 +0200 | [diff] [blame] | 22 | enum mgcp_trunk_type trunk_type; |
Philipp Maier | c66ab2c | 2020-06-02 20:55:34 +0200 | [diff] [blame] | 23 | |
| 24 | char *audio_fmtp_extra; |
Philipp Maier | c66ab2c | 2020-06-02 20:55:34 +0200 | [diff] [blame] | 25 | int audio_send_ptime; |
| 26 | int audio_send_name; |
| 27 | int audio_loop; |
| 28 | |
| 29 | int no_audio_transcoding; |
| 30 | |
| 31 | int omit_rtcp; |
| 32 | int keepalive_interval; |
| 33 | |
| 34 | /* RTP patching */ |
| 35 | int force_constant_ssrc; /* 0: don't, 1: once */ |
| 36 | int force_aligned_timing; |
| 37 | bool rfc5993_hr_convert; |
| 38 | |
| 39 | /* spec handling */ |
| 40 | int force_realloc; |
| 41 | |
| 42 | /* timer */ |
| 43 | struct osmo_timer_list keepalive_timer; |
| 44 | |
| 45 | /* When set, incoming RTP packets are not filtered |
| 46 | * when ports and ip-address do not match (debug) */ |
| 47 | int rtp_accept_all; |
| 48 | |
| 49 | unsigned int number_endpoints; |
Philipp Maier | c66ab2c | 2020-06-02 20:55:34 +0200 | [diff] [blame] | 50 | struct mgcp_endpoint **endpoints; |
| 51 | |
| 52 | /* global rate counters to measure the trunks overall performance and health */ |
| 53 | struct mgcp_ratectr_trunk ratectr; |
Philipp Maier | 889fe7f | 2020-07-06 17:44:12 +0200 | [diff] [blame] | 54 | |
| 55 | union { |
| 56 | /* Virtual trunk specific */ |
| 57 | struct { |
| 58 | unsigned int vty_number_endpoints; |
| 59 | } v; |
| 60 | /* E1 specific */ |
| 61 | struct { |
| 62 | unsigned int vty_line_nr; |
Philipp Maier | 889fe7f | 2020-07-06 17:44:12 +0200 | [diff] [blame] | 63 | bool ts_in_use[31]; |
| 64 | struct osmo_i460_timeslot i460_ts[31]; |
| 65 | } e1; |
| 66 | }; |
Philipp Maier | c66ab2c | 2020-06-02 20:55:34 +0200 | [diff] [blame] | 67 | }; |
| 68 | |
| 69 | struct mgcp_trunk *mgcp_trunk_alloc(struct mgcp_config *cfg, enum mgcp_trunk_type ttype, int nr); |
Philipp Maier | 889fe7f | 2020-07-06 17:44:12 +0200 | [diff] [blame] | 70 | int mgcp_trunk_equip(struct mgcp_trunk *trunk); |
Philipp Maier | 6fbbeec | 2020-07-01 23:00:54 +0200 | [diff] [blame] | 71 | struct mgcp_trunk *mgcp_trunk_by_num(const struct mgcp_config *cfg, enum mgcp_trunk_type ttype, int nr); |
Philipp Maier | c66ab2c | 2020-06-02 20:55:34 +0200 | [diff] [blame] | 72 | struct mgcp_trunk *mgcp_trunk_by_name(const struct mgcp_config *cfg, const char *epname); |
Philipp Maier | 7e9ddc9 | 2020-06-10 15:22:32 +0200 | [diff] [blame] | 73 | int e1_trunk_nr_from_epname(const char *epname); |
Philipp Maier | 889fe7f | 2020-07-06 17:44:12 +0200 | [diff] [blame] | 74 | struct mgcp_trunk *mgcp_trunk_by_line_num(const struct mgcp_config *cfg, unsigned int num); |
Philipp Maier | d19de2e | 2020-06-03 13:55:33 +0200 | [diff] [blame] | 75 | |
| 76 | /* The virtual trunk is always created on trunk id 0 for historical reasons, |
| 77 | * use this define constant as ID when allocating a virtual trunk. Other |
| 78 | * trunks may be assigned with arbritrary id numbers */ |
| 79 | #define MGCP_VIRT_TRUNK_ID 0 |