Kea: isc::dhcp::PktFilterInet6 Class Reference

| Kea 3.2.0-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:
[legend]

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

## 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.

## 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

## ◆ isSocketReceivedTimeSupported()

bool isc::dhcp::PktFilterInet6::isSocketReceivedTimeSupported | ( |  | ) | const
| virtual

Check if the socket received time is supported.

If true, then packets received through this filter will include a SOCKET_RECEIVED event in its event stack.

Returns
  True if SO_TIMESTAMP is defined.

Definition at line 26 of file pkt_filter_inet6.cc.

## ◆ openSocket()

SocketInfo isc::dhcp::PktFilterInet6::openSocket | ( | 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

  iface | Interface descriptor.
  addr | Address on the interface to be used to send packets.
  port | Port number.
  join_multicast | A 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::SocketConfigError | if error occurred when opening or configuring a socket.

Implements isc::dhcp::PktFilter6.

Definition at line 35 of file pkt_filter_inet6.cc.

References ALL_DHCP_RELAY_AGENTS_AND_SERVERS, ALL_DHCP_SERVERS, isc::dhcp::Iface::getName(), isc_throw, isc::asiolink::IOAddress::isV6LinkLocal(), isc::asiolink::IOAddress::isV6Multicast(), isc::dhcp::PktFilter6::joinMulticast(), 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_info | A structure holding socket information.

Returns
  A pointer to received message.

Exceptions

  isc::dhcp::SocketReadError | if error occurred during packet reception.

Implements isc::dhcp::PktFilter6.

Definition at line 170 of file pkt_filter_inet6.cc.

References isc::util::io::internal::convertPktInfo6(), isc_throw, isc::dhcp::IfaceMgr::RCVBUFSIZE, isc::dhcp::SocketInfo::sockfd_, and isc::dhcp::UNSET_IFINDEX.

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

  iface | Interface to be used to send packet.
  sockfd | A socket descriptor
  pkt | A packet to be sent.

Returns
  A result of sending the message. It is 0 if successful.

Exceptions

  isc::dhcp::SocketWriteError | if error occurred when sending a packet.

Implements isc::dhcp::PktFilter6.

Definition at line 300 of file pkt_filter_inet6.cc.

References isc::util::io::internal::convertPktInfo6(), isc_throw, isc_throw_assert, isc::dhcp::PktEvent::RESPONSE_SENT, and send().

Referenced by send().

Here is the call graph for this function:

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

- pkt_filter_inet6.h
- pkt_filter_inet6.cc