Update the winverbs interface and library to add support for connection
authorshefty <shefty@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Sat, 24 Jan 2009 19:49:59 +0000 (19:49 +0000)
committershefty <shefty@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Sat, 24 Jan 2009 19:49:59 +0000 (19:49 +0000)
establishment.  The implementation supports XP, 2003, and 2008.  Because
kernel support for IP is lacking in XP and 2003, the winverbs userspace
library performs address and route resolution, rather than relying on the
kernel driver to perform those operations.

The interface for datagram support was updated to match that used for
connections, but datagram support is not implemented at this time.

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@1877 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

13 files changed:
core/winverbs/user/SOURCES
core/winverbs/user/wv_cq.cpp
core/winverbs/user/wv_device.cpp
core/winverbs/user/wv_device.h
core/winverbs/user/wv_ep.cpp
core/winverbs/user/wv_ep.h
core/winverbs/user/wv_pd.cpp
core/winverbs/user/wv_provider.cpp
core/winverbs/user/wv_provider.h
core/winverbs/user/wv_qp.cpp
core/winverbs/user/wv_srq.cpp
inc/user/rdma/winverbs.h
inc/user/rdma/wvstatus.h

index 1ddb2ae..33fa883 100644 (file)
@@ -14,7 +14,7 @@ DLLDEF = $(OBJ_PATH)\$O\wv_exports.def
 !endif\r
 \r
 DLLENTRY = DllMain\r
-USE_NTDLL = 1\r
+USE_MSVCRT = 1\r
 \r
 SOURCES = \\r
        winverbs.rc             \\r
@@ -35,4 +35,5 @@ USER_C_FLAGS = $(USER_C_FLAGS) -DEXPORT_WV_SYMBOLS
 \r
 TARGETLIBS = \\r
        $(SDK_LIB_PATH)\kernel32.lib    \\r
-       $(SDK_LIB_PATH)\uuid.lib\r
+       $(SDK_LIB_PATH)\uuid.lib                \\r
+       $(SDK_LIB_PATH)\ws2_32.lib\r
index fafce97..9ce1d9a 100644 (file)
@@ -99,7 +99,7 @@ CWVCompletionQueue::~CWVCompletionQueue()
        DWORD   bytes;\r
        HRESULT hr;\r
 \r
