Kea: pkt_filter.h Source File

| Kea 3.2.0-git

pkt_filter.h
Go to the documentation of this file.
1// Copyright (C) 2013-2024 Internet Systems Consortium, Inc. ("ISC")
2//
3// This Source Code Form is subject to the terms of the Mozilla Public
4// License, v. 2.0. If a copy of the MPL was not distributed with this
5// file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
7#ifndef PKT_FILTER_H
8#define PKT_FILTER_H
9
10#include <dhcp/pkt4.h>
11#include <asiolink/io_address.h>
12#include <boost/shared_ptr.hpp>
13
14namespace isc {
15namespace dhcp {
16
18 class InvalidPacketFilter : public Exception {
19public:
20 InvalidPacketFilter(const char* file, size_t line, const char* what) :
21 isc::Exception(file, line, what) { }
22};
23
25struct SocketInfo;
26
28class Iface;
29
44 class PktFilter {
45public:
46
48 virtual ~PktFilter() { }
49
60 virtual bool isDirectResponseSupported() const = 0;
61
70 virtual bool isSocketReceivedTimeSupported() const = 0;
71
91 virtual SocketInfo openSocket(Iface& iface,
92 const isc::asiolink::IOAddress& addr,
93 const uint16_t port,
94 const bool receive_bcast,
95 const bool send_bcast) = 0;
96
103 virtual Pkt4Ptr receive(Iface& iface,
104 const SocketInfo& socket_info) = 0;
105
113 virtual int send(const Iface& iface, uint16_t sockfd,
114 const Pkt4Ptr& pkt) = 0;
115
116protected:
117
139 virtual int openFallbackSocket(const isc::asiolink::IOAddress& addr,
140 const uint16_t port);
141};
142
144 typedef boost::shared_ptr<PktFilter> PktFilterPtr;
145
146} // namespace isc::dhcp
147} // namespace isc
148
149#endif // PKT_FILTER_H
isc::Exception::Exception
Exception(const char *file, size_t line, const char *what)
Constructor for a given type for exceptions with file name and file line number.
Definition exceptions/exceptions.cc:17
isc::Exception::what
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
Definition exceptions/exceptions.cc:32
isc::asiolink::IOAddress
The IOAddress class represents an IP addresses (version agnostic).
Definition io_address.h:53
isc::dhcp::Iface
Represents a single network interface.
Definition iface_mgr.h:136
isc::dhcp::InvalidPacketFilter::InvalidPacketFilter
InvalidPacketFilter(const char *file, size_t line, const char *what)
Definition pkt_filter.h:20
isc::dhcp::PktFilter
Abstract packet handling class.
Definition pkt_filter.h:44
isc::dhcp::PktFilter::openSocket
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.
isc::dhcp::PktFilter::openFallbackSocket
virtual int openFallbackSocket(const isc::asiolink::IOAddress &addr, const uint16_t port)
Default implementation to open a fallback socket.
Definition pkt_filter.cc:18
isc::dhcp::PktFilter::receive
virtual Pkt4Ptr receive(Iface &iface, const SocketInfo &socket_info)=0
Receive packet over specified socket.
isc::dhcp::PktFilter::~PktFilter
virtual ~PktFilter()
Virtual Destructor.
Definition pkt_filter.h:48
isc::dhcp::PktFilter::send
virtual int send(const Iface &iface, uint16_t sockfd, const Pkt4Ptr &pkt)=0
Send packet over specified socket.
isc::dhcp::PktFilter::isDirectResponseSupported
virtual bool isDirectResponseSupported() const =0
Check if packet can be sent to the host without address directly.
isc::dhcp::PktFilter::isSocketReceivedTimeSupported
virtual bool isSocketReceivedTimeSupported() const =0
Check if the socket received time is supported.
io_address.h
isc::dhcp
Definition dhcp4/client_handler.cc:20
isc::dhcp::Pkt4Ptr
boost::shared_ptr< Pkt4 > Pkt4Ptr
A pointer to Pkt4 object.
Definition pkt4.h:556
isc::dhcp::PktFilterPtr
boost::shared_ptr< PktFilter > PktFilterPtr
Pointer to a PktFilter object.
Definition pkt_filter.h:144
isc::util::file
Definition filesystem.cc:29
isc
Defines the logger used by the top-level component of kea-lfc.
Definition check_exists_add.cc:18
pkt4.h
isc::dhcp::SocketInfo
Holds information about socket.
Definition socket_info.h:18