blob: 736025b2a503502e198582f5085f22feca449c76 [file] [log] [blame]
Philipp Maier87bd9be2017-08-22 16:35:41 +02001#pragma once
2
Pau Espin Pedrola790f0c2020-08-31 13:29:11 +02003#include <osmocom/core/socket.h>
Neels Hofmeyrf83ec562017-09-07 19:18:40 +02004
5#include <osmocom/netif/osmux.h>
Philipp Maier87bd9be2017-08-22 16:35:41 +02006struct mgcp_conn_rtp;
Neels Hofmeyrf83ec562017-09-07 19:18:40 +02007enum {
8 OSMUX_ROLE_BSC = 0,
9 OSMUX_ROLE_BSC_NAT,
10};
11
Pau Espin Pedrol21bcf6a2022-09-22 18:23:04 +020012int osmux_init(int role, struct mgcp_trunk *trunk);
Philipp Maier87bd9be2017-08-22 16:35:41 +020013int osmux_enable_conn(struct mgcp_endpoint *endp, struct mgcp_conn_rtp *conn,
Pau Espin Pedrol15e7e4f2022-09-09 16:52:41 +020014 const struct osmo_sockaddr *addr);
Pau Espin Pedrol85978da2019-05-17 14:38:19 +020015void conn_osmux_disable(struct mgcp_conn_rtp *conn);
Pau Espin Pedrol8de58e72019-04-24 13:33:46 +020016int conn_osmux_allocate_cid(struct mgcp_conn_rtp *conn, int osmux_cid);
17void conn_osmux_release_cid(struct mgcp_conn_rtp *conn);
Philipp Maier87bd9be2017-08-22 16:35:41 +020018int osmux_xfrm_to_osmux(char *buf, int buf_len, struct mgcp_conn_rtp *conn);
19int osmux_send_dummy(struct mgcp_endpoint *endp, struct mgcp_conn_rtp *conn);
Pau Espin Pedrol8de58e72019-04-24 13:33:46 +020020
21void osmux_cid_pool_get(uint8_t osmux_cid);
22int osmux_cid_pool_get_next(void);
23void osmux_cid_pool_put(uint8_t osmux_cid);
24bool osmux_cid_pool_allocated(uint8_t osmux_cid);
25int osmux_cid_pool_count_used(void);
Neels Hofmeyrf83ec562017-09-07 19:18:40 +020026
27enum osmux_state {
Pau Espin Pedrol407b1f12018-10-16 16:40:11 +020028 OSMUX_STATE_DISABLED = 0, /* Osmux not being currently used by endp */
Pau Espin Pedrol407b1f12018-10-16 16:40:11 +020029 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};