Kea 2.5.8
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
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
44class 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
144typedef boost::shared_ptr<PktFilter> PktFilterPtr;
145
146} // namespace isc::dhcp
147} // namespace isc
148
149#endif // PKT_FILTER_H
This is a base class for exceptions thrown from the DNS library module.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
Represents a single network interface.
Definition: iface_mgr.h:118
Exception thrown when invalid packet filter object specified.
Definition: pkt_filter.h:18
InvalidPacketFilter(const char *file, size_t line, const char *what)
Definition: pkt_filter.h:20
Abstract packet handling class.
Definition: pkt_filter.h:44
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 int openFallbackSocket(const isc::asiolink::IOAddress &addr, const uint16_t port)
Default implementation to open a fallback socket.
Definition: pkt_filter.cc:18
virtual Pkt4Ptr receive(Iface &iface, const SocketInfo &socket_info)=0
Receive packet over specified socket.
virtual ~PktFilter()
Virtual Destructor.
Definition: pkt_filter.h:48
virtual int send(const Iface &iface, uint16_t sockfd, const Pkt4Ptr &pkt)=0
Send packet over specified socket.
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.
boost::shared_ptr< Pkt4 > Pkt4Ptr
A pointer to Pkt4 object.
Definition: pkt4.h:555
boost::shared_ptr< PktFilter > PktFilterPtr
Pointer to a PktFilter object.
Definition: pkt_filter.h:144
Defines the logger used by the top-level component of kea-lfc.
Holds information about socket.
Definition: socket_info.h:19