diff options
Diffstat (limited to 'src/osmo-bts-virtual/osmo_mcast_sock.h')
-rw-r--r-- | src/osmo-bts-virtual/osmo_mcast_sock.h | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/osmo-bts-virtual/osmo_mcast_sock.h b/src/osmo-bts-virtual/osmo_mcast_sock.h new file mode 100644 index 00000000..f318ffea --- /dev/null +++ b/src/osmo-bts-virtual/osmo_mcast_sock.h @@ -0,0 +1,46 @@ +#pragma once + +#include <netinet/in.h> +#include <osmocom/core/select.h> + +struct mcast_server_sock { + struct osmo_fd *osmo_fd; + struct sockaddr_in *sock_conf; +}; + +struct mcast_client_sock { + struct osmo_fd *osmo_fd; + struct ip_mreq *mcast_group; +}; + +struct mcast_bidir_sock { + struct mcast_server_sock *tx_sock; + struct mcast_client_sock *rx_sock; +}; + +struct mcast_bidir_sock *mcast_bidir_sock_setup( + void *ctx, char* tx_mcast_group, int tx_mcast_port, + char* rx_mcast_group, int rx_mcast_port, int loopback, + int (*fd_rx_cb)(struct osmo_fd *ofd, unsigned int what), + void *osmo_fd_data); + +struct mcast_server_sock *mcast_server_sock_setup(void *ctx, + char* tx_mcast_group, + int tx_mcast_port, + int loopback); +struct mcast_client_sock *mcast_client_sock_setup( + void *ctx, char* mcast_group, int mcast_port, + int (*fd_rx_cb)(struct osmo_fd *ofd, unsigned int what), + void *osmo_fd_data); +int mcast_client_sock_rx(struct mcast_client_sock *client_sock, void* buf, + int buf_len); +int mcast_server_sock_tx(struct mcast_server_sock *serv_sock, void* data, + int data_len); +int mcast_bidir_sock_tx(struct mcast_bidir_sock *bidir_sock, void* data, + int data_len); +int mcast_bidir_sock_rx(struct mcast_bidir_sock *bidir_sock, void* buf, + int buf_len); +void mcast_client_sock_close(struct mcast_client_sock* client_sock); +void mcast_server_sock_close(struct mcast_server_sock* server_sock); +void mcast_bidir_sock_close(struct mcast_bidir_sock* bidir_sock); + |