Elektra: kdbio.h File Reference

Elektra 0.8.24

Typedefs | Enumerations | Functions
kdbio.h File Reference
I/O Bindings

Elektra-I/O structures for I/O bindings, plugins and applications. More...

`#include "kdb.h"`

## Typedefs
typedef struct _ElektraIoInterface | ElektraIoInterface
| I/O binding handle.
typedef struct _ElektraIoFdOperation | ElektraIoFdOperation
| file descriptor watch operation handle
typedef struct _ElektraIoTimerOperation | ElektraIoTimerOperation
| timer operation handle
typedef struct _ElektraIoIdleOperation | ElektraIoIdleOperation
| idle operation handle
typedef void(* | ElektraIoFdCallback) (ElektraIoFdOperation *fdOp, int flags)
| Callback for file descriptor watch operations. More...
typedef void(* | ElektraIoIdleCallback) (ElektraIoIdleOperation *idleOp)
| Callback for idle operations. More...
typedef void(* | ElektraIoTimerCallback) (ElektraIoTimerOperation *timerOp)
| Callback for timer operations. More...
typedef int | ElektraIoBindingAddFd(ElektraIoInterface *binding, ElektraIoFdOperation *fdOp)
| Add file descriptor to be watched by I/O binding. More...
typedef int | ElektraIoBindingUpdateFd(ElektraIoFdOperation *fdOp)
| Notify I/O binding about changes to file descriptor watch operation. More...
typedef int | ElektraIoBindingRemoveFd(ElektraIoFdOperation *fdOp)
| Remove file descriptor from I/O binding. More...
typedef int | ElektraIoBindingAddTimer(ElektraIoInterface *binding, ElektraIoTimerOperation *timerOp)
| Add timer to I/O binding. More...
typedef int | ElektraIoBindingUpdateTimer(ElektraIoTimerOperation *timerOp)
| Notifiy I/O binding about changes to timer structure. More...
typedef int | ElektraIoBindingRemoveTimer(ElektraIoTimerOperation *timerOp)
| Remove timer from I/O binding. More...
typedef int | ElektraIoBindingAddIdle(ElektraIoInterface *binding, ElektraIoIdleOperation *idleOp)
| Add idle to I/O binding. More...
typedef int | ElektraIoBindingUpdateIdle(ElektraIoIdleOperation *idleOp)
| Notifiy I/O binding about changes to idle structure. More...
typedef int | ElektraIoBindingRemoveIdle(ElektraIoIdleOperation *idleOp)
| Remove idle from I/O binding. More...
typedef int | ElektraIoBindingCleanup(ElektraIoInterface *binding)
| Free memory used by I/O binding. More...

## Enumerations
enum | ElektraIoFdFlags { ELEKTRA_IO_READABLE = 1 << 0, ELEKTRA_IO_WRITABLE = 1 << 1 }
| Available flags for file descriptors operation bitmask. More...

## Functions
int | elektraIoBindingAddFd (ElektraIoInterface *binding, ElektraIoFdOperation *fdOp)
| Add file descriptor to be watched by I/O binding. More...
int | elektraIoBindingUpdateFd (ElektraIoFdOperation *fdOp)
| Notify I/O binding about changes to file descriptor watch operation. More...
int | elektraIoBindingRemoveFd (ElektraIoFdOperation *fdOp)
| Remove file descriptor from I/O binding. More...
int | elektraIoBindingAddTimer (ElektraIoInterface *binding, ElektraIoTimerOperation *timerOp)
| Add timer to I/O binding. More...
int | elektraIoBindingUpdateTimer (ElektraIoTimerOperation *timerOp)
| Notifiy I/O binding about changes to timer structure. More...
int | elektraIoBindingRemoveTimer (ElektraIoTimerOperation *timerOp)
| Remove timer from I/O binding. More...
int | elektraIoBindingAddIdle (ElektraIoInterface *binding, ElektraIoIdleOperation *idleOp)
| Add idle to I/O binding. More...
int | elektraIoBindingUpdateIdle (ElektraIoIdleOperation *idleOp)
| Notifiy I/O binding about changes to idle structure. More...
int | elektraIoBindingRemoveIdle (ElektraIoIdleOperation *idleOp)
| Remove idle from I/O binding. More...
int | elektraIoBindingCleanup (ElektraIoInterface *binding)
| Free memory used by I/O binding. More...
ElektraIoInterface * | elektraIoNewBinding (ElektraIoBindingAddFd *addFd, ElektraIoBindingUpdateFd *updateFd, ElektraIoBindingRemoveFd *removeFd, ElektraIoBindingAddTimer *addTimer, ElektraIoBindingUpdateTimer *updateTimer, ElektraIoBindingRemoveTimer *removeTimer, ElektraIoBindingAddIdle *addIdle, ElektraIoBindingUpdateIdle *updateIdle, ElektraIoBindingRemoveIdle *removeIdle, ElektraIoBindingCleanup *cleanup)
| Create a new I/O binding. More...
void * | elektraIoBindingGetData (ElektraIoInterface *binding)
| Get private data from I/O Binding. More...
int | elektraIoBindingSetData (ElektraIoInterface *binding, void *data)
| Set private data from I/O Binding. More...
ElektraIoFdOperation * | elektraIoNewFdOperation (int fd, int flags, int enabled, ElektraIoFdCallback callback, void *data)
| Create a new file descriptor watch operation. More...
int | elektraIoFdSetEnabled (ElektraIoFdOperation *fdOp, int enabled)
| Enable or disable file descriptor watch operation. More...
int | elektraIoFdSetFlags (ElektraIoFdOperation *fdOp, int flags)
| Update flag bitmask of file descriptor watch operation. More...
int | elektraIoFdGetFd (ElektraIoFdOperation *fdOp)
| Get file descriptor number from operation. More...
void * | elektraIoFdGetData (ElektraIoFdOperation *fdOp)
| Get private data from operation. More...
int | elektraIoFdSetBindingData (ElektraIoFdOperation *fdOp, void *data)
| Set private binding data for operation. More...
void * | elektraIoFdGetBindingData (ElektraIoFdOperation *fdOp)
| Get private binding data from operation. More...
ElektraIoInterface * | elektraIoFdGetBinding (ElektraIoFdOperation *fdOp)
| Get binding from operation. More...
int | elektraIoFdIsEnabled (ElektraIoFdOperation *fdOp)
| Check if file descriptor watch operation is enabled or disabled. More...
int | elektraIoFdGetFlags (ElektraIoFdOperation *fdOp)
| Get flag bitmask of file descriptor watch operation. More...
ElektraIoFdCallback | elektraIoFdGetCallback (ElektraIoFdOperation *fdOp)
| Get callback of file descriptor watch operation. More...
ElektraIoTimerOperation * | elektraIoNewTimerOperation (unsigned int interval, int enabled, ElektraIoTimerCallback callback, void *data)
| Create a new timer operation. More...
int | elektraIoTimerSetEnabled (ElektraIoTimerOperation *timerOp, int enabled)
| Enable or disable timer operation. More...
int | elektraIoTimerIsEnabled (ElektraIoTimerOperation *timerOp)
| Check if timer operation is enabled or disabled. More...
int | elektraIoTimerSetInterval (ElektraIoTimerOperation *timerOp, unsigned int interval)
| Update interval of timer operation. More...
unsigned int | elektraIoTimerGetInterval (ElektraIoTimerOperation *timerOp)
| Get interval of timer operation. More...
int | elektraIoTimerSetBindingData (ElektraIoTimerOperation *timerOp, void *data)
| Set private binding data for operation. More...
void * | elektraIoTimerGetBindingData (ElektraIoTimerOperation *timerOp)
| Get private binding data from operation. More...
ElektraIoInterface * | elektraIoTimerGetBinding (ElektraIoTimerOperation *timerOp)
| Get binding from operation. More...
void * | elektraIoTimerGetData (ElektraIoTimerOperation *timerOp)
| Get private data from operation. More...
ElektraIoTimerCallback | elektraIoTimerGetCallback (ElektraIoTimerOperation *timerOp)
| Get callback of timer operation. More...
ElektraIoIdleOperation * | elektraIoNewIdleOperation (int enabled, ElektraIoIdleCallback callback, void *data)
| Create a new idle operation. More...
int | elektraIoIdleSetEnabled (ElektraIoIdleOperation *idleOp, int enabled)
| Enable or disable idle operation. More...
int | elektraIoIdleIsEnabled (ElektraIoIdleOperation *idleOp)
| Check if idle operation is enabled or disabled. More...
int | elektraIoIdleSetBindingData (ElektraIoIdleOperation *idleOp, void *data)
| Set private binding data for operation. More...
void * | elektraIoIdleGetBindingData (ElektraIoIdleOperation *idleOp)
| Get private binding data from operation. More...
ElektraIoInterface * | elektraIoIdleGetBinding (ElektraIoIdleOperation *idleOp)
| Get binding from operation. More...
void * | elektraIoIdleGetData (ElektraIoIdleOperation *idleOp)
| Get private data from operation. More...
ElektraIoIdleCallback | elektraIoIdleGetCallback (ElektraIoIdleOperation *idleOp)
| Get callback of idle operation. More...
void | elektraIoSetBinding (KDB *kdb, ElektraIoInterface *ioBinding)
| Set I/O binding for asynchronous I/O operations for KDB instance. More...
ElektraIoInterface * | elektraIoGetBinding (KDB *kdb)
| Get I/O binding for asynchronous I/O operations for KDB instance. More...

