namespace Vanara.PInvoke;
/// Items from Qwave.dll.
public static partial class Qwave
{
private const int QOS_MAX_OBJECT_STRING_LENGTH = 256;
///
/// The QOS_DIFFSERV traffic control object is used to specify filters for the packet scheduler when it operates in Differentiated
/// Services Mode.
///
///
/// The QOS_DIFFSERV object is used to specify the set of Diffserv rules that apply to the specified flow, all of which are
/// specified in the DiffservRule member. Each Diffserv rule has an InboundDSField value, which signifies the DSCP on the Inbound
/// packet. The Diffserv Rules also have OutboundDSCP and UserPriority values for conforming and nonconforming packets. These indicate
/// the DSCP and 802.1p values that go out on the forwarded packet. Note that the DSCP or UserPriority mapping based on ServiceType or
/// QOS_DS_CLASS or QOS_TRAFFIC_CLASS is not used in this mode.
///
// https://learn.microsoft.com/en-us/windows/win32/api/qosobjs/ns-qosobjs-qos_diffserv typedef struct _QOS_DIFFSERV { QOS_OBJECT_HDR
// ObjectHdr; ULONG DSFieldCount; UCHAR DiffservRule[1]; } QOS_DIFFSERV, *LPQOS_DIFFSERV;
[PInvokeData("qosobjs.h", MSDNShortId = "NS:qosobjs._QOS_DIFFSERV")]
[VanaraMarshaler(typeof(SafeAnysizeStructMarshaler), nameof(DSFieldCount))]
[StructLayout(LayoutKind.Sequential)]
public struct QOS_DIFFSERV : IQoSObjectHdr
{
/// The QOS object QOS_OBJECT_HDR. The object type for this traffic control object should be QOS_OBJECT_DIFFSERV.
public QOS_OBJECT_HDR ObjectHdr;
/// Number of Diffserv Rules in this object.
public uint DSFieldCount;
/// Array of QOS_DIFFSERV_RULE structures.
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)]
public byte[] DiffservRule;
}
///
/// The QOS_DIFFSERV_RULE structure is used in conjunction with the traffic control object QOS_DIFFSERV to provide Diffserv rules
/// for a given flow.
///
// https://learn.microsoft.com/en-us/windows/win32/api/qosobjs/ns-qosobjs-qos_diffserv_rule typedef struct _QOS_DIFFSERV_RULE { UCHAR
// InboundDSField; UCHAR ConformingOutboundDSField; UCHAR NonConformingOutboundDSField; UCHAR ConformingUserPriority; UCHAR
// NonConformingUserPriority; } QOS_DIFFSERV_RULE, *LPQOS_DIFFSERV_RULE;
[PInvokeData("qosobjs.h", MSDNShortId = "NS:qosobjs._QOS_DIFFSERV_RULE")]
[StructLayout(LayoutKind.Sequential)]
public struct QOS_DIFFSERV_RULE
{
///
///
/// Diffserv code point (DSCP) on the inbound packet. InboundDSField must be unique for the interface, otherwise the flow
/// addition will fail.
///
/// Valid range is 0x00 - 0x3F.
///
public byte InboundDSField;
///
///
/// Diffserv code point (DSCP) marked on all conforming packets on the flow. This member can be used to remark the packet before it
/// is forwarded.
///
/// Valid range is 0x00 - 0x3F.
///
public byte ConformingOutboundDSField;
///
///
/// Diffserv code point (DSCP) marked on all nonconforming packets on the flow. This member can be used to remark the packet before
/// it is forwarded.
///
/// Valid range is 0x00 - 0x3F.
///
public byte NonConformingOutboundDSField;
///
///
/// UserPriority value marked on all conforming packets on the flow. This member can be used to remark the packet before it is forwarded.
///
/// Valid range is 0-7
///
public byte ConformingUserPriority;
///
///
/// UserPriority value marked on all nonconforming packets on the flow. This member can be used to remark the packet before it is forwarded.
///
/// Valid range is 0-7
///
public byte NonConformingUserPriority;
}
///
/// The traffic control object QOS_DS_CLASS enables application developers to override the default Diffserv code point (DSCP)
/// value for the IP packets associated with a given flow. By default, the DSCP value is derived from the flow's ServiceType.
///
// https://learn.microsoft.com/en-us/windows/win32/api/qosobjs/ns-qosobjs-qos_ds_class typedef struct _QOS_DS_CLASS { QOS_OBJECT_HDR
// ObjectHdr; ULONG DSField; } QOS_DS_CLASS, *LPQOS_DS_CLASS;
[PInvokeData("qosobjs.h", MSDNShortId = "NS:qosobjs._QOS_DS_CLASS")]
[StructLayout(LayoutKind.Sequential)]
public struct QOS_DS_CLASS : IQoSObjectHdr
{
/// The QOS object QOS_OBJECT_HDR. The object type for this traffic control object should be QOS_OBJECT_DS_CLASS.
public QOS_OBJECT_HDR ObjectHdr;
///
///
/// User priority value for the flow. The valid range is 0x00 through 0x3F. The following settings are chosen (by default) when the
/// QOS_DS_CLASS traffic control object is not used.
///
///
///
/// Value
/// Meaning
///
/// -
/// 0
/// ServiceTypeBestEffort, ServiceTypeQualitative
///
/// -
/// 0x18
/// ServiceTypeControlledLoad
///
/// -
/// 0x28
/// ServiceTypeGuaranteed
///
/// -
/// 0x30
/// ServiceTypeNetworkControl
///
/// -
/// 0x00
/// Non-conformant traffic
///
///
///
public uint DSField;
}
/// The QOS_FRIENDLY_NAME traffic control object associates a friendly name with flow.
///
/// Programmers are encouraged to use the QOS_FRIENDLY_NAME traffic control object to associate flows with their applications.
/// This approach enables management applications to identify and associate enumerated flows with corresponding applications.
///
// https://learn.microsoft.com/en-us/windows/win32/api/qosobjs/ns-qosobjs-qos_friendly_name typedef struct _QOS_FRIENDLY_NAME {
// QOS_OBJECT_HDR ObjectHdr; WCHAR FriendlyName[QOS_MAX_OBJECT_STRING_LENGTH]; } QOS_FRIENDLY_NAME, *LPQOS_FRIENDLY_NAME;
[PInvokeData("qosobjs.h", MSDNShortId = "NS:qosobjs._QOS_FRIENDLY_NAME")]
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct QOS_FRIENDLY_NAME : IQoSObjectHdr
{
/// The QOS object QOS_OBJECT_HDR. The object type for this traffic control object should be QOS_OBJECT_FRIENDLY_NAME.
public QOS_OBJECT_HDR ObjectHdr;
/// Name to be associated with the flow.
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = QOS_MAX_OBJECT_STRING_LENGTH)]
public string FriendlyName;
}
///
/// The QOS_TCP_TRAFFIC structure is used to indicate that IP Precedence and UserPriority mappings for a given flow must be set to
/// system defaults for TCP traffic.
///
///
/// When the QOS_TCP_TRAFFIC object is passed, the DSField mapping and UserPriorityMapping of ServiceType are
/// ignored, as are QOS_OBJECT_DS_CLASS and QOS_OBJECT_TRAFFIC_CLASS.
///
// https://learn.microsoft.com/en-us/windows/win32/api/qosobjs/ns-qosobjs-qos_tcp_traffic typedef struct _QOS_TCP_TRAFFIC {
// QOS_OBJECT_HDR ObjectHdr; } QOS_TCP_TRAFFIC, *LPQOS_TCP_TRAFFIC;
[PInvokeData("qosobjs.h", MSDNShortId = "NS:qosobjs._QOS_TCP_TRAFFIC")]
[StructLayout(LayoutKind.Sequential)]
public struct QOS_TCP_TRAFFIC : IQoSObjectHdr
{
/// A QOS object header.
public QOS_OBJECT_HDR ObjectHdr;
}
///
///
/// The traffic control object QOS_TRAFFIC_CLASS is used to override the default UserPriority value ascribed to packets that
/// classify the traffic of a given flow.
///
///
/// By default, the UserPriority value of a flow is derived from the ServiceType (see: FLOWSPEC). Therefore, it is often necessary to
/// override the default UserPriority because packets can be tagged in their Layer 2 headers (such as an 802.1p header) to specify their
/// priority to Layer-2 devices. Using QOS_TRAFFIC_CLASS enables application developers to override the default UserPriority setting.
///
///
///
///
/// Traffic Control: The following ServiceType enumeration values are invalid when specifically working with Traffic Control.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/qosobjs/ns-qosobjs-qos_traffic_class typedef struct _QOS_TRAFFIC_CLASS {
// QOS_OBJECT_HDR ObjectHdr; ULONG TrafficClass; } QOS_TRAFFIC_CLASS, *LPQOS_TRAFFIC_CLASS;
[PInvokeData("qosobjs.h", MSDNShortId = "NS:qosobjs._QOS_TRAFFIC_CLASS")]
[StructLayout(LayoutKind.Sequential)]
public struct QOS_TRAFFIC_CLASS : IQoSObjectHdr
{
/// The QOS object QOS_OBJECT_HDR. The object type for this traffic control object should be QOS_OBJECT_TRAFFIC_CLASS.
public QOS_OBJECT_HDR ObjectHdr;
///
///
/// User priority value of the flow. The valid range is zero through seven. The following settings are chosen (by default) when the
/// QOS_TRAFFIC_CLASS traffic control object is not used.
///
///
/// Note This parameter specifies an 802.1 TrafficClass parameter which has been provided to the host by a layer 2 network in
/// an 802.1 extended RSVP RESV message. If this object is obtained from the network, hosts will stamp the MAC headers of
/// corresponding transmitted packets, with the value in the object. Otherwise, hosts can select a value based on the standard
/// Intserv mapping of ServiceType to 802.1 TrafficClass.
///
/// SERVICETYPE_BESTEFFORT (0x00000001)
/// SERVICETYPE_CONTROLLEDLOAD (0x00000002)
/// SERVICETYPE_GUARANTEED (0x00000003)
/// SERVICETYPE_NONCONFORMING (0x00000009)
/// SERVICETYPE_NETWORK_CONTROL (0x0000000A)
/// SERVICETYPE_QUALITATIVE (0x0000000D)
///
public uint TrafficClass;
}
}