Kea  2.3.1-git
isc::asiolink Namespace Reference

Classes

class  BufferOverflow
 Buffer overflow. More...
 
class  BufferTooLarge
 Buffer Too Large. More...
 
class  DummyAsioSocket
 The DummyAsioSocket class is a concrete derived class of IOAsioSocket that is not associated with any real socket. More...
 
class  DummyIOCallback
 Asynchronous I/O Completion Callback. More...
 
class  DummySocket
 The DummySocket class is a concrete derived class of IOSocket that is not associated with any real socket. More...
 
class  IntervalTimer
 The IntervalTimer class is a wrapper for the ASIO boost::asio::deadline_timer class. More...
 
class  IntervalTimerImpl
 This class holds a call back function of asynchronous operations. More...
 
class  IOAcceptor
 Base class for acceptor services in Kea. More...
 
class  IOAddress
 The IOAddress class represents an IP addresses (version agnostic) More...
 
class  IOAsioSocket
 I/O Socket with asynchronous operations. More...
 
class  IOEndpoint
 The IOEndpoint class is an abstract base class to represent a communication endpoint. More...
 
class  IOError
 An exception that is thrown if an error occurs within the IO module. More...
 
class  IOService
 The IOService class is a wrapper for the ASIO io_service class. More...
 
class  IOServiceImpl
 
class  IOSignalSet
 Implements an asynchronous "signal" for IOService driven processing. More...
 
class  IOSignalSetImpl
 Implementation class of IOSignalSet. More...
 
class  IOSocket
 The IOSocket class is an abstract base class to represent various types of network sockets. More...
 
class  ProcessSpawn
 Utility class for spawning new processes. More...
 
class  ProcessSpawnError
 Exception thrown when error occurs during spawning a process. More...
 
class  ProcessSpawnImpl
 Implementation of the ProcessSpawn class. More...
 
struct  ProcessState
 Type for process state. More...
 
class  SocketNotOpen
 Socket not open. More...
 
class  SocketSetError
 Error setting socket options. More...
 
class  TCPAcceptor
 Provides a service for accepting new TCP connections. More...
 
class  TCPEndpoint
 The TCPEndpoint class is a concrete derived class of IOEndpoint that represents an endpoint of a TCP packet. More...
 
class  TCPSocket
 The TCPSocket class is a concrete derived class of IOAsioSocket that represents a TCP socket. More...
 
class  TLSAcceptor
 Provides a service for accepting new TLS connections. More...
 
class  TlsContextBase
 TLS context base class. More...
 
class  TLSSocket
 The TLSSocket class is a concrete derived class of IOAsioSocket that represents a TLS socket. More...
 
class  TlsStreamBase
 TLS stream base class. More...
 
class  UDPEndpoint
 The UDPEndpoint class is a concrete derived class of IOEndpoint that represents an endpoint of a UDP packet. More...
 
class  UDPSocket
 The UDPSocket class is a concrete derived class of IOAsioSocket that represents a UDP socket. More...
 
class  UnixDomainSocket
 Represents unix domain socket implemented in terms of boost asio. More...
 
class  UnixDomainSocketAcceptor
 Implements acceptor service for UnixDomainSocket. More...
 
class  UnixDomainSocketEndpoint
 Endpoint for UnixDomainSocket. More...
 
class  UnixDomainSocketError
 Exception thrown upon socket error. More...
 
class  UnixDomainSocketImpl
 Implementation of the unix domain socket. More...
 

Typedefs

typedef boost::shared_ptr< isc::asiolink::IntervalTimerIntervalTimerPtr
 
typedef boost::shared_ptr< IOServiceIOServicePtr
 Defines a smart pointer to an IOService instance. More...
 
typedef std::function< void(int signum)> IOSignalHandler
 Defines a handler function for an IOSignal. More...
 
typedef boost::shared_ptr< IOSignalSetIOSignalSetPtr
 Defines a pointer to an IOSignalSet. More...
 
typedef std::vector< std::string > ProcessArgs
 Type of the container holding arguments of the executable being run as a background process. More...
 
typedef std::map< const ProcessSpawnImpl *, ProcessStatesProcessCollection
 ProcessCollection container which stores all ProcessStates for each instance of ProcessSpawnImpl. More...
 
