blob: c080c85321d3939c1bdfcb02b36c5df7d6bd2f72 [file] [log] [blame]
Philipp Maier87bd9be2017-08-22 16:35:41 +02001#pragma once
2
Neels Hofmeyrf83ec562017-09-07 19:18:40 +02003
4#include <osmocom/netif/osmux.h>
Philipp Maier87bd9be2017-08-22 16:35:41 +02005struct mgcp_conn_rtp;
Neels Hofmeyrf83ec562017-09-07 19:18:40 +02006
7#define OSMUX_PORT 1984
8
9enum {
10 OSMUX_ROLE_BSC = 0,
11 OSMUX_ROLE_BSC_NAT,
12};
13
14int osmux_init(int role, struct mgcp_config *cfg);
Philipp Maier87bd9be2017-08-22 16:35:41 +020015int osmux_enable_conn(struct mgcp_endpoint *endp, struct mgcp_conn_rtp *conn,
16 struct in_addr *addr, uint16_t port);
17void osmux_disable_conn(struct mgcp_conn_rtp *conn);
Pau Espin Pedrol8de58e72019-04-24 13:33:46 +020018int conn_osmux_allocate_cid(struct mgcp_conn_rtp *conn, int osmux_cid);
19void conn_osmux_release_cid(struct mgcp_conn_rtp *conn);
Philipp Maier87bd9be2017-08-22 16:35:41 +020020int osmux_xfrm_to_osmux(char *buf, int buf_len, struct mgcp_conn_rtp *conn);
21int osmux_send_dummy(struct mgcp_endpoint *endp, struct mgcp_conn_rtp *conn);
Pau Espin Pedrol8de58e72019-04-24 13:33:46 +020022
23void osmux_cid_pool_get(uint8_t osmux_cid);
24int osmux_cid_pool_get_next(void);
25void osmux_cid_pool_put(uint8_t osmux_cid);
26bool osmux_cid_pool_allocated(uint8_t osmux_cid);
27int osmux_cid_pool_count_used(void);
Neels Hofmeyrf83ec562017-09-07 19:18:40 +020028
29enum osmux_state {
Pau Espin Pedrol407b1f12018-10-16 16:40:11 +020030 OSMUX_STATE_DISABLED = 0, /* Osmux not being currently used by endp */
31 OSMUX_STATE_NEGOTIATING, /* Osmux was locally requested in MGCP CRCX */
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 Hofmeyrf83ec562017-09-07 19:18:40 +020034};
35
36enum osmux_usage {
37 OSMUX_USAGE_OFF = 0,
38 OSMUX_USAGE_ON = 1,
39 OSMUX_USAGE_ONLY = 2,
40};