Kea 2.7.4
|
Packet handling class using AF_INET socket family. More...
#include <pkt_filter_inet.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. | |
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 AF_INET socket family.
This class provides methods to send and receive packet via socket using AF_INET family and SOCK_DGRAM type.
Definition at line 20 of file pkt_filter_inet.h.
|
inlinevirtual |
Check if packet can be sent to the host without address directly.
This Packet Filter sends packets through AF_INET datagram sockets, so it can't inject the HW address of the destination host into the packet. Therefore this class does not support direct responses.
Implements isc::dhcp::PktFilter.
Definition at line 30 of file pkt_filter_inet.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 23 of file pkt_filter_inet.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. |
isc::dhcp::SocketConfigError | if error occurs when opening, binding or configuring the socket. |
Implements isc::dhcp::PktFilter.
Definition at line 32 of file pkt_filter_inet.cc.
References isc_throw, isc::asiolink::IOAddress::toText(), and isc::asiolink::IOAddress::toUint32().
|
virtual |
Receive packet over specified socket.
iface | interface |
socket_info | structure holding socket information |
isc::dhcp::SocketReadError | if an error occurs during reception of the packet. |
An | exception thrown by the isc::dhcp::Pkt4 object if DHCPv4 message parsing fails. |
Implements isc::dhcp::PktFilter.
Definition at line 124 of file pkt_filter_inet.cc.
References isc_throw, isc::dhcp::IfaceMgr::RCVBUFSIZE, and isc::dhcp::PktEvent::SOCKET_RECEIVED.
|
virtual |
Send packet over specified socket.
This function will use local address specified in the pkt
as a source address for the packet and the interface index to select the index through which the packet will be sent. However, if these values are not specified for the packet (zero IP address and negative interface index), this function will rely on the routing information to determine the right outbound interface and source address.
iface | interface to be used to send packet |
sockfd | socket descriptor |
pkt | packet to be sent |
isc::dhcp::SocketWriteError | if an error occurs during sending a DHCP message through the socket. |
Implements isc::dhcp::PktFilter.
Definition at line 248 of file pkt_filter_inet.cc.
References isc_throw.