Kea 2.5.8
isc::dhcp::PktFilterLPF Class Reference

Packet handling class using Linux Packet Filtering. More...

#include <pkt_filter_lpf.h>

+ Inheritance diagram for isc::dhcp::PktFilterLPF:

Public Member Functions

virtual bool isDirectResponseSupported () const
 Check if packet can be sent to the host without address directly.
 
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 receive_bcast, const bool send_bcast)
 Open primary and fallback socket.
 
virtual Pkt4Ptr receive (Iface &iface, const SocketInfo &socket_info)
 Receive packet over specified socket.
 
virtual int send (const Iface &iface, uint16_t sockfd, const Pkt4Ptr &pkt)
 Send packet over specified socket.
 
- Public Member Functions inherited from isc::dhcp::PktFilter
virtual ~PktFilter ()
 Virtual Destructor.
 
virtual bool isDirectResponseSupported () const =0
 Check if packet can be sent to the host without address directly.
 
virtual bool isSocketReceivedTimeSupported () const =0
 Check if the socket received time is supported.
 
virtual SocketInfo openSocket (Iface &iface, const isc::asiolink::IOAddress &addr, const uint16_t port, const bool receive_bcast, const bool send_bcast)=0
 Open primary and fallback socket.
 
virtual Pkt4Ptr receive (Iface &iface, const SocketInfo &socket_info)=0
 Receive packet over specified socket.
 
virtual int send (const Iface &iface, uint16_t sockfd, const Pkt4Ptr &pkt)=0
 Send packet over specified socket.
 

Additional Inherited Members

- Protected Member Functions inherited from isc::dhcp::PktFilter
virtual int openFallbackSocket (const isc::asiolink::IOAddress &addr, const uint16_t port)
 Default implementation to open a fallback socket.
 

Detailed Description

Packet handling class using Linux Packet Filtering.

This class provides methods to send and receive DHCPv4 messages using raw sockets and Linux Packet Filtering. It is used by isc::dhcp::IfaceMgr to send DHCPv4 messages to the hosts which don't have an IPv4 address assigned yet.

Definition at line 23 of file pkt_filter_lpf.h.

Member Function Documentation

◆ isDirectResponseSupported()

virtual bool isc::dhcp::PktFilterLPF::isDirectResponseSupported ( ) const
inlinevirtual

Check if packet can be sent to the host without address directly.

This class supports direct responses to the host without address.

Returns
true always.

Implements isc::dhcp::PktFilter.

Definition at line 31 of file pkt_filter_lpf.h.

◆ isSocketReceivedTimeSupported()

bool isc::dhcp::PktFilterLPF::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.

Implements isc::dhcp::PktFilter.

Definition at line 132 of file pkt_filter_lpf.cc.

◆ openSocket()

SocketInfo isc::dhcp::PktFilterLPF::openSocket ( Iface iface,
const isc::asiolink::IOAddress addr,
const uint16_t  port,
const bool  receive_bcast,
const bool  send_bcast 
)
virtual

Open primary and fallback socket.

Parameters
ifaceInterface descriptor.
addrAddress on the interface to be used to send packets.
portPort number.
receive_bcastConfigure socket to receive broadcast messages
send_bcastConfigure socket to send broadcast messages.
Returns
A structure describing a primary and fallback socket.

Implements isc::dhcp::PktFilter.

Definition at line 141 of file pkt_filter_lpf.cc.

References isc::dhcp::Iface::getIndex(), isc::dhcp::Iface::getName(), isc_throw, isc::dhcp::PktFilter::openFallbackSocket(), isc::asiolink::IOAddress::toText(), and isc::asiolink::IOAddress::toUint32().

+ Here is the call graph for this function:

◆ receive()

Pkt4Ptr isc::dhcp::PktFilterLPF::receive ( Iface iface,
const SocketInfo socket_info 
)
virtual

◆ send()

int isc::dhcp::PktFilterLPF::send ( const Iface iface,
uint16_t  sockfd,
const Pkt4Ptr pkt 
)
virtual

Send packet over specified socket.

Parameters
ifaceinterface to be used to send packet
sockfdsocket descriptor
pktpacket to be sent
Exceptions
isc::NotImplementedalways
Returns
result of sending a packet. It is 0 if successful.

Implements isc::dhcp::PktFilter.

Definition at line 362 of file pkt_filter_lpf.cc.

References isc::util::OutputBuffer::getData(), isc::dhcp::Iface::getHWType(), isc::dhcp::Iface::getIndex(), isc::util::OutputBuffer::getLength(), isc::dhcp::Iface::getMac(), isc::dhcp::Iface::getMacLen(), isc_throw, isc::dhcp::PktEvent::RESPONSE_SENT, isc::util::OutputBuffer::writeData(), isc::dhcp::writeEthernetHeader(), and isc::dhcp::writeIpUdpHeader().

+ Here is the call graph for this function:

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