/****************************************************************************
 * This file is part of the project AqHome.
 * AqHome (c) by 2023 Martin Preuss, all rights reserved.
 *
 * The license for this file can be found in the file COPYING which you
 * should have received along with this file.
 ****************************************************************************/

#ifndef AQH_ENDPOINT_IPC_H
#define AQH_ENDPOINT_IPC_H


#include <aqhome/api.h>

#include <gwenhywfar/endpoint.h>


#define AQH_IPCENDPOINT_FLAGS_WANTUPDATES 0x0001

#define AQH_IPCENDPOINT_PERMS_LISTVALUES  0x0001
#define AQH_IPCENDPOINT_PERMS_READVALUE   0x0002
#define AQH_IPCENDPOINT_PERMS_ADDVALUE    0x0004

#define AQH_IPCENDPOINT_PERMS_LISTDATA    0x0010
#define AQH_IPCENDPOINT_PERMS_READDATA    0x0020
#define AQH_IPCENDPOINT_PERMS_ADDDATA     0x0040
#define AQH_IPCENDPOINT_PERMS_SETDATA     0x0080

#define AQH_IPCENDPOINT_PERMS_LISTDEVICES 0x0100
#define AQH_IPCENDPOINT_PERMS_READDEVICE  0x0200
#define AQH_IPCENDPOINT_PERMS_ADDDEVICE   0x0400
#define AQH_IPCENDPOINT_PERMS_MODDEVICE   0x0800



AQHOME_API void AQH_IpcEndpoint_Extend(GWEN_MSG_ENDPOINT *ep);

AQHOME_API GWEN_MSG_ENDPOINT *AQH_IpcEndpoint_CreateIpcTcpClient(const char *host, int port, const char *name, int groupId);
AQHOME_API GWEN_MSG_ENDPOINT *AQH_IpcEndpoint_CreateIpcTcpServiceForSocket(GWEN_SOCKET *sk, const char *name, int groupId);

AQHOME_API uint32_t AQH_IpcEndpoint_GetAcceptedMsgGroups(const GWEN_MSG_ENDPOINT *ep);
AQHOME_API void AQH_IpcEndpoint_SetAcceptedMsgGroups(GWEN_MSG_ENDPOINT *ep, uint32_t i);
AQHOME_API void AQH_IpcEndpoint_AddAcceptedMsgGroups(GWEN_MSG_ENDPOINT *ep, uint32_t i);
AQHOME_API void AQH_IpcEndpoint_SubAcceptedMsgGroups(GWEN_MSG_ENDPOINT *ep, uint32_t i);

AQHOME_API const char *AQH_IpcEndpoint_GetServiceName(const GWEN_MSG_ENDPOINT *ep);
AQHOME_API void AQH_IpcEndpoint_SetServiceName(GWEN_MSG_ENDPOINT *ep, const char *s);

AQHOME_API const char *AQH_IpcEndpoint_GetUserName(const GWEN_MSG_ENDPOINT *ep);
AQHOME_API void AQH_IpcEndpoint_SetUserName(GWEN_MSG_ENDPOINT *ep, const char *s);

AQHOME_API const char *AQH_IpcEndpoint_GetPassword(const GWEN_MSG_ENDPOINT *ep);
AQHOME_API void AQH_IpcEndpoint_SetPassword(GWEN_MSG_ENDPOINT *ep, const char *s);

AQHOME_API uint32_t AQH_IpcEndpoint_GetPermissions(const GWEN_MSG_ENDPOINT *ep);
AQHOME_API void AQH_IpcEndpoint_SetPermissions(GWEN_MSG_ENDPOINT *ep, uint32_t i);


#endif

