Philipp Maier | 87bd9be | 2017-08-22 16:35:41 +0200 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Pau Espin Pedrol | 833281d | 2022-10-06 17:41:22 +0200 | [diff] [blame] | 3 | #include <stdint.h> |
| 4 | |
Pau Espin Pedrol | a790f0c | 2020-08-31 13:29:11 +0200 | [diff] [blame] | 5 | #include <osmocom/core/socket.h> |
Neels Hofmeyr | f83ec56 | 2017-09-07 19:18:40 +0200 | [diff] [blame] | 6 | |
| 7 | #include <osmocom/netif/osmux.h> |
Philipp Maier | 87bd9be | 2017-08-22 16:35:41 +0200 | [diff] [blame] | 8 | struct mgcp_conn_rtp; |
Pau Espin Pedrol | 928a20b | 2022-09-23 15:38:24 +0200 | [diff] [blame] | 9 | struct mgcp_trunk; |
| 10 | struct mgcp_endpoint; |
| 11 | struct mgcp_conn_rtp; |
| 12 | |
Pau Espin Pedrol | c1ad7fd | 2022-10-06 10:32:07 +0200 | [diff] [blame] | 13 | int osmux_init(struct mgcp_trunk *trunk); |
Pau Espin Pedrol | d48a811 | 2022-09-27 12:37:53 +0200 | [diff] [blame] | 14 | int osmux_init_conn(struct mgcp_conn_rtp *conn); |
Pau Espin Pedrol | 887c93e | 2022-10-06 12:36:03 +0200 | [diff] [blame] | 15 | int conn_osmux_enable(struct mgcp_conn_rtp *conn); |
Pau Espin Pedrol | 85978da | 2019-05-17 14:38:19 +0200 | [diff] [blame] | 16 | void conn_osmux_disable(struct mgcp_conn_rtp *conn); |
Pau Espin Pedrol | 833281d | 2022-10-06 17:41:22 +0200 | [diff] [blame] | 17 | int conn_osmux_event_rx_crcx_mdcx(struct mgcp_conn_rtp *conn); |
Philipp Maier | 87bd9be | 2017-08-22 16:35:41 +0200 | [diff] [blame] | 18 | int osmux_xfrm_to_osmux(char *buf, int buf_len, struct mgcp_conn_rtp *conn); |
Pau Espin Pedrol | 887c93e | 2022-10-06 12:36:03 +0200 | [diff] [blame] | 19 | int osmux_send_dummy(struct mgcp_conn_rtp *conn); |
Pau Espin Pedrol | 8de58e7 | 2019-04-24 13:33:46 +0200 | [diff] [blame] | 20 | |
| 21 | void osmux_cid_pool_get(uint8_t osmux_cid); |
| 22 | int osmux_cid_pool_get_next(void); |
| 23 | void osmux_cid_pool_put(uint8_t osmux_cid); |
| 24 | bool osmux_cid_pool_allocated(uint8_t osmux_cid); |
| 25 | int osmux_cid_pool_count_used(void); |
Neels Hofmeyr | f83ec56 | 2017-09-07 19:18:40 +0200 | [diff] [blame] | 26 | |
| 27 | enum osmux_state { |
Pau Espin Pedrol | 407b1f1 | 2018-10-16 16:40:11 +0200 | [diff] [blame] | 28 | OSMUX_STATE_DISABLED = 0, /* Osmux not being currently used by endp */ |
Pau Espin Pedrol | 887c93e | 2022-10-06 12:36:03 +0200 | [diff] [blame] | 29 | OSMUX_STATE_ACTIVATING, /* Osmux was accepted in MGCP CRCX ACK. It can now be enabled by \ref conn_osmux_enable. */ |
| 30 | OSMUX_STATE_ENABLED, /* Osmux was initialized by \ref conn_osmux_enable and can process frames */ |
Neels Hofmeyr | f83ec56 | 2017-09-07 19:18:40 +0200 | [diff] [blame] | 31 | }; |
| 32 | |
Pau Espin Pedrol | ea7aaf2 | 2022-09-22 21:07:54 +0200 | [diff] [blame] | 33 | extern const struct value_string osmux_state_strs[]; |
| 34 | static inline const char *osmux_state_str(enum osmux_state val) |
| 35 | { return get_value_string(osmux_state_strs, val); } |
| 36 | |
Neels Hofmeyr | f83ec56 | 2017-09-07 19:18:40 +0200 | [diff] [blame] | 37 | enum osmux_usage { |
| 38 | OSMUX_USAGE_OFF = 0, |
| 39 | OSMUX_USAGE_ON = 1, |
| 40 | OSMUX_USAGE_ONLY = 2, |
| 41 | }; |