PageRenderTime 16ms CodeModel.GetById 6ms RepoModel.GetById 0ms app.codeStats 0ms

/binding/win32/qos.d

http://github.com/wilkie/djehuty
D | 228 lines | 60 code | 48 blank | 120 comment | 0 complexity | 28f55abb141b8d235b171357b482b7d2 MD5 | raw file
  1. /*
  2. * qos.d
  3. *
  4. * This module binds Qos.h to D. The original copyright notice
  5. * is preserved below.
  6. *
  7. * Author: Dave Wilkinson
  8. * Originated: November 25th, 2009
  9. *
  10. */
  11. module binding.win32.qos;
  12. import binding.c;
  13. import binding.win32.windef;
  14. import binding.win32.winbase;
  15. import binding.win32.winnt;
  16. /*++
  17. Copyright (c) Microsoft Corporation. All rights reserved.
  18. Module Name:
  19. qos.h - QoS definitions for NDIS components.
  20. Abstract:
  21. This module defines the Quality of Service structures and types used
  22. by Winsock applications.
  23. WARNING:
  24. This api is deprecated and will be removed in a future release of Windows.
  25. Please use the QOS2.h api.
  26. Revision History:
  27. --*/
  28. /*
  29. * Definitions for valued-based Service Type for each direction of data flow.
  30. */
  31. typedef ULONG SERVICETYPE;
  32. const auto SERVICETYPE_NOTRAFFIC = 0x00000000 ; /* No data in this
  33. * direction */
  34. const auto SERVICETYPE_BESTEFFORT = 0x00000001 ; /* Best Effort */
  35. const auto SERVICETYPE_CONTROLLEDLOAD = 0x00000002 ; /* Controlled Load */
  36. const auto SERVICETYPE_GUARANTEED = 0x00000003 ; /* Guaranteed */
  37. const auto SERVICETYPE_NETWORK_UNAVAILABLE = 0x00000004 ; /* Used to notify
  38. * change to user */
  39. const auto SERVICETYPE_GENERAL_INFORMATION = 0x00000005 ; /* corresponds to
  40. * "General Parameters"
  41. * defined by IntServ */
  42. const auto SERVICETYPE_NOCHANGE = 0x00000006 ; /* used to indicate
  43. * that the flow spec
  44. * contains no change
  45. * from any previous
  46. * one */
  47. const auto SERVICETYPE_NONCONFORMING = 0x00000009 ; /* Non-Conforming Traffic */
  48. const auto SERVICETYPE_NETWORK_CONTROL = 0x0000000A ; /* Network Control traffic */
  49. const auto SERVICETYPE_QUALITATIVE = 0x0000000D ; /* Qualitative applications */
  50. /********* The usage of these is currently not supported. ***************/
  51. const auto SERVICE_BESTEFFORT = 0x80010000;
  52. const auto SERVICE_CONTROLLEDLOAD = 0x80020000;
  53. const auto SERVICE_GUARANTEED = 0x80040000;
  54. const auto SERVICE_QUALITATIVE = 0x80200000;
  55. /* **************************** ***** ************************************ */
  56. /*
  57. * Flags to control the usage of RSVP on this flow.
  58. */
  59. /*
  60. * to turn off traffic control, 'OR' ( | ) this flag with the
  61. * ServiceType field in the FLOWSPEC
  62. */
  63. const auto SERVICE_NO_TRAFFIC_CONTROL = 0x81000000;
  64. /*
  65. * this flag can be used to prevent any rsvp signaling messages from being
  66. * sent. Local traffic control will be invoked, but no RSVP Path messages
  67. * will be sent.This flag can also be used in conjunction with a receiving
  68. * flowspec to suppress the automatic generation of a Reserve message.
  69. * The application would receive notification that a Path message had arrived
  70. * and would then need to alter the QOS by issuing WSAIoctl( SIO_SET_QOS ),
  71. * to unset this flag and thereby causing Reserve messages to go out.
  72. */
  73. const auto SERVICE_NO_QOS_SIGNALING = 0x40000000;
  74. /*
  75. * Flow Specifications for each direction of data flow.
  76. */
  77. struct FLOWSPEC {
  78. ULONG TokenRate; /* In Bytes/sec */
  79. ULONG TokenBucketSize; /* In Bytes */
  80. ULONG PeakBandwidth; /* In Bytes/sec */
  81. ULONG Latency; /* In microseconds */
  82. ULONG DelayVariation; /* In microseconds */
  83. SERVICETYPE ServiceType;
  84. ULONG MaxSduSize; /* In Bytes */
  85. ULONG MinimumPolicedSize; /* In Bytes */
  86. }
  87. typedef FLOWSPEC* PFLOWSPEC;
  88. typedef FLOWSPEC* LPFLOWSPEC;
  89. /*
  90. * this value can be used in the FLOWSPEC structure to instruct the Rsvp Service
  91. * provider to derive the appropriate default value for the parameter. Note
  92. * that not all values in the FLOWSPEC structure can be defaults. In the
  93. * ReceivingFlowspec, all parameters can be defaulted except the ServiceType.
  94. * In the SendingFlowspec, the MaxSduSize and MinimumPolicedSize can be
  95. * defaulted. Other defaults may be possible. Refer to the appropriate
  96. * documentation.
  97. */
  98. const auto QOS_NOT_SPECIFIED = 0xFFFFFFFF;
  99. /*
  100. * define a value that can be used for the PeakBandwidth, which will map into
  101. * positive infinity when the FLOWSPEC is converted into IntServ floating point
  102. * format. We can't use (-1) because that value was previously defined to mean
  103. * "select the default".
  104. */
  105. const auto POSITIVE_INFINITY_RATE = 0xFFFFFFFE;
  106. /*
  107. * the provider specific structure can have a number of objects in it.
  108. * Each next structure in the
  109. * ProviderSpecific will be the QOS_OBJECT_HDR struct that prefaces the actual
  110. * data with a type and length for that object. This QOS_OBJECT struct can
  111. * repeat several times if there are several objects. This list of objects
  112. * terminates either when the buffer length has been reached ( WSABUF ) or
  113. * an object of type QOS_END_OF_LIST is encountered.
  114. */
  115. struct QOS_OBJECT_HDR {
  116. ULONG ObjectType;
  117. ULONG ObjectLength; /* the length of object buffer INCLUDING
  118. * this header */
  119. }
  120. typedef QOS_OBJECT_HDR* LPQOS_OBJECT_HDR;
  121. /*
  122. * general QOS objects start at this offset from the base and have a range
  123. * of 1000
  124. */
  125. const auto QOS_GENERAL_ID_BASE =2000;
  126. const auto QOS_OBJECT_END_OF_LIST = (0x00000001 + QOS_GENERAL_ID_BASE) ;
  127. /* QOS_End_of_list structure passed */
  128. const auto QOS_OBJECT_SD_MODE = (0x00000002 + QOS_GENERAL_ID_BASE) ;
  129. /* QOS_ShapeDiscard structure passed */
  130. const auto QOS_OBJECT_SHAPING_RATE= (0x00000003 + QOS_GENERAL_ID_BASE);
  131. /* QOS_ShapingRate structure */
  132. const auto QOS_OBJECT_DESTADDR= (0x00000004 + QOS_GENERAL_ID_BASE);
  133. /* QOS_DestAddr structure (defined in qossp.h) */
  134. /*
  135. * This structure is used to define the behaviour that the traffic
  136. * control packet shaper will apply to the flow.
  137. *
  138. * TC_NONCONF_BORROW - the flow will receive resources remaining
  139. * after all higher priority flows have been serviced. If a
  140. * TokenRate is specified, packets may be non-conforming and
  141. * will be demoted to less than best-effort priority.
  142. *
  143. * TC_NONCONF_SHAPE - TokenRate must be specified. Non-conforming
  144. * packets will be retianed in the packet shaper until they become
  145. * conforming.
  146. *
  147. * TC_NONCONF_DISCARD - TokenRate must be specified. Non-conforming
  148. * packets will be discarded.
  149. *
  150. */
  151. struct QOS_SD_MODE {
  152. QOS_OBJECT_HDR ObjectHdr;
  153. ULONG ShapeDiscardMode;
  154. }
  155. typedef QOS_SD_MODE* LPQOS_SD_MODE;
  156. const auto TC_NONCONF_BORROW = 0;
  157. const auto TC_NONCONF_SHAPE = 1;
  158. const auto TC_NONCONF_DISCARD = 2;
  159. const auto TC_NONCONF_BORROW_PLUS = 3 ; // Not supported currently
  160. /*
  161. * This structure allows an app to specify a prorated "average token rate" using by
  162. * the traffic shaper under SHAPE modehaper queue. It is expressed in bytes per sec.
  163. *
  164. * ShapingRate (bytes per sec.)
  165. *
  166. */
  167. struct QOS_SHAPING_RATE {
  168. QOS_OBJECT_HDR ObjectHdr;
  169. ULONG ShapingRate;
  170. }
  171. typedef QOS_SHAPING_RATE* LPQOS_SHAPING_RATE;