12 #ifndef ROC_NETIO_UDP_PORT_H_
13 #define ROC_NETIO_UDP_PORT_H_
74 uv_loop_t& event_loop,
107 static void close_cb_(uv_handle_t* handle);
109 static void alloc_cb_(uv_handle_t* handle,
size_t size, uv_buf_t* buf);
110 static void recv_cb_(uv_udp_t* handle,
113 const sockaddr* addr,
116 static void write_sem_cb_(uv_async_t* handle);
117 static void send_cb_(uv_udp_send_t* req,
int status);
124 bool fully_closed_()
const;
125 void start_closing_();
127 bool join_multicast_group_();
128 void leave_multicast_group_();
130 void report_stats_();
135 void* close_handler_arg_;
140 bool handle_initialized_;
142 uv_async_t write_sem_;
143 bool write_sem_initialized_;
145 bool multicast_group_joined_;
IArena & arena() const
Get arena.
Thread-safe lock-free node-based intrusive multi-producer single-consumer queue.
UDP sender/receiver port.
bool start_recv(packet::IWriter &inbound_writer)
Start receiving packets.
virtual AsyncOperationStatus async_close(ICloseHandler &handler, void *handler_arg)
Asynchronously close receiver.
virtual ~UdpPort()
Destroy.
virtual void format_descriptor(core::StringBuilder &b)
Format descriptor.
virtual bool open()
Open receiver.
const address::SocketAddr & bind_address() const
Get bind address.
packet::IWriter * start_send()
Start receiving packets.
UdpPort(const UdpConfig &config, uv_loop_t &event_loop, packet::PacketFactory &packet_factory, core::IArena &arena)
Initialize.
Intrusive doubly-linked list.
Multi-producer single-consumer queue.
AsyncOperationStatus
Asynchronous operation status.
char multicast_interface[64]
If not empty, port will join multicast group on the interface with given address. May be "0....
bool enable_reuseaddr
If set, enable SO_REUSEADDR when binding socket to non-ephemeral port. If not set,...
bool operator==(const UdpConfig &other) const
Check two configs for equality.
bool enable_non_blocking
If true, allow non-blocking writes directly in write() method. If non-blocking write can't be perform...
address::SocketAddr bind_address
Port will bind to this address. If IP is zero, INADDR_ANY is used, i.e. the socket is bound to all ne...