Send parameters are now passed to the driver. (Rev 76)
authortzachid <tzachid@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Mon, 21 Nov 2005 12:08:06 +0000 (12:08 +0000)
committertzachid <tzachid@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Mon, 21 Nov 2005 12:08:06 +0000 (12:08 +0000)
git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@163 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

ulp/sdp/include/SdpShared.h
ulp/sdp/kernel/SdpDriver.cpp
ulp/sdp/kernel/SdpSocket.cpp
ulp/sdp/kernel/SdpSocket.h
ulp/sdp/kernel/SdpTrace.h

index 577c4f2..a6e6532 100644 (file)
 \r
 // Define the IOCTL codes that will be used for sending the requests down\r
 \r
-#define IOCTL_WSP_SOCKET       CTL_CODE(FILE_DEVICE_UNKNOWN, 0x801, METHOD_BUFFERED ,FILE_ANY_ACCESS)\r
-#define IOCTL_WSP_CONNECT      CTL_CODE(FILE_DEVICE_UNKNOWN, 0x802, METHOD_BUFFERED ,FILE_ANY_ACCESS)\r
+#define IOCTL_WSP_SOCKET    CTL_CODE(FILE_DEVICE_UNKNOWN, 0x801, METHOD_BUFFERED ,FILE_ANY_ACCESS)\r
+#define IOCTL_WSP_CONNECT   CTL_CODE(FILE_DEVICE_UNKNOWN, 0x802, METHOD_BUFFERED ,FILE_ANY_ACCESS)\r
+#define IOCTL_WSP_SEND      CTL_CODE(FILE_DEVICE_UNKNOWN, 0x803, METHOD_BUFFERED ,FILE_ANY_ACCESS)\r
+\r
 \r
 // Data structures that are used for connect\r
 struct WspSocketIn {\r
-       ULONG dwFlags;\r
+    ULONG dwFlags;\r
 };\r
 \r
 struct WspSocketOut {\r
-       int Errno;\r
-       VOID *pSocket;\r
+    int Errno;\r
+    VOID *pSocket;\r
 };\r
 \r
 struct WspConnectIn {\r
     VOID *pSocket;\r
-       ULONG IP;\r
-       USHORT Port;\r
+    ULONG IP;\r
+    USHORT Port;\r
 };\r
 \r
 struct WspConnectOut {\r
-       int Errno;\r
+    int Errno;\r
+};\r
+\r
+struct WspSendIn {\r
+    VOID *pSocket;\r
+    CHAR *pData;\r
+    ULONG BufferSize;\r
+    ULONG dwFlags;\r
+};\r
+\r
+struct WspSendOut {\r
+    ULONG NumberOfBytesSent;\r
+    int Errno;\r
 };\r
 \r
+\r
 #endif //_SDP_SHARED_H\r
index 7166fe3..d78e8df 100644 (file)
@@ -389,10 +389,33 @@ NTSTATUS SdpDriver::DispatchDeviceIoControl(
                 SDP_PRINT(SDP_ERR, SDP_DRIVER, ("pSdpSocket->WSPConnect failed rc = 0x%x\n", rc ));        \r
                 goto Cleanup;\r
             }\r
-            \r
+        break;\r
 \r
+        case IOCTL_WSP_SEND :\r
+        {\r
+            SDP_PRINT(SDP_DEBUG, SDP_DRIVER, ("IOCTL_WSP_SEND recieved\n" ));   \r
+            VERIFY_BUFFERS(InputBufferLength, OutputBufferLength, WspSendIn, WspSendOut);\r
+            OutputDataSize = sizeof (WspSendOut);\r
 \r
-            break;\r
+            // get the socket based on the users pointer\r
+            WspSendIn *pWspSendIn = (WspSendIn *) pInputBuffer;\r
+            WspSendOut *pWspSendOut = (WspSendOut *) pOutputBuffer;\r
+            pSdpUserFile = (SdpUserFile *)pIrpSp->FileObject->FsContext;\r
+            pSdpSocket = pSdpUserFile->SocketByPointer(pWspSendIn->pSocket);\r
+            if (pSdpSocket == NULL) {\r
+               SDP_PRINT(SDP_DEBUG, SDP_DRIVER, ("IOCTL_WSP_SEND socket %x not found\n",pWspConnectIn->pSocket));   \r
+               // This is a well defined winsock error\r
+               pWspConnectOut->Errno = WSAENOTSOCK;\r
+               goto Cleanup;\r
+            }\r
+            rc = pSdpSocket->WSPSend(pWspSendIn, pWspSendOut);\r
+            if (!NT_SUCCESS(rc)) {\r
+                SDP_PRINT(SDP_ERR, SDP_DRIVER, ("pSdpSocket->WSPSend failed rc = 0x%x\n", rc ));        \r
+                goto Cleanup;\r
+            }\r
+        }\r
+        break;\r
+        \r
         \r
     default:\r
         // This is an unrecgnized IOCTL\r
