Commit in reactos on MAIN
include/afd/shared.h+4-281.12 -> 1.13
lib/msafd/misc/event.c+130-281.4 -> 1.5
              /helpers.c+3-21.11 -> 1.12
              /sndrcv.c+21.12 -> 1.13
+139-58
4 modified files
Added WSPEnumNetworkEvents, some reformatting.
Will be modified by alex_ionescu shortly.

reactos/include/afd
shared.h 1.12 -> 1.13
diff -u -r1.12 -r1.13
--- shared.h	25 Nov 2004 22:18:13 -0000	1.12
+++ shared.h	25 Nov 2004 23:35:06 -0000	1.13
@@ -52,10 +52,10 @@
 } AFD_HANDLE, *PAFD_HANDLE;
 
 typedef struct _AFD_POLL_INFO {
-	LARGE_INTEGER Timeout;
-	ULONG HandleCount;
-	BOOLEAN Exclusive;
-	AFD_HANDLE Handles[1];
+    LARGE_INTEGER		        Timeout;
+    ULONG				HandleCount;
+    ULONG                               Exclusive;
+    AFD_HANDLE			        Handles[1];
 } AFD_POLL_INFO, *PAFD_POLL_INFO;
 
 typedef struct _AFD_ACCEPT_DATA {
@@ -325,7 +325,6 @@
     DWORD NumberOfBytesSent;
 } FILE_REPLY_SENDTO, *PFILE_REPLY_SENDTO;
 
-
 typedef struct _FILE_REQUEST_RECVFROM {
     LPWSABUF Buffers;
     DWORD BufferCount;
@@ -339,29 +338,6 @@
     DWORD NumberOfBytesRecvd;
 } FILE_REPLY_RECVFROM, *PFILE_REPLY_RECVFROM;
 
-
-typedef struct _FILE_REQUEST_SELECT {
-    LPFD_SET ReadFDSet;
-    LPFD_SET WriteFDSet;
-    LPFD_SET ExceptFDSet;
-    TIMEVAL Timeout;
-} FILE_REQUEST_SELECT, *PFILE_REQUEST_SELECT;
-
-typedef struct _FILE_REPLY_SELECT {
-    INT Status;
-    DWORD SocketCount;
-} FILE_REPLY_SELECT, *PFILE_REPLY_SELECT;
-
-
-typedef struct _FILE_REQUEST_EVENTSELECT {
-    WSAEVENT hEventObject;
-    LONG lNetworkEvents;
-} FILE_REQUEST_EVENTSELECT, *PFILE_REQUEST_EVENTSELECT;
-
-typedef struct _FILE_REPLY_EVENTSELECT {
-    INT Status;
-} FILE_REPLY_EVENTSELECT, *PFILE_REPLY_EVENTSELECT;
-
 typedef struct _FILE_REQUEST_RECV {
     LPWSABUF Buffers;
     DWORD BufferCount;

reactos/lib/msafd/misc
event.c 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- event.c	25 Nov 2004 22:18:16 -0000	1.4
+++ event.c	25 Nov 2004 23:35:06 -0000	1.5
@@ -10,6 +10,7 @@
  *	 Alex 16/07/2004 - Complete Rewrite
  */
 
+#include <roscfg.h>
 #include <msafd.h>
 
 int 
@@ -58,7 +59,7 @@
     }
 
     if (lNetworkEvents & FD_WRITE) {
-		EventSelectInfo.Events |= AFD_EVENT_SEND;
+	EventSelectInfo.Events |= AFD_EVENT_SEND;
     }
 
     if (lNetworkEvents & FD_OOB) {
@@ -66,7 +67,7 @@
     }
 
     if (lNetworkEvents & FD_ACCEPT) {
-		EventSelectInfo.Events |= AFD_EVENT_ACCEPT;
+	EventSelectInfo.Events |= AFD_EVENT_ACCEPT;
     }
 
     if (lNetworkEvents & FD_CONNECT) {
@@ -74,53 +75,154 @@
     }
 
     if (lNetworkEvents & FD_CLOSE) {
-		EventSelectInfo.Events |= AFD_EVENT_DISCONNECT | AFD_EVENT_ABORT;
+	EventSelectInfo.Events |= AFD_EVENT_DISCONNECT | AFD_EVENT_ABORT;
     }
 
     if (lNetworkEvents & FD_QOS) {
-		EventSelectInfo.Events |= AFD_EVENT_QOS;
+	EventSelectInfo.Events |= AFD_EVENT_QOS;
     }
 
     if (lNetworkEvents & FD_GROUP_QOS) {
-		EventSelectInfo.Events |= AFD_EVENT_GROUP_QOS;
+	EventSelectInfo.Events |= AFD_EVENT_GROUP_QOS;
     }
 
