Kea  1.9.9-git
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. More...
 
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. More...
 
virtual Pkt4Ptr receive (Iface &iface, const SocketInfo &socket_info)
 Receive packet over specified socket. More...
 
virtual int send (const Iface &iface, uint16_t sockfd, const Pkt4Ptr &pkt)
 Send packet over specified socket. More...
 
- Public Member Functions inherited from isc::dhcp::PktFilter
virtual ~PktFilter ()
 Virtual Destructor. More...
 

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

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

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.

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 132 of file pkt_filter_lpf.cc.

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

+ Here is the call graph for this function:

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

Receive packet over specified socket.

Parameters
ifaceinterface
socket_infostructure holding socket information
Exceptions
isc::NotImplementedalways
Returns
Received packet

Implements isc::dhcp::PktFilter.

Definition at line 217 of file pkt_filter_lpf.cc.

References isc::dhcp::decodeEthernetHeader(), isc::dhcp::decodeIpUdpHeader(), isc::dhcp::DHCPDISCOVER, isc::dhcp::SocketInfo::fallbackfd_, isc::dhcp::Iface::getIndex(), isc::util::InputBuffer::getLength(), isc::dhcp::Iface::getName(), isc::util::InputBuffer::getPosition(), isc::util::InputBuffer::readVector(), and isc::dhcp::SocketInfo::sockfd_.

+ Here is the call graph for this function:

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 292 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::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: