qos.inc 10 KB

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