Android-cuttlefish cvd tool
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
UdpSocket Class Reference
Inheritance diagram for UdpSocket:
Inheritance graph
[legend]
Collaboration diagram for UdpSocket:
Collaboration graph
[legend]

Public Types

enum class  Type { kClient , kServer }
 
- Public Types inherited from Socket
enum class  Protocol { kTcp , kUdp }
 

Public Member Functions

 UdpSocket (Type type, cutils_socket_t sock)
 
bool Send (const void *data, size_t length) override
 
bool Send (std::vector< cutils_socket_buffer_t > buffers) override
 
ssize_t Receive (void *data, size_t length, int timeout_ms) override
 
- Public Member Functions inherited from Socket
virtual ~Socket ()
 
virtual bool Send (const void *data, size_t length)=0
 
virtual bool Send (std::vector< cutils_socket_buffer_t > buffers)=0
 
virtual ssize_t Receive (void *data, size_t length, int timeout_ms)=0
 
virtual ssize_t ReceiveAll (void *data, size_t length, int timeout_ms)
 
bool ReceiveTimedOut ()
 
virtual int Close ()
 
virtual std::unique_ptr< SocketAccept ()
 
int GetLocalPort ()
 

Private Member Functions

 DISALLOW_COPY_AND_ASSIGN (UdpSocket)
 

Private Attributes

std::unique_ptr< sockaddr_storage > addr_
 
socklen_t addr_size_ = 0
 

Additional Inherited Members

- Static Public Member Functions inherited from Socket
static std::string GetErrorMessage ()
 
static std::unique_ptr< SocketNewClient (Protocol protocol, const std::string &hostname, int port, std::string *error)
 
static std::unique_ptr< SocketNewServer (Protocol protocol, int port)
 
- Protected Member Functions inherited from Socket
 Socket (cutils_socket_t sock)
 
bool WaitForRecv (int timeout_ms)
 
- Protected Attributes inherited from Socket
cutils_socket_t sock_ = INVALID_SOCKET
 
bool receive_timed_out_ = false
 
std::function< ssize_t(cutils_socket_t, cutils_socket_buffer_t *, size_t)> socket_send_buffers_function_ = &socket_send_buffers
 

Member Enumeration Documentation

◆ Type

enum class UdpSocket::Type
strong
Enumerator
kClient 
kServer 

Constructor & Destructor Documentation

◆ UdpSocket()

UdpSocket::UdpSocket ( Type  type,
cutils_socket_t  sock 
)

Member Function Documentation

◆ DISALLOW_COPY_AND_ASSIGN()

UdpSocket::DISALLOW_COPY_AND_ASSIGN ( UdpSocket  )
private

◆ Receive()

ssize_t UdpSocket::Receive ( void *  data,
size_t  length,
int  timeout_ms 
)
overridevirtual

Implements Socket.

◆ Send() [1/2]

bool UdpSocket::Send ( const void *  data,
size_t  length 
)
overridevirtual

Implements Socket.

◆ Send() [2/2]

bool UdpSocket::Send ( std::vector< cutils_socket_buffer_t >  buffers)
overridevirtual

Implements Socket.

Member Data Documentation

◆ addr_

std::unique_ptr<sockaddr_storage> UdpSocket::addr_
private

◆ addr_size_

socklen_t UdpSocket::addr_size_ = 0
private

The documentation for this class was generated from the following file: