qos.inc 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  1. {
  2. $Id$
  3. This file is part of the Free Pascal run time library.
  4. This unit contains the declarations for the WinSock2
  5. Socket Library for Netware and Win32
  6. Copyright (c) 1999-2002 by the Free Pascal development team
  7. See the file COPYING.FPC, included in this distribution,
  8. for details about the copyright.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  12. **********************************************************************}
  13. { This module defines the Quality of Service structures and types used
  14. by Winsock applications. }
  15. {
  16. Definitions for valued-based Service Type for each direction of data flow.
  17. }
  18. type
  19. SERVICETYPE = u_long;
  20. { No data in this direction }
  21. const
  22. SERVICETYPE_NOTRAFFIC = $00000000;
  23. { Best Effort }
  24. SERVICETYPE_BESTEFFORT = $00000001;
  25. { Controlled Load }
  26. SERVICETYPE_CONTROLLEDLOAD = $00000002;
  27. { Guaranteed }
  28. SERVICETYPE_GUARANTEED = $00000003;
  29. { Used to notify
  30. change to user }
  31. SERVICETYPE_NETWORK_UNAVAILABLE = $00000004;
  32. { corresponds to
  33. "General Parameters"
  34. defined by IntServ }
  35. SERVICETYPE_GENERAL_INFORMATION = $00000005;
  36. { used to indicate
  37. that the flow spec
  38. contains no change
  39. from any previous
  40. one }
  41. SERVICETYPE_NOCHANGE = $00000006;
  42. { Non-Conforming Traffic }
  43. SERVICETYPE_NONCONFORMING = $00000009;
  44. { Custom ServiceType 1 }
  45. SERVICETYPE_CUSTOM1 = $0000000A;
  46. { Custom ServiceType 2 }
  47. SERVICETYPE_CUSTOM2 = $0000000B;
  48. { Custom ServiceType 3 }
  49. SERVICETYPE_CUSTOM3 = $0000000C;
  50. { Custom ServiceType 4 }
  51. SERVICETYPE_CUSTOM4 = $0000000D;
  52. {
  53. Definitions for bitmap-based Service Type for each direction of data flow.
  54. }
  55. SERVICE_BESTEFFORT = $80020000;
  56. SERVICE_CONTROLLEDLOAD = $80040000;
  57. SERVICE_GUARANTEED = $80080000;
  58. SERVICE_CUSTOM1 = $80100000;
  59. SERVICE_CUSTOM2 = $80200000;
  60. SERVICE_CUSTOM3 = $80400000;
  61. SERVICE_CUSTOM4 = $80800000;
  62. {
  63. Number of available Service Types.
  64. }
  65. NUM_SERVICETYPES = 8;
  66. {
  67. to turn on immediate traffic control, OR ( | ) this flag with the
  68. ServiceType field in the FLOWSPEC
  69. }
  70. { #define SERVICE_IMMEDIATE_TRAFFIC_CONTROL 0x80000000 // obsolete }
  71. SERVICE_NO_TRAFFIC_CONTROL = $81000000;
  72. {
  73. this flag can be used with the immediate traffic control flag above to
  74. prevent any rsvp signaling messages from being sent. Local traffic
  75. control will be invoked, but no RSVP Path messages will be sent.This flag
  76. can also be used in conjunction with a receiving flowspec to suppress
  77. the automatic generation of a Reserve message. The application would
  78. receive notification that a Path message had arrived and would then need
  79. to alter the QOS by issuing WSAIoctl( SIO_SET_QOS ), to unset this flag
  80. and thereby cause Reserve messages to go out.
  81. }
  82. SERVICE_NO_QOS_SIGNALING = $40000000;
  83. { rsvp status code }
  84. STATUS_QOS_RELEASED = $10101010;
  85. {
  86. Flow Specifications for each direction of data flow.
  87. }
  88. { In Bytes/sec }
  89. { In Bytes }
  90. { In Bytes/sec }
  91. { In microseconds }
  92. { In microseconds }
  93. { In Bytes }
  94. { In Bytes }
  95. type
  96. Tflowspec = record
  97. TokenRate : u_long;
  98. TokenBucketSize : u_long;
  99. PeakBandwidth : u_long;
  100. Latency : u_long;
  101. DelayVariation : u_long;
  102. ServiceType : SERVICETYPE;
  103. MaxSduSize : u_long;
  104. MinimumPolicedSize : u_long;
  105. end;
  106. PFLOWSPEC = ^Tflowspec;
  107. LPFLOWSPEC = ^Tflowspec;
  108. {
  109. this value can be used in the FLOWSPEC structure to instruct the Rsvp Service
  110. provider to derive the appropriate default value for the parameter. Note
  111. that not all values in the FLOWSPEC structure can be defaults. In the
  112. ReceivingFlowspec, all parameters can be defaulted except the ServiceType.
  113. In the SendingFlowspec, the MaxSduSize and MinimumPolicedSize can be
  114. defaulted. Other defaults may be possible. Refer to the appropriate
  115. documentation.
  116. }
  117. const
  118. QOS_NOT_SPECIFIED = $FFFFFFFF;
  119. NULL_QOS_TYPE = $FFFFFFFD;
  120. {
  121. define a value that can be used for the PeakBandwidth, which will map into
  122. positive infinity when the FLOWSPEC is converted into IntServ floating point
  123. format. We can't use (-1) because that value was previously defined to mean
  124. "select the default".
  125. }
  126. POSITIVE_INFINITY_RATE = $FFFFFFFE;
  127. {
  128. the provider specific structure can have a number of objects in it.
  129. Each next structure in the
  130. ProviderSpecific will be the QOS_OBJECT_HDR struct that prefaces the actual
  131. data with a type and length for that object. This QOS_OBJECT struct can
  132. repeat several times if there are several objects. This list of objects
  133. terminates either when the buffer length has been reached ( WSABUF ) or
  134. an object of type QOS_END_OF_LIST is encountered.
  135. }
  136. { the length of object buffer INCLUDING
  137. this header }
  138. type
  139. TQOS_OBJECT_HDR = record
  140. ObjectType : u_long;
  141. ObjectLength : u_long;
  142. end;
  143. LPQOS_OBJECT_HDR = ^TQOS_OBJECT_HDR;
  144. PQOS_OBJECT_HDR = ^TQOS_OBJECT_HDR;
  145. {
  146. general QOS objects start at this offset from the base and have a range
  147. of 1000
  148. }
  149. const
  150. QOS_GENERAL_ID_BASE = 2000;
  151. QOS_OBJECT_PRIORITY = $00000000 + QOS_GENERAL_ID_BASE;
  152. { QOS_PRIORITY structure passed }
  153. QOS_OBJECT_END_OF_LIST = $00000001 + QOS_GENERAL_ID_BASE;
  154. { QOS_End_of_list structure passed }
  155. QOS_OBJECT_SD_MODE = $00000002 + QOS_GENERAL_ID_BASE;
  156. { QOS_ShapeDiscard structure passed }
  157. QOS_OBJECT_TRAFFIC_CLASS = $00000003 + QOS_GENERAL_ID_BASE;
  158. { QOS_Traffic class structure passed }
  159. QOS_OBJECT_DESTADDR = $00000004 + QOS_GENERAL_ID_BASE;
  160. { QOS_DestAddr structure }
  161. QOS_OBJECT_SHAPER_QUEUE_DROP_MODE = $00000005 + QOS_GENERAL_ID_BASE;
  162. { QOS_ShaperQueueDropMode structure }
  163. QOS_OBJECT_SHAPER_QUEUE_LIMIT = $00000006 + QOS_GENERAL_ID_BASE;
  164. { QOS_ShaperQueueLimit structure }
  165. {
  166. This structure defines the absolute priorty of the flow. Priorities in the
  167. range of 0-7 are currently defined. Receive Priority is not currently used,
  168. but may at some point in the future.
  169. }
  170. { this gets mapped to layer 2 priority. }
  171. { there are none currently defined. }
  172. { this could be used to decide who
  173. gets forwarded up the stack first
  174. - not used now }
  175. type
  176. TQOS_PRIORITY = record
  177. ObjectHdr : TQOS_OBJECT_HDR;
  178. SendPriority : u_char;
  179. SendFlags : u_char;
  180. ReceivePriority : u_char;
  181. Unused : u_char;
  182. end;
  183. LPQOS_PRIORITY = ^TQOS_PRIORITY;
  184. PQOS_PRIORITY = ^TQOS_PRIORITY;
  185. {
  186. This structure is used to define the behaviour that the traffic
  187. control packet shaper will apply to the flow.
  188. PS_NONCONF_BORROW - the flow will receive resources remaining
  189. after all higher priority flows have been serviced. If a
  190. TokenRate is specified, packets may be non-conforming and
  191. will be demoted to less than best-effort priority.
  192. PS_NONCONF_SHAPE - TokenRate must be specified. Non-conforming
  193. packets will be retianed in the packet shaper until they become
  194. conforming.
  195. PS_NONCONF_DISCARD - TokenRate must be specified. Non-conforming
  196. packets will be discarded.
  197. }
  198. TQOS_SD_MODE = record
  199. ObjectHdr : TQOS_OBJECT_HDR;
  200. ShapeDiscardMode : u_long;
  201. end;
  202. LPQOS_SD_MODE = ^TQOS_SD_MODE;
  203. PQOS_SD_MODE = ^TQOS_SD_MODE;
  204. const
  205. TC_NONCONF_BORROW = 0;
  206. TC_NONCONF_SHAPE = 1;
  207. TC_NONCONF_DISCARD = 2;
  208. TC_NONCONF_BORROW_PLUS = 3;
  209. {
  210. This structure may carry an 802.1 TrafficClass parameter which
  211. has been provided to the host by a layer 2 network, for example,
  212. in an 802.1 extended RSVP RESV message. If this object is obtained
  213. from the network, hosts will stamp the MAC headers of corresponding
  214. transmitted packets, with the value in the object. Otherwise, hosts
  215. may select a value based on the standard Intserv mapping of
  216. ServiceType to 802.1 TrafficClass.
  217. }
  218. type
  219. TQOS_TRAFFIC_CLASS = record
  220. ObjectHdr : TQOS_OBJECT_HDR;
  221. TrafficClass : u_long;
  222. end;
  223. LPQOS_TRAFFIC_CLASS = ^TQOS_TRAFFIC_CLASS;
  224. PQOS_TRAFFIC_CLASS = ^TQOS_TRAFFIC_CLASS;
  225. {
  226. This structure allows overriding of the default schema used to drop
  227. packets when a flow's shaper queue limit is reached.
  228. DropMethod -
  229. QOS_SHAPER_DROP_FROM_HEAD - Drop packets from
  230. the head of the queue until the new packet can be
  231. accepted into the shaper under the current limit. This
  232. behavior is the default.
  233. QOS_SHAPER_DROP_INCOMING - Drop the incoming,
  234. limit-offending packet.
  235. }
  236. TQOS_SHAPER_QUEUE_LIMIT_DROP_MODE = record
  237. ObjectHdr : TQOS_OBJECT_HDR;
  238. DropMode : u_long;
  239. end;
  240. LPQOS_SHAPER_QUEUE_LIMIT_DROP_MODE = ^TQOS_SHAPER_QUEUE_LIMIT_DROP_MODE;
  241. PQOS_SHAPER_QUEUE_LIMIT_DROP_MODE = ^TQOS_SHAPER_QUEUE_LIMIT_DROP_MODE;
  242. const
  243. QOS_SHAPER_DROP_INCOMING = 0;
  244. QOS_SHAPER_DROP_FROM_HEAD = 1;
  245. { This structure allows the default per-flow limit on the shaper queue
  246. size to be overridden.
  247. QueueSizeLimit - Limit, in bytes, of the size of the shaper queue }
  248. type
  249. TQOS_SHAPER_QUEUE_LIMIT = record
  250. ObjectHdr : TQOS_OBJECT_HDR;
  251. QueueSizeLimit : u_long;
  252. end;
  253. LPQOS_SHAPER_QUEUE_LIMIT = ^TQOS_SHAPER_QUEUE_LIMIT;
  254. PQOS_SHAPER_QUEUE_LIMIT = ^TQOS_SHAPER_QUEUE_LIMIT;
  255. {
  256. $Log:
  257. }