VIRT-PHY: mcast_sock: Don't keep subscribed multicast group around
[osmocom-bb.git] / src / host / virt_phy / include / virtphy / osmo_mcast_sock.h
blobba5237a0996ad3c3184f7c8a4e7ef9e37b22d893
1 #pragma once
3 #include <netinet/in.h>
4 #include <osmocom/core/select.h>
6 struct mcast_server_sock {
7 struct osmo_fd osmo_fd;
8 };
10 struct mcast_client_sock {
11 struct osmo_fd osmo_fd;
14 struct mcast_bidir_sock {
15 struct mcast_server_sock *tx_sock;
16 struct mcast_client_sock *rx_sock;
19 struct mcast_bidir_sock *mcast_bidir_sock_setup(
20 void *ctx, char* tx_mcast_group, int tx_mcast_port,
21 char* rx_mcast_group, int rx_mcast_port, int loopback,
22 int (*fd_rx_cb)(struct osmo_fd *ofd, unsigned int what),
23 void *osmo_fd_data);
25 struct mcast_server_sock *mcast_server_sock_setup(void *ctx,
26 char* tx_mcast_group,
27 int tx_mcast_port,
28 int loopback);
29 struct mcast_client_sock *mcast_client_sock_setup(
30 void *ctx, char* mcast_group, int mcast_port,
31 int (*fd_rx_cb)(struct osmo_fd *ofd, unsigned int what),
32 void *osmo_fd_data);
33 int mcast_client_sock_rx(struct mcast_client_sock *client_sock, void* buf,
34 int buf_len);
35 int mcast_server_sock_tx(struct mcast_server_sock *serv_sock, void* data,
36 int data_len);
37 int mcast_bidir_sock_tx(struct mcast_bidir_sock *bidir_sock, void* data,
38 int data_len);
39 int mcast_bidir_sock_rx(struct mcast_bidir_sock *bidir_sock, void* buf,
40 int buf_len);
41 void mcast_client_sock_close(struct mcast_client_sock* client_sock);
42 void mcast_server_sock_close(struct mcast_server_sock* server_sock);
43 void mcast_bidir_sock_close(struct mcast_bidir_sock* bidir_sock);