Kea 3.1.5
isc::util::FDEventHandler Class Referenceabstract

File descriptor event handler class handles events for registered file descriptors. More...

#include <fd_event_handler.h>

+ Inheritance diagram for isc::util::FDEventHandler:

Public Types

enum  HandlerType : uint16_t { TYPE_UNKNOWN = 0 , TYPE_SELECT = 1 , TYPE_POLL = 2 }
 

Public Member Functions

 FDEventHandler (HandlerType type=TYPE_UNKNOWN)
 Constructor.
 
virtual ~FDEventHandler ()=default
 Destructor.
 
virtual void add (int fd)=0
 Add file descriptor to watch for events.
 
virtual void clear ()=0
 Clear registered file descriptors.
 
virtual bool hasError (int fd)=0
 Check if file descriptor has error.
 
virtual bool readReady (int fd)=0
 Check if file descriptor is ready for read operation.
 
HandlerType type ()
 Return the event handler type.
 
virtual int waitEvent (uint32_t timeout_sec, uint32_t timeout_usec=0, bool use_timeout=true)=0
 Wait for events on registered file descriptors.
 

Detailed Description

File descriptor event handler class handles events for registered file descriptors.

Definition at line 18 of file fd_event_handler.h.

Member Enumeration Documentation

◆ HandlerType

Enumerator
TYPE_UNKNOWN 
TYPE_SELECT 
TYPE_POLL 

Definition at line 20 of file fd_event_handler.h.

Constructor & Destructor Documentation

◆ FDEventHandler()

isc::util::FDEventHandler::FDEventHandler ( HandlerType type = TYPE_UNKNOWN)

Constructor.

Parameters
typeThe file descriptor event handler type.

Definition at line 14 of file fd_event_handler.cc.

References type().

Referenced by isc::util::PollEventHandler::PollEventHandler(), and isc::util::SelectEventHandler::SelectEventHandler().

+ Here is the call graph for this function:

◆ ~FDEventHandler()

virtual isc::util::FDEventHandler::~FDEventHandler ( )
virtualdefault

Destructor.

Member Function Documentation

◆ add()

virtual void isc::util::FDEventHandler::add ( int fd)
pure virtual

Add file descriptor to watch for events.

Parameters
fdThe file descriptor.

Implemented in isc::util::PollEventHandler, and isc::util::SelectEventHandler.

◆ clear()

virtual void isc::util::FDEventHandler::clear ( )
pure virtual

Clear registered file descriptors.

Implemented in isc::util::PollEventHandler, and isc::util::SelectEventHandler.

◆ hasError()

virtual bool isc::util::FDEventHandler::hasError ( int fd)
pure virtual

Check if file descriptor has error.

Parameters
fdThe file descriptor.
Returns
True if file descriptor has error.

Implemented in isc::util::PollEventHandler, and isc::util::SelectEventHandler.

◆ readReady()

virtual bool isc::util::FDEventHandler::readReady ( int fd)
pure virtual

Check if file descriptor is ready for read operation.

Parameters
fdThe file descriptor.
Returns
True if file descriptor is ready for reading.

Implemented in isc::util::PollEventHandler, and isc::util::SelectEventHandler.

◆ type()

FDEventHandler::HandlerType isc::util::FDEventHandler::type ( )

Return the event handler type.

Definition at line 17 of file fd_event_handler.cc.

Referenced by FDEventHandler().

◆ waitEvent()

virtual int isc::util::FDEventHandler::waitEvent ( uint32_t timeout_sec,
uint32_t timeout_usec = 0,
bool use_timeout = true )
pure virtual

Wait for events on registered file descriptors.

Parameters
timeout_secThe wait timeout in seconds.
timeout_usecThe wait timeout in micro seconds.
use_timeoutFlag which indicates if function should wait with no timeout (wait forever).
Returns
-1 on error, 0 if no data is available (timeout expired), 1 if data is ready.

Implemented in isc::util::PollEventHandler, and isc::util::SelectEventHandler.


The documentation for this class was generated from the following files: