Base connection between user mode sdp and kernel mode was achived. (Rev69)
authortzachid <tzachid@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Mon, 21 Nov 2005 10:53:19 +0000 (10:53 +0000)
committertzachid <tzachid@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Mon, 21 Nov 2005 10:53:19 +0000 (10:53 +0000)
git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@157 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

ulp/sdp/dirs [new file with mode: 0644]
ulp/sdp/kernel/SdpDriver.cpp
ulp/sdp/kernel/SdpDriver.h

diff --git a/ulp/sdp/dirs b/ulp/sdp/dirs
new file mode 100644 (file)
index 0000000..dcefa19
--- /dev/null
@@ -0,0 +1,3 @@
+dirs = \\r
+kernel          \\r
+\r
index 2c4bf6e..f391c81 100644 (file)
@@ -4,10 +4,10 @@ extern "C" {
 #include <NTDDK.h>\r
 }\r
 #include "sdpdriver.h"\r
-#include "SdpLib.h"\r
+#include "SdpShared.h"\r
 #include "SdpTrace.h"\r
 \r
-NTSTATUS CreateDevice (IN PDRIVER_OBJECT       pDriverObject);\r
+SdpDriver *g_pSdpDriver = NULL;\r
 \r
 VOID DriverUnload (\r
         IN PDRIVER_OBJECT      pDriverObject   \r
@@ -99,6 +99,7 @@ Cleanup:
             IoDeleteDevice(pDevObj);\r
         }\r
     }\r
+    g_pSdpDriver = pSdpDriver;\r
     return rc;\r
 \r
 }\r
@@ -113,6 +114,10 @@ NTSTATUS SdpDriver::Dispatch(
     PIO_STACK_LOCATION pIrpSp;\r
     pIrp->IoStatus.Status = STATUS_SUCCESS;\r
     pIrp->IoStatus.Information = 0;\r
+    PVOID pInputBuffer = NULL;\r
+    PVOID pOutputBuffer = NULL;\r
+    ULONG OutputDataSize = 0;\r
+\r
 \r
 \r
     pIrpSp = IoGetCurrentIrpStackLocation(pIrp);\r
@@ -155,10 +160,61 @@ NTSTATUS SdpDriver::Dispatch(
             // Handle the mode of the request and get it's params\r
 \r
 \r
-            // Handle the request itslef\r
+            // Handle the request itself\r
+            rc = g_pSdpDriver->DispatchDeviceIoControl(\r
+                    pIrpSp->FileObject,\r
+                    pIrp,\r
+                    pInputBuffer,\r
+                    pIrpSp->Parameters.DeviceIoControl.InputBufferLength,\r
+                    pOutputBuffer,\r
+                    pIrpSp->Parameters.DeviceIoControl.OutputBufferLength,\r
+                    pIrpSp->Parameters.DeviceIoControl.IoControlCode,\r
+                    OutputDataSize\r
+                    );\r
+\r
+            break;\r
+            \r
         }            \r
     }\r
 \r
+    if (rc != STATUS_PENDING) {\r
+        pIrp->IoStatus.Status = rc;\r
+        pIrp->IoStatus.Information = OutputDataSize;\r
+        IoCompleteRequest(pIrp, IO_NO_INCREMENT);\r
+    }\r
     return rc;\r
 }\r
 \r
+\r
+NTSTATUS SdpDriver::DispatchDeviceIoControl(\r
+        IN PFILE_OBJECT pDeviceObject,\r
+        IN PIRP pIrp,\r
+        PVOID pInputBuffer,\r
+        ULONG InputBufferLength,\r
+        PVOID pOutputBuffer,\r
+        ULONG OutputBufferLength,\r
+        ULONG IoControlCode,\r
+        ULONG &OutputDataSize\r
+        )\r
+{\r
+    NTSTATUS rc = STATUS_SUCCESS;\r
+    switch (IoControlCode) {\r
+        case IOCTL_WSP_SOCKET :\r
+        SDP_PRINT(SDP_DEBUG, SDP_DRIVER, ("DispatchDeviceIoControl IOCTL_WSP_SOCKET recieved\n" ));   \r
+\r
+\r
+        break;\r
+    default:\r
+        // This is an unrecgnized IOCTL\r
+        ASSERT(FALSE);\r
+        SDP_PRINT(SDP_ERR, SDP_DRIVER, ("DispatchDeviceIoControl unknow IOCTL code = 0x%x\n", IoControlCode ));\r
+        rc = STATUS_INVALID_PARAMETER;\r
+        goto Cleanup;\r
+\r
+        \r
+    }\r
+Cleanup:\r
+    return rc;\r
+}\r
+\r
+\r
index b0805ca..3ee01ca 100644 (file)
@@ -20,6 +20,19 @@ public:
                IN PIRP pIrp\r
                );\r
 \r
+       NTSTATUS DispatchDeviceIoControl(\r
+        IN PFILE_OBJECT pDeviceObject,\r
+        IN PIRP pIrp,\r
+        PVOID pInputBuffer,\r
+        ULONG InputBufferLength,\r
+        PVOID pOutputBuffer,\r
+        ULONG OutputBufferLength,\r
+        ULONG IoControlCode,\r
+        ULONG &OutputDataSize\r
+        );\r
+        \r
+        \r
+\r
 \r
 \r
 private:\r
@@ -27,4 +40,6 @@ private:
        PDEVICE_OBJECT m_pDevObj;\r
 };\r
 \r
+extern SdpDriver *g_pSdpDriver;\r
+\r
 #endif //H_SDP_DRIVER_H\r