jwaqos.pas 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. {******************************************************************************}
  2. { }
  3. { Winsock2 Quality Of Service API interface Unit for Object Pascal }
  4. { }
  5. { Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft }
  6. { Corporation. All Rights Reserved. }
  7. { }
  8. { The original file is: qos.h, released June 2000. The original Pascal }
  9. { code is: Qos.pas, released December 2000. The initial developer of the }
  10. { Pascal code is Marcel van Brakel (brakelm att chello dott nl). }
  11. { }
  12. { Portions created by Marcel van Brakel are Copyright (C) 1999-2001 }
  13. { Marcel van Brakel. All Rights Reserved. }
  14. { }
  15. { Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI) }
  16. { }
  17. { You may retrieve the latest version of this file at the Project JEDI }
  18. { APILIB home page, located at http://jedi-apilib.sourceforge.net }
  19. { }
  20. { The contents of this file are used with permission, subject to the Mozilla }
  21. { Public License Version 1.1 (the "License"); you may not use this file except }
  22. { in compliance with the License. You may obtain a copy of the License at }
  23. { http://www.mozilla.org/MPL/MPL-1.1.html }
  24. { }
  25. { Software distributed under the License is distributed on an "AS IS" basis, }
  26. { WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
  27. { the specific language governing rights and limitations under the License. }
  28. { }
  29. { Alternatively, the contents of this file may be used under the terms of the }
  30. { GNU Lesser General Public License (the "LGPL License"), in which case the }
  31. { provisions of the LGPL License are applicable instead of those above. }
  32. { If you wish to allow use of your version of this file only under the terms }
  33. { of the LGPL License and not to allow others to use your version of this file }
  34. { under the MPL, indicate your decision by deleting the provisions above and }
  35. { replace them with the notice and other provisions required by the LGPL }
  36. { License. If you do not delete the provisions above, a recipient may use }
  37. { your version of this file under either the MPL or the LGPL License. }
  38. { }
  39. { For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
  40. { }
  41. {******************************************************************************}
  42. // $Id: JwaQos.pas,v 1.7 2005/09/03 14:27:48 marquardt Exp $
  43. unit JwaQos;
  44. {$WEAKPACKAGEUNIT}
  45. {$HPPEMIT ''}
  46. {$HPPEMIT '#include "qos.h"'}
  47. {$HPPEMIT ''}
  48. {$I jediapilib.inc}
  49. interface
  50. uses
  51. JwaWindows;
  52. type
  53. ULONG = Cardinal;
  54. {$NODEFINE ULONG}
  55. //
  56. // Definitions for valued-based Service Type for each direction of data flow.
  57. //
  58. type
  59. SERVICETYPE = ULONG;
  60. {$EXTERNALSYM SERVICETYPE}
  61. TServiceType = SERVICETYPE;
  62. PServiceType = ^TServiceType;
  63. const
  64. SERVICETYPE_NOTRAFFIC = $00000000; // No data in this direction
  65. {$EXTERNALSYM SERVICETYPE_NOTRAFFIC}
  66. SERVICETYPE_BESTEFFORT = $00000001; // Best Effort
  67. {$EXTERNALSYM SERVICETYPE_BESTEFFORT}
  68. SERVICETYPE_CONTROLLEDLOAD = $00000002; // Controlled Load
  69. {$EXTERNALSYM SERVICETYPE_CONTROLLEDLOAD}
  70. SERVICETYPE_GUARANTEED = $00000003; // Guaranteed
  71. {$EXTERNALSYM SERVICETYPE_GUARANTEED}
  72. SERVICETYPE_NETWORK_UNAVAILABLE = $00000004; // Used to notify change to user
  73. {$EXTERNALSYM SERVICETYPE_NETWORK_UNAVAILABLE}
  74. SERVICETYPE_GENERAL_INFORMATION = $00000005; // corresponds to "General Parameters" defined by IntServ
  75. {$EXTERNALSYM SERVICETYPE_GENERAL_INFORMATION}
  76. SERVICETYPE_NOCHANGE = $00000006; // used to indicate that the flow spec contains no change from any previous one
  77. {$EXTERNALSYM SERVICETYPE_NOCHANGE}
  78. SERVICETYPE_NONCONFORMING = $00000009; // Non-Conforming Traffic
  79. {$EXTERNALSYM SERVICETYPE_NONCONFORMING}
  80. SERVICETYPE_NETWORK_CONTROL = $0000000A; // Network Control traffic
  81. {$EXTERNALSYM SERVICETYPE_NETWORK_CONTROL}
  82. SERVICETYPE_QUALITATIVE = $0000000D; // Qualitative applications
  83. {$EXTERNALSYM SERVICETYPE_QUALITATIVE}
  84. // ********* The usage of these is currently not supported. ***************
  85. SERVICE_BESTEFFORT = DWORD($80010000);
  86. {$EXTERNALSYM SERVICE_BESTEFFORT}
  87. SERVICE_CONTROLLEDLOAD = DWORD($80020000);
  88. {$EXTERNALSYM SERVICE_CONTROLLEDLOAD}
  89. SERVICE_GUARANTEED = DWORD($80040000);
  90. {$EXTERNALSYM SERVICE_GUARANTEED}
  91. SERVICE_QUALITATIVE = DWORD($80200000);
  92. {$EXTERNALSYM SERVICE_QUALITATIVE}
  93. // ***************************** ***** ************************************
  94. //
  95. // Flags to control the usage of RSVP on this flow.
  96. //
  97. //
  98. // to turn off traffic control, 'OR' ( | ) this flag with the
  99. // ServiceType field in the FLOWSPEC
  100. //
  101. SERVICE_NO_TRAFFIC_CONTROL = DWORD($81000000);
  102. {$EXTERNALSYM SERVICE_NO_TRAFFIC_CONTROL}
  103. //
  104. // this flag can be used to prevent any rsvp signaling messages from being
  105. // sent. Local traffic control will be invoked, but no RSVP Path messages
  106. // will be sent.This flag can also be used in conjunction with a receiving
  107. // flowspec to suppress the automatic generation of a Reserve message.
  108. // The application would receive notification that a Path message had arrived
  109. // and would then need to alter the QOS by issuing WSAIoctl( SIO_SET_QOS ),
  110. // to unset this flag and thereby causing Reserve messages to go out.
  111. //
  112. SERVICE_NO_QOS_SIGNALING = $40000000;
  113. {$EXTERNALSYM SERVICE_NO_QOS_SIGNALING}
  114. //
  115. // Flow Specifications for each direction of data flow.
  116. //
  117. type
  118. _flowspec = record
  119. TokenRate: ULONG; // In Bytes/sec
  120. TokenBucketSize: ULONG; // In Bytes
  121. PeakBandwidth: ULONG; // In Bytes/sec
  122. Latency: ULONG; // In microseconds
  123. DelayVariation: ULONG; // In microseconds
  124. ServiceType: SERVICETYPE;
  125. MaxSduSize: ULONG; // In Bytes
  126. MinimumPolicedSize: ULONG; // In Bytes
  127. end;
  128. {$EXTERNALSYM _flowspec}
  129. FLOWSPEC = _flowspec;
  130. {$EXTERNALSYM FLOWSPEC}
  131. PFLOWSPEC = ^FLOWSPEC;
  132. {$EXTERNALSYM PFLOWSPEC}
  133. LPFLOWSPEC = ^FLOWSPEC;
  134. {$EXTERNALSYM LPFLOWSPEC}
  135. TFlowSpec = FLOWSPEC;
  136. //
  137. // this value can be used in the FLOWSPEC structure to instruct the Rsvp Service
  138. // provider to derive the appropriate default value for the parameter. Note
  139. // that not all values in the FLOWSPEC structure can be defaults. In the
  140. // ReceivingFlowspec, all parameters can be defaulted except the ServiceType.
  141. // In the SendingFlowspec, the MaxSduSize and MinimumPolicedSize can be
  142. // defaulted. Other defaults may be possible. Refer to the appropriate
  143. // documentation.
  144. //
  145. const
  146. QOS_NOT_SPECIFIED = DWORD($FFFFFFFF);
  147. {$EXTERNALSYM QOS_NOT_SPECIFIED}
  148. //
  149. // define a value that can be used for the PeakBandwidth, which will map into
  150. // positive infinity when the FLOWSPEC is converted into IntServ floating point
  151. // format. We can't use (-1) because that value was previously defined to mean
  152. // "select the default".
  153. //
  154. POSITIVE_INFINITY_RATE = DWORD($FFFFFFFE);
  155. {$EXTERNALSYM POSITIVE_INFINITY_RATE}
  156. //
  157. // the provider specific structure can have a number of objects in it.
  158. // Each next structure in the
  159. // ProviderSpecific will be the QOS_OBJECT_HDR struct that prefaces the actual
  160. // data with a type and length for that object. This QOS_OBJECT struct can
  161. // repeat several times if there are several objects. This list of objects
  162. // terminates either when the buffer length has been reached ( WSABUF ) or
  163. // an object of type QOS_END_OF_LIST is encountered.
  164. //
  165. type
  166. QOS_OBJECT_HDR = record
  167. ObjectType: ULONG;
  168. ObjectLength: ULONG; // the length of object buffer INCLUDING this header
  169. end;
  170. {$EXTERNALSYM QOS_OBJECT_HDR}
  171. LPQOS_OBJECT_HDR = ^QOS_OBJECT_HDR;
  172. {$EXTERNALSYM LPQOS_OBJECT_HDR}
  173. TQOSObjectHdr = QOS_OBJECT_HDR;
  174. PQOSObjectHdr = LPQOS_OBJECT_HDR;
  175. //
  176. // general QOS objects start at this offset from the base and have a range
  177. // of 1000
  178. //
  179. const
  180. QOS_GENERAL_ID_BASE = 2000;
  181. {$EXTERNALSYM QOS_GENERAL_ID_BASE}
  182. QOS_OBJECT_END_OF_LIST = $00000001 + QOS_GENERAL_ID_BASE; // QOS_End_of_list structure passed
  183. {$EXTERNALSYM QOS_OBJECT_END_OF_LIST}
  184. QOS_OBJECT_SD_MODE = $00000002 + QOS_GENERAL_ID_BASE; // QOS_ShapeDiscard structure passed
  185. {$EXTERNALSYM QOS_OBJECT_SD_MODE}
  186. QOS_OBJECT_SHAPING_RATE = $00000003 + QOS_GENERAL_ID_BASE; // QOS_ShapingRate structure
  187. {$EXTERNALSYM QOS_OBJECT_SHAPING_RATE}
  188. QOS_OBJECT_DESTADDR = $00000004 + QOS_GENERAL_ID_BASE; // QOS_DestAddr structure (defined in qossp.h)
  189. {$EXTERNALSYM QOS_OBJECT_DESTADDR}
  190. //
  191. // This structure is used to define the behaviour that the traffic
  192. // control packet shaper will apply to the flow.
  193. //
  194. // TC_NONCONF_BORROW - the flow will receive resources remaining
  195. // after all higher priority flows have been serviced. If a
  196. // TokenRate is specified, packets may be non-conforming and
  197. // will be demoted to less than best-effort priority.
  198. //
  199. // TC_NONCONF_SHAPE - TokenRate must be specified. Non-conforming
  200. // packets will be retianed in the packet shaper until they become
  201. // conforming.
  202. //
  203. // TC_NONCONF_DISCARD - TokenRate must be specified. Non-conforming
  204. // packets will be discarded.
  205. //
  206. type
  207. _QOS_SD_MODE = record
  208. ObjectHdr: QOS_OBJECT_HDR;
  209. ShapeDiscardMode: ULONG;
  210. end;
  211. {$EXTERNALSYM _QOS_SD_MODE}
  212. QOS_SD_MODE = _QOS_SD_MODE;
  213. {$EXTERNALSYM QOS_SD_MODE}
  214. LPQOS_SD_MODE = ^QOS_SD_MODE;
  215. {$EXTERNALSYM LPQOS_SD_MODE}
  216. TQOSSDMode = QOS_SD_MODE;
  217. PQOSSDMode = LPQOS_SD_MODE;
  218. const
  219. TC_NONCONF_BORROW = 0;
  220. {$EXTERNALSYM TC_NONCONF_BORROW}
  221. TC_NONCONF_SHAPE = 1;
  222. {$EXTERNALSYM TC_NONCONF_SHAPE}
  223. TC_NONCONF_DISCARD = 2;
  224. {$EXTERNALSYM TC_NONCONF_DISCARD}
  225. TC_NONCONF_BORROW_PLUS = 3; // not supported currently
  226. {$EXTERNALSYM TC_NONCONF_BORROW_PLUS}
  227. //
  228. // This structure allows an app to specify a prorated "average token rate" using by
  229. // the traffic shaper under SHAPE modehaper queue. It is expressed in bytes per sec.
  230. //
  231. // ShapingRate (bytes per sec.)
  232. //
  233. type
  234. _QOS_SHAPING_RATE = record
  235. ObjectHdr: QOS_OBJECT_HDR;
  236. ShapingRate: ULONG;
  237. end;
  238. {$EXTERNALSYM _QOS_SHAPING_RATE}
  239. QOS_SHAPING_RATE = _QOS_SHAPING_RATE;
  240. {$EXTERNALSYM QOS_SHAPING_RATE}
  241. LPQOS_SHAPING_RATE = ^QOS_SHAPING_RATE;
  242. {$EXTERNALSYM LPQOS_SHAPING_RATE}
  243. TQOSShapingRate = QOS_SHAPING_RATE;
  244. PQOSShapingRate = LPQOS_SHAPING_RATE;
  245. implementation
  246. end.