Heavy work on IPC.
We will now have a broker (aqhome-data) which stores data and distributes value change messages among connected clients. aqhomed will connect to that broker and send its values there. aqhome-mqtt will also connect to the broker and send its values there. Other clients can later connect to check for changes and react according to rules.
This commit is contained in:
@@ -55,6 +55,10 @@ void _freeData(void *bp, void *p)
|
||||
AQH_ENDPOINT_IPC *xep;
|
||||
|
||||
xep=(AQH_ENDPOINT_IPC*) p;
|
||||
|
||||
free(xep->serviceName);
|
||||
free(xep->userName);
|
||||
|
||||
GWEN_FREE_OBJECT(xep);
|
||||
}
|
||||
|
||||
@@ -115,6 +119,94 @@ void AQH_IpcEndpoint_SubAcceptedMsgGroups(GWEN_MSG_ENDPOINT *ep, uint32_t i)
|
||||
|
||||
|
||||
|
||||
const char *AQH_IpcEndpoint_GetServiceName(const GWEN_MSG_ENDPOINT *ep)
|
||||
{
|
||||
if (ep) {
|
||||
AQH_ENDPOINT_IPC *xep;
|
||||
|
||||
xep=GWEN_INHERIT_GETDATA(GWEN_MSG_ENDPOINT, AQH_ENDPOINT_IPC, ep);
|
||||
if (xep)
|
||||
return xep->serviceName;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void AQH_IpcEndpoint_SetServiceName(GWEN_MSG_ENDPOINT *ep, const char *s)
|
||||
{
|
||||
if (ep) {
|
||||
AQH_ENDPOINT_IPC *xep;
|
||||
|
||||
xep=GWEN_INHERIT_GETDATA(GWEN_MSG_ENDPOINT, AQH_ENDPOINT_IPC, ep);
|
||||
if (xep) {
|
||||
free(xep->serviceName);
|
||||
xep->serviceName=s?strdup(s):NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
const char *AQH_IpcEndpoint_GetUserName(const GWEN_MSG_ENDPOINT *ep)
|
||||
{
|
||||
if (ep) {
|
||||
AQH_ENDPOINT_IPC *xep;
|
||||
|
||||
xep=GWEN_INHERIT_GETDATA(GWEN_MSG_ENDPOINT, AQH_ENDPOINT_IPC, ep);
|
||||
if (xep)
|
||||
return xep->userName;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void AQH_IpcEndpoint_SetUserName(GWEN_MSG_ENDPOINT *ep, const char *s)
|
||||
{
|
||||
if (ep) {
|
||||
AQH_ENDPOINT_IPC *xep;
|
||||
|
||||
xep=GWEN_INHERIT_GETDATA(GWEN_MSG_ENDPOINT, AQH_ENDPOINT_IPC, ep);
|
||||
if (xep) {
|
||||
free(xep->userName);
|
||||
xep->userName=s?strdup(s):NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
uint32_t AQH_IpcEndpoint_GetPermissions(const GWEN_MSG_ENDPOINT *ep)
|
||||
{
|
||||
if (ep) {
|
||||
AQH_ENDPOINT_IPC *xep;
|
||||
|
||||
xep=GWEN_INHERIT_GETDATA(GWEN_MSG_ENDPOINT, AQH_ENDPOINT_IPC, ep);
|
||||
if (xep)
|
||||
return xep->permissions;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void AQH_IpcEndpoint_SetPermissions(GWEN_MSG_ENDPOINT *ep, uint32_t i)
|
||||
{
|
||||
if (ep) {
|
||||
AQH_ENDPOINT_IPC *xep;
|
||||
|
||||
xep=GWEN_INHERIT_GETDATA(GWEN_MSG_ENDPOINT, AQH_ENDPOINT_IPC, ep);
|
||||
if (xep)
|
||||
xep->permissions=i;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
GWEN_MSG_ENDPOINT *AQH_IpcEndpoint_CreateIpcTcpClient(const char *host, int port, const char *name, int groupId)
|
||||
{
|
||||
GWEN_MSG_ENDPOINT *ep;
|
||||
|
||||
Reference in New Issue
Block a user