-       if (m_Id != NULL) {\r
+       if (m_Id != 0) {\r
                m_pVerbs->pre_destroy_cq(m_hVerbsCq);\r
                hr = WvDeviceIoControl(m_hFile, WV_IOCTL_CQ_DESTROY, &m_Id, sizeof m_Id,\r
                                                           NULL, 0, &bytes, NULL) ?\r
index a90b214..c326820 100644 (file)
@@ -293,7 +293,7 @@ out:
 }\r
 \r
 STDMETHODIMP CWVDevice::\r
-FindGidIndex(UINT8 PortNumber, WV_GID *pGid, UINT16 *pIndex)\r
+FindGid(UINT8 PortNumber, WV_GID *pGid, DWORD *pIndex)\r
 {\r
        WV_GID  gid;\r
        DWORD   index;\r
@@ -302,16 +302,16 @@ FindGidIndex(UINT8 PortNumber, WV_GID *pGid, UINT16 *pIndex)
        for (index = 0; true; index++) {\r
                hr = QueryGid(PortNumber, index, &gid);\r
                if (FAILED(hr)) {\r
-                       break;\r
+                       return hr;\r
                }\r
 \r
-               if (RtlCompareMemory(pGid, &gid, sizeof(gid)) == sizeof(gid)) {\r
+               if (RtlEqualMemory(pGid, &gid, sizeof(gid))) {\r
                        *pIndex = (UINT16) index;\r
-                       break;\r
+                       return WV_SUCCESS;\r
                }\r
        }\r
 \r
-       return hr;\r
+       return WV_INVALID_ADDRESS;\r
 }\r
 \r
 STDMETHODIMP CWVDevice::\r
@@ -352,6 +352,28 @@ out:
        return hr;\r
 }\r
 \r
+STDMETHODIMP CWVDevice::\r
+FindPkey(UINT8 PortNumber, NET16 Pkey, DWORD *pIndex)\r
+{\r
+       NET16   key;\r
+       DWORD   index;\r
+       HRESULT hr;\r
+\r
+       for (index = 0; true; index++) {\r
+               hr = QueryPkey(PortNumber, index, &key);\r
+               if (FAILED(hr)) {\r
+                       return hr;\r
+               }\r
+\r
+               if (Pkey == key) {\r
+                       *pIndex = (UINT16) index;\r
+                       return WV_SUCCESS;\r
+               }\r
+       }\r
+\r
+       return WV_INVALID_ADDRESS;\r
+}\r
+\r
 STDMETHODIMP CWVDevice::\r
 CreateCompletionQueue(SIZE_T *pEntries, IWVCompletionQueue** ppCq)\r
 {\r
index 613bab9..aa2350b 100644 (file)
@@ -55,7 +55,9 @@ public:
        STDMETHODIMP Query(WV_DEVICE_ATTRIBUTES* pAttributes);\r
        STDMETHODIMP QueryPort(UINT8 PortNumber, WV_PORT_ATTRIBUTES* pAttributes);\r
        STDMETHODIMP QueryGid(UINT8 PortNumber, DWORD Index, WV_GID* pGid);\r
+       STDMETHODIMP FindGid(UINT8 PortNumber, WV_GID *pGid, DWORD *pIndex);\r
        STDMETHODIMP QueryPkey(UINT8 PortNumber, DWORD Index, NET16* pPkey);\r
+       STDMETHODIMP FindPkey(UINT8 PortNumber, NET16 Pkey, DWORD *pIndex);\r
        STDMETHODIMP CreateCompletionQueue(SIZE_T *pEntries, IWVCompletionQueue** ppCq);\r
        STDMETHODIMP AllocateProtectionDomain(IWVProtectionDomain** ppPd);\r
        STDMETHODIMP Notify(UINT8 PortNumber, OVERLAPPED* pOverlapped, DWORD* pFlags);\r
@@ -94,7 +96,6 @@ public:
                *ppDevice = NULL;\r
                return hr;\r
        }\r
-       STDMETHODIMP FindGidIndex(UINT8 PortNumber, WV_GID *pGid, UINT16 *pIndex);\r
 \r
        CWVProvider             *m_pProvider;\r
        uvp_interface_t m_Verbs;\r
index 832abbc..ddf6467 100644 (file)
 #include "wv_memory.h"\r
 #include "wv_ep.h"\r
 #include "wv_ioctl.h"\r
+#include "wv_qp.h"\r
+\r
+static void WvIoConvertConnParam(WV_IO_CONNECT_PARAM *pIoParam,\r
+                                                                WV_CONNECT_PARAM *pParam)\r
+{\r
+       pIoParam->DataLength = (UINT8) pParam->DataLength;\r
+       pIoParam->ResponderResources = pParam->ResponderResources;\r
+       pIoParam->InitiatorDepth = pParam->InitiatorDepth;\r
+       pIoParam->RetryCount = pParam->RetryCount;\r
+       pIoParam->RnrRetryCount = pParam->RnrRetryCount;\r
+       RtlZeroMemory(pIoParam->Reserved, sizeof pIoParam->Reserved);\r
+       RtlCopyMemory(pIoParam->Data, pParam->Data, pParam->DataLength);\r
+}\r
 \r
 CWVConnectEndpoint::CWVConnectEndpoint(CWVProvider *pProvider)\r
 {\r
        pProvider->AddRef();\r
        m_pProvider = pProvider;\r
        m_hFile = pProvider->m_hFile;\r
+       m_Socket = INVALID_SOCKET;\r
+}\r
+\r
+STDMETHODIMP CWVConnectEndpoint::\r
+Allocate(void)\r
+{\r
+       UINT64                  EpType;\r
+       DWORD                   bytes;\r
+       HRESULT                 hr;\r
+\r
+       EpType = WV_IO_EP_TYPE_CONNECT;\r
+       if (WvDeviceIoControl(m_hFile, WV_IOCTL_EP_CREATE, &EpType, sizeof EpType,\r
+                                                 &m_Id, sizeof m_Id, &bytes, NULL)) {\r
+               hr = WV_SUCCESS;\r
+       } else {\r
+               hr = HRESULT_FROM_WIN32(GetLastError());\r
+       }\r
+\r
+       return hr;\r
 }\r
 \r
 CWVConnectEndpoint::~CWVConnectEndpoint()\r
 {\r
+       DWORD   bytes;\r
+\r
+       if (m_Id != 0) {\r
+               WvDeviceIoControl(m_hFile, WV_IOCTL_EP_DESTROY, &m_Id, sizeof m_Id,\r
+                                                 NULL, 0, &bytes, NULL);\r
+       }\r
+\r
+       if (m_Socket != INVALID_SOCKET) {\r
+               closesocket(m_Socket);\r
+       }\r
        m_pProvider->Release();\r
 }\r
 \r
@@ -88,64 +130,270 @@ GetOverlappedResult(OVERLAPPED *pOverlapped,
 }\r
 \r
 STDMETHODIMP CWVConnectEndpoint::\r
-BindAddress(const struct sockaddr* pAddress)\r
+Modify(DWORD Option, const VOID* pOptionData, SIZE_T OptionLength)\r
 {\r
-       UNREFERENCED_PARAMETER(pAddress);\r
+       WV_IO_ID                        *pId;\r
+       DWORD                           bytes;\r
+       HRESULT                         hr;\r
+       CWVBuffer                       buf;\r
+\r
+       bytes = sizeof WV_IO_ID + OptionLength;\r
+       pId = (WV_IO_ID *) buf.Get(bytes);\r
+       if (pId == NULL) {\r
+               return WV_NO_MEMORY;\r
+       }\r
 \r
-       return E_NOTIMPL;\r
+       pId->Id = m_Id;\r
+       pId->Data = Option;\r
+       RtlCopyMemory(pId + 1, pOptionData, OptionLength);\r
+\r
+       if (WvDeviceIoControl(m_hFile, WV_IOCTL_EP_MODIFY, pId, bytes,\r
+                                                 NULL, 0, &bytes, NULL)) {\r
+               hr = WV_SUCCESS;\r
+       } else {\r
+               hr = HRESULT_FROM_WIN32(GetLastError());\r
+       }\r
+\r
+       buf.Put();\r
+       return hr;\r
 }\r
 \r
 STDMETHODIMP CWVConnectEndpoint::\r
-Reject(const VOID* pPrivateData, SIZE_T PrivateDataLength)\r
+BindAddress(SOCKADDR* pAddress)\r
 {\r
-       UNREFERENCED_PARAMETER(pPrivateData);\r
-       UNREFERENCED_PARAMETER(PrivateDataLength);\r
+       WV_IO_EP_BIND           attr;\r
+       BOOLEAN                         any;\r
+       DWORD                           bytes;\r
+       int                                     len;\r
+       HRESULT                         hr;\r
+\r
+       if (pAddress->sa_family == AF_INET) {\r
+               any = (((SOCKADDR_IN *) pAddress)->sin_addr.S_un.S_addr == INADDR_ANY);\r
+               bytes = sizeof(SOCKADDR_IN);\r
+       } else {\r
+               any = IN6ADDR_ISANY((SOCKADDR_IN6 *) pAddress);\r
+               bytes = sizeof(SOCKADDR_IN6);\r
+       }\r
 \r
-       return E_NOTIMPL;\r
+       if (any) {\r
+               RtlZeroMemory(&attr.Device, sizeof attr.Device);\r
+       } else {\r
+               hr = m_pProvider->TranslateAddress(pAddress, (WV_DEVICE_ADDRESS *) &attr.Device);\r
+               if (FAILED(hr)) {\r
+                       return hr;\r
+               }\r
+       }\r
+\r
+       m_Socket = socket(pAddress->sa_family, SOCK_STREAM, IPPROTO_TCP);\r
+       if (m_Socket == INVALID_SOCKET) {\r
+               return WSAGetLastError();\r
+       }\r
+\r
+       hr = bind(m_Socket, pAddress, bytes);\r
+       if (FAILED(hr)) {\r
+               goto get_err;\r
+       }\r
+\r
+       attr.Id = m_Id;\r
+       len = sizeof attr.Address;\r
+       hr = getsockname(m_Socket, (sockaddr *) &attr.Address, &len);\r
+       if (FAILED(hr)) {\r
+               goto get_err;\r
+       }\r
+\r
+       if (!WvDeviceIoControl(m_hFile, WV_IOCTL_EP_BIND, &attr, sizeof attr,\r
+                                                  &attr, sizeof attr, &bytes, NULL)) {\r
+               hr = HRESULT_FROM_WIN32(GetLastError());\r
+               goto err;\r
+       }\r
+\r
+       return WV_SUCCESS;\r
+\r
+get_err:\r
+       hr = WSAGetLastError();\r
+err:\r
+       closesocket(m_Socket);\r
+       m_Socket = INVALID_SOCKET;\r
+       return hr;\r
 }\r
 \r
 STDMETHODIMP CWVConnectEndpoint::\r
-Connect(IWVConnectQueuePair* pQp, WV_CONNECT_PARAM* pParam, OVERLAPPED* pOverlapped)\r
+Listen(SIZE_T Backlog)\r
 {\r
-       UNREFERENCED_PARAMETER(pQp);\r
-       UNREFERENCED_PARAMETER(pParam);\r
-       UNREFERENCED_PARAMETER(pOverlapped);\r
+       WV_IO_EP_LISTEN         attr;\r
+       DWORD                           bytes;\r
+       HRESULT                         hr;\r
+\r
+       attr.Id = m_Id;\r
+       attr.Backlog = Backlog;\r
+\r
+       if (!WvDeviceIoControl(m_hFile, WV_IOCTL_EP_LISTEN, &attr, sizeof attr,\r
+                                                  &attr, sizeof attr, &bytes, NULL)) {\r
+               hr = HRESULT_FROM_WIN32(GetLastError());\r
+       } else {\r
+               hr = WV_SUCCESS;\r
+       }\r
 \r
-       return E_NOTIMPL;\r
+       return hr;\r
+}\r
+\r
+STDMETHODIMP CWVConnectEndpoint::\r
+Reject(const VOID* pUserData, SIZE_T UserDataLength)\r
+{\r
+       WV_IO_ID                        *pId;\r
+       DWORD                           bytes;\r
+       HRESULT                         hr;\r
+       CWVBuffer                       buf;\r
+\r
+       bytes = sizeof WV_IO_ID + UserDataLength;\r
+       pId = (WV_IO_ID *) buf.Get(bytes);\r
+       if (pId == NULL) {\r
+               return WV_NO_MEMORY;\r
+       }\r
+\r
+       pId->Id = m_Id;\r
+       RtlCopyMemory(pId + 1, pUserData, UserDataLength);\r
+\r
+       if (WvDeviceIoControl(m_hFile, WV_IOCTL_EP_REJECT, pId, bytes,\r
+                                                 NULL, 0, &bytes, NULL)) {\r
+               hr = WV_SUCCESS;\r
+       } else {\r
+               hr = HRESULT_FROM_WIN32(GetLastError());\r
+       }\r
+\r
+       buf.Put();\r
+       return hr;\r
+}\r
+\r
+STDMETHODIMP CWVConnectEndpoint::\r
+GetRequest(IWVConnectEndpoint* pEndpoint, OVERLAPPED* pOverlapped)\r
+{\r
+       WV_IO_EP_GET_REQUEST    req;\r
+       DWORD                                   bytes;\r
+       HRESULT                                 hr;\r
+\r
+       req.Id = m_Id;\r
+       req.EpId = ((CWVConnectEndpoint *) pEndpoint)->m_Id;\r
+       if (WvDeviceIoControl(m_hFile, WV_IOCTL_EP_GET_REQUEST,\r
+                                                 &req, sizeof req, NULL, 0, &bytes, pOverlapped)) {\r
+               hr = WV_SUCCESS;\r
+       } else {\r
+               hr = HRESULT_FROM_WIN32(GetLastError());\r
+       }\r
+\r
+       return hr;\r
+}\r
+\r
+STDMETHODIMP CWVConnectEndpoint::\r
+Connect(IWVConnectQueuePair* pQp, const SOCKADDR* pAddress,\r
+               WV_CONNECT_PARAM* pParam, OVERLAPPED* pOverlapped)\r
+{\r
+       WV_IO_EP_CONNECT        attr;\r
+       DWORD                           bytes;\r
+       HRESULT                         hr;\r
+\r
+       attr.Id = m_Id;\r
+       attr.QpId = ((CWVConnectQueuePair *) pQp)->m_Id;\r
+\r
+       if (pAddress->sa_family == AF_INET) {\r
+               RtlCopyMemory(&attr.PeerAddress, pAddress, sizeof(SOCKADDR_IN));\r
+       } else {\r
+               RtlCopyMemory(&attr.PeerAddress, pAddress, sizeof(SOCKADDR_IN6));\r
+       }\r
+       WvIoConvertConnParam(&attr.Param, pParam);\r
+\r
+       if (WvDeviceIoControl(m_hFile, WV_IOCTL_EP_CONNECT, &attr, sizeof attr,\r
+                                                 NULL, 0, &bytes, pOverlapped)) {\r
+               hr = WV_SUCCESS;\r
+       } else {\r
+               hr = HRESULT_FROM_WIN32(GetLastError());\r
+       }\r
+\r
+       return hr;\r
 }\r
 \r
 STDMETHODIMP CWVConnectEndpoint::\r
 Accept(IWVConnectQueuePair* pQp, WV_CONNECT_PARAM* pParam, OVERLAPPED* pOverlapped)\r
 {\r
-       UNREFERENCED_PARAMETER(pQp);\r
-       UNREFERENCED_PARAMETER(pParam);\r
-       UNREFERENCED_PARAMETER(pOverlapped);\r
+       CWVConnectQueuePair     *qp = (CWVConnectQueuePair *) pQp;\r
+       WV_IO_EP_ACCEPT         attr;\r
+       DWORD                           bytes;\r
+       HRESULT                         hr;\r
+       void                            *pout;\r
+       DWORD                           size;\r
+\r
+       attr.Id = m_Id;\r
+       attr.QpId = qp->m_Id;\r
+       qp->m_pVerbs->nd_modify_qp(qp->m_hVerbsQp, &pout, &size);\r
+       WvIoConvertConnParam(&attr.Param, pParam);\r
+\r
+       if (WvDeviceIoControl(m_hFile, WV_IOCTL_EP_ACCEPT, &attr, sizeof attr,\r
+                                                 pout, size, &bytes, pOverlapped)) {\r
+               hr = WV_SUCCESS;\r
+       } else {\r
+               hr = HRESULT_FROM_WIN32(GetLastError());\r
+       }\r
 \r
-       return E_NOTIMPL;\r
+       return hr;\r
 }\r
 \r
 STDMETHODIMP CWVConnectEndpoint::\r
-Disconnect(OVERLAPPED* pOverlapped)\r
+Disconnect(void)\r
 {\r
-       UNREFERENCED_PARAMETER(pOverlapped);\r
+       DWORD           bytes;\r
+       HRESULT         hr;\r
+\r
+       if (WvDeviceIoControl(m_hFile, WV_IOCTL_EP_DISCONNECT,\r
+                                                 &m_Id, sizeof m_Id, NULL, 0, &bytes, NULL)) {\r
+               hr = WV_SUCCESS;\r
+       } else {\r
+               hr = HRESULT_FROM_WIN32(GetLastError());\r
+       }\r
 \r
-       return E_NOTIMPL;\r
+       return hr;\r
 }\r
 \r
 STDMETHODIMP CWVConnectEndpoint::\r
 NotifyDisconnect(OVERLAPPED* pOverlapped)\r
 {\r
-       UNREFERENCED_PARAMETER(pOverlapped);\r
+       DWORD           bytes;\r
+       HRESULT         hr;\r
+\r
+       if (WvDeviceIoControl(m_hFile, WV_IOCTL_EP_DISCONNECT_NOTIFY,\r
+                                                 &m_Id, sizeof m_Id, NULL, 0, &bytes, pOverlapped)) {\r
+               hr = WV_SUCCESS;\r
+       } else {\r
+               hr = HRESULT_FROM_WIN32(GetLastError());\r
+       }\r
 \r
-       return E_NOTIMPL;\r
+       return hr;\r
 }\r
 \r
 STDMETHODIMP CWVConnectEndpoint::\r
 Query(WV_CONNECT_ATTRIBUTES* pAttributes)\r
 {\r
-       UNREFERENCED_PARAMETER(pAttributes);\r
+       WV_IO_EP_ATTRIBUTES     attr;\r
+       DWORD                           bytes;\r
+       HRESULT                         hr;\r
 \r
-       return E_NOTIMPL;\r
+       if (!WvDeviceIoControl(m_hFile, WV_IOCTL_EP_QUERY, &m_Id, sizeof m_Id,\r
+                                                  &attr, sizeof attr, &bytes, NULL)) {\r
+               return HRESULT_FROM_WIN32(GetLastError());\r
+       }\r
+\r
+       RtlCopyMemory(&pAttributes->LocalAddress, &attr.LocalAddress,\r
+                                 sizeof pAttributes->LocalAddress);\r
+       RtlCopyMemory(&pAttributes->PeerAddress, &attr.PeerAddress,\r
+                                 sizeof pAttributes->PeerAddress);\r
+       RtlCopyMemory(&pAttributes->Device, &attr.Device, sizeof pAttributes->Device);\r
+       pAttributes->Param.DataLength = attr.Param.Connect.DataLength;\r
+       pAttributes->Param.ResponderResources = (SIZE_T) attr.Param.Connect.ResponderResources;\r
+       pAttributes->Param.InitiatorDepth = (SIZE_T) attr.Param.Connect.InitiatorDepth;\r
+       pAttributes->Param.RetryCount = attr.Param.Connect.RetryCount;\r
+       pAttributes->Param.RnrRetryCount = attr.Param.Connect.RnrRetryCount;\r
+       RtlCopyMemory(pAttributes->Param.Data, attr.Param.Connect.Data, attr.Param.Connect.DataLength);\r
+\r
+       return WV_SUCCESS;\r
 }\r
 \r
 \r
@@ -155,9 +403,33 @@ CWVDatagramEndpoint::CWVDatagramEndpoint(CWVProvider *pProvider)
        m_pProvider = pProvider;\r
        m_hFile = pProvider->m_hFile;\r
 }\r
