C++ Distributed Hash Table
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
dht::net::DatagramSocket Class Referenceabstract
Inheritance diagram for dht::net::DatagramSocket:
Inheritance graph
[legend]

Public Types

using OnReceive = std::function< PacketList(PacketList &&packets)>
 

Public Member Functions

virtual int sendTo (const SockAddr &dest, const uint8_t *data, size_t size, bool replied)=0
 
void setOnReceive (OnReceive &&cb)
 
virtual bool hasIPv4 () const =0
 
virtual bool hasIPv6 () const =0
 
SockAddr getBound (sa_family_t family=AF_UNSPEC) const
 
in_port_t getPort (sa_family_t family=AF_UNSPEC) const
 
virtual const SockAddrgetBoundRef (sa_family_t family=AF_UNSPEC) const =0
 
virtual std::vector< SockAddrresolve (const std::string &host, const std::string &service={})
 
virtual void stop ()=0
 

Protected Member Functions

PacketList getNewPacket ()
 
void onReceived (PacketList &&packets)
 

Protected Attributes

std::mutex lock
 

Detailed Description

Definition at line 62 of file network_utils.h.

Member Typedef Documentation

◆ OnReceive

using dht::net::DatagramSocket::OnReceive = std::function<PacketList(PacketList&& packets)>

A function that takes a list of new received packets and optionally returns consumed packets for recycling.

Definition at line 67 of file network_utils.h.

Member Function Documentation

◆ resolve()

virtual std::vector<SockAddr> dht::net::DatagramSocket::resolve ( const std::string &  host,
const std::string &  service = {} 
)
inlinevirtual

Virtual resolver mothod allows to implement custom resolver

Definition at line 92 of file network_utils.h.


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