Kea 3.1.5
select_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 SELECT_EVENT_HANDLER_H
8#define SELECT_EVENT_HANDLER_H
9
11
12#include <sys/select.h>
13
14namespace isc {
15namespace util {
16
20public:
23
25 virtual ~SelectEventHandler() = default;
26
30 void add(int fd);
31
40 int waitEvent(uint32_t timeout_sec, uint32_t timeout_usec = 0,
41 bool use_timeout = true);
42
48 bool readReady(int fd);
49
55 virtual bool hasError(int fd);
56
58 void clear();
59
60private:
62 int max_fd_;
63
65 fd_set read_fd_set_;
66
68 fd_set read_fd_set_data_;
69};
70
71} // namespace isc::util;
72} // namespace isc
73
74#endif // SELECT_EVENT_HANDLER_H
FDEventHandler(HandlerType type=TYPE_UNKNOWN)
Constructor.
int waitEvent(uint32_t timeout_sec, uint32_t timeout_usec=0, bool use_timeout=true)
Wait for events on registered file descriptors.
void add(int fd)
Add file descriptor to watch for events.
virtual bool hasError(int fd)
Check if file descriptor has error.
virtual ~SelectEventHandler()=default
Destructor.
bool readReady(int fd)
Check if file descriptor is ready for read operation.
void clear()
Clear registered file descriptors.
Defines the logger used by the top-level component of kea-lfc.