home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 2000 May / PCP163A.iso / Runimage / Cbuilder4 / Include / QOS.H < prev    next >
Encoding:
C/C++ Source or Header  |  1999-01-26  |  16.4 KB  |  489 lines

  1. /*++
  2.  
  3. Copyright 1997 - 1998 Microsoft Corporation
  4.  
  5. Module Name:
  6.  
  7.     qos.h - QoS definitions for NDIS components.
  8.  
  9. Abstract:
  10.  
  11.     This module defines the Quality of Service structures and types used
  12.     by Winsock applications.
  13.  
  14. Revision History:
  15.  
  16. --*/
  17.  
  18. #ifndef __QOS_H_
  19. #pragma option push -b -a8 -pc -A- /*P_O_Push_S*/
  20. #define __QOS_H_
  21.  
  22.  
  23. /*
  24.  *  Definitions for Service Type for each direction of data flow.
  25.  */
  26. typedef ULONG   SERVICETYPE;
  27. #define SERVICETYPE_NOTRAFFIC               0x00000000  /* No data in this
  28.                                                          * direction */
  29. #define SERVICETYPE_BESTEFFORT              0x00000001  /* Best Effort */
  30. #define SERVICETYPE_CONTROLLEDLOAD          0x00000002  /* Controlled Load */
  31. #define SERVICETYPE_GUARANTEED              0x00000003  /* Guaranteed */
  32. #define SERVICETYPE_NETWORK_UNAVAILABLE     0x00000004  /* Used to notify 
  33.                                                          * change to user */
  34. #define SERVICETYPE_GENERAL_INFORMATION     0x00000005  /* corresponds to 
  35.                                                          * "General Parameters"
  36.                                                          * defined by IntServ */
  37. #define SERVICETYPE_NOCHANGE                0x00000006  /* used to indicate
  38.                                                          * that the flow spec
  39.                                                          * contains no change
  40.                                                          * from any previous
  41.                                                          * one */
  42.  
  43. /*
  44.  * to turn on immediate traffic control, OR ( | ) this flag with the 
  45.  * ServiceType field in the FLOWSPEC
  46.  */
  47. #define SERVICE_IMMEDIATE_TRAFFIC_CONTROL   0x80000000
  48.  
  49. /*
  50.  * this flag can be used with the immediate traffic control flag above to
  51.  * prevent any rsvp signaling messages from being sent. Local traffic 
  52.  * control will be invoked, but no RSVP Path messages will be sent.This flag
  53.  * can also be used in conjunction with a receiving flowspec to suppress 
  54.  * the automatic generation of a Reserve message.  The application would 
  55.  * receive notification that a Path  message had arrived and would then need
  56.  * to alter the QOS by issuing WSAIoctl( SIO_SET_QOS ), to unset this flag 
  57.  * and thereby cause Reserve messages to go out.
  58.  */
  59. #define SERVICE_NO_QOS_SIGNALING   0x40000000
  60.  
  61. /*
  62.  *  Flow Specifications for each direction of data flow.
  63.  */
  64. typedef struct _flowspec
  65. {
  66.     ULONG       TokenRate;              /* In Bytes/sec */
  67.     ULONG       TokenBucketSize;        /* In Bytes */
  68.     ULONG       PeakBandwidth;          /* In Bytes/sec */
  69.     ULONG       Latency;                /* In microseconds */
  70.     ULONG       DelayVariation;         /* In microseconds */
  71.     SERVICETYPE ServiceType;
  72.     ULONG       MaxSduSize;             /* In Bytes */
  73.     ULONG       MinimumPolicedSize;     /* In Bytes */
  74.  
  75. } FLOWSPEC, *PFLOWSPEC, * LPFLOWSPEC;
  76.  
  77. /*
  78.  * the provider specific structure can have a number of objects in it.
  79.  * Each next structure in the
  80.  * ProviderSpecific will be the QOS_OBJECT_HDR struct that prefaces the actual
  81.  * data with a type and length for that object.  This QOS_OBJECT struct can 
  82.  * repeat several times if there are several objects.  This list of objects
  83.  * terminates either when the buffer length has been reached ( WSABUF ) or
  84.  * an object of type QOS_END_OF_LIST is encountered.
  85.  */
  86.  
  87. /*
  88.  * define the type of objects that can go into the ProviderSpecific buffer 
  89.  * in the QOS structure
  90.  */
  91.  
  92. typedef struct  {
  93.  
  94.     ULONG   ObjectType;
  95.     ULONG   ObjectLength;  /* the length of object buffer INCLUDING 
  96.                             * this header */
  97.  
  98. } QOS_OBJECT_HDR, *LPQOS_OBJECT_HDR;
  99.  
  100. /*
  101.  * Definition of object Types
  102.  *
  103.  *
  104.  * define the values for ObjectType above - RSVP Objects ids start at an 
  105.  * offset from zero to allow for ATM objects that might be defined in the 
  106.  * lower number range.
  107.  */
  108. #define   RSVP_OBJECT_ID_BASE         1000
  109. #define   RSVP_OBJECT_STATUS_INFO     (0x00000000 + RSVP_OBJECT_ID_BASE)
  110.           /* RSVP_STATUS_INFO structure passed */
  111. #define   RSVP_OBJECT_RESERVE_INFO    (0x00000001 + RSVP_OBJECT_ID_BASE)
  112.           /* RSVP_RESERVE_INFO structure passed */
  113. #define   RSVP_OBJECT_ADSPEC          (0x00000002 + RSVP_OBJECT_ID_BASE)
  114.           /* RSVP_ADSPEC structure passed */
  115.  
  116. /*
  117.  * general QOS objects start at this offset from the base and have a range 
  118.  * of 1000
  119.  */
  120. #define   QOS_GENERAL_ID_BASE         2000
  121. #define   QOS_OBJECT_PRIORITY         (0x00000000 + QOS_GENERAL_ID_BASE)
  122.           /* QOS_PRIORITY structure passed */
  123. #define   QOS_OBJECT_END_OF_LIST      (0x00000001 + QOS_GENERAL_ID_BASE) 
  124.           /* QOS_End_of_list structure passed */
  125. #define   QOS_OBJECT_SD_MODE          (0x00000002 + QOS_GENERAL_ID_BASE) 
  126.           /* QOS_ShapeDiscard structure passed */
  127. #define   QOS_OBJECT_TRAFFIC_CLASS    (0x00000003 + QOS_GENERAL_ID_BASE) 
  128.           /* QOS_Traffic class structure passed */
  129.  
  130. /*
  131.  * this value can be used in the FLOWSPEC structure to instruct the Rsvp Service 
  132.  * provider to derive the appropriate default value for the parameter.  Note 
  133.  * that not all values in the FLOWSPEC structure can be defaults. In the
  134.  * ReceivingFlowspec, all parameters can be defaulted except the ServiceType.  
  135.  * In the SendingFlowspec, the MaxSduSize and MinimumPolicedSize can be
  136.  * defaulted. Other defaults may be possible. Refer to the appropriate
  137.  * documentation.
  138.  */
  139. #define QOS_NOT_SPECIFIED     0xFFFFFFFF
  140.  
  141. /*
  142.  * define a value that can be used for the PeakBandwidth, which will map into 
  143.  * positive infinity when the FLOWSPEC is converted into IntServ floating point 
  144.  * format.  We can't use (-1) because that value was previously defined to mean
  145.  * "select the default".
  146.  */
  147. #define   POSITIVE_INFINITY_RATE     0xFFFFFFFE
  148.  
  149. /* 
  150.  * IPV6 addressing for RSVP FILTERSPECS
  151.  */
  152. typedef union _IN_ADDR_IPV4 {
  153.  
  154.     ULONG  Addr;
  155.     UCHAR  AddrBytes[4];
  156.  
  157. } IN_ADDR_IPV4, *LPIN_ADDR_IPV4;
  158.  
  159. /*
  160.  * IPV6 addressing for RSVP FILTERSPECS
  161.  */
  162. typedef struct _IN_ADDR_IPV6 {
  163.  
  164.     UCHAR  Addr[16];               //IPV6 address
  165.  
  166. } IN_ADDR_IPV6, *LPIN_ADDR_IPV6;
  167.  
  168. typedef const IN_ADDR_IPV6  *LPCIN_ADDR_IPV6;
  169.  
  170. /*
  171.  * IPV4 addressing for RSVP FILTERSPECS
  172.  */
  173. typedef struct _RSVP_FILTERSPEC_V4 {
  174.  
  175.     IN_ADDR_IPV4    Address;
  176.     USHORT          Unused;
  177.     USHORT          Port;
  178.  
  179. } RSVP_FILTERSPEC_V4, *LPRSVP_FILTERSPEC_V4;
  180.  
  181. typedef struct _RSVP_FILTERSPEC_V6 {
  182.  
  183.     IN_ADDR_IPV6    Address;
  184.     USHORT          UnUsed;
  185.     USHORT          Port;
  186.  
  187. } RSVP_FILTERSPEC_V6, *LPRSVP_FILTERSPEC_V6;
  188.  
  189.  
  190. typedef struct _RSVP_FILTERSPEC_V6_FLOW {
  191.  
  192.     IN_ADDR_IPV6    Address;
  193.     UCHAR           UnUsed;
  194.     UCHAR           FlowLabel[3];
  195.  
  196. } RSVP_FILTERSPEC_V6_FLOW, *LPRSVP_FILTERSPEC_V6_FLOW;
  197.  
  198. typedef struct _RSVP_FILTERSPEC_V4_GPI {
  199.  
  200.     IN_ADDR_IPV4    Address;
  201.     ULONG           GeneralPortId;
  202.  
  203. } RSVP_FILTERSPEC_V4_GPI, *LPRSVP_FILTERSPEC_V4_GPI;
  204.  
  205. typedef struct _RSVP_FILTERSPEC_V6_GPI {
  206.  
  207.     IN_ADDR_IPV6    Address;
  208.     ULONG           GeneralPortId;
  209.  
  210. } RSVP_FILTERSPEC_V6_GPI, *LPRSVP_FILTERSPEC_V6_GPI;
  211.  
  212.  
  213. /*
  214.  * FILTERSPEC TYPES used in making reservations.
  215.  */
  216. typedef enum {
  217.  
  218.         FILTERSPECV4 = 1,
  219.         FILTERSPECV6,
  220.         FILTERSPECV6_FLOW,
  221.         FILTERSPECV4_GPI,
  222.         FILTERSPECV6_GPI,
  223.         FILTERSPEC_END
  224.  
  225. } FilterType;
  226.  
  227. typedef struct _RSVP_FILTERSPEC {
  228.  
  229.     FilterType   Type;
  230.  
  231.     union {
  232.         RSVP_FILTERSPEC_V4      FilterSpecV4;
  233.         RSVP_FILTERSPEC_V6      FilterSpecV6;
  234.         RSVP_FILTERSPEC_V6_FLOW FilterSpecV6Flow;
  235.         RSVP_FILTERSPEC_V4_GPI  FilterSpecV4Gpi;
  236.         RSVP_FILTERSPEC_V6_GPI  FilterSpecV6Gpi;
  237.     };
  238.  
  239. } RSVP_FILTERSPEC, *LPRSVP_FILTERSPEC;
  240.  
  241. /*
  242.  * FLOWDESCRIPTOR Structure used for specifying one or more
  243.  * Filters per Flowspec.
  244.  */
  245. typedef struct _FLOWDESCRIPTOR {
  246.  
  247.     FLOWSPEC            FlowSpec;
  248.     ULONG               NumFilters;
  249.     LPRSVP_FILTERSPEC   FilterList;
  250.  
  251. } FLOWDESCRIPTOR, *LPFLOWDESCRIPTOR;
  252.  
  253. /*
  254.  * RSVP_POLICY contains undefined policy data.  RSVP transports this
  255.  * data on behalf of the Policy Control component.
  256.  */
  257. typedef struct _RSVP_POLICY {
  258.  
  259.     HANDLE       Type;              /* Pointer to structure: TBD */
  260.  
  261. } RSVP_POLICY, *LPRSVP_POLICY;
  262.  
  263. typedef const RSVP_POLICY *LPCRSVP_POLICY;
  264.  
  265.  
  266. /*
  267.  * RSVP_RESERVE_INFO Structure used for storing RSVP specific
  268.  * information for fine tuning interaction via the Winsock2
  269.  * Generic QoS API via the provider specific buffer. This structure
  270.  * includes the QOS_OBJECT_HDR structure directly
  271.  */
  272.  
  273. typedef struct _RSVP_RESERVE_INFO {
  274.  
  275.     QOS_OBJECT_HDR      ObjectHdr;            /* type and length of this object */
  276.     ULONG               Style;                /* RSVP Style (FF,WF,SE) */
  277.     ULONG               ConfirmRequest;       /* Non Zero for Confirm Request */
  278.     LPRSVP_POLICY       Policy;               /* Optional policy data */
  279.     ULONG               NumFlowDesc;          /* Number of FlowDesc */
  280.     LPFLOWDESCRIPTOR    FlowDescList;         /* FlowDesc list */
  281.  
  282. } RSVP_RESERVE_INFO, *LPRSVP_RESERVE_INFO;
  283.  
  284. typedef const RSVP_RESERVE_INFO *LPCRSVP_RESERVE_INFO;
  285.  
  286. /*
  287.  * definitions for the ulStyle in the previous structure
  288.  */
  289. #define RSVP_WILDCARD_STYLE           0x00000001
  290. #define RSVP_FIXED_FILTER_STYLE       0x00000002
  291. #define RSVP_SHARED_EXPLICIT_STYLE    0x00000003
  292.  
  293. /*
  294.  * RSVP_STATUS_INFO Structure used for storing RSVP specific
  295.  * error of status indications.  This also serves as a header
  296.  * for additional objects in the provider specific buffer when
  297.  * interacting via Winsock2 Generic QoS API. This structure includes
  298.  * the QOS_OBJECT_COUNT and QOS_OBJECT_HDR structures directly It is
  299.  * expected to be the first structure in the provider specific structure
  300.  * since it includes the QOS_OBJECT_COUNT
  301.  */
  302.  
  303. typedef struct _RSVP_STATUS_INFO {
  304.  
  305.     QOS_OBJECT_HDR      ObjectHdr;      /* Object Hdr */
  306.     ULONG               StatusCode;     /* Error or Status Information see 
  307.                                          * Winsock2.h */
  308.     ULONG               ExtendedStatus1;/* Provider specific status extension */
  309.     ULONG               ExtendedStatus2;/* Provider specific status extension */
  310.  
  311. } RSVP_STATUS_INFO, *LPRSVP_STATUS_INFO;
  312.  
  313. typedef const RSVP_STATUS_INFO *LPCRSVP_STATUS_INFO;
  314.  
  315. /*
  316.  * This structure defines the absolute priorty of the flow.  Priorities in the 
  317.  * range of 0-7 are currently defined. Receive Priority is not currently used, 
  318.  * but may at some point in the future.
  319.  */
  320. typedef struct _QOS_PRIORITY {
  321.  
  322.     QOS_OBJECT_HDR  ObjectHdr;
  323.     UCHAR           SendPriority;     /* this gets mapped to layer 2 priority.*/
  324.     UCHAR           SendFlags;        /* there are none currently defined.*/
  325.     UCHAR           ReceivePriority;  /* this could be used to decide who 
  326.                                        * gets forwarded up the stack first 
  327.                                        * - not used now */
  328.     UCHAR           Unused;
  329.  
  330. } QOS_PRIORITY, *LPQOS_PRIORITY;
  331.  
  332.  
  333. /*
  334.  * This structure is used to define the behaviour that the traffic
  335.  * control packet shaper will apply to the flow.
  336.  *
  337.  * PS_NONCONF_BORROW - the flow will receive resources remaining 
  338.  *  after all higher priority flows have been serviced. If a 
  339.  *  TokenRate is specified, packets may be non-conforming and
  340.  *  will be demoted to less than best-effort priority.
  341.  *  
  342.  * PS_NONCONF_SHAPE - TokenRate must be specified. Non-conforming
  343.  *  packets will be retianed in the packet shaper until they become
  344.  *  conforming.
  345.  *
  346.  * PS_NONCONF_DISCARD - TokenRate must be specified. Non-conforming
  347.  *  packets will be discarded.
  348.  *
  349.  */
  350.  
  351.  
  352. typedef struct _QOS_SD_MODE {
  353.  
  354.     QOS_OBJECT_HDR ObjectHdr;
  355.     ULONG   ShapeDiscardMode;
  356.  
  357. } QOS_SD_MODE, *LPQOS_SD_MODE;
  358.  
  359. #define TC_NONCONF_BORROW   0
  360. #define TC_NONCONF_SHAPE    1
  361. #define TC_NONCONF_DISCARD  2
  362.  
  363. /*
  364.  * This structure may carry an 802.1 TrafficClass parameter which 
  365.  * has been provided to the host by a layer 2 network, for example, 
  366.  * in an 802.1 extended RSVP RESV message. If this object is obtained
  367.  * from the network, hosts will stamp the MAC headers of corresponding
  368.  * transmitted packets, with the value in the object. Otherwise, hosts
  369.  * may select a value based on the standard Intserv mapping of 
  370.  * ServiceType to 802.1 TrafficClass.
  371.  *
  372.  */
  373.  
  374. typedef struct _QOS_TRAFFIC_CLASS {
  375.  
  376.     QOS_OBJECT_HDR ObjectHdr;
  377.     ULONG   TrafficClass;
  378.  
  379. } QOS_TRAFFIC_CLASS, *LPQOS_TRAFFIC_CLASS;
  380.  
  381. /*
  382.  * this structure defines the "General Characterization Parameters" contained in
  383.  * the RSVP Adspec object
  384.  */
  385. typedef struct _AD_GENERAL_PARAMS{
  386.  
  387.     ULONG       IntServAwareHopCount;   /* number of hops that conform to
  388.                                          * Integrated Services requirements */
  389.     ULONG       PathBandwidthEstimate;  /* minimum bandwidth available from 
  390.                                          * sender to receiver */
  391.     ULONG       MinimumLatency;         /* sum of minimum latency of the packet
  392.                                          * forwarding process in routers 
  393.                                          * (in usec)*/
  394.     ULONG       PathMTU;                /* max transmission unit end to end that
  395.                                          * will not incur fragmentation */
  396.     ULONG       Flags;                  /* used to hold break bits.*/
  397.  
  398. } AD_GENERAL_PARAMS, *LPAD_GENERAL_PARAMS;
  399.  
  400. /*
  401.  * Minimum Latency may be set to this "undefined" value
  402.  */
  403. #define INDETERMINATE_LATENCY   0xFFFFFFFF;
  404.  
  405. /*
  406.  * This Flag is used to indicate the existence of a network element not 
  407.  * supporting  QoS control services somewhere in the data path. If this bit 
  408.  * is set in the specific service override then it indicates that that
  409.  * service was not supported at at least one hop.
  410.  */
  411. #define AD_FLAG_BREAK_BIT    0x00000001
  412.  
  413. /*
  414.  * this structure describes the Guaranteed service parameters
  415.  */
  416. typedef struct _AD_GUARANTEED {
  417.  
  418.     ULONG       CTotal;
  419.     ULONG       DTotal;
  420.     ULONG       CSum;
  421.     ULONG       DSum;
  422.  
  423. } AD_GUARANTEED, *LPAD_GUARANTEED;
  424.  
  425. /*
  426.  * this structure describes the format of the parameter buffer that can be
  427.  * included in the Service_Type structure below.  This structure allows an
  428.  * application to include any valid Int Serv service parameter in the Buffer 
  429.  * value, after providing the Int Serv parameter id in the ParameterId field.
  430.  */
  431. typedef struct _PARAM_BUFFER {
  432.  
  433.     ULONG   ParameterId;    /* Int Server parameter ID */
  434.     ULONG   Length;         /* total length of this structure 
  435.                              * ( 8 bytes + length of Buffer ) */
  436.     UCHAR   Buffer[1];      /* Paramter itself */
  437.  
  438. } PARAM_BUFFER, *LPPARAM_BUFFER;
  439.  
  440. /*
  441.  * this structure contains the service types supported
  442.  */
  443. typedef struct _CONTROL_SERVICE {
  444.  
  445.     /*
  446.      * the length of this entire structure including the following buffer.  
  447.      * This length value can be added to the ptr to the structure to get the ptr
  448.      * to the next SERVICE_TYPE structure in the list, until the
  449.      * NumberOfServices count has been exhausted.
  450.      */
  451.     ULONG               Length;
  452.  
  453.     SERVICETYPE         Service;
  454.     AD_GENERAL_PARAMS   Overrides;
  455.  
  456.     /*
  457.      * service specific information ( controlled load has no service specific 
  458.      * info here )
  459.      */
  460.     union {
  461.         AD_GUARANTEED   Guaranteed;
  462.         PARAM_BUFFER    ParamBuffer[1];     /* allows for other services down 
  463.                                              * the road */
  464.     };
  465.  
  466. } CONTROL_SERVICE, *LPCONTROL_SERVICE;
  467.  
  468. /*
  469.  * This structure defines the information which is carried in the Rsvp 
  470.  * Adspec.  This Rsvp object typically indicates which service types are 
  471.  * available ( Controlled Load and/or Guaranteed Service ), if a non-Rsvp
  472.  * hop has been encountered by the Path message, and the minumum MTU along 
  473.  * the path. The services array indicates which services are supported
  474.  */
  475. typedef struct _RSVP_ADSPEC  {
  476.  
  477.     QOS_OBJECT_HDR     ObjectHdr;
  478.     AD_GENERAL_PARAMS  GeneralParams;      /* contains the general 
  479.                                             * characterization paramters */
  480.     ULONG              NumberOfServices;   /* count of the number of services */
  481.     CONTROL_SERVICE    Services[1];        /* a list of the services 
  482.                                             * supported/requested */
  483.  
  484. } RSVP_ADSPEC, *LPRSVP_ADSPEC;
  485.  
  486.  
  487. #pragma option pop /*P_O_Pop*/
  488. #endif  /* __QOS_H_ */
  489.