$darkmode
Elektra 0.11.0
Typedefs | Enumerations | Functions
zeromq.h File Reference

I/O Adapter for D-Bus. More...

#include <stdlib.h>
#include <string.h>
#include <zmq.h>
#include <kdbio.h>
Include dependency graph for zeromq.h:
This graph shows which files directly or indirectly include this file:

Typedefs

typedef void(* ElektraIoAdapterZeroMqCallback) (void *socket, void *context)
 Callback for ZeroMq adapter callbacks. More...
 
typedef struct _ElektraIoAdapterZeroMqHandle ElektraIoAdapterZeroMqHandle
 D-Bus Adapter Handle. More...
 

Enumerations

enum  ElektraIoAdapterZeroMqCallbackType { ELEKTRA_IO_ADAPTER_ZEROMQCB_READ = 1 << 0 , ELEKTRA_IO_ADAPTER_ZEROMQCB_WRITE = 1 << 1 }
 callback types
More...
 

Functions

ElektraIoAdapterZeroMqHandleelektraIoAdapterZeroMqAttach (void *socket, ElektraIoInterface *ioBinding, ElektraIoAdapterZeroMqCallbackType type, ElektraIoAdapterZeroMqCallback callback, void *context)
 Attach to ZeroMq socket. More...
 
void elektraIoAdapterZeroMqSetContext (ElektraIoAdapterZeroMqHandle *handle, void *context)
 Set the callback context for a ZeroMq adapter handle. More...
 
int elektraIoAdapterZeroMqDetach (ElektraIoAdapterZeroMqHandle *handle)
 Remove ZeroMq socket from I/O binding. More...
 

Detailed Description

I/O Adapter for D-Bus.

Typedef Documentation

◆ ElektraIoAdapterZeroMqCallback

typedef void(* ElektraIoAdapterZeroMqCallback) (void *socket, void *context)

Callback for ZeroMq adapter callbacks.

Parameters
socketzeromq socket
contextcallback context supplied to elektraIoZeroMqAdapterAttach()

◆ ElektraIoAdapterZeroMqHandle

typedef struct _ElektraIoAdapterZeroMqHandle ElektraIoAdapterZeroMqHandle

D-Bus Adapter Handle.

Returned by elektraIoAdapterDbusAttach().

Enumeration Type Documentation

◆ ElektraIoAdapterZeroMqCallbackType

callback types

Enumerator
ELEKTRA_IO_ADAPTER_ZEROMQCB_READ 

callback is called when socket is readable

ELEKTRA_IO_ADAPTER_ZEROMQCB_WRITE 

callback is called when socket is writable

Function Documentation

◆ elektraIoAdapterZeroMqAttach()

ElektraIoAdapterZeroMqHandle* elektraIoAdapterZeroMqAttach ( void *  socket,
ElektraIoInterface ioBinding,
ElektraIoAdapterZeroMqCallbackType  type,
ElektraIoAdapterZeroMqCallback  callback,
void *  context 
)

Attach to ZeroMq socket.

The callback is called whenever socket is readable or writable (depending on type) and data can be processed. The callback should not do blocking calls (e.g. use ZMQ_DONTWAIT for zmq_*recv()). Since ZeroMq guarantees that multipart messages arrive at once, data will be available. New adapter instances are enabled.

Parameters
socketZeroMq socket
ioBindingI/O binding
typecallback type (
See also
ElektraIoAdapterZeroMqCallbackType)
Parameters
callbackcallback
contextcallback context (gets passed to callback)
Returns
handle to use with elektraIoZeroMqAdapterDetach() or NULL on error

◆ elektraIoAdapterZeroMqDetach()

int elektraIoAdapterZeroMqDetach ( ElektraIoAdapterZeroMqHandle handle)

Remove ZeroMq socket from I/O binding.

This function frees the passed handle.

Parameters
handleadapter handle
Return values
1on success
0on error

◆ elektraIoAdapterZeroMqSetContext()

void elektraIoAdapterZeroMqSetContext ( ElektraIoAdapterZeroMqHandle handle,
void *  context 
)

Set the callback context for a ZeroMq adapter handle.

The previous context is replaced and not freed.

Parameters
handleadapter handle
contextnew callback context