adapted to latest changes in gwen (msgio API v2 becomes v1).

This commit is contained in:
Martin Preuss
2023-07-12 19:30:53 +02:00
parent 7a4edb6854
commit 0fd58567fe
37 changed files with 956 additions and 956 deletions

View File

@@ -45,7 +45,7 @@
<headers dist="true" install="$(pkgincludedir)/ipc" >
endpoint2_ipc.h
endpoint_ipc.h
msg_ipc.h
msg_ipc_forward.h
msg_ipc_value.h
@@ -58,14 +58,14 @@
<headers dist="true" >
endpoint2_ipc_p.h
endpoint_ipc_p.h
</headers>
<sources>
$(local/typefiles)
endpoint2_ipc.c
endpoint_ipc.c
msg_ipc.c
msg_ipc_forward.c
msg_ipc_value.c

View File

@@ -1,139 +0,0 @@
/****************************************************************************
* 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.
****************************************************************************/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "aqhome/ipc/endpoint2_ipc_p.h"
#include <gwenhywfar/endpoint2_ipc.h>
#include <gwenhywfar/debug.h>
#define AQH_MSG_ENDPOINT2_IPC_NAME "ipc"
GWEN_INHERIT(GWEN_MSG_ENDPOINT, AQH_ENDPOINT2_IPC)
/* ------------------------------------------------------------------------------------------------
* forward declarations
* ------------------------------------------------------------------------------------------------
*/
static void GWENHYWFAR_CB _freeData(void *bp, void *p);
/* ------------------------------------------------------------------------------------------------
* implementations
* ------------------------------------------------------------------------------------------------
*/
void AQH_IpcEndpoint2_Extend(GWEN_MSG_ENDPOINT2 *ep)
{
AQH_ENDPOINT2_IPC *xep;
GWEN_NEW_OBJECT(AQH_ENDPOINT2_IPC, xep);
GWEN_INHERIT_SETDATA(GWEN_MSG_ENDPOINT2, AQH_ENDPOINT2_IPC, ep, xep, _freeData);
}
void _freeData(void *bp, void *p)
{
AQH_ENDPOINT2_IPC *xep;
xep=(AQH_ENDPOINT2_IPC*) p;
GWEN_FREE_OBJECT(xep);
}
uint32_t AQH_IpcEndpoint2_GetAcceptedMsgGroups(const GWEN_MSG_ENDPOINT2 *ep)
{
if (ep) {
AQH_ENDPOINT2_IPC *xep;
xep=GWEN_INHERIT_GETDATA(GWEN_MSG_ENDPOINT2, AQH_ENDPOINT2_IPC, ep);
if (xep) {
return xep->acceptedMsgGroups;
}
}
return 0;
}
void AQH_IpcEndpoint2_SetAcceptedMsgGroups(GWEN_MSG_ENDPOINT2 *ep, uint32_t i)
{
if (ep) {
AQH_ENDPOINT2_IPC *xep;
xep=GWEN_INHERIT_GETDATA(GWEN_MSG_ENDPOINT2, AQH_ENDPOINT2_IPC, ep);
if (xep)
xep->acceptedMsgGroups=i;
}
}
void AQH_IpcEndpoint2_AddAcceptedMsgGroups(GWEN_MSG_ENDPOINT2 *ep, uint32_t i)
{
if (ep) {
AQH_ENDPOINT2_IPC *xep;
xep=GWEN_INHERIT_GETDATA(GWEN_MSG_ENDPOINT2, AQH_ENDPOINT2_IPC, ep);
if (xep)
xep->acceptedMsgGroups|=i;
}
}
void AQH_IpcEndpoint2_SubAcceptedMsgGroups(GWEN_MSG_ENDPOINT2 *ep, uint32_t i)
{
if (ep) {
AQH_ENDPOINT2_IPC *xep;
xep=GWEN_INHERIT_GETDATA(GWEN_MSG_ENDPOINT2, AQH_ENDPOINT2_IPC, ep);
if (xep)
xep->acceptedMsgGroups&=~i;
}
}
GWEN_MSG_ENDPOINT2 *AQH_IpcEndpoint2_CreateIpcTcpClient(const char *host, int port, const char *name, int groupId)
{
GWEN_MSG_ENDPOINT2 *ep;
ep=GWEN_IpcEndpoint2_CreateIpcTcpClient(host, port, name?name:AQH_MSG_ENDPOINT2_IPC_NAME, groupId);
AQH_IpcEndpoint2_Extend(ep);
return ep;
}
GWEN_MSG_ENDPOINT2 *AQH_IpcEndpoint2_CreateIpcTcpServiceForSocket(GWEN_SOCKET *sk, const char *name, int groupId)
{
GWEN_MSG_ENDPOINT2 *ep;
ep=GWEN_IpcEndpoint2_CreateIpcTcpServiceForSocket(sk, name?name:AQH_MSG_ENDPOINT2_IPC_NAME, groupId);
AQH_IpcEndpoint2_Extend(ep);
return ep;
}

View File

