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