- giIPCFileHandle = open("/Devices/ip/loop/udpc", OPENFLAG_READ|OPENFLAG_EXEC);
-// ioctl(giIPCFileHandle, );
+ giIPCFileHandle = open("/Devices/ip/loop/udp", OPENFLAG_READ);
+ tmp = AXWIN_PORT; ioctl(giIPCFileHandle, 4, &tmp); // TODO: Don't hard-code IOCtl number
+}
+
+void IPC_FillSelect(int *nfds, fd_set *set)
+{
+ if( giIPCFileHandle > *nfds ) *nfds = giIPCFileHandle;
+ FD_SET(giIPCFileHandle, set);
+}
+
+void IPC_HandleSelect(fd_set *set)
+{
+ if( FD_ISSET(giIPCFileHandle, set) )
+ {
+ char staticBuf[STATICBUF_SIZE];
+ int readlen, identlen;
+ char *msg;
+ readlen = read(giIPCFileHandle, sizeof(staticBuf), staticBuf);
+
+ // Assume that all connections are from localhost
+ identlen = 4 + Net_GetAddressSize( ((uint16_t*)staticBuf)[1] );
+ msg = staticBuf + identlen;
+
+ Messages_Handle(staticBuf, readlen - identlen, (void*)msg, Messages_RespondIPC);
+ }