Kea 3.1.5
fd_event_handler.h
Go to the documentation of this file.
1// Copyright (C) 2025 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 FD_EVENT_HANDLER_H
8#define FD_EVENT_HANDLER_H
9
10#include <boost/shared_ptr.hpp>
11#include <stdint.h>
12
13namespace isc {
14namespace util {
15
19public:
20 enum HandlerType : uint16_t {
24 };
25
30
32 virtual ~FDEventHandler() = default;
33
37 virtual void add(int fd) = 0;
38
47 virtual int waitEvent(uint32_t timeout_sec, uint32_t timeout_usec = 0,
48 bool use_timeout = true) = 0;
49
55 virtual bool readReady(int fd) = 0;
56
62 virtual bool hasError(int fd) = 0;
63
65 virtual void clear() = 0;
66
69
70private:
72 HandlerType type_;
73};
74
76typedef boost::shared_ptr<FDEventHandler> FDEventHandlerPtr;
77
78} // namespace isc::util
79} // namespace isc
80
81#endif // FD_EVENT_HANDLER_H
virtual ~FDEventHandler()=default
Destructor.
virtual void add(int fd)=0
Add file descriptor to watch for events.
virtual int waitEvent(uint32_t timeout_sec, uint32_t timeout_usec=0, bool use_timeout=true)=0
Wait for events on registered file descriptors.
HandlerType type()
Return the event handler type.
FDEventHandler(HandlerType type=TYPE_UNKNOWN)
Constructor.
virtual bool readReady(int fd)=0
Check if file descriptor is ready for read operation.
virtual bool hasError(int fd)=0
Check if file descriptor has error.
virtual void clear()=0
Clear registered file descriptors.
boost::shared_ptr< FDEventHandler > FDEventHandlerPtr
Shared pointer to an FD event handler.
Defines the logger used by the top-level component of kea-lfc.