|
TARAXA
|
UDP Interface Handler must implement UDPSocketEvents. More...
#include <UDP.h>

Public Types | |
| enum | { maxDatagramSize = MaxDatagramSize } |
Public Member Functions | |
| UDPSocket (ba::strand< ba::io_context::executor_type > &_strand, UDPSocketEvents &_host, bi::udp::endpoint _endpoint) | |
| Create socket for specific endpoint. | |
| UDPSocket (ba::strand< ba::io_context::executor_type > &_strand, UDPSocketEvents &_host, unsigned _port) | |
| Create socket which listens to all ports. | |
| virtual | ~UDPSocket () |
| void | connect () |
| Socket will begin listening for and delivering packets. | |
| bool | send (UDPDatagram const &_datagram) override |
| Send datagram. | |
| bool | isOpen () |
| Returns if socket is open. | |
| void | disconnect () override |
| Disconnect socket. | |
Protected Member Functions | |
| void | doRead () |
| void | doWrite () |
| void | disconnectWithError (boost::system::error_code _ec) |
Protected Attributes | |
| std::atomic< bool > | m_started {} |
| std::atomic< bool > | m_closed {} |
| Connection availability. | |
| UDPSocketEvents & | m_host |
| Interface which owns this socket. | |
| bi::udp::endpoint | m_endpoint |
| Endpoint which we listen to. | |
| Mutex | x_sendQ |
| std::deque< UDPDatagram > | m_sendQ |
| Queue for egress data. | |
| std::array< byte, maxDatagramSize > | m_recvData |
| Buffer for ingress data. | |
| bi::udp::endpoint | m_recvEndpoint |
| Endpoint data was received from. | |
| bi::udp::socket | m_socket |
| Boost asio udp socket. | |
| Mutex | x_socketError |
| boost::system::error_code | m_socketError |
| Set when shut down due to error. | |
| ba::strand< ba::io_context::executor_type > & | strand_ |
Additional Inherited Members |
UDP Interface Handler must implement UDPSocketEvents.
multiple endpoints (we cannot advertise 0.0.0.0)
decouple deque from UDPDatagram and add ref() to datagram for fire&forget
|
inline |
Create socket for specific endpoint.
|
inline |
Create socket which listens to all ports.
|
inlinevirtual |
| void dev::p2p::UDPSocket< Handler, MaxDatagramSize >::connect | ( | ) |
Socket will begin listening for and delivering packets.
|
inlineoverridevirtual |
Disconnect socket.
Implements dev::p2p::UDPSocketFace.
|
protected |
|
protected |
|
protected |
|
inline |
Returns if socket is open.
|
overridevirtual |
Send datagram.
Implements dev::p2p::UDPSocketFace.
|
protected |
Connection availability.
|
protected |
Endpoint which we listen to.
|
protected |
Interface which owns this socket.
|
protected |
Buffer for ingress data.
|
protected |
Endpoint data was received from.
|
protected |
Queue for egress data.
|
protected |
Boost asio udp socket.
|
protected |
Set when shut down due to error.
|
protected |
Atomically ensure connection is started once. Start cannot occur unless m_started is false. Managed by start and disconnectWithError.
|
protected |
|
protected |
|
protected |
Mutex for error which can be set from host or IO thread.