aqhome: completed adapting to msgio2 interface.
This commit is contained in:
@@ -46,10 +46,6 @@
|
||||
|
||||
<headers dist="true" install="$(pkgincludedir)/ipc" >
|
||||
endpoint2_ipc.h
|
||||
endpoint_node_ipc.h
|
||||
endpoint_node_ipc_tcpd.h
|
||||
endpoint_ipc_tcpc.h
|
||||
endpoint_ipc_tcpc_p.h
|
||||
msg_ipc.h
|
||||
msg_ipc_forward.h
|
||||
msg_ipc_value.h
|
||||
@@ -70,9 +66,6 @@
|
||||
$(local/typefiles)
|
||||
|
||||
endpoint2_ipc.c
|
||||
endpoint_node_ipc.c
|
||||
endpoint_node_ipc_tcpd.c
|
||||
endpoint_ipc_tcpc.c
|
||||
msg_ipc.c
|
||||
msg_ipc_forward.c
|
||||
msg_ipc_value.c
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
#include <aqhome/api.h>
|
||||
|
||||
#include <gwenhywfar/endpoint.h>
|
||||
#include <gwenhywfar/endpoint2.h>
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,84 +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/endpoint_ipc_tcpc_p.h"
|
||||
|
||||
#include <gwenhywfar/endpoint_tcpc.h>
|
||||
#include <gwenhywfar/endpoint_ipc.h>
|
||||
#include <gwenhywfar/debug.h>
|
||||
|
||||
|
||||
|
||||
|
||||
#define AQH_MSG_ENDPOINT_IPCC_NAME "ipc_tcpc"
|
||||
|
||||
|
||||
GWEN_INHERIT(GWEN_MSG_ENDPOINT, AQH_ENDPOINT_IPCC)
|
||||
|
||||
|
||||
static void GWENHYWFAR_CB _freeData(void *bp, void *p);
|
||||
static void _run(GWEN_MSG_ENDPOINT *ep);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
GWEN_MSG_ENDPOINT *AQH_IpcTcpClientEndpoint_new(const char *host, int port, const char *name, int groupId)
|
||||
{
|
||||
GWEN_MSG_ENDPOINT *ep;
|
||||
AQH_ENDPOINT_IPCC *xep;
|
||||
|
||||
ep=GWEN_TcpcEndpoint_new(host, port, name?name:AQH_MSG_ENDPOINT_IPCC_NAME, groupId);
|
||||
if (ep==NULL) {
|
||||
DBG_INFO(AQH_LOGDOMAIN, "here");
|
||||
return NULL;
|
||||
}
|
||||
GWEN_IpcEndpoint_Extend(ep);
|
||||
|
||||
GWEN_NEW_OBJECT(AQH_ENDPOINT_IPCC, xep);
|
||||
GWEN_INHERIT_SETDATA(GWEN_MSG_ENDPOINT, AQH_ENDPOINT_IPCC, ep, xep, _freeData);
|
||||
|
||||
xep->previousRunFn=GWEN_MsgEndpoint_SetRunFn(ep, _run);
|
||||
|
||||
return ep;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void _freeData(void *bp, void *p)
|
||||
{
|
||||
AQH_ENDPOINT_IPCC *xep;
|
||||
|
||||
xep=(AQH_ENDPOINT_IPCC*) p;
|
||||
GWEN_FREE_OBJECT(xep);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void _run(GWEN_MSG_ENDPOINT *ep)
|
||||
{
|
||||
AQH_ENDPOINT_IPCC *xep;
|
||||
|
||||
xep=GWEN_INHERIT_GETDATA(GWEN_MSG_ENDPOINT, AQH_ENDPOINT_IPCC, ep);
|
||||
if (xep) {
|
||||
if (xep->previousRunFn)
|
||||
xep->previousRunFn(ep);
|
||||
/* TODO: send CONNECT_REQ message, check for CONNECT_RSP */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,27 +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_ENDPOINT_IPCC_TCPC_H
|
||||
#define AQH_ENDPOINT_IPCC_TCPC_H
|
||||
|
||||
|
||||
#include <aqhome/api.h>
|
||||
|
||||
#include <gwenhywfar/endpoint.h>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
AQHOME_API GWEN_MSG_ENDPOINT *AQH_IpcTcpClientEndpoint_new(const char *host, int port, const char *name, int groupId);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,39 +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_ENDPOINT_IPCC_TCPC_P_H
|
||||
#define AQH_ENDPOINT_IPCC_TCPC_P_H
|
||||
|
||||
|
||||
#include <aqhome/api.h>
|
||||
|
||||
#include <gwenhywfar/endpoint.h>
|
||||
|
||||
#include "aqhome/ipc/endpoint_ipc_tcpc.h"
|
||||
|
||||
|
||||
typedef struct AQH_ENDPOINT_IPCC AQH_ENDPOINT_IPCC;
|
||||
struct AQH_ENDPOINT_IPCC {
|
||||
|
||||
GWEN_MSG_ENDPOINT_RUN_FN previousRunFn;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,97 +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/endpoint_node_ipc.h"
|
||||
#include "aqhome/msg/endpoint_node.h"
|
||||
#include "aqhome/msg/msg_node.h"
|
||||
#include "aqhome/msg/msg_value2.h"
|
||||
#include "aqhome/ipc/msg_ipc_forward.h"
|
||||
#include "aqhome/ipc/msg_ipc_value.h"
|
||||
|
||||
#include <gwenhywfar/list.h>
|
||||
#include <gwenhywfar/debug.h>
|
||||
#include <gwenhywfar/gwentime.h>
|
||||
#include <gwenhywfar/endpoint_ipc.h>
|
||||
|
||||
|
||||
#define AQH_MSG_ENDPOINT_NODEIPC_NAME "nodeipc"
|
||||
|
||||
|
||||
|
||||
static void _processOutMessage(GWEN_MSG_ENDPOINT *ep, GWEN_MSG *m);
|
||||
static void _processValue2Message(GWEN_MSG_ENDPOINT *ep, GWEN_MSG *nodeMsg);
|
||||
static void _forwardAnyMessage(GWEN_MSG_ENDPOINT *ep, GWEN_MSG *nodeMsg);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
GWEN_MSG_ENDPOINT *AQH_IpcNodeEndpoint_new(const char *name, int groupId)
|
||||
{
|
||||
GWEN_MSG_ENDPOINT *ep;
|
||||
|
||||
ep=GWEN_IpcEndpoint_new(name?name:AQH_MSG_ENDPOINT_NODEIPC_NAME, groupId);
|
||||
AQH_NodeEndpoint_Extend(ep);
|
||||
GWEN_MsgEndpoint_SetProcessOutMsgFn(ep, _processOutMessage);
|
||||
|
||||
// AQH_NodeEndpoint_SetAcceptedMsgGroups(ep, AQH_MSG_TYPEGROUP_ALL);
|
||||
|
||||
return ep;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void _processOutMessage(GWEN_MSG_ENDPOINT *ep, GWEN_MSG *nodeMsg)
|
||||
{
|
||||
switch(AQH_NodeMsg_GetMsgType(nodeMsg)) {
|
||||
case AQH_MSG_TYPE_VALUE2:
|
||||
_processValue2Message(ep, nodeMsg);
|
||||
break;
|
||||
default:
|
||||
_forwardAnyMessage(ep, nodeMsg);
|
||||
break;
|
||||
}
|
||||
|
||||
GWEN_Msg_free(nodeMsg);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void _processValue2Message(GWEN_MSG_ENDPOINT *ep, GWEN_MSG *nodeMsg)
|
||||
{
|
||||
GWEN_MSG *ipcMsg;
|
||||
|
||||
ipcMsg=AQH_ValueIpcMsg_new(AQH_MSGTYPE_IPC_VALUE,
|
||||
AQH_Value2Msg_GetUid(nodeMsg),
|
||||
AQH_Value2Msg_GetValueId(nodeMsg),
|
||||
AQH_Value2Msg_GetValueType(nodeMsg),
|
||||
AQH_Value2Msg_GetValueNom(nodeMsg),
|
||||
AQH_Value2Msg_GetValueDenom(nodeMsg));
|
||||
GWEN_MsgEndpoint_AddSendMessage(ep, ipcMsg);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void _forwardAnyMessage(GWEN_MSG_ENDPOINT *ep, GWEN_MSG *nodeMsg)
|
||||
{
|
||||
GWEN_MSG *ipcMsg;
|
||||
|
||||
ipcMsg=AQH_ForwardIpcMsg_new(AQH_MSGTYPE_IPC_FORWARD, GWEN_Msg_GetConstBuffer(nodeMsg), GWEN_Msg_GetBytesInBuffer(nodeMsg));
|
||||
GWEN_MsgEndpoint_AddSendMessage(ep, ipcMsg);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,24 +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_ENDPOINT_NODE_IPC_H
|
||||
#define AQH_ENDPOINT_NODE_IPC_H
|
||||
|
||||
|
||||
#include <aqhome/api.h>
|
||||
|
||||
#include <gwenhywfar/endpoint.h>
|
||||
|
||||
|
||||
|
||||
AQHOME_API GWEN_MSG_ENDPOINT *AQH_IpcNodeEndpoint_new(const char *name, int groupId);
|
||||
|
||||
AQHOME_API int AQH_IpcNodeEndpointMgr_LoopOnce(GWEN_MSG_ENDPOINT_MGR *emgr);
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,69 +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/endpoint_node_ipc_tcpd.h"
|
||||
#include "aqhome/ipc/endpoint_node_ipc.h"
|
||||
#include "aqhome/msg/endpoint_node.h"
|
||||
#include "aqhome/msg/msg_node.h"
|
||||
#include "aqhome/msgmanager.h"
|
||||
|
||||
#include <gwenhywfar/list.h>
|
||||
#include <gwenhywfar/debug.h>
|
||||
#include <gwenhywfar/gwentime.h>
|
||||
#include <gwenhywfar/endpoint_tcpd_ipc.h>
|
||||
|
||||
|
||||
|
||||
#define AQH_MSG_ENDPOINT_NODEIPCTCP_NAME "node_ipc_tcpd"
|
||||
|
||||
|
||||
|
||||
static GWEN_MSG_ENDPOINT *_createChild(GWEN_MSG_ENDPOINT *ep);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
GWEN_MSG_ENDPOINT *AQH_TcpdIpcNodeEndpoint_new(const char *host, int port, const char *name, int groupId)
|
||||
{
|
||||
GWEN_MSG_ENDPOINT *ep;
|
||||
|
||||
ep=GWEN_IpcTcpdEndpoint_new(host, port, name?name:AQH_MSG_ENDPOINT_NODEIPCTCP_NAME, groupId);
|
||||
AQH_NodeEndpoint_Extend(ep);
|
||||
GWEN_MsgEndpoint_AddFlags(ep, AQH_MSGEP_NODE_FLAGS_NOMESSAGES);
|
||||
GWEN_MsgEndpoint_SetCreateChildFn(ep, _createChild);
|
||||
|
||||
return ep;
|
||||
}
|
||||
|
||||
|
||||
|
||||
GWEN_MSG_ENDPOINT *_createChild(GWEN_MSG_ENDPOINT *ep)
|
||||
{
|
||||
GWEN_MSG_ENDPOINT *epNew;
|
||||
|
||||
DBG_INFO(AQH_LOGDOMAIN, "Creating child endpoint for %s", GWEN_MsgEndpoint_GetName(ep));
|
||||
epNew=AQH_IpcNodeEndpoint_new(NULL, AQH_MSGMGR_ENDPOINTGROUP_IPC);
|
||||
GWEN_MsgEndpoint_AddFlags(epNew, GWEN_MSG_ENDPOINT_FLAGS_DELONDISCONNECT);
|
||||
GWEN_MsgEndpoint_SetAcceptedGroupIds(epNew, GWEN_MsgEndpoint_GetAcceptedGroupIds(ep));
|
||||
return epNew;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,22 +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_ENDPOINT_NODE_IPC_TCPD_H
|
||||
#define AQH_ENDPOINT_NODE_IPC_TCPD_H
|
||||
|
||||
|
||||
#include <aqhome/api.h>
|
||||
|
||||
#include <gwenhywfar/endpoint.h>
|
||||
|
||||
|
||||
|
||||
AQHOME_API GWEN_MSG_ENDPOINT *AQH_TcpdIpcNodeEndpoint_new(const char *host, int port, const char *name, int groupId);
|
||||
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user