2 * AxWin4 Interface Library
3 * - By John Hodge (thePowersGang)
8 #include <axwin4/axwin.h>
9 #include "include/common.hpp"
10 #include "include/IIPCChannel.hpp"
11 #include "include/CIPCChannel_AcessIPCPipe.hpp"
19 IIPCChannel* gIPCChannel;
21 extern "C" bool AxWin4_Connect(const char *URI)
27 if( strncmp(URI, "ipcpipe://", 3+4+3) == 0 )
29 gIPCChannel = new CIPCChannel_AcessIPCPipe(URI);
36 catch( const ::std::exception& e )
38 fprintf(stderr, "AxWin4_Connect: %s\n", e.what());
44 extern "C" bool AxWin4_PeekEventQueue(void)
49 extern "C" bool AxWin4_WaitEventQueue(uint64_t Timeout)
51 AxWin4_WaitEventQueueSelect(0, NULL, NULL, NULL, Timeout);
54 extern "C" bool AxWin4_WaitEventQueueSelect(int nFDs, fd_set *rfds, fd_set *wfds, fd_set *efds, uint64_t Timeout)
60 int64_t select_timeout = Timeout;
61 int64_t *select_timeout_p = (Timeout ? &select_timeout : 0);
63 nFDs = ::std::max(nFDs, gIPCChannel->FillSelect(*rfds));
64 _SysSelect(nFDs, rfds, wfds, efds, select_timeout_p, 0);
65 return gIPCChannel->HandleSelect(*rfds);
68 void SendMessage(CSerialiser& message)
70 gIPCChannel->Send(message);
73 IIPCChannel::~IIPCChannel()