index b895b17..33cd8b2 100644 (file)
@@ -90,6 +90,23 @@ NTSTATUS SdpSocket::Init(
     return rc;\r
 }\r
 \r
+NTSTATUS SdpSocket::WSPSend(\r
+        WspSendIn    *pWspSendIn,\r
+        WspSendOut   *pWspSendOut\r
+        )\r
+{\r
+    NTSTATUS rc = STATUS_SUCCESS;\r
+    SDP_PRINT(SDP_TRACE, SDP_SOCKET, ("this = 0x%p \n",this));\r
+\r
+    pWspSendOut->Errno = 0;\r
+    pWspSendOut->NumberOfBytesSent = pWspSendIn->BufferSize;\r
+\r
+    return rc;\r
+    \r
+}\r
+\r
+\r
+\r
 NTSTATUS SdpSocket::WSPConnect(\r
     WspConnectIn    *pWspConnectIn,\r
     WspConnectOut   *pWspConnectOut\r
@@ -102,7 +119,7 @@ NTSTATUS SdpSocket::WSPConnect(
     ib_path_rec_t path_rec;\r
     CSpinLockWrapper Lock(m_Lock);\r
         \r
-    SDP_PRINT(SDP_TRACE, SDP_SOCKET, ("SdpSocket::WSPConnect this = 0x%p remote addresses ip=%d.%d.%d.%d:%d\n",\r
+    SDP_PRINT(SDP_TRACE, SDP_SOCKET, ("this = 0x%p remote addresses ip=%d.%d.%d.%d:%d\n",\r
         this,\r
         (pWspConnectIn->IP & 0XFF000000) >> 24,\r
         (pWspConnectIn->IP & 0XFF0000) >> 16,\r
index 24e402e..1850583 100644 (file)
@@ -76,6 +76,11 @@ public:
         WspConnectOut   *pWspConnectOut\r
         );\r
 \r
+    NTSTATUS WSPSend(\r
+        WspSendIn    *pWspSendIn,\r
+        WspSendOut   *pWspSendOut\r
+        );    \r
+\r
     VOID Shutdown();\r
 \r
 \r
index 94f68e5..77b1554 100644 (file)
@@ -3,18 +3,18 @@
 #define H_SDP_TRACE_H \r
 \r
 // Debug level masks\r
-#define SDP_ALL        0x00000001\r
-#define SDP_DEBUG      0x00000002\r
-#define SDP_TRACE      0x00000004\r
-#define SDP_WARN       0x00000008\r
-#define SDP_ERR        0x00000010\r
+#define SDP_ALL     0x00000001\r
+#define SDP_DEBUG   0x00000002\r
+#define SDP_TRACE   0x00000004\r
+#define SDP_WARN    0x00000008\r
+#define SDP_ERR     0x00000010\r
 \r
 // Debug toppics\r
-#define SDP_API                            0x000001\r
-#define SDP_CONNECT        0x000002\r
-#define SDP_DRIVER             0x000004\r
-#define SDP_SOCKET             0x000008\r
-#define SDP_ARP                0x000010\r
+#define SDP_API             0x000001\r
+#define SDP_CONNECT         0x000002\r
+#define SDP_DRIVER          0x000004\r
+#define SDP_SOCKET          0x000008\r
+#define SDP_ARP             0x000010\r
 \r
 // BUGBUG: CONVERT TO A FUNCTION\r
 \r