+       \r
+STDMETHODIMP CWVDatagramEndpoint::\r
+Allocate(void)\r
+{\r
+       UINT64                  EpType;\r
+       DWORD                   bytes;\r
+       HRESULT                 hr;\r
+\r
+       EpType = WV_IO_EP_TYPE_DATAGRAM;\r
+       if (WvDeviceIoControl(m_hFile, WV_IOCTL_EP_CREATE, &EpType, sizeof EpType,\r
+                                                 &m_Id, sizeof m_Id, &bytes, NULL)) {\r
+               hr = WV_SUCCESS;\r
+       } else {\r
+               hr = HRESULT_FROM_WIN32(GetLastError());\r
+       }\r
+\r
+       return hr;\r
+}\r
 \r
 CWVDatagramEndpoint::~CWVDatagramEndpoint()\r
 {\r
+       DWORD   bytes;\r
+\r
+       if (m_Id != 0) {\r
+               WvDeviceIoControl(m_hFile, WV_IOCTL_EP_DESTROY, &m_Id, sizeof m_Id,\r
+                                                 NULL, 0, &bytes, NULL);\r
+       }\r
        m_pProvider->Release();\r
 }\r
 \r
@@ -206,7 +478,17 @@ GetOverlappedResult(OVERLAPPED *pOverlapped,
 }\r
 \r
 STDMETHODIMP CWVDatagramEndpoint::\r
