#ifndef OPENLIPC_H
#define OPENLIPC_H
#include <stdarg.h>
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef void LIPC;
typedef enum {
LIPC_OK = 0,
LIPC_ERROR_UNKNOWN,
LIPC_ERROR_INTERNAL,
LIPC_ERROR_NO_SUCH_SOURCE,
LIPC_ERROR_OPERATION_NOT_SUPPORTED,
LIPC_ERROR_OUT_OF_MEMORY,
LIPC_ERROR_SUBSCRIPTION_FAILED,
LIPC_ERROR_NO_SUCH_PARAM,
LIPC_ERROR_NO_SUCH_PROPERTY,
LIPC_ERROR_ACCESS_NOT_ALLOWED,
LIPC_ERROR_BUFFER_TOO_SMALL,
LIPC_ERROR_INVALID_HANDLE,
LIPC_ERROR_INVALID_ARG,
LIPC_ERROR_OPERATION_NOT_ALLOWED,
LIPC_ERROR_PARAMS_SIZE_EXCEEDED,
LIPC_ERROR_TIMED_OUT,
LIPC_ERROR_SERVICE_NAME_TOO_LONG,
LIPC_ERROR_DUPLICATE_SERVICE_NAME,
LIPC_ERROR_INIT_DBUS,
LIPC_PROP_ERROR_INVALID_STATE = 0x100,
LIPC_PROP_ERROR_NOT_INITIALIZED = 0x101,
LIPC_PROP_ERROR_INTERNAL = 0x102,
} LIPCcode;
LIPC *LipcOpenNoName(void);
LIPC *LipcOpen(const char *service);
LIPC *LipcOpenEx(const char *service, LIPCcode *code);
void LipcClose(LIPC *lipc);
const char *LipcGetServiceName(LIPC *lipc);
const char *LipcGetErrorString(LIPCcode code);
typedef void LIPCha;
typedef enum {
LIPC_HASHARRAY_INT = 0,
LIPC_HASHARRAY_STRING = 1,
LIPC_HASHARRAY_BLOB = 2,
} LIPCHasharrayType;
LIPCha *LipcHasharrayNew(LIPC *lipc);
LIPCcode LipcHasharrayFree(LIPCha *ha, int destroy);
LIPCcode LipcHasharrayDestroy(LIPCha *ha);
int LipcHasharrayGetHashCount(LIPCha *ha);
LIPCcode LipcHasharrayAddHash(LIPCha *ha, size_t *index);
LIPCcode LipcHasharrayKeys(LIPCha *ha, int index, const char *keys[],
size_t *count);
LIPCcode LipcHasharrayCheckKey(LIPCha *ha, int index, const char *key,
LIPCHasharrayType *type, size_t *size);
LIPCcode LipcHasharrayGetInt(LIPCha *ha, int index, const char *key,
int *value);
LIPCcode LipcHasharrayPutInt(LIPCha *ha, int index, const char *key,
int value);
LIPCcode LipcHasharrayGetString(LIPCha *ha, int index, const char *key,
char **value);
LIPCcode LipcHasharrayPutString(LIPCha *ha, int index, const char *key,
const char *value);
LIPCcode LipcHasharrayGetBlob(LIPCha *ha, int index, const char *key,
unsigned char *data[], size_t *size);
LIPCcode LipcHasharrayPutBlob(LIPCha *ha, int index, const char *key,
const unsigned char *data, size_t size);
LIPCcode LipcHasharrayCopy(LIPCha *dest, const LIPCha *src);
LIPCcode LipcHasharrayCopyHash(LIPCha *dest, int dest_index,
const LIPCha *src, int src_index);
LIPCha *LipcHasharrayClone(const LIPCha *ha);
LIPCcode LipcHasharraySave(const LIPCha *ha, int fd);
LIPCha *LipcHasharrayRestore(LIPC *lipc, int fd);
LIPCcode LipcHasharrayToString(const LIPCha *ha, char *str, size_t *size);
int LipcGetPropAccessTimeout(LIPC *lipc);
LIPCcode LipcGetIntProperty(LIPC *lipc, const char *service,
const char *property, int *value);
LIPCcode LipcSetIntProperty(LIPC *lipc, const char *service,
const char *property, int value);
LIPCcode LipcGetStringProperty(LIPC *lipc, const char *service,
const char *property, char **value);
LIPCcode LipcSetStringProperty(LIPC *lipc, const char *service,
const char *property, const char *value);
LIPCcode LipcAccessHasharrayProperty(LIPC *lipc, const char *service,
const char *property, const LIPCha *ha,
LIPCha **ha_out);
#define LipcGetProperties(lipc, service, value) \
LipcGetStringProperty(lipc, service, "_properties", value)
void LipcFreeString(char *string);
typedef LIPCcode (*LipcPropCallback)(LIPC *lipc, const char *property,
void *value, void *data);
#define LIPC_GETTER_VTOI(value) (*(int *)(value))
#define LIPC_SETTER_VTOI(value) ((long int)(value))
#define LIPC_GETTER_VTOS(value) ((char *)(value))
#define LIPC_SETTER_VTOS(value) ((char *)(value))
LIPCcode LipcRegisterIntProperty(LIPC *lipc, const char *property,
LipcPropCallback getter,
LipcPropCallback setter,
void *data);
LIPCcode LipcRegisterStringProperty(LIPC *lipc, const char *property,
LipcPropCallback getter,
LipcPropCallback setter,
void *data);
LIPCcode LipcRegisterHasharrayProperty(LIPC *lipc, const char *property,
LipcPropCallback callback,
void *data);
LIPCcode LipcUnregisterProperty(LIPC *lipc, const char *property, void **data);
typedef void LIPCevent;
LIPCevent *LipcNewEvent(LIPC *lipc, const char *name);
void LipcEventFree(LIPCevent *event);
LIPCcode LipcSendEvent(LIPC *lipc, LIPCevent *event);
LIPCcode LipcCreateAndSendEvent(LIPC *lipc, const char *name);
LIPCcode LipcCreateAndSendEventWithParameters(LIPC *lipc, const char *name,
const char *format, ...);
LIPCcode LipcCreateAndSendEventWithVAListParameters(LIPC *lipc,
const char *name,
const char *format,
va_list ap);
const char *LipcGetEventSource(LIPCevent *event);
const char *LipcGetEventName(LIPCevent *event);
LIPCcode LipcGetIntParam(LIPCevent *event, int *value);
LIPCcode LipcAddIntParam(LIPCevent *event, int value);
LIPCcode LipcGetStringParam(LIPCevent *event, char **value);
LIPCcode LipcAddStringParam(LIPCevent *event, const char *value);
LIPCcode LipcRewindParams(LIPCevent *event);
typedef LIPCcode (*LipcEventCallback)(LIPC *lipc, const char *name,
LIPCevent *event, void *data);
LIPCcode LipcSetEventCallback(LIPC *lipc, LipcEventCallback callback);
LIPCcode LipcSubscribe(LIPC *lipc, const char *service);
LIPCcode LipcSubscribeExt(LIPC *lipc, const char *service, const char *name,
LipcEventCallback callback, void *data);
LIPCcode LipcUnsubscribeExt(LIPC *lipc, const char *service,
const char *name, void **data);
#define LAB126_LOG_DEBUG (n) ((1 << ((n) - 1)) << 8)
#define LAB126_LOG_INFO (0x0080 << 16)
#define LAB126_LOG_WARNING (0x0100 << 16)
#define LAB126_LOG_ERROR (0x0200 << 16)
#define LAB126_LOG_CRITICAL (0x0400 << 16)
#define LAB126_LOG_DEBUG_ALL 0x0000FF00
#define LAB126_LOG_ALL 0xFFFFFF00
extern int g_lab126_log_mask;
void LipcSetLlog(int mask);
#ifdef __cplusplus
}
#endif
#endif