Kea  2.1.7-git
isc::dhcp::PktFilterInet6 Class Reference

A DHCPv6 packet handling class using datagram sockets. More...

#include <pkt_filter_inet6.h>

+ Inheritance diagram for isc::dhcp::PktFilterInet6:

Public Member Functions

virtual SocketInfo openSocket (const Iface &iface, const isc::asiolink::IOAddress &addr, const uint16_t port, const bool join_multicast)
 Opens a socket. More...
 
virtual Pkt6Ptr receive (const SocketInfo &socket_info)
 Receives DHCPv6 message on the interface. More...
 
virtual int send (const Iface &iface, uint16_t sockfd, const Pkt6Ptr &pkt)
 Sends DHCPv6 message through a specified interface and socket. More...
 
- Public Member Functions inherited from isc::dhcp::PktFilter6
virtual ~PktFilter6 ()
 Virtual Destructor. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from isc::dhcp::PktFilter6
static bool joinMulticast (int sock, const std::string &ifname, const std::string &mcast)
 Joins IPv6 multicast group on a socket. More...
 

Detailed Description

A DHCPv6 packet handling class using datagram sockets.

This class opens a datagram IPv6/UDPv6 socket. It also implements functions to send and receive DHCPv6 messages through this socket. It is a default class to be used by IfaceMgr to access IPv6 sockets.

Definition at line 21 of file pkt_filter_inet6.h.

Member Function Documentation

◆ openSocket()

SocketInfo isc::dhcp::PktFilterInet6::openSocket ( const Iface iface,
const isc::asiolink::IOAddress addr,
const uint16_t  port,
const bool  join_multicast 
)
virtual

Opens a socket.

This function opens an IPv6 socket on an interface and binds it to a specified UDP port and IP address. The addr value may be set to "::" in which case the address is unspecified and the socket is bound to in6addr_any.

Parameters
ifaceInterface descriptor.
addrAddress on the interface to be used to send packets.
portPort number.
join_multicastA boolean parameter which indicates whether socket should join All_DHCP_Relay_Agents_and_servers multicast group.
Returns
A structure describing a primary and fallback socket.
Exceptions
isc::dhcp::SocketConfigErrorif error occurred when opening or configuring a socket.

Implements isc::dhcp::PktFilter6.

Definition at line 27 of file pkt_filter_inet6.cc.

References ALL_DHCP_RELAY_AGENTS_AND_SERVERS, isc::dhcp::Iface::getName(), isc_throw, isc::asiolink::IOAddress::isV6LinkLocal(), isc::asiolink::IOAddress::isV6Multicast(), isc::asiolink::IOAddress::toBytes(), and isc::asiolink::IOAddress::toText().

+ Here is the call graph for this function:

◆ receive()

Pkt6Ptr isc::dhcp::PktFilterInet6::receive ( const SocketInfo socket_info)
virtual

Receives DHCPv6 message on the interface.

This function receives a single DHCPv6 message through a socket open on a specified interface. This function will block if there is no message waiting on the specified socket. Therefore the IfaceMgr must first check that there is any message on the socket (using select function) prior to calling this function.

If the message is received through the socket bound to "any" (in6addr_any) address this function will drop this message if it has been sent to an address other than multicast or link-local.

Parameters
socket_infoA structure holding socket information.
Returns
A pointer to received message.
Exceptions
isc::dhcp::SocketReadErrorif error occurred during packet reception.

Implements isc::dhcp::PktFilter6.

Definition at line 145 of file pkt_filter_inet6.cc.

References isc::dhcp::SocketInfo::addr_, isc::util::io::internal::convertPktInfo6(), isc::asiolink::IOAddress::fromBytes(), isc_throw, isc::asiolink::IOAddress::isV6LinkLocal(), isc::asiolink::IOAddress::isV6Multicast(), and isc::dhcp::SocketInfo::sockfd_.

+ Here is the call graph for this function:

◆ send()

int isc::dhcp::PktFilterInet6::send ( const Iface iface,
uint16_t  sockfd,
const Pkt6Ptr pkt 
)
virtual

Sends DHCPv6 message through a specified interface and socket.

The function sends a DHCPv6 message through a specified interface and socket. In general, there may be multiple sockets open on a single interface as a single interface may have multiple IPv6 addresses.

Parameters
ifaceInterface to be used to send packet.
sockfdA socket descriptor
pktA packet to be sent.
Returns
A result of sending the message. It is 0 if successful.
Exceptions
isc::dhcp::SocketWriteErrorif error occurred when sending a packet.

Implements isc::dhcp::PktFilter6.

Definition at line 257 of file pkt_filter_inet6.cc.

References isc::util::io::internal::convertPktInfo6(), isc_throw, and isc_throw_assert.

+ Here is the call graph for this function:

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