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)
23 _SysDebug("AxWin4_Connect('%s')", URI);
28 if( strncmp(URI, "ipcpipe://", 3+4+3) == 0 )
30 gIPCChannel = new CIPCChannel_AcessIPCPipe(URI+3+4+3);
34 _SysDebug("Unknown protocol");
38 catch( const ::std::exception& e )
40 fprintf(stderr, "AxWin4_Connect: %s\n", e.what());
46 extern "C" bool AxWin4_PeekEventQueue(void)
51 extern "C" bool AxWin4_WaitEventQueue(uint64_t Timeout)
53 AxWin4_WaitEventQueueSelect(0, NULL, NULL, NULL, Timeout);
56 extern "C" bool AxWin4_WaitEventQueueSelect(int nFDs, fd_set *rfds, fd_set *wfds, fd_set *efds, uint64_t Timeout)
64 int64_t select_timeout = Timeout;
65 int64_t *select_timeout_p = (Timeout ? &select_timeout : 0);
67 nFDs = ::std::max(nFDs, gIPCChannel->FillSelect(*rfds));
68 _SysSelect(nFDs, rfds, wfds, efds, select_timeout_p, 0);
69 return gIPCChannel->HandleSelect(*rfds);
72 void SendMessage(CSerialiser& message)
74 gIPCChannel->Send(message);
77 IIPCChannel::~IIPCChannel()