Kea  2.3.2-git
pkt_filter.h
Go to the documentation of this file.
1 // Copyright (C) 2013-2017 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 
14 namespace isc {
15 namespace dhcp {
16 
19 public:
20  InvalidPacketFilter(const char* file, size_t line, const char* what) :
21  isc::Exception(file, line, what) { };
22 };
23 
25 struct SocketInfo;
26 
28 class Iface;
29 
44 class PktFilter {
45 public:
46 
48  virtual ~PktFilter() { }
49 
60  virtual bool isDirectResponseSupported() const = 0;
61 
81  virtual SocketInfo openSocket(Iface& iface,
82  const isc::asiolink::IOAddress& addr,
83  const uint16_t port,
84  const bool receive_bcast,
85  const bool send_bcast) = 0;
86 
93  virtual Pkt4Ptr receive(Iface& iface,
94  const SocketInfo& socket_info) = 0;
95 
103  virtual int send(const Iface& iface, uint16_t sockfd,
104  const Pkt4Ptr& pkt) = 0;
105 
106 protected:
107 
129  virtual int openFallbackSocket(const isc::asiolink::IOAddress& addr,
130  const uint16_t port);
131 };
132 
134 typedef boost::shared_ptr<PktFilter> PktFilterPtr;
135 
136 } // namespace isc::dhcp
137 } // namespace isc
138 
139 #endif // PKT_FILTER_H
Represents a single network interface.
Definition: iface_mgr.h:118
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
boost::shared_ptr< PktFilter > PktFilterPtr
Pointer to a PktFilter object.
Definition: pkt_filter.h:134
InvalidPacketFilter(const char *file, size_t line, const char *what)
Definition: pkt_filter.h:20
Abstract packet handling class.
Definition: pkt_filter.h:44
Exception thrown when invalid packet filter object specified.
Definition: pkt_filter.h:18
boost::shared_ptr< Pkt4 > Pkt4Ptr
A pointer to Pkt4 object.
Definition: pkt4.h:544
This is a base class for exceptions thrown from the DNS library module.
Defines the logger used by the top-level component of kea-lfc.
virtual ~PktFilter()
Virtual Destructor.
Definition: pkt_filter.h:48
Holds information about socket.
Definition: socket_info.h:19