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.

251 lines
7.4 KiB

  1. /*
  2. - QOS.H
  3. -
  4. * Microsoft NetMeeting
  5. * Quality of Service DLL
  6. * Header file
  7. *
  8. * Revision History:
  9. *
  10. * When Who What
  11. * -------- ------------------ ---------------------------------------
  12. * 10.23.96 Yoram Yaacovi Created
  13. *
  14. */
  15. #ifndef _NMQOS_H_
  16. #define _NMQOS_H_
  17. #include <pshpack8.h> /* Assume 8 byte packing throughout */
  18. /*
  19. * Constants
  20. */
  21. // Properties stuff
  22. // Property types
  23. #define PT_NULL ((ULONG) 1) /* NULL property value */
  24. #define PT_I2 ((ULONG) 2) /* Signed 16-bit value */
  25. #define PT_LONG ((ULONG) 3) /* Signed 32-bit value */
  26. #define PT_BOOLEAN ((ULONG) 11) /* 16-bit boolean (non-zero true) */
  27. #define PT_STRING8 ((ULONG) 30) /* Null terminated 8-bit character string */
  28. #define PT_UNICODE ((ULONG) 31) /* Null terminated Unicode string */
  29. #define PT_CLSID ((ULONG) 72) /* OLE GUID */
  30. #define PT_BINARY ((ULONG) 258) /* Uninterpreted (counted byte array) */
  31. // Property IDs
  32. #define QOS_PROPERTY_BASE 0x3000
  33. #define PR_QOS_WINDOW_HANDLE PROPERTY_TAG( PT_LONG, QOS_PROPERTY_BASE+1)
  34. // hresult codes, facility QOS = 0x300
  35. #define QOS_E_RES_NOT_ENOUGH_UNITS 0x83000001
  36. #define QOS_E_RES_NOT_AVAILABLE 0x83000002
  37. #define QOS_E_NO_SUCH_REQUEST 0x83000003
  38. #define QOS_E_NO_SUCH_RESOURCE 0x83000004
  39. #define QOS_E_NO_SUCH_CLIENT 0x83000005
  40. #define QOS_E_REQ_ERRORS 0x83000006
  41. #define QOS_W_MAX_UNITS_EXCEEDED 0x03000007
  42. #define QOS_E_INTERNAL_ERROR 0x83000008
  43. #define QOS_E_NO_SUCH_PROPERTY 0x83000100
  44. // Resource IDs
  45. #define RESOURCE_NULL 0
  46. #define RESOURCE_OUTGOING_BANDWIDTH 1 /* units: bps */
  47. #define RESOURCE_INCOMING_BANDWIDTH 2 /* units: bps */
  48. #define RESOURCE_OUTGOING_LATENCY 3 /* units: */
  49. #define RESOURCE_INCOMING_LATENCY 4 /* units: */
  50. #define RESOURCE_CPU_CYCLES 10 /* units: */
  51. #define QOS_CLIENT_NAME_ZISE 20
  52. // For use as dimension for variable size arrays
  53. #define VARIABLE_DIM 1
  54. /*
  55. * Macros
  56. */
  57. #define PROPERTY_TYPE_MASK ((ULONG)0x0000FFFF) /* Mask for Property type */
  58. #define PROPERTY_TYPE(ulPropTag) (((ULONG)(ulPropTag))&PROPERTY_TYPE_MASK)
  59. #define PROPERTY_ID(ulPropTag) (((ULONG)(ulPropTag))>>16)
  60. #define PROPERTY_TAG(ulPropType,ulPropID) ((((ULONG)(ulPropID))<<16)|((ULONG)(ulPropType)))
  61. #ifndef GUARANTEE
  62. // this used to be defined in the original winsock2.h
  63. typedef enum
  64. {
  65. BestEffortService,
  66. ControlledLoadService,
  67. PredictiveService,
  68. GuaranteedDelayService,
  69. GuaranteedService
  70. } GUARANTEE;
  71. #endif
  72. /*
  73. * Data Structures
  74. */
  75. // Properties part
  76. typedef struct _binaryvalue
  77. {
  78. ULONG cb;
  79. LPBYTE lpb;
  80. } BINARYVALUE, *PBINARYVALUE;
  81. typedef union _propvalue
  82. {
  83. short int i; /* case PT_I2 */
  84. LONG l; /* case PT_LONG */
  85. ULONG_PTR ul; /* alias for PT_LONG */
  86. unsigned short int b; /* case PT_BOOLEAN */
  87. LPSTR lpszA; /* case PT_STRING8 */
  88. BINARYVALUE bin; /* case PT_BINARY */
  89. LPWSTR lpszW; /* case PT_UNICODE */
  90. LPGUID lpguid; /* case PT_CLSID */
  91. } PROPVALUE;
  92. typedef struct _property
  93. {
  94. ULONG ulPropTag;
  95. ULONG hResult;
  96. union _propvalue Value;
  97. } PROPERTY, *PPROPERTY;
  98. typedef struct _proptagarray
  99. {
  100. ULONG cValues;
  101. ULONG aulPropTag[VARIABLE_DIM];
  102. } PROPTAGARRAY, *PPROPTAGARRAY;
  103. // QoS part
  104. typedef struct _resource
  105. {
  106. DWORD resourceID;
  107. DWORD ulResourceFlags; /* 0 in NetMeeting 2.0 */
  108. int nUnits; /* Total units of the resource */
  109. DWORD reserved; /* Must be 0 */
  110. } RESOURCE, *LPRESOURCE;
  111. typedef struct _resourcerequest
  112. {
  113. DWORD resourceID;
  114. DWORD ulRequestFlags; /* 0 in NetMeeting 2.0 */
  115. GUARANTEE levelOfGuarantee; /* Guaranteed, Predictive */
  116. int nUnitsMin; /* # of units to reserve */
  117. int nUnitsMax; /* 0 in NetMeeting 2.0 */
  118. SOCKET socket; /* Socket where the */
  119. /* reservation will be used */
  120. HRESULT hResult; /* result code for this resource */
  121. DWORD reserved; /* Must be 0 */
  122. } RESOURCEREQUEST, *LPRESOURCEREQUEST;
  123. typedef struct _resourcelist
  124. {
  125. ULONG cResources;
  126. RESOURCE aResources[VARIABLE_DIM];
  127. } RESOURCELIST, *LPRESOURCELIST;
  128. typedef struct _resourcerequestlist
  129. {
  130. ULONG cRequests;
  131. RESOURCEREQUEST aRequests[VARIABLE_DIM];
  132. } RESOURCEREQUESTLIST, *LPRESOURCEREQUESTLIST;
  133. typedef struct _client
  134. {
  135. GUID guidClientGUID;
  136. int priority; /* 1 highest, 9 lowest, 0 invalid */
  137. WCHAR wszName[QOS_CLIENT_NAME_ZISE]; /* name of the client */
  138. DWORD reserved; /* Must be 0 */
  139. } CLIENT, *LPCLIENT;
  140. typedef struct _clientlist
  141. {
  142. ULONG cClients;
  143. CLIENT aClients[VARIABLE_DIM];
  144. } CLIENTLIST, *LPCLIENTLIST;
  145. /*
  146. * Functions
  147. */
  148. typedef HRESULT (CALLBACK *LPFNQOSNOTIFY)
  149. (LPRESOURCEREQUESTLIST lpResourceRequestList,
  150. DWORD_PTR dwParam);
  151. /*
  152. * Interfaces
  153. */
  154. #ifndef DECLARE_INTERFACE_PTR
  155. #ifdef __cplusplus
  156. #define DECLARE_INTERFACE_PTR(iface, piface) \
  157. interface iface; typedef iface FAR * piface
  158. #else
  159. #define DECLARE_INTERFACE_PTR(iface, piface) \
  160. typedef interface iface iface, FAR * piface
  161. #endif
  162. #endif /* DECLARE_INTERFACE_PTR */
  163. #define IUNKNOWN_METHODS(IPURE) \
  164. STDMETHOD (QueryInterface) \
  165. (THIS_ REFIID riid, LPVOID FAR * ppvObj) IPURE; \
  166. STDMETHOD_(ULONG,AddRef) (THIS) IPURE; \
  167. STDMETHOD_(ULONG,Release) (THIS) IPURE; \
  168. #define IQOS_METHODS(IPURE) \
  169. STDMETHOD(RequestResources) \
  170. (THIS_ LPGUID lpStreamGUID, \
  171. LPRESOURCEREQUESTLIST lpResourceRequestList, \
  172. LPFNQOSNOTIFY lpfnQoSNotify, \
  173. DWORD_PTR dwParam) IPURE; \
  174. STDMETHOD (ReleaseResources) \
  175. (THIS_ LPGUID lpStreamGUID, \
  176. LPRESOURCEREQUESTLIST lpResourceRequestList) IPURE; \
  177. STDMETHOD (SetResources) (THIS_ LPRESOURCELIST lpResourceList) IPURE; \
  178. STDMETHOD (GetResources) (THIS_ LPRESOURCELIST *lppResourceList) IPURE; \
  179. STDMETHOD (SetClients) (THIS_ LPCLIENTLIST lpClientList) IPURE; \
  180. STDMETHOD (NotifyNow) (THIS) IPURE; \
  181. STDMETHOD (FreeBuffer) (THIS_ LPVOID lpBuffer) IPURE; \
  182. #define IPROP_METHODS(IPURE) \
  183. STDMETHOD (SetProps) \
  184. (THIS_ ULONG cValues, \
  185. PPROPERTY pPropArray) IPURE; \
  186. STDMETHOD (GetProps) \
  187. (THIS_ PPROPTAGARRAY pPropTagArray, \
  188. ULONG ulFlags, \
  189. ULONG *pcValues, \
  190. PPROPERTY *ppPropArray) IPURE; \
  191. #undef INTERFACE
  192. #define INTERFACE IQoS
  193. DECLARE_INTERFACE_(IQoS, IUnknown)
  194. {
  195. IUNKNOWN_METHODS(PURE)
  196. IQOS_METHODS(PURE)
  197. IPROP_METHODS(PURE)
  198. };
  199. DECLARE_INTERFACE_PTR(IQoS, LPIQOS);
  200. EXTERN_C HRESULT WINAPI CreateQoS ( IUnknown *punkOuter,
  201. REFIID riid,
  202. void **ppv);
  203. typedef HRESULT (WINAPI *PFNCREATEQOS)
  204. (IUnknown *punkOuter, REFIID riid, void **ppv);
  205. // QoS Class GUID
  206. // {085C06A0-3CAA-11d0-A00E-00A024A85A2C}
  207. DEFINE_GUID(CLSID_QoS, 0x085c06a0, 0x3caa, 0x11d0, 0xa0, 0x0e, 0x0, 0xa0, 0x24, 0xa8, 0x5a, 0x2c);
  208. // QoS Interface GUID
  209. // {DFC1F900-2DCE-11d0-92DD-00A0C922E6B2}
  210. DEFINE_GUID(IID_IQoS, 0xdfc1f900, 0x2dce, 0x11d0, 0x92, 0xdd, 0x0, 0xa0, 0xc9, 0x22, 0xe6, 0xb2);
  211. #include <poppack.h> /* End byte packing */
  212. #endif // _NMQOS_H_
  213.