## Detailed Description

Elektra-I/O structures for I/O bindings, plugins and applications.

Copyright
  BSD License (see LICENSE.md or https://www.libelektra.org)

## Typedef Documentation

## ◆ ElektraIoBindingAddFd

typedef int ElektraIoBindingAddFd(ElektraIoInterface *binding, ElektraIoFdOperation *fdOp)

Add file descriptor to be watched by I/O binding.

An operation may only be added to one binding.

Parameters

  binding | I/O binding handle
  fdOp | file desciptor opertation handle

Return values

  1 | on success
  0 | on error

## ◆ ElektraIoBindingAddIdle

typedef int ElektraIoBindingAddIdle(ElektraIoInterface *binding, ElektraIoIdleOperation *idleOp)

Add idle to I/O binding.

Idle callbacks are executed without negative effects on other IO sources or the application (e.g. next event loop iteration) An operation may only be added to one binding.

Parameters

  binding | I/O binding handle
  idleOp | idle operation handle

Return values

  1 | on success
  0 | on error

## ◆ ElektraIoBindingAddTimer

typedef int ElektraIoBindingAddTimer(ElektraIoInterface *binding, ElektraIoTimerOperation *timerOp)

Add timer to I/O binding.

Timeouts callbacks are executed after the initial interval has elapsed and then repeatedly after the interval has elapsed. An operation may only be added to one binding.

Parameters

  binding | I/O binding handle
  timerOp | timer operation handle

Return values

  1 | on success
  0 | on error

## ◆ ElektraIoBindingCleanup

typedef int ElektraIoBindingCleanup(ElektraIoInterface *binding)

Free memory used by I/O binding.

All added operations have to be removed before calling this function.

Parameters

  binding | I/O binding handle

Return values

  1 | on success
  0 | on error

## ◆ ElektraIoBindingRemoveFd

typedef int ElektraIoBindingRemoveFd(ElektraIoFdOperation *fdOp)

Remove file descriptor from I/O binding.

Parameters

  fdOp | file descriptor opertation handle

Return values

  1 | on success
  0 | on error

## ◆ ElektraIoBindingRemoveIdle

typedef int ElektraIoBindingRemoveIdle(ElektraIoIdleOperation *idleOp)

Remove idle from I/O binding.

Parameters

  idleOp | idle operation handle

Return values

  1 | on success
  0 | on error

## ◆ ElektraIoBindingRemoveTimer

typedef int ElektraIoBindingRemoveTimer(ElektraIoTimerOperation *timerOp)

Remove timer from I/O binding.

Parameters

  timerOp | timer operation handle

Return values

  1 | on success
  0 | on error

## ◆ ElektraIoBindingUpdateFd

typedef int ElektraIoBindingUpdateFd(ElektraIoFdOperation *fdOp)

Notify I/O binding about changes to file descriptor watch operation.

Parameters

  fdOp | file descriptor opertation handle

Return values

  1 | on success
  0 | on error

## ◆ ElektraIoBindingUpdateIdle

typedef int ElektraIoBindingUpdateIdle(ElektraIoIdleOperation *idleOp)

Notifiy I/O binding about changes to idle structure.

Parameters

  idleOp | idle operation handle

Return values

  1 | on success
  0 | on error

## ◆ ElektraIoBindingUpdateTimer

typedef int ElektraIoBindingUpdateTimer(ElektraIoTimerOperation *timerOp)

Notifiy I/O binding about changes to timer structure.

Parameters

  timerOp | timer operation handle

Return values

  1 | on success
  0 | on error

## ◆ ElektraIoFdCallback

typedef void(* ElektraIoFdCallback) (ElektraIoFdOperation *fdOp, int flags)

Callback for file descriptor watch operations.

Called whenever a file descriptor status changes.

Parameters

  fdOp | operation handle
  flags | current file descriptor flag bitmask

## ◆ ElektraIoIdleCallback

typedef void(* ElektraIoIdleCallback) (ElektraIoIdleOperation *idleOp)

Callback for idle operations.

Called whenever compute intensive tasks can be execute without interfering with other operations.

Parameters

  idleOp | operation handle

## ◆ ElektraIoTimerCallback

typedef void(* ElektraIoTimerCallback) (ElektraIoTimerOperation *timerOp)

Callback for timer operations.

Called after the timer interval has elapsed.

Parameters

  timerOp | operation handle

## Enumeration Type Documentation

## ◆ ElektraIoFdFlags

enum ElektraIoFdFlags

Available flags for file descriptors operation bitmask.

Enumerator
ELEKTRA_IO_READABLE | file descriptor is readable
ELEKTRA_IO_WRITABLE | file descriptor is writable

## Function Documentation

## ◆ elektraIoBindingAddFd()

int elektraIoBindingAddFd | ( | ElektraIoInterface * | binding,
|  | ElektraIoFdOperation * | fdOp
| ) |  |

Add file descriptor to be watched by I/O binding.

An operation may only be added to one binding.

Parameters

  binding | I/O binding handle
  fdOp | file desciptor opertation handle

Return values

  1 | on success
  0 | on error

## ◆ elektraIoBindingAddIdle()

int elektraIoBindingAddIdle | ( | ElektraIoInterface * | binding,
|  | ElektraIoIdleOperation * | idleOp
| ) |  |

Add idle to I/O binding.

Idle callbacks are executed without negative effects on other IO sources or the application (e.g. next event loop iteration) An operation may only be added to one binding.

Parameters

  binding | I/O binding handle
  idleOp | idle operation handle

Return values

  1 | on success
  0 | on error

## ◆ elektraIoBindingAddTimer()

int elektraIoBindingAddTimer | ( | ElektraIoInterface * | binding,
|  | ElektraIoTimerOperation * | timerOp
| ) |  |

Add timer to I/O binding.

Timeouts callbacks are executed after the initial interval has elapsed and then repeatedly after the interval has elapsed. An operation may only be added to one binding.

Parameters

  binding | I/O binding handle
  timerOp | timer operation handle

Return values

  1 | on success
  0 | on error

## ◆ elektraIoBindingCleanup()

int elektraIoBindingCleanup | ( | ElektraIoInterface * | binding | ) |

Free memory used by I/O binding.

All added operations have to be removed before calling this function.

Parameters

  binding | I/O binding handle

Return values

  1 | on success
  0 | on error

## ◆ elektraIoBindingGetData()

void* elektraIoBindingGetData | ( | ElektraIoInterface * | binding | ) |

Get private data from I/O Binding.

To be used by I/O binding implementations only.

Parameters

  binding | I/O-Binding handle

Returns
  pointer to data or NULL on error

## ◆ elektraIoBindingRemoveFd()

int elektraIoBindingRemoveFd | ( | ElektraIoFdOperation * | fdOp | ) |

Remove file descriptor from I/O binding.

Parameters

  fdOp | file descriptor opertation handle

Return values

  1 | on success
  0 | on error

## ◆ elektraIoBindingRemoveIdle()

int elektraIoBindingRemoveIdle | ( | ElektraIoIdleOperation * | idleOp | ) |

Remove idle from I/O binding.

Parameters

  idleOp | idle operation handle

Return values

  1 | on success
  0 | on error

## ◆ elektraIoBindingRemoveTimer()

int elektraIoBindingRemoveTimer | ( | ElektraIoTimerOperation * | timerOp | ) |

Remove timer from I/O binding.

Parameters

  timerOp | timer operation handle

Return values

  1 | on success
  0 | on error

## ◆ elektraIoBindingSetData()

int elektraIoBindingSetData | ( | ElektraIoInterface * | binding,
|  | void * | data
| ) |  |

Set private data from I/O Binding.

To be used by I/O binding implementations only.

Parameters

  binding | I/O binding handle
  data | private data

Return values

  1 | on success
  0 | on error

## ◆ elektraIoBindingUpdateFd()

int elektraIoBindingUpdateFd | ( | ElektraIoFdOperation * | fdOp | ) |

Notify I/O binding about changes to file descriptor watch operation.

Parameters

  fdOp | file descriptor opertation handle

Return values

  1 | on success
  0 | on error

## ◆ elektraIoBindingUpdateIdle()

int elektraIoBindingUpdateIdle | ( | ElektraIoIdleOperation * | idleOp | ) |

Notifiy I/O binding about changes to idle structure.

Parameters

  idleOp | idle operation handle

Return values

  1 | on success
  0 | on error

## ◆ elektraIoBindingUpdateTimer()

int elektraIoBindingUpdateTimer | ( | ElektraIoTimerOperation * | timerOp | ) |

Notifiy I/O binding about changes to timer structure.

Parameters

  timerOp | timer operation handle

Return values

  1 | on success
  0 | on error

## ◆ elektraIoFdGetBinding()

ElektraIoInterface* elektraIoFdGetBinding | ( | ElektraIoFdOperation * | fdOp | ) |

Get binding from operation.

Parameters

  fdOp | fd operation handle

Returns
  pointer to binding or NULL on error

## ◆ elektraIoFdGetBindingData()

void* elektraIoFdGetBindingData | ( | ElektraIoFdOperation * | fdOp | ) |

Get private binding data from operation.

Parameters

  fdOp | file descriptor operation handle

Returns
  pointer to data or NULL on error

## ◆ elektraIoFdGetCallback()

ElektraIoFdCallback elektraIoFdGetCallback | ( | ElektraIoFdOperation * | fdOp | ) |

Get callback of file descriptor watch operation.

Parameters

  fdOp | file descriptor operation handle

Returns
  callback

## ◆ elektraIoFdGetData()

void* elektraIoFdGetData | ( | ElektraIoFdOperation * | fdOp | ) |

Get private data from operation.

Parameters

  fdOp | file descriptor operation handle

Returns
  pointer to data or NULL on error

## ◆ elektraIoFdGetFd()

int elektraIoFdGetFd | ( | ElektraIoFdOperation * | fdOp | ) |

Get file descriptor number from operation.

Parameters

  fdOp | file descriptor operation handle

Returns
  file descriptor number or 0 on error

## ◆ elektraIoFdGetFlags()

int elektraIoFdGetFlags | ( | ElektraIoFdOperation * | fdOp | ) |

Get flag bitmask of file descriptor watch operation.

Parameters

  fdOp | file descriptor operation handle

Returns
  watch flag bitmask (see ElektraIoFdFlags).

## ◆ elektraIoFdIsEnabled()

int elektraIoFdIsEnabled | ( | ElektraIoFdOperation * | fdOp | ) |

Check if file descriptor watch operation is enabled or disabled.

Parameters

  fdOp | file descriptor operation handle

Return values

  0 | if disabled
  1 | if enabled

## ◆ elektraIoFdSetBindingData()

int elektraIoFdSetBindingData | ( | ElektraIoFdOperation * | fdOp,
|  | void * | data
| ) |  |

Set private binding data for operation.

Parameters

  fdOp | file descriptor operation handle
  data | pointer to data

Return values

  1 | on success
  0 | on error

## ◆ elektraIoFdSetEnabled()

int elektraIoFdSetEnabled | ( | ElektraIoFdOperation * | fdOp,
|  | int | enabled
| ) |  |

Enable or disable file descriptor watch operation.

Parameters

  fdOp | file descriptor operation handle
  enabled | 0 to disabled, any other value for enabled

Return values

  1 | on success
  0 | on error

## ◆ elektraIoFdSetFlags()

int elektraIoFdSetFlags | ( | ElektraIoFdOperation * | fdOp,
|  | int | flags
| ) |  |

Update flag bitmask of file descriptor watch operation.

Parameters

  fdOp | file descriptor operation handle
  flags | watch flag bitmask (see ElektraIoFdFlags).

Return values

  1 | on success
  0 | on error

## ◆ elektraIoGetBinding()

ElektraIoInterface* elektraIoGetBinding | ( | KDB * | kdb | ) |

Get I/O binding for asynchronous I/O operations for KDB instance.

Returns NULL if no I/O binding was set.

Parameters

  kdb | KDB instance

Returns
  I/O binding or NULL

## ◆ elektraIoIdleGetBinding()

ElektraIoInterface* elektraIoIdleGetBinding | ( | ElektraIoIdleOperation * | idleOp | ) |

Get binding from operation.

Parameters

  idleOp | idle operation handle

Returns
  pointer to binding or NULL on error

## ◆ elektraIoIdleGetBindingData()

void* elektraIoIdleGetBindingData | ( | ElektraIoIdleOperation * | idleOp | ) |

Get private binding data from operation.

Parameters

  idleOp | idle operation handle

Returns
  pointer to data or NULL on error

## ◆ elektraIoIdleGetCallback()

ElektraIoIdleCallback elektraIoIdleGetCallback | ( | ElektraIoIdleOperation * | idleOp | ) |

Get callback of idle operation.

Parameters

  idleOp | idle operation handle

Returns
  callback

## ◆ elektraIoIdleGetData()

void* elektraIoIdleGetData | ( | ElektraIoIdleOperation * | idleOp | ) |

Get private data from operation.

Parameters

  idleOp | idle operation handle

Returns
  pointer to data or NULL on error

## ◆ elektraIoIdleIsEnabled()

int elektraIoIdleIsEnabled | ( | ElektraIoIdleOperation * | idleOp | ) |

Check if idle operation is enabled or disabled.

Parameters

  idleOp | idle operation handle

Return values

  0 | if disabled
  1 | if enabled

## ◆ elektraIoIdleSetBindingData()

int elektraIoIdleSetBindingData | ( | ElektraIoIdleOperation * | idleOp,
|  | void * | data
| ) |  |

Set private binding data for operation.

Parameters

  idleOp | idle operation handle
  data | pointer to data

Return values

  1 | on success
  0 | on error

## ◆ elektraIoIdleSetEnabled()

int elektraIoIdleSetEnabled | ( | ElektraIoIdleOperation * | idleOp,
|  | int | enabled
| ) |  |

Enable or disable idle operation.

Parameters

  idleOp | idle operation handle
  enabled | 0 to disabled, any other value for enabled

Return values

  1 | on success
  0 | on error

## ◆ elektraIoNewBinding()

ElektraIoInterface* elektraIoNewBinding | ( | ElektraIoBindingAddFd * | addFd,
|  | ElektraIoBindingUpdateFd * | updateFd,
|  | ElektraIoBindingRemoveFd * | removeFd,
|  | ElektraIoBindingAddTimer * | addTimer,
|  | ElektraIoBindingUpdateTimer * | updateTimer,
|  | ElektraIoBindingRemoveTimer * | removeTimer,
|  | ElektraIoBindingAddIdle * | addIdle,
|  | ElektraIoBindingUpdateIdle * | updateIdle,
|  | ElektraIoBindingRemoveIdle * | removeIdle,
|  | ElektraIoBindingCleanup * | cleanup
| ) |  |

Create a new I/O binding.

Make sure to free returned data in ElektraIoBindingCleanup.

Parameters

  addFd | function for adding a file descriptor watch operation
  updateFd | function for updating a file descriptor operation
  removeFd | function for removing a file descriptor operation
  addTimer | function for adding a timer operation
  updateTimer | function for updateing a timer operation
  removeTimer | function for removing a timer operation
  addIdle | function for adding an idle operation
  updateIdle | function for updating an idle operation
  removeIdle | function for removing an idle operation
  cleanup | function for cleaning up binding data

Returns
  newly created binding

## ◆ elektraIoNewFdOperation()

ElektraIoFdOperation* elektraIoNewFdOperation | ( | int | fd,
|  | int | flags,
|  | int | enabled,
|  | ElektraIoFdCallback | callback,
|  | void * | data
| ) |  |

Create a new file descriptor watch operation.

Free returned data after use.

Parameters

  fd | file descriptor number
  flags | watch flag bitmask (see ElektraIoFdFlags). Select on which file descriptor state changes the callback should be invoked
  enabled | 0 to disabled, any other value for enabled
  callback | Called when file descriptor state has changes
  data | Custom private data

Returns
  file descriptor operation handle

## ◆ elektraIoNewIdleOperation()

ElektraIoIdleOperation* elektraIoNewIdleOperation | ( | int | enabled,
|  | ElektraIoIdleCallback | callback,
|  | void * | data
| ) |  |

Create a new idle operation.

Free returned data after use.

Parameters

  enabled | 0 to disable, any other value for enabled
  callback | Called when file descriptor state has changes
  data | Custom private data

Returns
  idle operation handle

## ◆ elektraIoNewTimerOperation()

ElektraIoTimerOperation* elektraIoNewTimerOperation | ( | unsigned int | interval,
|  | int | enabled,
|  | ElektraIoTimerCallback | callback,
|  | void * | data
| ) |  |

Create a new timer operation.

Free returned data after use.

Parameters

  interval | timer interval in miliseconds
  enabled | 0 to disable, any other value for enabled
  callback | Called when file descriptor state has changes
  data | Custom private data

Returns
  timer operation handle

## ◆ elektraIoTimerGetBinding()

ElektraIoInterface* elektraIoTimerGetBinding | ( | ElektraIoTimerOperation * | timerOp | ) |

Get binding from operation.

Parameters

  timerOp | timer operation handle

Returns
  pointer to binding or NULL on error

## ◆ elektraIoTimerGetBindingData()

void* elektraIoTimerGetBindingData | ( | ElektraIoTimerOperation * | timerOp | ) |

Get private binding data from operation.

Parameters

  timerOp | timer operation handle

Returns
  pointer to data or NULL on error

## ◆ elektraIoTimerGetCallback()

ElektraIoTimerCallback elektraIoTimerGetCallback | ( | ElektraIoTimerOperation * | timerOp | ) |

Get callback of timer operation.

Parameters

  timerOp | timer operation handle

Returns
  callback

## ◆ elektraIoTimerGetData()

void* elektraIoTimerGetData | ( | ElektraIoTimerOperation * | timerOp | ) |

Get private data from operation.

Parameters

  timerOp | timer operation handle

Returns
  pointer to data or NULL on error

## ◆ elektraIoTimerGetInterval()

unsigned int elektraIoTimerGetInterval | ( | ElektraIoTimerOperation * | timerOp | ) |

Get interval of timer operation.

Parameters

  timerOp | timer operation handle

Returns
  timer interval in miliseconds, 0 on error

## ◆ elektraIoTimerIsEnabled()

int elektraIoTimerIsEnabled | ( | ElektraIoTimerOperation * | timerOp | ) |

Check if timer operation is enabled or disabled.

Parameters

  timerOp | timer operation handle

Return values

  0 | if disabled
  1 | if enabled

## ◆ elektraIoTimerSetBindingData()

int elektraIoTimerSetBindingData | ( | ElektraIoTimerOperation * | timerOp,
|  | void * | data
| ) |  |

Set private binding data for operation.

Parameters

  timerOp | timer operation handle
  data | pointer to data

Return values

  1 | on success
  0 | on error

## ◆ elektraIoTimerSetEnabled()

int elektraIoTimerSetEnabled | ( | ElektraIoTimerOperation * | timerOp,
|  | int | enabled
| ) |  |

Enable or disable timer operation.

Parameters

  timerOp | timer operation handle
  enabled | 0 to disabled, any other value for enabled

Return values

  1 | on success
  0 | on error

## ◆ elektraIoTimerSetInterval()

int elektraIoTimerSetInterval | ( | ElektraIoTimerOperation * | timerOp,
|  | unsigned int | interval
| ) |  |

Update interval of timer operation.

Parameters

  timerOp | timer operation handle
  interval | timer interval in miliseconds

Return values

  1 | on success
  0 | on error