Philipp Maier | 87bd9be | 2017-08-22 16:35:41 +0200 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Pau Espin Pedrol | a790f0c | 2020-08-31 13:29:11 +0200 | [diff] [blame] | 3 | #include <osmocom/core/socket.h> |
Neels Hofmeyr | f83ec56 | 2017-09-07 19:18:40 +0200 | [diff] [blame] | 4 | |
| 5 | #include <osmocom/netif/osmux.h> |
Philipp Maier | 87bd9be | 2017-08-22 16:35:41 +0200 | [diff] [blame] | 6 | struct mgcp_conn_rtp; |
Neels Hofmeyr | f83ec56 | 2017-09-07 19:18:40 +0200 | [diff] [blame] | 7 | |
| 8 | #define OSMUX_PORT 1984 |
| 9 | |
| 10 | enum { |
| 11 | OSMUX_ROLE_BSC = 0, |
| 12 | OSMUX_ROLE_BSC_NAT, |
| 13 | }; |
| 14 | |
| 15 | int osmux_init(int role, struct mgcp_config *cfg); |
Philipp Maier | 87bd9be | 2017-08-22 16:35:41 +0200 | [diff] [blame] | 16 | int osmux_enable_conn(struct mgcp_endpoint *endp, struct mgcp_conn_rtp *conn, |
Pau Espin Pedrol | a790f0c | 2020-08-31 13:29:11 +0200 | [diff] [blame] | 17 | struct osmo_sockaddr *addr, uint16_t port); |
Pau Espin Pedrol | 85978da | 2019-05-17 14:38:19 +0200 | [diff] [blame] | 18 | void conn_osmux_disable(struct mgcp_conn_rtp *conn); |
Pau Espin Pedrol | 8de58e7 | 2019-04-24 13:33:46 +0200 | [diff] [blame] | 19 | int conn_osmux_allocate_cid(struct mgcp_conn_rtp *conn, int osmux_cid); |
| 20 | void conn_osmux_release_cid(struct mgcp_conn_rtp *conn); |
Philipp Maier | 87bd9be | 2017-08-22 16:35:41 +0200 | [diff] [blame] | 21 | int osmux_xfrm_to_osmux(char *buf, int buf_len, struct mgcp_conn_rtp *conn); |
| 22 | int osmux_send_dummy(struct mgcp_endpoint *endp, struct mgcp_conn_rtp *conn); |
Pau Espin Pedrol | 8de58e7 | 2019-04-24 13:33:46 +0200 | [diff] [blame] | 23 | |
| 24 | void osmux_cid_pool_get(uint8_t osmux_cid); |
| 25 | int osmux_cid_pool_get_next(void); |
| 26 | void osmux_cid_pool_put(uint8_t osmux_cid); |
| 27 | bool osmux_cid_pool_allocated(uint8_t osmux_cid); |
| 28 | int osmux_cid_pool_count_used(void); |
Neels Hofmeyr | f83ec56 | 2017-09-07 19:18:40 +0200 | [diff] [blame] | 29 | |
| 30 | enum osmux_state { |
Pau Espin Pedrol | 407b1f1 | 2018-10-16 16:40:11 +0200 | [diff] [blame] | 31 | OSMUX_STATE_DISABLED = 0, /* Osmux not being currently used by endp */ |
Pau Espin Pedrol | 407b1f1 | 2018-10-16 16:40:11 +0200 | [diff] [blame] | 32 | OSMUX_STATE_ACTIVATING, /* Osmux was accepted in MGCP CRCX ACK. It can now be enabled by \ref osmux_enable_endpoint. */ |
| 33 | OSMUX_STATE_ENABLED, /* Osmux was initialized by \ref osmux_enable_endpoint and can process frames */ |
Neels Hofmeyr | f83ec56 | 2017-09-07 19:18:40 +0200 | [diff] [blame] | 34 | }; |
| 35 | |
| 36 | enum osmux_usage { |
| 37 | OSMUX_USAGE_OFF = 0, |
| 38 | OSMUX_USAGE_ON = 1, |
| 39 | OSMUX_USAGE_ONLY = 2, |
| 40 | }; |