@@ -1,31 +0,0 @@
/****************************************************************************
* 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_ENDPOINT2_IPC_H
#define AQH_ENDPOINT2_IPC_H
#include <aqhome/api.h>
#include <gwenhywfar/endpoint2.h>
AQHOME_API void AQH_IpcEndpoint2_Extend(GWEN_MSG_ENDPOINT2 *ep);
AQHOME_API GWEN_MSG_ENDPOINT2 *AQH_IpcEndpoint2_CreateIpcTcpClient(const char *host, int port, const char *name, int groupId);
AQHOME_API GWEN_MSG_ENDPOINT2 *AQH_IpcEndpoint2_CreateIpcTcpServiceForSocket(GWEN_SOCKET *sk, const char *name, int groupId);
AQHOME_API uint32_t AQH_IpcEndpoint2_GetAcceptedMsgGroups(const GWEN_MSG_ENDPOINT2 *ep);
AQHOME_API void AQH_IpcEndpoint2_SetAcceptedMsgGroups(GWEN_MSG_ENDPOINT2 *ep, uint32_t i);
AQHOME_API void AQH_IpcEndpoint2_AddAcceptedMsgGroups(GWEN_MSG_ENDPOINT2 *ep, uint32_t i);
AQHOME_API void AQH_IpcEndpoint2_SubAcceptedMsgGroups(GWEN_MSG_ENDPOINT2 *ep, uint32_t i);
#endif

139
aqhome/ipc/endpoint_ipc.c Normal file
View File

@@ -0,0 +1,139 @@
/****************************************************************************
* 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.
****************************************************************************/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "aqhome/ipc/endpoint_ipc_p.h"
#include <gwenhywfar/endpoint_ipc.h>
#include <gwenhywfar/debug.h>
#define AQH_MSG_ENDPOINT_IPC_NAME "ipc"
GWEN_INHERIT(GWEN_MSG_ENDPOINT, AQH_ENDPOINT_IPC)
/* ------------------------------------------------------------------------------------------------
* forward declarations
* ------------------------------------------------------------------------------------------------
*/
static void GWENHYWFAR_CB _freeData(void *bp, void *p);
/* ------------------------------------------------------------------------------------------------
* implementations
* ------------------------------------------------------------------------------------------------
*/
void AQH_IpcEndpoint_Extend(GWEN_MSG_ENDPOINT *ep)
{
AQH_ENDPOINT_IPC *xep;
GWEN_NEW_OBJECT(AQH_ENDPOINT_IPC, xep);
GWEN_INHERIT_SETDATA(GWEN_MSG_ENDPOINT, AQH_ENDPOINT_IPC, ep, xep, _freeData);
}
void _freeData(void *bp, void *p)
{
AQH_ENDPOINT_IPC *xep;
xep=(AQH_ENDPOINT_IPC*) p;
GWEN_FREE_OBJECT(xep);
}
uint32_t AQH_IpcEndpoint_GetAcceptedMsgGroups(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->acceptedMsgGroups;
}
}
return 0;
}
void AQH_IpcEndpoint_SetAcceptedMsgGroups(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->acceptedMsgGroups=i;
}
}
void AQH_IpcEndpoint_AddAcceptedMsgGroups(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->acceptedMsgGroups|=i;
}
}
void AQH_IpcEndpoint_SubAcceptedMsgGroups(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->acceptedMsgGroups&=~i;
}
}
GWEN_MSG_ENDPOINT *AQH_IpcEndpoint_CreateIpcTcpClient(const char *host, int port, const char *name, int groupId)
{
GWEN_MSG_ENDPOINT *ep;
ep=GWEN_IpcEndpoint_CreateIpcTcpClient(host, port, name?name:AQH_MSG_ENDPOINT_IPC_NAME, groupId);
AQH_IpcEndpoint_Extend(ep);
return ep;
}
GWEN_MSG_ENDPOINT *AQH_IpcEndpoint_CreateIpcTcpServiceForSocket(GWEN_SOCKET *sk, const char *name, int groupId)
{
GWEN_MSG_ENDPOINT *ep;
ep=GWEN_IpcEndpoint_CreateIpcTcpServiceForSocket(sk, name?name:AQH_MSG_ENDPOINT_IPC_NAME, groupId);
AQH_IpcEndpoint_Extend(ep);
return ep;
}

31
aqhome/ipc/endpoint_ipc.h Normal file
View File

@@ -0,0 +1,31 @@
/****************************************************************************
* 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>
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);
#endif

View File

@@ -6,19 +6,19 @@
* should have received along with this file.
****************************************************************************/
#ifndef AQH_ENDPOINT2_IPC_P_H
#define AQH_ENDPOINT2_IPC_P_H
#ifndef AQH_ENDPOINT_IPC_P_H
#define AQH_ENDPOINT_IPC_P_H
#include <aqhome/api.h>
#include <gwenhywfar/endpoint2.h>
#include <gwenhywfar/endpoint.h>
#include "aqhome/ipc/endpoint2_ipc.h"
#include "aqhome/ipc/endpoint_ipc.h"
typedef struct AQH_ENDPOINT2_IPC AQH_ENDPOINT2_IPC;
struct AQH_ENDPOINT2_IPC {
typedef struct AQH_ENDPOINT_IPC AQH_ENDPOINT_IPC;
struct AQH_ENDPOINT_IPC {
uint32_t acceptedMsgGroups;
};