Win32 API 日本語リファレンス
ホームNetworkManagement.QoS › QOS_PACKET_PRIORITY

QOS_PACKET_PRIORITY

構造体
サイズx64: 16 バイト / x86: 16 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
ConformantDSCPValueDWORD4+0+0適合トラフィックに適用するDSCP値。
NonConformantDSCPValueDWORD4+4+4非適合トラフィックに適用するDSCP値。
ConformantL2ValueDWORD4+8+8適合トラフィックに適用するレイヤ2優先度値。
NonConformantL2ValueDWORD4+12+12非適合トラフィックに適用するレイヤ2優先度値。

各言語での定義

#include <windows.h>

// QOS_PACKET_PRIORITY  (x64 16 / x86 16 バイト)
typedef struct QOS_PACKET_PRIORITY {
    DWORD ConformantDSCPValue;
    DWORD NonConformantDSCPValue;
    DWORD ConformantL2Value;
    DWORD NonConformantL2Value;
} QOS_PACKET_PRIORITY;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct QOS_PACKET_PRIORITY
{
    public uint ConformantDSCPValue;
    public uint NonConformantDSCPValue;
    public uint ConformantL2Value;
    public uint NonConformantL2Value;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure QOS_PACKET_PRIORITY
    Public ConformantDSCPValue As UInteger
    Public NonConformantDSCPValue As UInteger
    Public ConformantL2Value As UInteger
    Public NonConformantL2Value As UInteger
End Structure
import ctypes
from ctypes import wintypes

class QOS_PACKET_PRIORITY(ctypes.Structure):
    _fields_ = [
        ("ConformantDSCPValue", wintypes.DWORD),
        ("NonConformantDSCPValue", wintypes.DWORD),
        ("ConformantL2Value", wintypes.DWORD),
        ("NonConformantL2Value", wintypes.DWORD),
    ]
#[repr(C)]
pub struct QOS_PACKET_PRIORITY {
    pub ConformantDSCPValue: u32,
    pub NonConformantDSCPValue: u32,
    pub ConformantL2Value: u32,
    pub NonConformantL2Value: u32,
}
import "golang.org/x/sys/windows"

type QOS_PACKET_PRIORITY struct {
	ConformantDSCPValue uint32
	NonConformantDSCPValue uint32
	ConformantL2Value uint32
	NonConformantL2Value uint32
}
type
  QOS_PACKET_PRIORITY = record
    ConformantDSCPValue: DWORD;
    NonConformantDSCPValue: DWORD;
    ConformantL2Value: DWORD;
    NonConformantL2Value: DWORD;
  end;
const QOS_PACKET_PRIORITY = extern struct {
    ConformantDSCPValue: u32,
    NonConformantDSCPValue: u32,
    ConformantL2Value: u32,
    NonConformantL2Value: u32,
};
type
  QOS_PACKET_PRIORITY {.bycopy.} = object
    ConformantDSCPValue: uint32
    NonConformantDSCPValue: uint32
    ConformantL2Value: uint32
    NonConformantL2Value: uint32
struct QOS_PACKET_PRIORITY
{
    uint ConformantDSCPValue;
    uint NonConformantDSCPValue;
    uint ConformantL2Value;
    uint NonConformantL2Value;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; QOS_PACKET_PRIORITY サイズ: 16 バイト(x64)
dim st, 4    ; 4byte整数×4(構造体サイズ 16 / 4 切り上げ)
; ConformantDSCPValue : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; NonConformantDSCPValue : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; ConformantL2Value : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; NonConformantL2Value : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global QOS_PACKET_PRIORITY
    #field int ConformantDSCPValue
    #field int NonConformantDSCPValue
    #field int ConformantL2Value
    #field int NonConformantL2Value
#endstruct

stdim st, QOS_PACKET_PRIORITY        ; NSTRUCT 変数を確保
st->ConformantDSCPValue = 100
mes "ConformantDSCPValue=" + st->ConformantDSCPValue