Kea
3.2.1-git
fd_event_handler_factory.cc
Go to the documentation of this file.
1
// Copyright (C) 2025-2026 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
#include <config.h>
8
9
#include <
exceptions/exceptions.h
>
10
11
#include <
util/fd_event_handler_factory.h
>
12
#include <
util/poll_event_handler.h
>
13
#include <
util/select_event_handler.h
>
14
15
#include <cstdlib>
16
#include <string>
17
18
using namespace
std;
19
20
namespace
isc
{
21
namespace
util
{
22
23
FDEventHandlerPtr
FDEventHandlerFactory::factoryFDEventHandler
() {
24
// todo: use configuration to initialize the FDEventHandler.
25
FDEventHandler::HandlerType
type =
FDEventHandler::TYPE_SELECT
;
26
const
char
* env_type = getenv(
"KEA_EVENT_HANDLER_TYPE"
);
27
if
(env_type) {
28
if
(
string
(env_type) ==
string
(
"select"
)) {
29
type =
FDEventHandler::TYPE_SELECT
;
30
}
31
if
(
string
(env_type) ==
string
(
"poll"
)) {
32
type =
FDEventHandler::TYPE_POLL
;
33
}
34
}
35
switch
(type) {
36
case
FDEventHandler::TYPE_SELECT
:
37
return
(
FDEventHandlerPtr
(
new
SelectEventHandler
()));
38
case
FDEventHandler::TYPE_POLL
:
39
return
(
FDEventHandlerPtr
(
new
PollEventHandler
()));
40
default
:
41
return
(
FDEventHandlerPtr
(
new
SelectEventHandler
()));
42
}
43
return
(
FDEventHandlerPtr
(
new
SelectEventHandler
()));
44
}
45
46
}
// end of namespace isc::util
47
}
// end of namespace isc
isc::util::FDEventHandlerFactory::factoryFDEventHandler
static FDEventHandlerPtr factoryFDEventHandler()
Return an FDEventhandler.
Definition
fd_event_handler_factory.cc:23
isc::util::FDEventHandler::HandlerType
HandlerType
Definition
fd_event_handler.h:20
isc::util::FDEventHandler::TYPE_POLL
@ TYPE_POLL
Definition
fd_event_handler.h:23
isc::util::FDEventHandler::TYPE_SELECT
@ TYPE_SELECT
Definition
fd_event_handler.h:22
isc::util::PollEventHandler::PollEventHandler
PollEventHandler()
Constructor.
Definition
poll_event_handler.cc:17
isc::util::SelectEventHandler::SelectEventHandler
SelectEventHandler()
Constructor.
Definition
select_event_handler.cc:24
exceptions.h
fd_event_handler_factory.h
isc::util
Definition
time_utils.cc:43
isc::util::FDEventHandlerPtr
boost::shared_ptr< FDEventHandler > FDEventHandlerPtr
Shared pointer to an FD event handler.
Definition
fd_event_handler.h:76
isc
Defines the logger used by the top-level component of kea-lfc.
Definition
check_exists_add.cc:18
poll_event_handler.h
select_event_handler.h
src
lib
util
fd_event_handler_factory.cc
Generated on
for Kea by
1.18.0