typedef std::vector< std::string > ProcessEnvVars
 Type of the container holding environment variables of the executable being run as a background process. More...
 
typedef boost::shared_ptr< ProcessSpawnImplProcessSpawnImplPtr
 Pointer to a ProcessSpawnImpl class. More...
 
typedef boost::shared_ptr< ProcessStateProcessStatePtr
 Defines a pointer to a ProcessState. More...
 
typedef std::map< pid_t, ProcessStatePtrProcessStates
 ProcessStates container which stores a ProcessState for each process identified by PID. More...
 
typedef boost::shared_ptr< TlsContext > TlsContextPtr
 The type of shared pointers to TlsContext objects. More...
 

Enumerations

enum  TlsRole { CLIENT, SERVER }
 Client and server roles. More...
 

Functions

uint64_t addrsInRange (const IOAddress &min, const IOAddress &max)
 Returns number of available addresses in the specified range (min - max). More...
 
IOAddress firstAddrInPrefix (const IOAddress &prefix, uint8_t len)
 This code is based on similar code from the Dibbler project. More...
 
IOAddress getNetmask4 (uint8_t len)
 Generates an IPv4 netmask of specified length. More...
 
size_t hash_value (const IOAddress &address)
 Hash the IOAddress. More...
 
IOAddress lastAddrInPrefix (const IOAddress &prefix, uint8_t len)
 returns a last address in a given prefix More...
 
IOAddress offsetAddress (const IOAddress &addr, uint64_t offset)
 Finds the address increased by offset. More...
 
ostream & operator<< (std::ostream &os, const IOEndpoint &endpoint)
 Insert the IOEndpoint as a string into stream. More...
 
std::ostream & operator<< (std::ostream &os, const IOAddress &address)
 Insert the IOAddress as a string into stream. More...
 
uint64_t prefixesInRange (const uint8_t pool_len, const uint8_t delegated_len)
 Returns number of available IPv6 prefixes in the specified prefix. More...
 
int prefixLengthFromRange (const IOAddress &min, const IOAddress &max)
 Returns prefix length from the specified range (min - max). More...
 

Typedef Documentation

◆ IntervalTimerPtr

Definition at line 138 of file interval_timer.h.

◆ IOServicePtr

typedef boost::shared_ptr<IOService> isc::asiolink::IOServicePtr

Defines a smart pointer to an IOService instance.

Definition at line 110 of file io_service.h.

◆ IOSignalHandler

typedef std::function<void(int signum)> isc::asiolink::IOSignalHandler

Defines a handler function for an IOSignal.

Definition at line 18 of file io_service_signal.h.

◆ IOSignalSetPtr

typedef boost::shared_ptr<IOSignalSet> isc::asiolink::IOSignalSetPtr

Defines a pointer to an IOSignalSet.

Definition at line 55 of file io_service_signal.h.

◆ ProcessArgs

typedef std::vector<std::string> isc::asiolink::ProcessArgs

Type of the container holding arguments of the executable being run as a background process.

Definition at line 37 of file process_spawn.h.

◆ ProcessCollection

ProcessCollection container which stores all ProcessStates for each instance of ProcessSpawnImpl.

Definition at line 52 of file process_spawn.cc.

◆ ProcessEnvVars

typedef std::vector<std::string> isc::asiolink::ProcessEnvVars

Type of the container holding environment variables of the executable being run as a background process.

Definition at line 41 of file process_spawn.h.

◆ ProcessSpawnImplPtr

Pointer to a ProcessSpawnImpl class.

Definition at line 30 of file process_spawn.h.

◆ ProcessStatePtr

typedef boost::shared_ptr<ProcessState> isc::asiolink::ProcessStatePtr

Defines a pointer to a ProcessState.

Definition at line 46 of file process_spawn.cc.

◆ ProcessStates

ProcessStates container which stores a ProcessState for each process identified by PID.

Definition at line 50 of file process_spawn.cc.

◆ TlsContextPtr

typedef boost::shared_ptr<TlsContext> isc::asiolink::TlsContextPtr

The type of shared pointers to TlsContext objects.

Definition at line 34 of file common_tls.h.

Enumeration Type Documentation

◆ TlsRole

Client and server roles.

Enumerator
CLIENT 
SERVER 

Definition at line 31 of file common_tls.h.

