jwaqos.pas 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  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. unit JwaQos;
  43. {$WEAKPACKAGEUNIT}
  44. {$HPPEMIT ''}
  45. {$HPPEMIT '#include "qos.h"'}
  46. {$HPPEMIT ''}
  47. {$I jediapilib.inc}
  48. interface
  49. uses
  50. JwaWinType;
  51. type
  52. ULONG = Cardinal;
  53. {$NODEFINE ULONG}
  54. //
  55. // Definitions for valued-based Service Type for each direction of data flow.
  56. //
  57. type
  58. SERVICETYPE = ULONG;
  59. {$EXTERNALSYM SERVICETYPE}
  60. TServiceType = SERVICETYPE;
  61. PServiceType = ^TServiceType;
  62. const
  63. SERVICETYPE_NOTRAFFIC = $00000000; // No data in this direction
  64. {$EXTERNALSYM SERVICETYPE_NOTRAFFIC}
  65. SERVICETYPE_BESTEFFORT = $00000001; // Best Effort
  66. {$EXTERNALSYM SERVICETYPE_BESTEFFORT}
  67. SERVICETYPE_CONTROLLEDLOAD = $00000002; // Controlled Load
  68. {$EXTERNALSYM SERVICETYPE_CONTROLLEDLOAD}
  69. SERVICETYPE_GUARANTEED = $00000003; // Guaranteed
  70. {$EXTERNALSYM SERVICETYPE_GUARANTEED}
  71. SERVICETYPE_NETWORK_UNAVAILABLE = $00000004; // Used to notify change to user
  72. {$EXTERNALSYM SERVICETYPE_NETWORK_UNAVAILABLE}
  73. SERVICETYPE_GENERAL_INFORMATION = $00000005; // corresponds to "General Parameters" defined by IntServ
  74. {$EXTERNALSYM SERVICETYPE_GENERAL_INFORMATION}
  75. SERVICETYPE_NOCHANGE = $00000006; // used to indicate that the flow spec contains no change from any previous one
  76. {$EXTERNALSYM SERVICETYPE_NOCHANGE}
  77. SERVICETYPE_NONCONFORMING = $00000009; // Non-Conforming Traffic
  78. {$EXTERNALSYM SERVICETYPE_NONCONFORMING}
  79. SERVICETYPE_NETWORK_CONTROL = $0000000A; // Network Control traffic
  80. {$EXTERNALSYM SERVICETYPE_NETWORK_CONTROL}
  81. SERVICETYPE_QUALITATIVE = $0000000D; // Qualitative applications
  82. {$EXTERNALSYM SERVICETYPE_QUALITATIVE}
  83. // ********* The usage of these is currently not supported. ***************
  84. SERVICE_BESTEFFORT = DWORD($80010000);
  85. {$EXTERNALSYM SERVICE_BESTEFFORT}
  86. SERVICE_CONTROLLEDLOAD = DWORD($80020000);
  87. {$EXTERNALSYM SERVICE_CONTROLLEDLOAD}
  88. SERVICE_GUARANTEED = DWORD($80040000);
  89. {$EXTERNALSYM SERVICE_GUARANTEED}
  90. SERVICE_QUALITATIVE = DWORD($80200000);
  91. {$EXTERNALSYM SERVICE_QUALITATIVE}
  92. // ***************************** ***** ************************************
  93. //
  94. // Flags to control the usage of RSVP on this flow.
  95. //
  96. //
  97. // to turn off traffic control, 'OR' ( | ) this flag with the
  98. // ServiceType field in the FLOWSPEC
  99. //
  100. SERVICE_NO_TRAFFIC_CONTROL = DWORD($81000000);
  101. {$EXTERNALSYM SERVICE_NO_TRAFFIC_CONTROL}
  102. //
  103. // this flag can be used to prevent any rsvp signaling messages from being
  104. // sent. Local traffic control will be invoked, but no RSVP Path messages
  105. // will be sent.This flag can also be used in conjunction with a receiving
  106. // flowspec to suppress the automatic generation of a Reserve message.
  107. // The application would receive notification that a Path message had arrived
  108. // and would then need to alter the QOS by issuing WSAIoctl( SIO_SET_QOS ),
  109. // to unset this flag and thereby causing Reserve messages to go out.
  110. //
  111. SERVICE_NO_QOS_SIGNALING = $40000000;
  112. {$EXTERNALSYM SERVICE_NO_QOS_SIGNALING}
  113. //
  114. // Flow Specifications for each direction of data flow.
  115. //
  116. type
  117. _flowspec = record
  118. TokenRate: ULONG; // In Bytes/sec
  119. TokenBucketSize: ULONG; // In Bytes
  120. PeakBandwidth: ULONG; // In Bytes/sec
  121. Latency: ULONG; // In microseconds
  122. DelayVariation: ULONG; // In microseconds
  123. ServiceType: SERVICETYPE;
  124. MaxSduSize: ULONG; // In Bytes
  125. MinimumPolicedSize: ULONG; // In Bytes
  126. end;
  127. {$EXTERNALSYM _flowspec}
  128. FLOWSPEC = _flowspec;
  129. {$EXTERNALSYM FLOWSPEC}
  130. PFLOWSPEC = ^FLOWSPEC;
  131. {$EXTERNALSYM PFLOWSPEC}
  132. LPFLOWSPEC = ^FLOWSPEC;
  133. {$EXTERNALSYM LPFLOWSPEC}
  134. TFlowSpec = FLOWSPEC;
  135. //
  136. // this value can be used in the FLOWSPEC structure to instruct the Rsvp Service
  137. // provider to derive the appropriate default value for the parameter. Note
  138. // that not all values in the FLOWSPEC structure can be defaults. In the
  139. // ReceivingFlowspec, all parameters can be defaulted except the ServiceType.
  140. // In the SendingFlowspec, the MaxSduSize and MinimumPolicedSize can be
  141. // defaulted. Other defaults may be possible. Refer to the appropriate
  142. // documentation.
  143. //
  144. const
  145. QOS_NOT_SPECIFIED = DWORD($FFFFFFFF);
  146. {$EXTERNALSYM QOS_NOT_SPECIFIED}
  147. //
  148. // define a value that can be used for the PeakBandwidth, which will map into
  149. // positive infinity when the FLOWSPEC is converted into IntServ floating point
  150. // format. We can't use (-1) because that value was previously defined to mean
  151. // "select the default".
  152. //
  153. POSITIVE_INFINITY_RATE = DWORD($FFFFFFFE);
  154. {$EXTERNALSYM POSITIVE_INFINITY_RATE}
  155. //
  156. // the provider specific structure can have a number of objects in it.
  157. // Each next structure in the
  158. // ProviderSpecific will be the QOS_OBJECT_HDR struct that prefaces the actual
  159. // data with a type and length for that object. This QOS_OBJECT struct can
  160. // repeat several times if there are several objects. This list of objects
  161. // terminates either when the buffer length has been reached ( WSABUF ) or
  162. // an object of type QOS_END_OF_LIST is encountered.
  163. //
  164. type
  165. QOS_OBJECT_HDR = record
  166. ObjectType: ULONG;
  167. ObjectLength: ULONG; // the length of object buffer INCLUDING this header
  168. end;
  169. {$EXTERNALSYM QOS_OBJECT_HDR}
  170. LPQOS_OBJECT_HDR = ^QOS_OBJECT_HDR;
  171. {$EXTERNALSYM LPQOS_OBJECT_HDR}
  172. TQOSObjectHdr = QOS_OBJECT_HDR;
  173. PQOSObjectHdr = LPQOS_OBJECT_HDR;
  174. //
  175. // general QOS objects start at this offset from the base and have a range
  176. // of 1000
  177. //
  178. const
  179. QOS_GENERAL_ID_BASE = 2000;
  180. {$EXTERNALSYM QOS_GENERAL_ID_BASE}
  181. QOS_OBJECT_END_OF_LIST = $00000001 + QOS_GENERAL_ID_BASE; // QOS_End_of_list structure passed
  182. {$EXTERNALSYM QOS_OBJECT_END_OF_LIST}
  183. QOS_OBJECT_SD_MODE = $00000002 + QOS_GENERAL_ID_BASE; // QOS_ShapeDiscard structure passed
  184. {$EXTERNALSYM QOS_OBJECT_SD_MODE}
  185. QOS_OBJECT_SHAPING_RATE = $00000003 + QOS_GENERAL_ID_BASE; // QOS_ShapingRate structure
  186. {$EXTERNALSYM QOS_OBJECT_SHAPING_RATE}
  187. QOS_OBJECT_DESTADDR = $00000004 + QOS_GENERAL_ID_BASE; // QOS_DestAddr structure (defined in qossp.h)
  188. {$EXTERNALSYM QOS_OBJECT_DESTADDR}
  189. //
  190. // This structure is used to define the behaviour that the traffic
  191. // control packet shaper will apply to the flow.
  192. //
  193. // TC_NONCONF_BORROW - the flow will receive resources remaining
  194. // after all higher priority flows have been serviced. If a
  195. // TokenRate is specified, packets may be non-conforming and
  196. // will be demoted to less than best-effort priority.
  197. //
  198. // TC_NONCONF_SHAPE - TokenRate must be specified. Non-conforming
  199. // packets will be retianed in the packet shaper until they become
  200. // conforming.
  201. //
  202. // TC_NONCONF_DISCARD - TokenRate must be specified. Non-conforming
  203. // packets will be discarded.
  204. //
  205. type
  206. _QOS_SD_MODE = record
  207. ObjectHdr: QOS_OBJECT_HDR;
  208. ShapeDiscardMode: ULONG;
  209. end;
  210. {$EXTERNALSYM _QOS_SD_MODE}
  211. QOS_SD_MODE = _QOS_SD_MODE;
  212. {$EXTERNALSYM QOS_SD_MODE}
  213. LPQOS_SD_MODE = ^QOS_SD_MODE;
  214. {$EXTERNALSYM LPQOS_SD_MODE}
  215. TQOSSDMode = QOS_SD_MODE;
  216. PQOSSDMode = LPQOS_SD_MODE;
  217. const
  218. TC_NONCONF_BORROW = 0;
  219. {$EXTERNALSYM TC_NONCONF_BORROW}
  220. TC_NONCONF_SHAPE = 1;
  221. {$EXTERNALSYM TC_NONCONF_SHAPE}
  222. TC_NONCONF_DISCARD = 2;
  223. {$EXTERNALSYM TC_NONCONF_DISCARD}
  224. TC_NONCONF_BORROW_PLUS = 3; // not supported currently
  225. {$EXTERNALSYM TC_NONCONF_BORROW_PLUS}
  226. //
  227. // This structure allows an app to specify a prorated "average token rate" using by
  228. // the traffic shaper under SHAPE modehaper queue. It is expressed in bytes per sec.
  229. //
  230. // ShapingRate (bytes per sec.)
  231. //
  232. type
  233. _QOS_SHAPING_RATE = record
  234. ObjectHdr: QOS_OBJECT_HDR;
  235. ShapingRate: ULONG;
  236. end;
  237. {$EXTERNALSYM _QOS_SHAPING_RATE}
  238. QOS_SHAPING_RATE = _QOS_SHAPING_RATE;
  239. {$EXTERNALSYM QOS_SHAPING_RATE}
  240. LPQOS_SHAPING_RATE = ^QOS_SHAPING_RATE;
  241. {$EXTERNALSYM LPQOS_SHAPING_RATE}
  242. TQOSShapingRate = QOS_SHAPING_RATE;
  243. PQOSShapingRate = LPQOS_SHAPING_RATE;
  244. implementation
  245. end.