Kea: pkt_filter.h Source File

| Kea 1.5.0

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
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
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
106protected:
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
isc::Exception
This is a base class for exceptions thrown from the DNS library module.
Definition: exceptions/exceptions.h:23
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:45
isc::dhcp::Iface
Represents a single network interface.
Definition: iface_mgr.h:114
isc::dhcp::InvalidPacketFilter
Exception thrown when invalid packet filter object specified.
Definition: pkt_filter.h:18
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.
io_address.h
isc::dhcp::Pkt4Ptr
boost::shared_ptr< Pkt4 > Pkt4Ptr
A pointer to Pkt4 object.
Definition: pkt4.h:546
isc::dhcp::PktFilterPtr
boost::shared_ptr< PktFilter > PktFilterPtr
Pointer to a PktFilter object.
Definition: pkt_filter.h:134
isc
Defines the logger used by the top-level component of kea-dhcp-ddns.
Definition: agent_parser.cc:144
pkt4.h
isc::dhcp::SocketInfo
Holds information about socket.
Definition: socket_info.h:19