winverbs/nd: map completion status to ND values
[mirror/winof/.git] / inc / user / rdma / winverbs.h
index 19a6fce..12542a5 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
@@ -183,8 +176,8 @@ typedef struct _WV_ADDRESS_LIST
 typedef enum _WV_CQ_NOTIFY_TYPE\r
 {\r
        WvCqError,\r
-       WvCqSolicited,\r
-       WvCqNextCompletion\r
+       WvCqNextCompletion,\r
+       WvCqSolicited\r
 \r
 }      WV_CQ_NOTIFY_TYPE;\r
 \r
@@ -201,6 +194,25 @@ typedef enum _WV_OPCODE
 \r
 }      WV_OPCODE;\r
 \r
+typedef enum _WV_WC_STATUS\r
+{\r
+       WvWcSuccess,\r
+       WvWcLocalLengthError,\r
+       WvWcLocalOpError,\r
+       WvWcLocalProtectionError,\r
+       WvWcFlushed,\r
+       WvWcMwBindError,\r
+       WvWcRemoteAccessError,\r
+       WvWcRemoteOpError,\r
+       WvWcRnrRetryError,\r
+       WvWcTimeoutRetryError,\r
+       WvWcRemoteInvalidRequest,\r
+       WvWcBadResponse,\r
+       WvWcLocalAccessError,\r
+       WvWcError\r
+\r
+}      WV_WC_STATUS;\r
+\r
 // Completion flags\r
 #define WV_WC_IMMEDIATE                0x00000001\r
 // reserved                                    0x00000002\r
@@ -214,7 +226,7 @@ typedef struct _WV_COMPLETION
        WV_OPCODE               Opcode;\r
        UINT32                  Length;\r
        UINT64                  VendorCode;\r
-       HRESULT                 Status;\r
+       WV_WC_STATUS    Status;\r
 \r
        // Receive completion data\r
        DWORD                   Flags;\r
@@ -476,8 +488,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 +496,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 +506,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
@@ -736,9 +758,9 @@ DECLARE_INTERFACE_(IWVSharedReceiveQueue, IWVOverlapped)
 \r
 #undef INTERFACE\r
 #define INTERFACE IWVQueuePair\r
