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