-BindAddress(const struct sockaddr* pAddress)\r
+Modify(DWORD Option, const VOID* pOptionData, SIZE_T OptionLength)\r
+{\r
+       UNREFERENCED_PARAMETER(Option);\r
+       UNREFERENCED_PARAMETER(pOptionData);\r
+       UNREFERENCED_PARAMETER(OptionLength);\r
+\r
+       return E_NOTIMPL;\r
+}\r
+\r
+STDMETHODIMP CWVDatagramEndpoint::\r
+BindAddress(SOCKADDR* pAddress)\r
 {\r
        UNREFERENCED_PARAMETER(pAddress);\r
 \r
@@ -214,21 +496,38 @@ BindAddress(const struct sockaddr* pAddress)
 }\r
 \r
 STDMETHODIMP CWVDatagramEndpoint::\r
-Reject(const VOID* pPrivateData, SIZE_T PrivateDataLength)\r
+Listen(SIZE_T Backlog)\r
 {\r
-       UNREFERENCED_PARAMETER(pPrivateData);\r
-       UNREFERENCED_PARAMETER(PrivateDataLength);\r
+       UNREFERENCED_PARAMETER(Backlog);\r
+\r
+       return E_NOTIMPL;\r
+}\r
+\r
+STDMETHODIMP CWVDatagramEndpoint::\r
+Reject(const VOID* pUserData, SIZE_T UserDataLength)\r
+{\r
+       UNREFERENCED_PARAMETER(pUserData);\r
+       UNREFERENCED_PARAMETER(UserDataLength);\r
+\r
+       return E_NOTIMPL;\r
+}\r
+\r
+STDMETHODIMP CWVDatagramEndpoint::\r
+GetRequest(IWVDatagramEndpoint* pEndpoint, OVERLAPPED* pOverlapped)\r
+{\r
+       UNREFERENCED_PARAMETER(pEndpoint);\r
+       UNREFERENCED_PARAMETER(pOverlapped);\r
 \r
        return E_NOTIMPL;\r
 }\r
 \r
 STDMETHODIMP CWVDatagramEndpoint::\r
-Lookup(const struct sockaddr* pAddress, const VOID* pPrivateData,\r
-          SIZE_T PrivateDataLength, OVERLAPPED* pOverlapped)\r
+Lookup(const SOCKADDR* pAddress, const VOID* pUserData,\r
+          SIZE_T UserDataLength, OVERLAPPED* pOverlapped)\r
 {\r
        UNREFERENCED_PARAMETER(pAddress);\r
-       UNREFERENCED_PARAMETER(pPrivateData);\r
-       UNREFERENCED_PARAMETER(PrivateDataLength);\r
+       UNREFERENCED_PARAMETER(pUserData);\r
+       UNREFERENCED_PARAMETER(UserDataLength);\r
        UNREFERENCED_PARAMETER(pOverlapped);\r
 \r
        return E_NOTIMPL;\r
@@ -244,7 +543,7 @@ Accept(WV_DATAGRAM_PARAM* pParam, OVERLAPPED* pOverlapped)
 }\r
 \r
 STDMETHODIMP CWVDatagramEndpoint::\r
-JoinMulticast(const struct sockaddr* pAddress, OVERLAPPED* pOverlapped)\r
+JoinMulticast(const SOCKADDR* pAddress, OVERLAPPED* pOverlapped)\r
 {\r
        UNREFERENCED_PARAMETER(pAddress);\r
        UNREFERENCED_PARAMETER(pOverlapped);\r
@@ -253,7 +552,7 @@ JoinMulticast(const struct sockaddr* pAddress, OVERLAPPED* pOverlapped)
 }\r
 \r
 STDMETHODIMP CWVDatagramEndpoint::\r
-LeaveMulticast(const struct sockaddr* pAddress, OVERLAPPED* pOverlapped)\r
+LeaveMulticast(const SOCKADDR* pAddress, OVERLAPPED* pOverlapped)\r
 {\r
        UNREFERENCED_PARAMETER(pAddress);\r
        UNREFERENCED_PARAMETER(pOverlapped);\r
index ab2fd14..1d3ee5f 100644 (file)
@@ -50,15 +50,18 @@ public:
                                                                         DWORD *pNumberOfBytesTransferred, BOOL bWait);\r
 \r
        // IWVEndpoint methods\r
-       STDMETHODIMP BindAddress(const struct sockaddr* pAddress);\r
-       STDMETHODIMP Reject(const VOID* pPrivateData, SIZE_T PrivateDataLength);\r
+       STDMETHODIMP Modify(DWORD Option, const VOID* pOptionData, SIZE_T OptionLength);\r
+       STDMETHODIMP BindAddress(SOCKADDR* pAddress);\r
+       STDMETHODIMP Listen(SIZE_T Backlog);\r
+       STDMETHODIMP Reject(const VOID* pUserData, SIZE_T UserDataLength);\r
 \r
        // IWVConnectEndpoint methods\r
-       STDMETHODIMP Connect(IWVConnectQueuePair* pQp, WV_CONNECT_PARAM* pParam,\r
-                                                OVERLAPPED* pOverlapped);\r
+       STDMETHODIMP GetRequest(IWVConnectEndpoint* pEndpoint, OVERLAPPED* pOverlapped);\r
+       STDMETHODIMP Connect(IWVConnectQueuePair* pQp, const SOCKADDR* pAddress,\r
+                                                WV_CONNECT_PARAM* pParam, OVERLAPPED* pOverlapped);\r
        STDMETHODIMP Accept(IWVConnectQueuePair* pQp, WV_CONNECT_PARAM* pParam,\r
                                                OVERLAPPED* pOverlapped);\r
-       STDMETHODIMP Disconnect(OVERLAPPED* pOverlapped);\r
+       STDMETHODIMP Disconnect();\r
        STDMETHODIMP NotifyDisconnect(OVERLAPPED* pOverlapped);\r
        STDMETHODIMP Query(WV_CONNECT_ATTRIBUTES* pAttributes);\r
 \r
@@ -82,6 +85,11 @@ public:
                        goto err2;\r
                }\r
 \r
+               hr = ep->Allocate();\r
+               if (FAILED(hr)) {\r
+                       goto err2;\r
+               }\r
+\r
                *ppConnectEndpoint = ep;\r
                return WV_SUCCESS;\r
 \r
@@ -93,6 +101,11 @@ public:
        }\r
 \r
        CWVProvider             *m_pProvider;\r
+\r
+protected:\r
+       SOCKET                  m_Socket;\r
+\r
+       STDMETHODIMP Allocate();\r
 };\r
 \r
 class CWVDatagramEndpoint : IWVDatagramEndpoint, public CWVBase\r
@@ -109,16 +122,19 @@ public:
                                                                         DWORD *pNumberOfBytesTransferred, BOOL bWait);\r
 \r
        // IWVEndpoint methods\r