Function Documentation

◆ addrsInRange()

uint64_t isc::asiolink::addrsInRange ( const IOAddress min,
const IOAddress max 
)

Returns number of available addresses in the specified range (min - max).

Note that for min equal max case, the number of addresses is one.

Exceptions
BadValueif min and max are not of the same family (both must be either IPv4 or IPv6) or if max < min.
Parameters
minthe first address in range
maxthe last address in range
Returns
number of addresses in range

Definition at line 203 of file addr_utilities.cc.

References isc::asiolink::IOAddress::getFamily(), isc::asiolink::IOAddress::increase(), isc_throw, isc::asiolink::IOAddress::isV4(), isc::asiolink::IOAddress::subtract(), isc::asiolink::IOAddress::toBytes(), isc::asiolink::IOAddress::toText(), and isc::asiolink::IOAddress::toUint32().

Referenced by isc::dhcp::Pool4::Pool4(), and isc::dhcp::Pool6::Pool6().

+ Here is the call graph for this function:

◆ firstAddrInPrefix()

IOAddress isc::asiolink::firstAddrInPrefix ( const IOAddress prefix,
uint8_t  len 
)

This code is based on similar code from the Dibbler project.

I, Tomasz Mrugalski, as a sole creator of that code hereby release it under BSD license for the benefit of the Kea project. returns a first address in a given prefix

Example: For 2001:db8:1::deaf:beef and length /120 the function will return 2001:db8:1::dead:be00. See also lastAddrInPrefix.

Parameters
prefixand address that belongs to a prefix
lenprefix length
Returns
first address from a prefix

Definition at line 172 of file addr_utilities.cc.

References isc::asiolink::IOAddress::isV4().

Referenced by isc::yang::TranslatorPool::getAddresses(), isc::dhcp::Subnet::inRange(), isc::dhcp::CfgSubnets4::selectSubnet4o6(), and isc::yang::TranslatorPool::setPoolIetf6().

+ Here is the call graph for this function:

◆ getNetmask4()

IOAddress isc::asiolink::getNetmask4 ( uint8_t  len)

Generates an IPv4 netmask of specified length.

Exceptions
BadValueif len is greater than 32
Returns
netmask

Definition at line 192 of file addr_utilities.cc.

References isc_throw.

Referenced by isc::dhcp::Dhcpv4Srv::setFixedFields().

◆ hash_value()

size_t isc::asiolink::hash_value ( const IOAddress address)

Hash the IOAddress.

This method allows boost multi-index hashed indexes on IOAddresses. It follows the requirement with equality: if two addresses are equal their hashes are equal, if two addresses are not equal their hashes are almost surely not equal.

Parameters
addressA IOAddress to hash.
Returns
The hash of the IOAddress.

Definition at line 178 of file io_address.cc.

References isc::asiolink::IOAddress::isV4(), isc::asiolink::IOAddress::toBytes(), and isc::asiolink::IOAddress::toUint32().

Referenced by isc::asiolink::IOAddress::IPV6_ZERO_ADDRESS().

+ Here is the call graph for this function:

◆ lastAddrInPrefix()

IOAddress isc::asiolink::lastAddrInPrefix ( const IOAddress prefix,
uint8_t  len 
)

returns a last address in a given prefix

Example: For 2001:db8:1::deaf:beef and length /112 the function will return 2001:db8:1::dead:ffff. See also firstAddrInPrefix.

Parameters
prefixand address that belongs to a prefix
lenprefix length
Returns
first address from a prefix

Definition at line 182 of file addr_utilities.cc.

References isc::asiolink::IOAddress::isV4().

Referenced by isc::dhcp::Pool6::create(), isc::yang::TranslatorPool::getAddresses(), isc::dhcp::Subnet::inRange(), isc::dhcp::Pool4::Pool4(), isc::dhcp::CfgSubnets4::selectSubnet4o6(), and isc::yang::TranslatorPool::setPoolIetf6().

+ Here is the call graph for this function:

◆ offsetAddress()

IOAddress isc::asiolink::offsetAddress ( const IOAddress addr,
uint64_t  offset 
)

Finds the address increased by offset.

