$darkmode
Elektra 0.11.0
|
I/O example binding. More...
#include <stdlib.h>
#include <string.h>
#include <kdbassert.h>
#include <kdbhelper.h>
#include <kdbio.h>
#include <kdblogger.h>
Classes | |
struct | SomeIoLibHandle |
Example I/O management library data structure. More... | |
struct | DocOperationData |
[kdbio operation data] More... | |
struct | DocBindingData |
[kdbio operation data] More... | |
Typedefs | |
typedef struct SomeIoLibHandle | SomeIoLibHandle |
Example I/O management library data structure. | |
typedef struct DocOperationData | DocOperationData |
[kdbio operation data] More... | |
typedef struct DocBindingData | DocBindingData |
[kdbio operation data] More... | |
Enumerations | |
enum | SomeIoLibFlags { SOME_IOLIB_READABLE = 1 << 0 , SOME_IOLIB_WRITABLE = 1 << 1 } |
Example I/O mangement library bitmask flags. More... | |
Functions | |
DocOperationData * | newOperationData (void) |
[kdbio binding data] More... | |
int | someBitMaskToElektraIoFlags (int bitmask) |
Convert your I/O library bit mask to Elektra's I/O flags. More... | |
void | ioDocBindingFdCallback (SomeIoLibHandle *handle, int bitmask) |
Calls the associated operation callback. More... | |
void | ioDocBindingTimerCallback (SomeIoLibHandle *handle) |
[kdbio operation callback] More... | |
void | ioDocBindingIdleCallback (SomeIoLibHandle *handle) |
Calls the associated operation callback. More... | |
int | ioDocBindingUpdateFd (ElektraIoFdOperation *fdOp) |
Update information about a file descriptor watched by I/O binding. More... | |
int | ioDocBindingAddFd (ElektraIoInterface *binding, ElektraIoFdOperation *fdOp) |
Add file descriptor to I/O binding. More... | |
int | ioDocBindingRemoveFd (ElektraIoFdOperation *fdOp) |
Remove file descriptor from I/O binding. More... | |
int | ioDocBindingUpdateTimer (ElektraIoTimerOperation *timerOp) |
Update timer in I/O binding. More... | |
int | ioDocBindingAddTimer (ElektraIoInterface *binding, ElektraIoTimerOperation *timerOp) |
Add timer for I/O binding. More... | |
int | ioDocBindingRemoveTimer (ElektraIoTimerOperation *timerOp) |
Remove timer from I/O binding. More... | |
int | ioDocBindingUpdateIdle (ElektraIoIdleOperation *idleOp) |
Update idle operation in I/O binding. More... | |
int | ioDocBindingAddIdle (ElektraIoInterface *binding, ElektraIoIdleOperation *idleOp) |
Add idle operation to I/O binding. More... | |
int | ioDocBindingRemoveIdle (ElektraIoIdleOperation *idleOp) |
Remove idle operation from I/O binding. More... | |
int | ioDocBindingCleanup (ElektraIoInterface *binding) |
Cleanup. More... | |
ElektraIoInterface * | elektraIoDocNew (char *foo) |
Create and initialize a new doc I/O binding. More... | |
I/O example binding.
All functions except the I/O binding entry point (elektraIoDocNew()) would normally be static but for documentation purposes they are not.
typedef struct DocBindingData DocBindingData |
[kdbio operation data]
[kdbio binding data] Container for additional information for an I/O binding.
typedef struct DocOperationData DocOperationData |
[kdbio operation data]
Container for additional information for I/O binding operations.
It is helpful to create a data structure for your binding to store additional data
enum SomeIoLibFlags |
ElektraIoInterface* elektraIoDocNew | ( | char * | foo | ) |
Create and initialize a new doc I/O binding.
foo | Some data from I/O management library (e.g. a handle) |
[kdbio binding create]
[kdbio binding create] [kdbio binding setdata]
[kdbio binding setdata]
int ioDocBindingAddFd | ( | ElektraIoInterface * | binding, |
ElektraIoFdOperation * | fdOp | ||
) |
Add file descriptor to I/O binding.
[kdbio binding addfd]
[kdbio binding addfd]
int ioDocBindingAddIdle | ( | ElektraIoInterface * | binding, |
ElektraIoIdleOperation * | idleOp | ||
) |
Add idle operation to I/O binding.
int ioDocBindingAddTimer | ( | ElektraIoInterface * | binding, |
ElektraIoTimerOperation * | timerOp | ||
) |
Add timer for I/O binding.
int ioDocBindingCleanup | ( | ElektraIoInterface * | binding | ) |
void ioDocBindingFdCallback | ( | SomeIoLibHandle * | handle, |
int | bitmask | ||
) |
Calls the associated operation callback.
Called by your I/O management library whenever a file descriptor status has changed.
handle | some I/O management handle |
flags | flags bit mask [kdbio operation callback] |
void ioDocBindingIdleCallback | ( | SomeIoLibHandle * | handle | ) |
Calls the associated operation callback.
Called by your I/O management library whenever an idle operation can run without interfering with other operations.
handle | some I/O management handle |
int ioDocBindingRemoveFd | ( | ElektraIoFdOperation * | fdOp | ) |
Remove file descriptor from I/O binding.
[kdbio operation getdata]
[kdbio operation getdata]
int ioDocBindingRemoveIdle | ( | ElektraIoIdleOperation * | idleOp | ) |
Remove idle operation from I/O binding.
int ioDocBindingRemoveTimer | ( | ElektraIoTimerOperation * | timerOp | ) |
Remove timer from I/O binding.
void ioDocBindingTimerCallback | ( | SomeIoLibHandle * | handle | ) |
[kdbio operation callback]
Calls the associated operation callback. Called by your I/O management library whenever a timer interval has passed.
handle | some I/O management handle |
int ioDocBindingUpdateFd | ( | ElektraIoFdOperation * | fdOp | ) |
Update information about a file descriptor watched by I/O binding.
int ioDocBindingUpdateIdle | ( | ElektraIoIdleOperation * | idleOp | ) |
Update idle operation in I/O binding.
int ioDocBindingUpdateTimer | ( | ElektraIoTimerOperation * | timerOp | ) |
Update timer in I/O binding.
DocOperationData* newOperationData | ( | void | ) |
[kdbio binding data]
A little helper function for allocating our custom operation data structure
int someBitMaskToElektraIoFlags | ( | int | bitmask | ) |
Convert your I/O library bit mask to Elektra's I/O flags.
bitmask | bit mask from I/O management library |