-       STDMETHODIMP BindAddress(const struct sockaddr* pAddress);\r
-       STDMETHODIMP Reject(const VOID* pPrivateData, SIZE_T PrivateDataLength);\r
+       STDMETHODIMP Modify(DWORD Option, const VOID* pOptionData, SIZE_T OptionLength);\r
+       STDMETHODIMP BindAddress(SOCKADDR* pAddress);\r
+       STDMETHODIMP Listen(SIZE_T Backlog);\r
+       STDMETHODIMP Reject(const VOID* pUserData, SIZE_T UserDataLength);\r
 \r
        // IWVDatagramEndpoint methods\r
-       STDMETHODIMP Lookup(const struct sockaddr* pAddress, const VOID* pPrivateData,\r
-                                               SIZE_T PrivateDataLength, OVERLAPPED* pOverlapped);\r
+       STDMETHODIMP GetRequest(IWVDatagramEndpoint* pEndpoint, OVERLAPPED* pOverlapped);\r
+       STDMETHODIMP Lookup(const SOCKADDR* pAddress, const VOID* pUserData,\r
+                                               SIZE_T UserDataLength, OVERLAPPED* pOverlapped);\r
        STDMETHODIMP Accept(WV_DATAGRAM_PARAM* pParam, OVERLAPPED* pOverlapped);\r
-       STDMETHODIMP JoinMulticast(const struct sockaddr* pAddress,\r
+       STDMETHODIMP JoinMulticast(const SOCKADDR* pAddress,\r
                                                           OVERLAPPED* pOverlapped);\r
-       STDMETHODIMP LeaveMulticast(const struct sockaddr* pAddress,\r
+       STDMETHODIMP LeaveMulticast(const SOCKADDR* pAddress,\r
                                                                OVERLAPPED* pOverlapped);\r
        STDMETHODIMP Query(WV_DATAGRAM_ATTRIBUTES* pAttributes);\r
 \r
@@ -142,6 +158,11 @@ public:
                        goto err2;\r
                }\r
 \r
+               hr = ep->Allocate();\r
+               if (FAILED(hr)) {\r
+                       goto err2;\r
+               }\r
+\r
                *ppDatagramEndpoint = ep;\r
                return WV_SUCCESS;\r
 \r
@@ -153,6 +174,9 @@ public:
        }\r
 \r
        CWVProvider             *m_pProvider;\r
+\r
+protected:\r
+       STDMETHODIMP Allocate();\r
 };\r
 \r
 #endif // _WV_EP_H_\r
index 6002bb1..c7b11a7 100644 (file)
@@ -97,9 +97,9 @@ CWVProtectionDomain::~CWVProtectionDomain()
        DWORD   bytes;\r
        HRESULT hr;\r
 \r
