My Project: dht::net::DatagramSocket Class Reference

My Project 3.7.7 C++ Distributed Hash Table

Loading...
Searching...
No Matches
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:
[legend]
Collaboration diagram for dht::net::DatagramSocket:
[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 SockAddr & | getBoundRef (sa_family_t family=AF_UNSPEC) const =0
virtual std::vector< SockAddr > | resolve (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 48 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 54 of file network_utils.h.

## Constructor & Destructor Documentation

## ◆ ~DatagramSocket()

virtual dht::net::DatagramSocket::~DatagramSocket | ( |  | ) |
| inlinevirtual

Definition at line 55 of file network_utils.h.

## Member Function Documentation

## ◆ getBound()

SockAddr dht::net::DatagramSocket::getBound | ( | sa_family_t | family = AF_UNSPEC | ) | const
| inline

Definition at line 68 of file network_utils.h.

## ◆ getNewPacket()

PacketList dht::net::DatagramSocket::getNewPacket | ( |  | ) |
| inlineprotected

Definition at line 90 of file network_utils.h.

## ◆ getPort()

in_port_t dht::net::DatagramSocket::getPort | ( | sa_family_t | family = AF_UNSPEC | ) | const
| inline

Definition at line 73 of file network_utils.h.

## ◆ onReceived()

void dht::net::DatagramSocket::onReceived | ( | PacketList && | packets | ) |
| inlineprotected

Definition at line 103 of file network_utils.h.

## ◆ 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 82 of file network_utils.h.

## ◆ setOnReceive()

void dht::net::DatagramSocket::setOnReceive | ( | OnReceive && | cb | ) |
| inline

Definition at line 59 of file network_utils.h.

## Member Data Documentation

## ◆ lock

std::mutex dht::net::DatagramSocket::lock
| mutableprotected

Definition at line 114 of file network_utils.h.

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

- /home/noptrix/ba/blackarch/packages/opendht-c/src/opendht/include/opendht/network_utils.h