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

QOS_DIFFSERV_RULE

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

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

フィールド

フィールドサイズx64x86説明
InboundDSFieldBYTE1+0+0受信パケットのDSフィールド値。
ConformingOutboundDSFieldBYTE1+1+1適合送信パケットに設定するDSフィールド値。
NonConformingOutboundDSFieldBYTE1+2+2非適合送信パケットに設定するDSフィールド値。
ConformingUserPriorityBYTE1+3+3適合トラフィックのユーザー優先度(802.1p)値。
NonConformingUserPriorityBYTE1+4+4非適合トラフィックのユーザー優先度(802.1p)値。

各言語での定義

#include <windows.h>

// QOS_DIFFSERV_RULE  (x64 5 / x86 5 バイト)
typedef struct QOS_DIFFSERV_RULE {
    BYTE InboundDSField;
    BYTE ConformingOutboundDSField;
    BYTE NonConformingOutboundDSField;
    BYTE ConformingUserPriority;
    BYTE NonConformingUserPriority;
} QOS_DIFFSERV_RULE;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct QOS_DIFFSERV_RULE
{
    public byte InboundDSField;
    public byte ConformingOutboundDSField;
    public byte NonConformingOutboundDSField;
    public byte ConformingUserPriority;
    public byte NonConformingUserPriority;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure QOS_DIFFSERV_RULE
    Public InboundDSField As Byte
    Public ConformingOutboundDSField As Byte
    Public NonConformingOutboundDSField As Byte
    Public ConformingUserPriority As Byte
    Public NonConformingUserPriority As Byte
End Structure
import ctypes
from ctypes import wintypes

class QOS_DIFFSERV_RULE(ctypes.Structure):
    _fields_ = [
        ("InboundDSField", ctypes.c_ubyte),
        ("ConformingOutboundDSField", ctypes.c_ubyte),
        ("NonConformingOutboundDSField", ctypes.c_ubyte),
        ("ConformingUserPriority", ctypes.c_ubyte),
        ("NonConformingUserPriority", ctypes.c_ubyte),
    ]
#[repr(C)]
pub struct QOS_DIFFSERV_RULE {
    pub InboundDSField: u8,
    pub ConformingOutboundDSField: u8,
    pub NonConformingOutboundDSField: u8,
    pub ConformingUserPriority: u8,
    pub NonConformingUserPriority: u8,
}
import "golang.org/x/sys/windows"

type QOS_DIFFSERV_RULE struct {
	InboundDSField byte
	ConformingOutboundDSField byte
	NonConformingOutboundDSField byte
	ConformingUserPriority byte
	NonConformingUserPriority byte
}
type
  QOS_DIFFSERV_RULE = record
    InboundDSField: Byte;
    ConformingOutboundDSField: Byte;
    NonConformingOutboundDSField: Byte;
    ConformingUserPriority: Byte;
    NonConformingUserPriority: Byte;
  end;
const QOS_DIFFSERV_RULE = extern struct {
    InboundDSField: u8,
    ConformingOutboundDSField: u8,
    NonConformingOutboundDSField: u8,
    ConformingUserPriority: u8,
    NonConformingUserPriority: u8,
};
type
  QOS_DIFFSERV_RULE {.bycopy.} = object
    InboundDSField: uint8
    ConformingOutboundDSField: uint8
    NonConformingOutboundDSField: uint8
    ConformingUserPriority: uint8
    NonConformingUserPriority: uint8
struct QOS_DIFFSERV_RULE
{
    ubyte InboundDSField;
    ubyte ConformingOutboundDSField;
    ubyte NonConformingOutboundDSField;
    ubyte ConformingUserPriority;
    ubyte NonConformingUserPriority;
}

HSP用 定義

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

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

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