-       if (m_Id != NULL) {\r
+       if (m_Id != 0) {\r
                m_pVerbs->pre_deallocate_pd(m_hVerbsPd);\r
-               hr = WvDeviceIoControl(m_hFile, WV_IOCTL_PD_ALLOCATE, &m_Id, sizeof m_Id,\r
+               hr = WvDeviceIoControl(m_hFile, WV_IOCTL_PD_DEALLOCATE, &m_Id, sizeof m_Id,\r
                                                           NULL, 0, &bytes, NULL) ?\r
                                                           WV_SUCCESS : HRESULT_FROM_WIN32(GetLastError());\r
                m_pVerbs->post_deallocate_pd(m_hVerbsPd, (ib_api_status_t) hr);\r
@@ -271,7 +271,7 @@ CWVMemoryWindow::~CWVMemoryWindow()
        DWORD   bytes;\r
        HRESULT hr;\r
 \r
-       if (m_Id != NULL) {\r
+       if (m_Id != 0) {\r
                m_pVerbs->pre_destroy_mw(m_hVerbsMw);\r
                hr = WvDeviceIoControl(m_hFile, WV_IOCTL_MW_DEALLOCATE,\r
                                                           &m_Id, sizeof m_Id, NULL, 0, &bytes, NULL) ?\r
@@ -384,7 +384,7 @@ CWVAddressHandle::~CWVAddressHandle()
        HRESULT                 hr;\r
        ib_api_status_t stat;\r
 \r
-       if (m_Id != NULL) {\r
+       if (m_Id != 0) {\r
                stat = m_pVerbs->pre_destroy_av(m_hVerbsAh);\r
                if (stat != IB_VERBS_PROCESSING_DONE) {\r
                        hr = WvDeviceIoControl(m_hFile, WV_IOCTL_AH_DESTROY,\r
@@ -424,16 +424,17 @@ Release(void)
 STDMETHODIMP CWVAddressHandle::\r
 ConvertAv(ib_av_attr_t *pVerbsAv, WV_ADDRESS_VECTOR *pAv)\r
 {\r
+       DWORD index;\r
        HRESULT hr;\r
 \r
        pVerbsAv->grh_valid = pAv->Route.Valid;\r
        if (pVerbsAv->grh_valid) {\r
-               hr = m_pPd->m_pDevice->FindGidIndex(pAv->PortNumber, &pAv->Route.SGid,\r
-                                                                                       &pVerbsAv->grh.resv1);\r
+               hr = m_pPd->m_pDevice->FindGid(pAv->PortNumber, &pAv->Route.SGid, &index);\r
                if (FAILED(hr)) {\r
                        return hr;\r
                }\r
 \r
+               pVerbsAv->grh.resv1 = (UINT16) index;\r
                pVerbsAv->grh.ver_class_flow =\r
                        _byteswap_ulong(_byteswap_ulong(pAv->Route.FlowLabel) |\r
                                                         (pAv->Route.TrafficClass << 20));\r
index 1b12e81..c5c5cd4 100644 (file)
  */\r
 \r
 #include <iba\ib_al.h>\r
+#include <iba\ib_at_ioctl.h>\r
 \r
 #include "wv_memory.h"\r
 #include "wv_provider.h"\r
 #include "wv_device.h"\r
 #include "wv_ep.h"\r
-#include "wv_listen.h"\r
 #include "wv_ioctl.h"\r
 \r
 CWVProvider::CWVProvider()\r
@@ -45,7 +45,9 @@ CWVProvider::CWVProvider()
 CWVProvider::~CWVProvider()\r
 {\r
        CloseHandle(m_hFile);\r
-       InterlockedDecrement(&WvRef);\r
+       if (InterlockedDecrement(&WvRef) == 0) {\r
+               WSACleanup();\r
+       }\r
 }\r
 \r
 STDMETHODIMP CWVProvider::\r
@@ -132,12 +134,44 @@ out:
 }\r
 \r
 STDMETHODIMP CWVProvider::\r
-QueryAddressList(WV_ADDRESS_LIST* pAddressList, SIZE_T* pBufferSize)\r
+TranslateAddress(SOCKADDR* pAddress, WV_DEVICE_ADDRESS* pDeviceAddress)\r
 {\r
-       UNREFERENCED_PARAMETER(pAddressList);\r
-       UNREFERENCED_PARAMETER(pBufferSize);\r
+       HANDLE hIbat;\r
+       IOCTL_IBAT_IP_TO_PORT_IN addr;\r
+       IBAT_PORT_RECORD port;\r
+       DWORD bytes;\r
+       HRESULT hr;\r
+\r
+       hIbat = CreateFileW(IBAT_WIN32_NAME, GENERIC_READ | GENERIC_WRITE,\r
+                                               FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,\r
+                                               OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);\r
+       if (hIbat == INVALID_HANDLE_VALUE) {\r
+               return HRESULT_FROM_WIN32(GetLastError());\r
+       }\r
+\r
+       addr.Version = IBAT_IOCTL_VERSION;\r
+       if (pAddress->sa_family == AF_INET) {\r
+               addr.Address.IpVersion = 4;\r
+               RtlCopyMemory(addr.Address.Address + 12,\r
+                                         &((SOCKADDR_IN *)pAddress)->sin_addr, 4);\r
+       } else {\r
+               addr.Address.IpVersion = 6;\r
+               RtlCopyMemory(addr.Address.Address,\r
+                                         &((SOCKADDR_IN6 *)pAddress)->sin6_addr, 16);\r
+       }\r
+\r
+       if (DeviceIoControl(hIbat, IOCTL_IBAT_IP_TO_PORT,\r
+                                               &addr, sizeof addr, &port, sizeof port, &bytes, NULL)) {\r
+               hr = WV_SUCCESS;\r
+               pDeviceAddress->DeviceGuid = port.CaGuid;\r
+               pDeviceAddress->Pkey = port.PKey;\r
+               pDeviceAddress->PortNumber = port.PortNum;\r
+       } else {\r
+               hr = HRESULT_FROM_WIN32(GetLastError());\r
+       }\r
 \r
-       return E_NOTIMPL;\r
+       CloseHandle(hIbat);\r
+       return hr;\r
 }\r
 \r
 STDMETHODIMP CWVProvider::\r
@@ -157,9 +191,3 @@ CreateDatagramEndpoint(IWVDatagramEndpoint** ppDatagramEndpoint)
 {\r
        return CWVDatagramEndpoint::CreateInstance(this, ppDatagramEndpoint);\r
 }\r
-\r
-STDMETHODIMP CWVProvider::\r
-CreateListen(const struct sockaddr* pAddress, SIZE_T Backlog, IWVListen** ppListen)\r
-{\r
-       return CWVListen::CreateInstance(this, pAddress, Backlog, ppListen);\r
-}\r
index c7635f3..581f83c 100644 (file)
@@ -49,23 +49,30 @@ public:
        STDMETHODIMP_(HANDLE) GetFileHandle();\r
        STDMETHODIMP QueryDeviceList(NET64* pGuidList, SIZE_T* pBufferSize);\r
        STDMETHODIMP QueryDevice(NET64 Guid, WV_DEVICE_ATTRIBUTES* pAttributes);\r
-       STDMETHODIMP QueryAddressList(WV_ADDRESS_LIST* pAddressList, SIZE_T* pBufferSize);\r
+       STDMETHODIMP TranslateAddress(SOCKADDR* pAddress,\r
+                                                                 WV_DEVICE_ADDRESS* pDeviceAddress);\r
 \r
        STDMETHODIMP OpenDevice(NET64 Guid, IWVDevice** ppDevice);\r
 \r
        STDMETHODIMP CreateConnectEndpoint(IWVConnectEndpoint** ppConnectEndpoint);\r
        STDMETHODIMP CreateDatagramEndpoint(IWVDatagramEndpoint** ppDatagramEndpoint);\r
-       STDMETHODIMP CreateListen(const struct sockaddr* pAddress,\r
-                                                         SIZE_T backlog, IWVListen** ppListen);\r
 \r
        CWVProvider();\r
        ~CWVProvider();\r
        void Delete() {delete this;}\r
        static STDMETHODIMP CreateInstance(IWVProvider** ppProvider)\r
        {\r
+               WSADATA wsadata;\r
                HRESULT hr;\r
                CWVProvider *wv;\r
 \r
+               if (WvRef == 0) {\r
+                       hr = WSAStartup(MAKEWORD(2, 2), &wsadata);\r
+                       if (FAILED(hr)) {\r
+                               return hr;\r
+                       }\r
+               }\r
+\r
                wv = new CWVProvider;\r
                if (wv == NULL) {\r
                        hr = WV_NO_MEMORY;\r
index ac4a75a..5946ac8 100644 (file)
@@ -194,6 +194,7 @@ static void WvIoConvertQpAttr(WV_IO_QP_ATTRIBUTES *pIoAttr,
 \r
        pIoAttr->AccessFlags = (UINT8) pAttr->AccessFlags;\r
        pIoAttr->QpFlags = (UINT8) pAttr->QpFlags;\r
+       RtlZeroMemory(pIoAttr->Reserved, sizeof pIoAttr->Reserved);\r
 }\r
 \r
 CWVQueuePair::CWVQueuePair(CWVProtectionDomain *pPd)\r
@@ -298,7 +299,7 @@ CWVQueuePair::~CWVQueuePair()
        DWORD   bytes;\r
        HRESULT hr;\r
 \r
-       if (m_Id != NULL) {\r
+       if (m_Id != 0) {\r
                m_pVerbs->pre_destroy_qp(m_hVerbsQp);\r
                hr = WvDeviceIoControl(m_hFile, WV_IOCTL_QP_DESTROY, &m_Id, sizeof m_Id,\r
                                                           NULL, 0, &bytes, NULL) ?\r
index 0c9650f..32d5ebe 100644 (file)
@@ -73,6 +73,7 @@ Create(SIZE_T MaxWr, SIZE_T MaxSge, SIZE_T SrqLimit)
        pattr->MaxSge = attr.max_sge;\r
        pattr->MaxWr = attr.max_wr;\r
        pattr->SrqLimit = attr.srq_limit;\r
+       pattr->Reserved = 0;\r
        RtlCopyMemory(pattr + 1, (void *) (ULONG_PTR) verbsData.p_inout_buf,\r
                                  verbsData.input_size);\r
 \r
@@ -102,7 +103,7 @@ CWVSharedReceiveQueue::~CWVSharedReceiveQueue()
        DWORD   bytes;\r
        HRESULT hr;\r
 \r
-       if (m_Id != NULL) {\r
+       if (m_Id != 0) {\r
                m_pVerbs->pre_destroy_srq(m_hVerbsSrq);\r
                hr = WvDeviceIoControl(m_hFile, WV_IOCTL_SRQ_DESTROY, &m_Id, sizeof m_Id,\r
                                                           NULL, 0, &bytes, NULL) ?\r
@@ -180,6 +181,7 @@ Query(SIZE_T* pMaxWr, SIZE_T* pMaxSge, SIZE_T* pSrqLimit)
 \r
        pattr->Id.Id = m_Id;\r
        pattr->Id.VerbInfo = verbsData.command;\r
+       pattr->Reserved = 0;\r
        RtlCopyMemory(pattr + 1, (void *) (ULONG_PTR) verbsData.p_inout_buf,\r
                                  verbsData.input_size);\r
 \r
@@ -241,6 +243,7 @@ Modify(SIZE_T MaxWr, SIZE_T SrqLimit)
        pattr->Id.VerbInfo = verbsData.command;\r
        pattr->MaxWr = attr.max_wr;\r
        pattr->SrqLimit = attr.srq_limit;\r
+       pattr->Reserved = 0;\r
        RtlCopyMemory(pattr + 1, (void *) (ULONG_PTR) verbsData.p_inout_buf,\r
                                  verbsData.input_size);\r
 \r
index 19a6fce..27cb920 100644 (file)
@@ -35,6 +35,7 @@
 #include <initguid.h>\r
 \r
 #include <winsock2.h>\r
+#include <ws2tcpip.h>\r
 #include <unknwn.h>\r
 #include <rdma\wvstatus.h>\r
 \r
@@ -156,21 +157,13 @@ typedef struct _WV_PORT_ATTRIBUTES
 \r
 }      WV_PORT_ATTRIBUTES;\r
 \r
-typedef struct _WV_ADDRESS\r
+typedef struct _WV_DEVICE_ADDRESS\r
 {\r
-       SOCKET_ADDRESS  Address;\r
-       NET64                   DeviceGuid;\r
-       NET16                   Pkey;\r
-       UINT8                   PortNumber;\r
-\r
-}      WV_ADDRESS;\r
-\r
-typedef struct _WV_ADDRESS_LIST\r
-{\r
-       SIZE_T                  Count;\r
-       WV_ADDRESS              Address[1];\r
+       NET64                           DeviceGuid;\r
+       NET16                           Pkey;\r
+       UINT8                           PortNumber;\r
 \r
-}      WV_ADDRESS_LIST;\r
+}      WV_DEVICE_ADDRESS;\r
 \r
 // Port notification flags\r
 #define WV_EVENT_ERROR                         0x00000001\r
@@ -476,8 +469,6 @@ typedef struct _WV_QP_ATTRIBUTES
 \r
 #define WV_CM_UDP_QKEY 0x01234567\r
 \r
-#pragma warning(push)\r
-#pragma warning(disable: 4200)\r
 typedef struct _WV_CONNECT_PARAM\r
 {\r
        SIZE_T                          DataLength;\r
@@ -486,7 +477,7 @@ typedef struct _WV_CONNECT_PARAM
        UINT8                           RetryCount;                     // Ignored when accepting\r
        UINT8                           RnrRetryCount;\r
        UINT8                           Reserved[2];\r
-       UINT8                           Data[];\r
+       UINT8                           Data[56];\r
 \r
 }      WV_CONNECT_PARAM;\r
 \r
@@ -496,27 +487,39 @@ typedef struct _WV_DATAGRAM_PARAM
        WV_ADDRESS_VECTOR       AddressVector;\r
        NET32                           Qpn;\r
        NET32                           Qkey;\r
-       UINT8                           Data[];\r
+       UINT8                           Data[56];\r
 \r
 }      WV_DATAGRAM_PARAM;\r
-#pragma warning(pop)\r
+\r
+typedef union _WV_SOCKADDR\r
+{\r
+       SOCKADDR                        Sa;\r
+       SOCKADDR_IN                     Sin;\r
+       SOCKADDR_IN6            Sin6;\r
+\r
+}      WV_SOCKADDR;\r
 \r
 typedef struct _WV_CONNECT_ATTRIBUTES\r
 {\r
-       WV_ADDRESS                      LocalAddress;\r
-       SOCKET_ADDRESS          PeerAddress;\r
+       WV_SOCKADDR                     LocalAddress;\r
+       WV_SOCKADDR                     PeerAddress;\r
+       WV_DEVICE_ADDRESS       Device;\r
        WV_CONNECT_PARAM        Param;\r
 \r
 }      WV_CONNECT_ATTRIBUTES;\r
 \r
 typedef struct _WV_DATAGRAM_ATTRIBUTES\r
 {\r
-       WV_ADDRESS                      LocalAddress;\r
-       SOCKET_ADDRESS          PeerAddress;            // Specify when querying\r
+       WV_SOCKADDR                     LocalAddress;\r
+       WV_SOCKADDR                     PeerAddress;            // Specify when querying\r
+       WV_DEVICE_ADDRESS       Device;\r
        WV_DATAGRAM_PARAM       Param;\r
 \r
 }      WV_DATAGRAM_ATTRIBUTES;\r
 \r
+// Endpoint options\r
+#define WV_EP_OPTION_ROUTE                             0x00000001\r
+\r
 #undef INTERFACE\r
 #define INTERFACE IWVOverlapped\r
 // {64687592-aa67-4b55-bc4b-e189bdd2fc4f}\r
@@ -1126,15 +1129,27 @@ DECLARE_INTERFACE_(IWVEndpoint, IWVOverlapped)
                ) PURE;\r
 \r
        // IWVEndpoint methods\r
+       STDMETHOD(Modify)(\r
+               THIS_\r
+               __in DWORD Option,\r
+               __in_bcount_opt(OptionLength) const VOID* pOptionData,\r
+               __in SIZE_T OptionLength\r
+               ) PURE;\r
+\r
        STDMETHOD(BindAddress)(\r
                THIS_\r
-               __in const struct sockaddr* pAddress\r
+               __in SOCKADDR* pAddress\r
+               ) PURE;\r
+\r
+       STDMETHOD(Listen)(\r
+               THIS_\r
+               __in SIZE_T Backlog\r
                ) PURE;\r
 \r
        STDMETHOD(Reject)(\r
                THIS_\r
-               __in_bcount_opt(PrivateDataLength) const VOID* pPrivateData,\r
-               __in SIZE_T PrivateDataLength\r
+               __in_bcount_opt(UserDataLength) const VOID* pUserData,\r
+               __in SIZE_T UserDataLength\r
                ) PURE;\r
 };\r
 \r
@@ -1175,21 +1190,40 @@ DECLARE_INTERFACE_(IWVConnectEndpoint, IWVEndpoint)
                ) PURE;\r
 \r
        // IWVEndpoint methods\r
+       __override STDMETHOD(Modify)(\r
+               THIS_\r
+               __in DWORD Option,\r
+               __in_bcount_opt(OptionLength) const VOID* pOptionData,\r
+               __in SIZE_T OptionLength\r
+               ) PURE;\r
+\r
        __override STDMETHOD(BindAddress)(\r
                THIS_\r
-               __in const struct sockaddr* pAddress\r
+               __in SOCKADDR* pAddress\r
+               ) PURE;\r
+\r
+       __override STDMETHOD(Listen)(\r
+               THIS_\r
+               __in SIZE_T Backlog\r
                ) PURE;\r
 \r
        __override STDMETHOD(Reject)(\r
                THIS_\r
-               __in_bcount_opt(PrivateDataLength) const VOID* pPrivateData,\r
-               __in SIZE_T PrivateDataLength\r
+               __in_bcount_opt(UserDataLength) const VOID* pUserData,\r
+               __in SIZE_T UserDataLength\r
                ) PURE;\r
 \r
        // IWVConnectEndpoint methods\r
+       STDMETHOD(GetRequest)(\r
+               THIS_\r
+               __in IWVConnectEndpoint* pEndpoint,\r
+               __in_opt OVERLAPPED* pOverlapped\r
+               ) PURE;\r
+\r
        STDMETHOD(Connect)(\r
                THIS_\r
                __in IWVConnectQueuePair* pQp,\r
+               __in const SOCKADDR* pAddress,\r
                __in WV_CONNECT_PARAM* pParam,\r
                __in_opt OVERLAPPED* pOverlapped\r
                ) PURE;\r
@@ -1202,8 +1236,7 @@ DECLARE_INTERFACE_(IWVConnectEndpoint, IWVEndpoint)
                ) PURE;\r
 \r
        STDMETHOD(Disconnect)(\r
-               THIS_\r
-               __in_opt OVERLAPPED* pOverlapped\r
+               THIS\r
                ) PURE;\r
 \r
        STDMETHOD(NotifyDisconnect)(\r
@@ -1254,23 +1287,41 @@ DECLARE_INTERFACE_(IWVDatagramEndpoint, IWVEndpoint)
                ) PURE;\r
 \r
        // IWVEndpoint methods\r
+       __override STDMETHOD(Modify)(\r
+               THIS_\r
+               __in DWORD Option,\r
+               __in_bcount_opt(OptionLength) const VOID* pOptionData,\r
+               __in SIZE_T OptionLength\r
+               ) PURE;\r
+\r
        __override STDMETHOD(BindAddress)(\r
                THIS_\r
-               __in const struct sockaddr* pAddress\r
+               __in SOCKADDR* pAddress\r
+               ) PURE;\r
+\r
+       __override STDMETHOD(Listen)(\r
+               THIS_\r
+               __in SIZE_T Backlog\r
                ) PURE;\r
 \r
        __override STDMETHOD(Reject)(\r
                THIS_\r
-               __in_bcount_opt(PrivateDataLength) const VOID* pPrivateData,\r
-               __in SIZE_T PrivateDataLength\r
+               __in_bcount_opt(UserDataLength) const VOID* pUserData,\r
+               __in SIZE_T UserDataLength\r
                ) PURE;\r
 \r
        // IWVDatagramEndpoint methods\r
+       STDMETHOD(GetRequest)(\r
+               THIS_\r
+               __in IWVDatagramEndpoint* pEndpoint,\r
+               __in_opt OVERLAPPED* pOverlapped\r
+               ) PURE;\r
+\r
        STDMETHOD(Lookup)(\r
                THIS_\r
-               __in const struct sockaddr* pAddress,\r
-               __in_bcount_opt(PrivateDataLength) const VOID* pPrivateData,\r
-               __in SIZE_T PrivateDataLength,\r
+               __in const SOCKADDR* pAddress,\r
+               __in_bcount_opt(UserDataLength) const VOID* pUserData,\r
+               __in SIZE_T UserDataLength,\r
                __in_opt OVERLAPPED* pOverlapped\r
                ) PURE;\r
 \r
@@ -1282,13 +1333,13 @@ DECLARE_INTERFACE_(IWVDatagramEndpoint, IWVEndpoint)
 \r
        STDMETHOD(JoinMulticast)(\r
                THIS_\r
-               __in const struct sockaddr* pAddress,\r
+               __in const SOCKADDR* pAddress,\r
                __in_opt OVERLAPPED* pOverlapped\r
                ) PURE;\r
 \r
        STDMETHOD(LeaveMulticast)(\r
                THIS_\r
-               __in const struct sockaddr* pAddress,\r
+               __in const SOCKADDR* pAddress,\r
                __in_opt OVERLAPPED* pOverlapped\r
                ) PURE;\r
 \r
@@ -1299,50 +1350,6 @@ DECLARE_INTERFACE_(IWVDatagramEndpoint, IWVEndpoint)
 };\r
 \r
 \r
-#undef INTERFACE\r
-#define INTERFACE IWVListen\r
-// {5b839fd4-7410-441f-a2d9-5d75b1d8599b}\r
-DEFINE_GUID(IID_IWVListen, 0x5b839fd4, 0x7410, 0x441f,\r
-                       0xa2, 0xd9, 0x5d, 0x75, 0xb1, 0xd8, 0x59, 0x9b);\r
-\r
-DECLARE_INTERFACE_(IWVListen, IWVOverlapped)\r
-{\r
-       // IUnknown methods\r
-       __override STDMETHOD(QueryInterface)(\r
-               THIS_\r
-               REFIID riid,\r
-               LPVOID FAR* ppvObj\r
-               ) PURE;\r
-\r
-       __override STDMETHOD_(ULONG,AddRef)(\r
-               THIS\r
-               ) PURE;\r
-\r
-       __override STDMETHOD_(ULONG,Release)(\r
-               THIS\r
-               ) PURE;\r
-\r
-       // IWVOverlapped methods\r
-       __override STDMETHOD(CancelOverlappedRequests)(\r
-               THIS\r
-               ) PURE;\r
-\r
-       __override STDMETHOD(GetOverlappedResult)(\r
-               THIS_\r
-               __inout_opt OVERLAPPED *pOverlapped,\r
-               __out DWORD *pNumberOfBytesTransferred,\r
-               __in BOOL bWait\r
-               ) PURE;\r
-\r
-       // IWVListen methods\r
-       STDMETHOD(GetRequest)(\r
-               THIS_\r
-               __in IWVEndpoint* pEndpoint,\r
-               __in_opt OVERLAPPED* pOverlapped\r
-               ) PURE;\r
-};\r
-\r
-\r
 #undef INTERFACE\r
 #define INTERFACE IWVDevice\r
 // {244af78c-b1ac-40e4-9896-271d58d591b8}\r
@@ -1397,6 +1404,13 @@ DECLARE_INTERFACE_(IWVDevice, IWVOverlapped)
                __out WV_GID* pGid\r
                ) PURE;\r
 \r
+       STDMETHOD(FindGid)(\r
+               THIS_\r
+               __in UINT8 PortNumber,\r
+               __in WV_GID* pGid,\r
+               __out DWORD* pIndex\r
+               ) PURE;\r
+\r
        STDMETHOD(QueryPkey)(\r
                THIS_\r
                __in UINT8 PortNumber,\r
@@ -1404,6 +1418,13 @@ DECLARE_INTERFACE_(IWVDevice, IWVOverlapped)
                __out NET16* pPkey\r
                ) PURE;\r
 \r
+       STDMETHOD(FindPkey)(\r
+               THIS_\r
+               __in UINT8 PortNumber,\r
+               __in NET16 Pkey,\r
+               __out DWORD* pIndex\r
+               ) PURE;\r
+\r
        STDMETHOD(CreateCompletionQueue)(\r
                THIS_\r
                __inout SIZE_T *pEntries,\r
@@ -1426,9 +1447,9 @@ DECLARE_INTERFACE_(IWVDevice, IWVOverlapped)
 \r
 #undef INTERFACE\r
 #define INTERFACE IWVProvider\r
-// {6901010c-17af-4894-a1dc-794d3611f262}\r
-DEFINE_GUID(IID_IWVProvider, 0x6901010c, 0x17af, 0x4894,\r
-                       0xa1, 0xdc, 0x79, 0x4d, 0x36, 0x11, 0xf2, 0x62);\r
+// {060E95D6-EC54-43b2-83FC-B578FD037259}\r
+DEFINE_GUID(IID_IWVProvider, 0x60e95d6, 0xec54, 0x43b2,\r
+                       0x83, 0xfc, 0xb5, 0x78, 0xfd, 0x3, 0x72, 0x59);\r
 \r
 DECLARE_INTERFACE_(IWVProvider, IUnknown)\r
 {\r
@@ -1464,10 +1485,10 @@ DECLARE_INTERFACE_(IWVProvider, IUnknown)
                __out WV_DEVICE_ATTRIBUTES* pAttributes\r
                ) PURE;\r
 \r
-       STDMETHOD(QueryAddressList)(\r
+       STDMETHOD(TranslateAddress)(\r
                THIS_\r
-               __inout_bcount_part_opt(*pBufferSize, *pBufferSize) WV_ADDRESS_LIST* pAddressList,\r
-               __inout SIZE_T* pBufferSize\r
+               __in SOCKADDR* pAddress,\r
+               __out WV_DEVICE_ADDRESS* pDeviceAddress\r
                ) PURE;\r
 \r
        STDMETHOD(OpenDevice)(\r
@@ -1485,13 +1506,6 @@ DECLARE_INTERFACE_(IWVProvider, IUnknown)
                THIS_\r
                __deref_out IWVDatagramEndpoint** ppDatagramEndpoint\r
                ) PURE;\r
-\r
-       STDMETHOD(CreateListen)(\r
-               THIS_\r
-               __in const struct sockaddr* pAddress,\r
-               __in SIZE_T Backlog,\r
-               __deref_out IWVListen** ppListen\r
-               ) PURE;\r
 };\r
 \r
 __declspec(dllexport) HRESULT WvGetObject(REFIID riid, LPVOID FAR* ppvObj);\r
index ab42837..0259076 100644 (file)
@@ -83,6 +83,7 @@
 #define WV_DEVICE_BUSY                                 ((HRESULT)0x80000011L)\r
 #define WV_NO_MORE_ENTRIES                             ((HRESULT)0x8000001AL)\r
 #define WV_IO_PENDING                                  ((HRESULT)0x800703E5L)\r
+#define WV_REJECTED                                            ((HRESULT)0x80070047L)\r
 #define WV_UNSUCCESSFUL                                        ((HRESULT)0xC0000001L)\r
 #define WV_ACCESS_VIOLATION                            ((HRESULT)0xC0000005L)\r
 #define WV_INVALID_HANDLE                              ((HRESULT)0xC0000008L)\r