Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

222 lines
7.6 KiB

  1. /***************************************************************************
  2. *
  3. * Copyright (C) 2001-2002 Microsoft Corporation. All Rights Reserved.
  4. *
  5. * File: dp8sim.h
  6. *
  7. * Content: Header for using DP8Sim.
  8. //@@BEGIN_MSINTERNAL
  9. *
  10. * History:
  11. * Date By Reason
  12. * ======== ======== =========
  13. * 04/23/01 VanceO Created.
  14. //@@END_MSINTERNAL
  15. *
  16. ***************************************************************************/
  17. #ifndef __DP8SIM_H__
  18. #define __DP8SIM_H__
  19. #include <ole2.h> // for DECLARE_INTERFACE and HRESULT
  20. #ifdef __cplusplus
  21. extern "C" {
  22. #endif
  23. /****************************************************************************
  24. *
  25. * DP8Sim simulated service providers
  26. *
  27. ****************************************************************************/
  28. // {8D3F9E5E-A3BD-475b-9E49-B0E77139143C}
  29. DEFINE_GUID(CLSID_NETWORKSIMULATOR_DP8SP_TCPIP,
  30. 0x8d3f9e5e, 0xa3bd, 0x475b, 0x9e, 0x49, 0xb0, 0xe7, 0x71, 0x39, 0x14, 0x3c);
  31. /****************************************************************************
  32. *
  33. * DP8Sim control object class ID
  34. *
  35. ****************************************************************************/
  36. // {40530071-1A80-4420-9B74-6A73171B0876}
  37. DEFINE_GUID(CLSID_DP8SimControl,
  38. 0x40530071, 0x1a80, 0x4420, 0x9b, 0x74, 0x6a, 0x73, 0x17, 0x1b, 0x8, 0x76);
  39. /****************************************************************************
  40. *
  41. * DP8Sim Control interface ID
  42. *
  43. ****************************************************************************/
  44. // {9CC03740-A510-4bcc-A014-776304B6E0D9}
  45. DEFINE_GUID(IID_IDP8SimControl,
  46. 0x9cc03740, 0xa510, 0x4bcc, 0xa0, 0x14, 0x77, 0x63, 0x4, 0xb6, 0xe0, 0xd9);
  47. /****************************************************************************
  48. *
  49. * DP8Sim Control suggested packet header sizes
  50. *
  51. ****************************************************************************/
  52. #define DP8SIMPACKETHEADERSIZE_IP 20
  53. #define DP8SIMPACKETHEADERSIZE_UDP 8
  54. #define DP8SIMPACKETHEADERSIZE_IP_UDP (DP8SIMPACKETHEADERSIZE_IP + DP8SIMPACKETHEADERSIZE_UDP)
  55. /****************************************************************************
  56. *
  57. * DP8Sim Control structures
  58. *
  59. ****************************************************************************/
  60. typedef struct _DP8SIM_PARAMETERS
  61. {
  62. DWORD dwSize; // size of this structure, must be filled in prior to calling GetAllParameters or SetAllParameters
  63. DWORD dwFlags; // flags for this structure
  64. DWORD dwPacketHeaderSize; // fixed underlying transport packet header size to add into calculations, or 0 to calculate based only on DirectPlay headers and payload
  65. DWORD dwBandwidthBPS; // bandwidth in bytes per second, or 0 for no limit
  66. FLOAT fPacketLossPercent; // percentage of packets to drop, between 0.0 and 100.0
  67. DWORD dwMinLatencyMS; // minimum artificial latency, in milliseconds (on top of any caused by bandwidth settings)
  68. DWORD dwMaxLatencyMS; // maximum artificial latency, in milliseconds (on top of any caused by bandwidth settings)
  69. } DP8SIM_PARAMETERS, * PDP8SIM_PARAMETERS;
  70. typedef struct _DP8SIM_STATISTICS
  71. {
  72. DWORD dwSize; // size of this structure, must be filled in prior to calling GetAllStatistics
  73. DWORD dwFlags; // flags for this structure
  74. DWORD dwTransmittedPackets; // number of packets sent/received
  75. DWORD dwTransmittedBytes; // number of bytes sent/received
  76. DWORD dwDroppedPackets; // number of packets intentionally dropped
  77. DWORD dwDroppedBytes; // number of bytes intentionally dropped
  78. DWORD dwTotalDelayMS; // total number of milliseconds delay added because of bandwidth limitations or random latency settings
  79. } DP8SIM_STATISTICS, * PDP8SIM_STATISTICS;
  80. /****************************************************************************
  81. *
  82. * DP8Sim Control application interfaces
  83. *
  84. ****************************************************************************/
  85. #undef INTERFACE
  86. #define INTERFACE IDP8SimControl
  87. DECLARE_INTERFACE_(IDP8SimControl, IUnknown)
  88. {
  89. /*** IUnknown methods ***/
  90. STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  91. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  92. STDMETHOD_(ULONG,Release) (THIS) PURE;
  93. /*** IDP8SimControl methods ***/
  94. STDMETHOD(Initialize) (THIS_ const DWORD dwFlags) PURE;
  95. STDMETHOD(Close) (THIS_ const DWORD dwFlags) PURE;
  96. STDMETHOD(GetAllParameters) (THIS_ DP8SIM_PARAMETERS * const pdp8spSend, DP8SIM_PARAMETERS * const pdp8spReceive, const DWORD dwFlags) PURE;
  97. STDMETHOD(SetAllParameters) (THIS_ const DP8SIM_PARAMETERS * const pdp8spSend, const DP8SIM_PARAMETERS * const pdp8spReceive, const DWORD dwFlags) PURE;
  98. STDMETHOD(GetAllStatistics) (THIS_ DP8SIM_STATISTICS * const pdp8ssSend, DP8SIM_STATISTICS * const pdp8ssReceive, const DWORD dwFlags) PURE;
  99. STDMETHOD(ClearAllStatistics) (THIS_ const DWORD dwFlags) PURE;
  100. };
  101. /****************************************************************************
  102. *
  103. * DP8Sim Control application interface macros
  104. *
  105. ****************************************************************************/
  106. #if (! defined(__cplusplus) || defined(CINTERFACE))
  107. #define IDP8SimControl_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
  108. #define IDP8SimControl_AddRef(p) (p)->lpVtbl->AddRef(p)
  109. #define IDP8SimControl_Release(p) (p)->lpVtbl->Release(p)
  110. #define IDP8SimControl_Initialize(p,a) (p)->lpVtbl->Initialize(p,a)
  111. #define IDP8SimControl_Close(p,a) (p)->lpVtbl->Close(p,a)
  112. #define IDP8SimControl_GetAllParameters(p,a,b,c) (p)->lpVtbl->GetAllParameters(p,a,b,c)
  113. #define IDP8SimControl_SetAllParameters(p,a,b,c) (p)->lpVtbl->SetAllParameters(p,a,b,c)
  114. #define IDP8SimControl_GetAllStatistics(p,a,b,c) (p)->lpVtbl->GetAllStatistics(p,a,b,c)
  115. #define IDP8SimControl_ClearAllStatistics(p,a) (p)->lpVtbl->ClearAllStatistics(p,a)
  116. #else // C++
  117. #define IDP8SimControl_QueryInterface(p,a,b) (p)->QueryInterface(a,b)
  118. #define IDP8SimControl_AddRef(p) (p)->AddRef()
  119. #define IDP8SimControl_Release(p) (p)->Release()
  120. #define IDP8SimControl_Initialize(p,a) (p)->Initialize(a)
  121. #define IDP8SimControl_Close(p,a) (p)->Close(a)
  122. #define IDP8SimControl_GetAllParameters(p,a,b,c) (p)->GetAllParameters(p,a,b,c)
  123. #define IDP8SimControl_SetAllParameters(p,a,b,c) (p)->SetAllParameters(p,a,b,c)
  124. #define IDP8SimControl_GetAllStatistics(p,a,b,c) (p)->GetAllStatistics(p,a,b,c)
  125. #define IDP8SimControl_ClearAllStatistics(p,a) (p)->ClearAllStatistics(p,a)
  126. #endif
  127. /****************************************************************************
  128. *
  129. * DP8Sim Control return codes
  130. *
  131. * Errors are represented by negative values and cannot be combined.
  132. *
  133. ****************************************************************************/
  134. #define _DP8SIMH_FACILITY_CODE 0x015
  135. #define _DP8SIMH_HRESULT_BASE 0xE000
  136. #define MAKE_DP8SIMSUCCESS(code) MAKE_HRESULT(0, _DP8SIMH_FACILITY_CODE, (code + _DP8SIMH_HRESULT_BASE))
  137. #define MAKE_DP8SIMFAILURE(code) MAKE_HRESULT(1, _DP8SIMH_FACILITY_CODE, (code + _DP8SIMH_HRESULT_BASE))
  138. #define DP8SIM_OK S_OK
  139. #define DP8SIMERR_ALREADYINITIALIZED MAKE_DP8SIMFAILURE(0x10)
  140. #define DP8SIMERR_GENERIC E_FAIL
  141. #define DP8SIMERR_INVALIDFLAGS MAKE_DP8SIMFAILURE(0x20)
  142. #define DP8SIMERR_INVALIDOBJECT MAKE_DP8SIMFAILURE(0x30)
  143. #define DP8SIMERR_INVALIDPARAM E_INVALIDARG
  144. #define DP8SIMERR_INVALIDPOINTER E_POINTER
  145. #define DP8SIMERR_MISMATCHEDVERSION MAKE_DP8SIMFAILURE(0x40)
  146. #define DP8SIMERR_NOTINITIALIZED MAKE_DP8SIMFAILURE(0x50)
  147. #define DP8SIMERR_OUTOFMEMORY E_OUTOFMEMORY
  148. #ifdef __cplusplus
  149. }
  150. #endif
  151. #endif // __DP8SIM_H__