64 lines
1.5 KiB
C
64 lines
1.5 KiB
C
/****************************************************************************
|
|
* 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_tcp.h"
|
|
#include "aqhome/ipc/endpoint_node_ipc.h"
|
|
#include "aqhome/msg/endpoint_node.h"
|
|
#include "aqhome/msg/msg_node.h"
|
|
#include "aqhome/ipc/msg_forward.h"
|
|
|
|
#include <gwenhywfar/list.h>
|
|
#include <gwenhywfar/debug.h>
|
|
#include <gwenhywfar/gwentime.h>
|
|
#include <gwenhywfar/endpoint_ipc_tcp.h>
|
|
|
|
|
|
#define AQH_MSG_ENDPOINT_NODEIPCTCP_NAME "nodeipctcp"
|
|
|
|
|
|
|
|
static GWEN_MSG_ENDPOINT *_createChild(GWEN_MSG_ENDPOINT *ep);
|
|
|
|
|
|
|
|
|
|
|
|
GWEN_MSG_ENDPOINT *AQH_TcpIpcNodeEndpoint_new(const char *name, const char *host, int port, int groupId)
|
|
{
|
|
int fd;
|
|
GWEN_MSG_ENDPOINT *ep;
|
|
|
|
ep=GWEN_TcpIpcEndpoint_new(name?name:AQH_MSG_ENDPOINT_NODEIPCTCP_NAME, host, port, groupId);
|
|
GWEN_MsgEndpoint_AddFlags(ep, AQH_MSGEP_NODE_FLAGS_NOMESSAGES);
|
|
GWEN_MsgEndpoint_SetCreateChildFn(ep, _createChild);
|
|
|
|
return ep;
|
|
}
|
|
|
|
|
|
|
|
GWEN_MSG_ENDPOINT *_createChild(GWEN_MSG_ENDPOINT *ep)
|
|
{
|
|
DBG_INFO(AQH_LOGDOMAIN, "Creating child endpoint for %s", GWEN_MsgEndpoint_GetName(ep));
|
|
return AQH_IpcNodeEndpoint_new(NULL, GWEN_MsgEndpoint_GetGroupId(ep));
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|