-// {a847c13c-e617-489c-b0ab-2da73eb0adfd}\r
-DEFINE_GUID(IID_IWVQueuePair, 0xa847c13c, 0xe617, 0x489c,\r
-                       0xb0, 0xab, 0x2d, 0xa7, 0x3e, 0xb0, 0xad, 0xfd);\r
+// {35C64226-6A1F-4c8d-9465-C6FEE8053CDD}\r
+DEFINE_GUID(IID_IWVQueuePair, 0x35c64226, 0x6a1f, 0x4c8d,\r
+                       0x94, 0x65, 0xc6, 0xfe, 0xe8, 0x5, 0x3c, 0xdd);\r
 \r
 DECLARE_INTERFACE_(IWVQueuePair, IWVOverlapped)\r
 {\r
@@ -799,9 +821,9 @@ DECLARE_INTERFACE_(IWVQueuePair, IWVOverlapped)
 \r
 #undef INTERFACE\r
 #define INTERFACE IWVConnectQueuePair\r
-// {A791309C-4244-4194-AD63-7D372CADE5E0}\r
-DEFINE_GUID(IID_IWVConnectQueuePair, 0xa791309c, 0x4244, 0x4194,\r
-                       0xad, 0x63, 0x7d, 0x37, 0x2c, 0xad, 0xe5, 0xe0);\r
+// {DF905570-AEEB-4114-B30E-4DC3EB5A9AD6}\r
+DEFINE_GUID(IID_IWVConnectQueuePair, 0xdf905570, 0xaeeb, 0x4114,\r
+                       0xb3, 0xe, 0x4d, 0xc3, 0xeb, 0x5a, 0x9a, 0xd6);\r
 \r
 DECLARE_INTERFACE_(IWVConnectQueuePair, IWVQueuePair)\r
 {\r
@@ -1019,11 +1041,11 @@ DECLARE_INTERFACE_(IWVDatagramQueuePair, IWVQueuePair)
 \r
 #undef INTERFACE\r
 #define INTERFACE IWVProtectionDomain\r
-// {a5633a12-dffc-4060-927d-9a600d7efb63}\r
-DEFINE_GUID(IID_IWVProtectionDomain, 0xa5633a12, 0xdffc, 0x4060,\r
-                       0x92, 0x7d, 0x9a, 0x60, 0x0d, 0x7e, 0xfb, 0x63);\r
+// {E3657ABE-8C4E-4994-BE32-45B49BAE95E4}\r
+DEFINE_GUID(IID_IWVProtectionDomain, 0xe3657abe, 0x8c4e, 0x4994,\r
+                       0xbe, 0x32, 0x45, 0xb4, 0x9b, 0xae, 0x95, 0xe4);\r
 \r
-DECLARE_INTERFACE_(IWVProtectionDomain, IUnknown)\r
+DECLARE_INTERFACE_(IWVProtectionDomain, IWVOverlapped)\r
 {\r
        // IUnknown methods\r
        __override STDMETHOD(QueryInterface)(\r
@@ -1040,6 +1062,18 @@ DECLARE_INTERFACE_(IWVProtectionDomain, IUnknown)
                THIS\r
                ) PURE;\r
 \r
+       // IWVOverlapped methods\r
+       STDMETHOD(CancelOverlappedRequests)(\r
+               THIS\r
+               ) PURE;\r
+\r
+       STDMETHOD(GetOverlappedResult)(\r
+               THIS_\r
+               __inout_opt OVERLAPPED *pOverlapped,\r
+               __out DWORD *pNumberOfBytesTransferred,\r
+               __in BOOL bWait\r
+               ) PURE;\r
+\r
        // IWVProtectionDomain methods\r
        STDMETHOD(CreateSharedReceiveQueue)(\r
                THIS_\r
@@ -1126,24 +1160,36 @@ 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
 \r
 #undef INTERFACE\r
 #define INTERFACE IWVConnectEndpoint\r
-// {ac670274-1934-4759-a39c-eee01a8130b3}\r
-DEFINE_GUID(IID_IWVConnectEndpoint, 0xac670274, 0x1934, 0x4759,\r
-                       0xa3, 0x9c, 0xee, 0xe0, 0x1a, 0x81, 0x30, 0xb3);\r
+// {8FDA0EE7-E7F7-48cc-83D3-17E9C871FEA3}\r
+DEFINE_GUID(IID_IWVConnectEndpoint, 0x8fda0ee7, 0xe7f7, 0x48cc,\r
+                       0x83, 0xd3, 0x17, 0xe9, 0xc8, 0x71, 0xfe, 0xa3);\r
 \r
 DECLARE_INTERFACE_(IWVConnectEndpoint, IWVEndpoint)\r
 {\r
@@ -1175,28 +1221,47 @@ 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
 \r
        STDMETHOD(Accept)(\r
                THIS_\r
-               __in IWVConnectQueuePair* pQp,\r
+               __in_opt IWVConnectQueuePair* pQp,\r
                __in WV_CONNECT_PARAM* pParam,\r
                __in_opt OVERLAPPED* pOverlapped\r
                ) PURE;\r
@@ -1254,23 +1319,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 +1365,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 +1382,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,13 +1436,27 @@ 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
-               __in DWORD Index,\r
+               __in UINT16 Index,\r
                __out NET16* pPkey\r
                ) PURE;\r
 \r
+       STDMETHOD(FindPkey)(\r
+               THIS_\r
+               __in UINT8 PortNumber,\r
+               __in NET16 Pkey,\r
+               __out UINT16* pIndex\r
+               ) PURE;\r
+\r
        STDMETHOD(CreateCompletionQueue)(\r
                THIS_\r
                __inout SIZE_T *pEntries,\r
@@ -1426,9 +1479,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
+// {75AD0EDA-23C9-4687-8FFF-D1B34E1EF5BE}\r
+DEFINE_GUID(IID_IWVProvider, 0x75ad0eda, 0x23c9, 0x4687,\r
+                       0x8f, 0xff, 0xd1, 0xb3, 0x4e, 0x1e, 0xf5, 0xbe);\r
 \r
 DECLARE_INTERFACE_(IWVProvider, IUnknown)\r
 {\r
@@ -1464,10 +1517,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 const SOCKADDR* pAddress,\r
+               __out WV_DEVICE_ADDRESS* pDeviceAddress\r
                ) PURE;\r
 \r
        STDMETHOD(OpenDevice)(\r
@@ -1485,15 +1538,12 @@ 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
+#ifdef __cplusplus\r
+extern "C" __declspec(dllexport) HRESULT WvGetObject(REFIID riid, LPVOID FAR* ppvObj);\r
+#else\r
 __declspec(dllexport) HRESULT WvGetObject(REFIID riid, LPVOID FAR* ppvObj);\r
+#endif\r
 \r
 #endif // _WINVERBS_H_\r