Adds offset to the IPv4 or iPv6 address and finds the resulting address. Note that the current limitation is the maximum value of the offset, i.e. max uint64_t. If the sum of the IPv4 address and the offset exceeds the maximum value of uint32_t type, the 255.255.255.255 is returned.

Parameters
addrinput address
offsetdistance of the returned address from the input address.
Returns
address being offset greater than the input address

Definition at line 376 of file addr_utilities.cc.

References isc::asiolink::IOAddress::fromBytes(), isc::asiolink::IOAddress::isV4(), isc::asiolink::IOAddress::toBytes(), and isc::asiolink::IOAddress::toUint32().

Referenced by isc::dhcp::FreeLeaseQueue::addRange(), isc::dhcp::IPRangePermutation::next(), and isc::dhcp::PrefixRange::PrefixRange().

+ Here is the call graph for this function:

◆ operator<<() [1/2]

std::ostream & isc::asiolink::operator<< ( std::ostream &  os,
const IOEndpoint endpoint 
)

Insert the IOEndpoint as a string into stream.

This method converts endpoint into a string and inserts it into the output stream os.

This method converts the address and port of the endpoint in the textual format that other Kea modules would use in logging, i.e.,

  • For IPv6 address: [<address>]:port (e.g., [2001:db8::5300]:53)
  • For IPv4 address: <address>:port (e.g., 192.0.2.53:5300)

If it's neither IPv6 nor IPv4, it converts the endpoint into text in the same format as that for IPv4, although in practice such a case is not really expected.

Parameters
osA std::ostream object on which the insertion operation is performed.
endpointA reference to an IOEndpoint object output by the operation.
Returns
A reference to the same std::ostream object referenced by parameter os after the insertion operation.

Definition at line 55 of file io_endpoint.cc.

References isc::asiolink::IOEndpoint::getAddress(), isc::asiolink::IOEndpoint::getFamily(), and isc::asiolink::IOEndpoint::getPort().

+ Here is the call graph for this function:

◆ operator<<() [2/2]

std::ostream & isc::asiolink::operator<< ( std::ostream &  os,
const IOAddress address 
)

Insert the IOAddress as a string into stream.

This method converts the address into a string and inserts it into the output stream os.

This function overloads the global operator<< to behave as described in ostream::operator<< but applied to IOAddress objects.

Parameters
osA std::ostream object on which the insertion operation is performed.
addressThe IOAddress object output by the operation.
Returns
A reference to the same std::ostream object referenced by parameter os after the insertion operation.

Definition at line 123 of file io_address.cc.

References isc::asiolink::IOAddress::toText().

Referenced by isc::asiolink::IOAddress::IPV6_ZERO_ADDRESS(), and isc::asiolink::IOEndpoint::~IOEndpoint().

+ Here is the call graph for this function:

◆ prefixesInRange()

uint64_t isc::asiolink::prefixesInRange ( const uint8_t  pool_len,
const uint8_t  delegated_len 
)

Returns number of available IPv6 prefixes in the specified prefix.

Note that if the answer is bigger than uint64_t can hold, it will return the max value of uint64_t type.

Example: prefixesInRange(48, 64) returns 65536, as there are /48 pool can be split into 65536 prefixes, each /64 large.

Parameters
pool_lenlength of the pool in bits
delegated_lenlength of the prefixes to be delegated from the pool
Returns
number of prefixes in range

Definition at line 352 of file addr_utilities.cc.

Referenced by isc::dhcp::Pool6::create(), and isc::dhcp::PrefixRange::PrefixRange().

◆ prefixLengthFromRange()

int isc::asiolink::prefixLengthFromRange ( const IOAddress min,
const IOAddress max 
)

Returns prefix length from the specified range (min - max).

This can be considered as log2(addrsInRange)

Exceptions
BadValueif min and max do not define a prefix.
Parameters
minthe first address in range
maxthe last address in range
Returns
the prefix length or -1 if the range is not from a prefix

Definition at line 273 of file addr_utilities.cc.

References isc::asiolink::IOAddress::getFamily(), isc_throw, isc::asiolink::IOAddress::isV4(), isc::asiolink::IOAddress::toBytes(), isc::asiolink::IOAddress::toText(), and isc::asiolink::IOAddress::toUint32().

Referenced by isc::dhcp::Pool4::toElement(), and isc::dhcp::Pool6::toElement().

+ Here is the call graph for this function: