aqhome: more work on transformation to event2/ipc2.
This commit is contained in:
53
aqhome/ipc2/ipc_client.c
Normal file
53
aqhome/ipc2/ipc_client.c
Normal file
@@ -0,0 +1,53 @@
|
||||
/****************************************************************************
|
||||
* This file is part of the project AqHome.
|
||||
* AqHome (c) by 2025 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 "./ipc_client.h"
|
||||
|
||||
#include <aqhome/ipc2/ipcmsgreader.h>
|
||||
#include <aqhome/ipc2/msgwriter.h>
|
||||
#include <aqhome/events2/fdobject.h>
|
||||
|
||||
#include <gwenhywfar/debug.h>
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* code
|
||||
* ------------------------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
AQH_OBJECT *AQH_IpcClientObject_new(AQH_EVENT_LOOP *eventLoop, int fd)
|
||||
{
|
||||
int fdCopy;
|
||||
AQH_OBJECT *fdReader;
|
||||
AQH_OBJECT *fdWriter;
|
||||
AQH_OBJECT *msgReader;
|
||||
AQH_OBJECT *msgWriter;
|
||||
AQH_OBJECT *endpoint;
|
||||
|
||||
fdCopy=dup(fd);
|
||||
|
||||
fdReader=AQH_FdObject_new(eventLoop, fd, AQH_FDOBJECT_FDMODE_READ);
|
||||
msgReader=AQH_IpcMsgReader_new(eventLoop, fdReader);
|
||||
AQH_Object_Enable(msgReader);
|
||||
|
||||
fdWriter=AQH_FdObject_new(eventLoop, fdCopy, AQH_FDOBJECT_FDMODE_WRITE);
|
||||
msgWriter=AQH_MsgWriter_new(eventLoop, fdWriter);
|
||||
|
||||
endpoint=AQH_Endpoint_new(eventLoop, msgReader, msgWriter);
|
||||
return endpoint;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user