-	/* Send IOCTL */
-	Status = NtDeviceIoControlFile((HANDLE)Handle,
-									SockEvent,
-									NULL,
-									NULL,
-									&IOSB,
-									IOCTL_AFD_EVENT_SELECT,
-									&EventSelectInfo,
-									sizeof(EventSelectInfo),
-									NULL,
-									0);
-
-	/* Wait for return */
-	if (Status == STATUS_PENDING) {
-		WaitForSingleObject(SockEvent, 0);
-	}
+    /* Send IOCTL */
+    Status = NtDeviceIoControlFile((HANDLE)Handle,
+				   SockEvent,
+				   NULL,
+				   NULL,
+				   &IOSB,
+				   IOCTL_AFD_EVENT_SELECT,
+				   &EventSelectInfo,
+				   sizeof(EventSelectInfo),
+				   NULL,
+				   0);
+
+    AFD_DbgPrint(MID_TRACE,("AFD: %x\n", Status));
+
+    /* Wait for return */
+    if (Status == STATUS_PENDING) {
+	WaitForSingleObject(SockEvent, INFINITE);
+    }
+
+    AFD_DbgPrint(MID_TRACE,("Waited\n"));
+
+    NtClose( SockEvent );
 
-	NtClose( SockEvent );
+    AFD_DbgPrint(MID_TRACE,("Closed event\n"));
 
-	/* Set Socket Data*/
-	Socket->EventObject = hEventObject;
-	Socket->NetworkEvents = lNetworkEvents;
+    /* Set Socket Data*/
+    Socket->EventObject = hEventObject;
+    Socket->NetworkEvents = lNetworkEvents;
 
