blob: 685be9c60ad26ec6a504fefdc8010c0fdb9dc3bb [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);
18void osmux_allocate_cid(struct mgcp_conn_rtp *conn);
19void osmux_release_cid(struct mgcp_conn_rtp *conn);
20int 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);
Neels Hofmeyrf83ec562017-09-07 19:18:40 +020022int osmux_get_cid(void);
23void osmux_put_cid(uint8_t osmux_cid);
24int osmux_used_cid(void);
25
26enum osmux_state {
Pau Espin Pedrol407b1f12018-10-16 16:40:11 +020027 OSMUX_STATE_DISABLED = 0, /* Osmux not being currently used by endp */
28 OSMUX_STATE_NEGOTIATING, /* Osmux was locally requested in MGCP CRCX */
29 OSMUX_STATE_ACTIVATING, /* Osmux was accepted in MGCP CRCX ACK. It can now be enabled by \ref osmux_enable_endpoint. */
30 OSMUX_STATE_ENABLED, /* Osmux was initialized by \ref osmux_enable_endpoint and can process frames */
Neels Hofmeyrf83ec562017-09-07 19:18:40 +020031};
32
33enum osmux_usage {
34 OSMUX_USAGE_OFF = 0,
35 OSMUX_USAGE_ON = 1,
36 OSMUX_USAGE_ONLY = 2,
37};