Kea 2.5.8
|
Packet handling class using Linux Packet Filtering. More...
#include <pkt_filter_lpf.h>
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. | |
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.
|
inlinevirtual |
Check if packet can be sent to the host without address directly.
This class supports direct responses to the host without address.
Implements isc::dhcp::PktFilter.
Definition at line 31 of file pkt_filter_lpf.h.
|
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.
Implements isc::dhcp::PktFilter.
Definition at line 132 of file pkt_filter_lpf.cc.
|
virtual |
Open primary and fallback socket.
iface | Interface descriptor. |
addr | Address on the interface to be used to send packets. |
port | Port number. |
receive_bcast | Configure socket to receive broadcast messages |
send_bcast | Configure socket to send broadcast messages. |
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().
|
virtual |
Receive packet over specified socket.
iface | interface |
socket_info | structure holding socket information |
isc::NotImplemented | always |
Implements isc::dhcp::PktFilter.
Definition at line 234 of file pkt_filter_lpf.cc.
References isc::dhcp::PktEvent::BUFFER_READ, 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_throw, isc::dhcp::IfaceMgr::RCVBUFSIZE, isc::util::InputBuffer::readVector(), isc::dhcp::PktEvent::SOCKET_RECEIVED, and isc::dhcp::SocketInfo::sockfd_.
|
virtual |
Send packet over specified socket.
iface | interface to be used to send packet |
sockfd | socket descriptor |
pkt | packet to be sent |
isc::NotImplemented | always |
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().