-	return 0;
+    AFD_DbgPrint(MID_TRACE,("Leaving\n"));
+
+    return 0;
 }
 
 
 INT
 WSPAPI
 WSPEnumNetworkEvents(
-  IN  SOCKET s, 
+  IN  SOCKET Handle, 
   IN  WSAEVENT hEventObject, 
   OUT LPWSANETWORKEVENTS lpNetworkEvents, 
   OUT LPINT lpErrno)
 {
-   return 0;
+    AFD_ENUM_NETWORK_EVENTS_INFO EnumReq;
+    IO_STATUS_BLOCK				IOSB;
+    PSOCKET_INFORMATION			Socket = NULL;
+    NTSTATUS					Status;
+    HANDLE                                  SockEvent;
+
+    AFD_DbgPrint(MID_TRACE,("Called (lpNetworkEvents %x)\n", lpNetworkEvents));
+
+    Status = NtCreateEvent( &SockEvent, GENERIC_READ | GENERIC_WRITE,
+			    NULL, 1, FALSE );
+
+    if( !NT_SUCCESS(Status) ) {
+	AFD_DbgPrint(MID_TRACE,("Could not make an event %x\n", Status));
+	return -1;
+    }
+
+    /* Get the Socket Structure associate to this Socket*/
+    Socket = GetSocketStructure(Handle);
+
+    EnumReq.Event = hEventObject;
+
+    /* Send IOCTL */
+    Status = NtDeviceIoControlFile((HANDLE)Handle,
+				   SockEvent,
+				   NULL,
+				   NULL,
+				   &IOSB,
+				   IOCTL_AFD_ENUM_NETWORK_EVENTS,
+				   &EnumReq,
+				   sizeof(EnumReq),
+				   NULL,
+				   0);
+
+    AFD_DbgPrint(MID_TRACE,("AFD: %x\n", Status));
+
+    /* Wait for return */
+    if (Status == STATUS_PENDING) {
+	WaitForSingleObject(SockEvent, INFINITE);
+	Status = STATUS_SUCCESS;
+    }
+
+    AFD_DbgPrint(MID_TRACE,("Waited\n"));
+
+    NtClose( SockEvent );
+
+    AFD_DbgPrint(MID_TRACE,("Closed event\n"));
+    AFD_DbgPrint(MID_TRACE,("About to touch struct at %x (%d)\n", 
+			    lpNetworkEvents, sizeof(*lpNetworkEvents)));
+
+    lpNetworkEvents->lNetworkEvents = 0;
+
+    AFD_DbgPrint(MID_TRACE,("Zeroed struct\n"));
+
+    /* Set Events to wait for */
+    if (EnumReq.PollEvents & AFD_EVENT_RECEIVE) {
+	lpNetworkEvents->lNetworkEvents |= FD_READ;
+    }
+
+    if (EnumReq.PollEvents & AFD_EVENT_SEND) {
+	lpNetworkEvents->lNetworkEvents |= FD_WRITE;
+    }
+
+    if (EnumReq.PollEvents & AFD_EVENT_OOB_RECEIVE) {
+        lpNetworkEvents->lNetworkEvents |= FD_OOB;
+    }
+
+    if (EnumReq.PollEvents & AFD_EVENT_ACCEPT) {
+	lpNetworkEvents->lNetworkEvents |= FD_ACCEPT;
+    }
+
+    if (EnumReq.PollEvents & 
+	(AFD_EVENT_CONNECT | AFD_EVENT_CONNECT_FAIL)) {
+        lpNetworkEvents->lNetworkEvents |= FD_CONNECT;
+    }
+
+    if (EnumReq.PollEvents & 
+	(AFD_EVENT_DISCONNECT | AFD_EVENT_ABORT)) {
+	lpNetworkEvents->lNetworkEvents |= FD_CLOSE;
+    }
+
+    if (EnumReq.PollEvents & AFD_EVENT_QOS) {
+	lpNetworkEvents->lNetworkEvents |= FD_QOS;
+    }
+
+    if (EnumReq.PollEvents & AFD_EVENT_GROUP_QOS) {
+	lpNetworkEvents->lNetworkEvents |= FD_GROUP_QOS;
+    }
+
+    if( NT_SUCCESS(Status) ) *lpErrno = 0;
+    else *lpErrno = WSAEINVAL;
+
+    AFD_DbgPrint(MID_TRACE,("Leaving\n"));
+
+    return 0;
 }
 
 /* EOF */

reactos/lib/msafd/misc
helpers.c 1.11 -> 1.12
diff -u -r1.11 -r1.12
--- helpers.c	15 Nov 2004 18:24:56 -0000	1.11
+++ helpers.c	25 Nov 2004 23:35:06 -0000	1.12
@@ -142,8 +142,9 @@
 
             /* Return the Helper Pointers */
             *HelperDllData = HelperData;
-            HeapFree(GlobalHeap, 0, Transports);
-            HeapFree(GlobalHeap, 0, Mapping);
+	    /* We actually cache these ... the can't be freed yet */
+            /*HeapFree(GlobalHeap, 0, Transports);*/
+            /*HeapFree(GlobalHeap, 0, Mapping);*/
             return NO_ERROR;
         }
         

reactos/lib/msafd/misc
sndrcv.c 1.12 -> 1.13
diff -u -r1.12 -r1.13
--- sndrcv.c	25 Nov 2004 22:18:16 -0000	1.12
+++ sndrcv.c	25 Nov 2004 23:35:06 -0000	1.13
@@ -9,6 +9,8 @@
  *   CSH 01/09-2000 Created
  *	 Alex 16/07/2004 - Complete Rewrite
  */
+
+#include <roscfg.h>
 #include <string.h>
 #include <msafd.h>
 
CVSspam 0.2.8