ホーム › NetworkManagement.QoS › TC_GEN_FLOW
TC_GEN_FLOW
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| SendingFlowspec | FLOWSPEC | 32 | +0 | +0 | 送信方向のフロー仕様を示すFLOWSPEC。 |
| ReceivingFlowspec | FLOWSPEC | 32 | +32 | +32 | 受信方向のフロー仕様を示すFLOWSPEC。 |
| TcObjectsLength | DWORD | 4 | +64 | +64 | TcObjectsが占めるバイト長。 |
| TcObjects | QOS_OBJECT_HDR | 8 | +68 | +68 | フローに付随するQoSオブジェクト群の先頭(QOS_OBJECT_HDR)。 |
各言語での定義
#include <windows.h>
// FLOWSPEC (x64 32 / x86 32 バイト)
typedef struct FLOWSPEC {
DWORD TokenRate;
DWORD TokenBucketSize;
DWORD PeakBandwidth;
DWORD Latency;
DWORD DelayVariation;
DWORD ServiceType;
DWORD MaxSduSize;
DWORD MinimumPolicedSize;
} FLOWSPEC;
// QOS_OBJECT_HDR (x64 8 / x86 8 バイト)
typedef struct QOS_OBJECT_HDR {
DWORD ObjectType;
DWORD ObjectLength;
} QOS_OBJECT_HDR;
// TC_GEN_FLOW (x64 76 / x86 76 バイト)
typedef struct TC_GEN_FLOW {
FLOWSPEC SendingFlowspec;
FLOWSPEC ReceivingFlowspec;
DWORD TcObjectsLength;
QOS_OBJECT_HDR TcObjects[1];
} TC_GEN_FLOW;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct FLOWSPEC
{
public uint TokenRate;
public uint TokenBucketSize;
public uint PeakBandwidth;
public uint Latency;
public uint DelayVariation;
public uint ServiceType;
public uint MaxSduSize;
public uint MinimumPolicedSize;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct QOS_OBJECT_HDR
{
public uint ObjectType;
public uint ObjectLength;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct TC_GEN_FLOW
{
public FLOWSPEC SendingFlowspec;
public FLOWSPEC ReceivingFlowspec;
public uint TcObjectsLength;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public QOS_OBJECT_HDR[] TcObjects;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure FLOWSPEC
Public TokenRate As UInteger
Public TokenBucketSize As UInteger
Public PeakBandwidth As UInteger
Public Latency As UInteger
Public DelayVariation As UInteger
Public ServiceType As UInteger
Public MaxSduSize As UInteger
Public MinimumPolicedSize As UInteger
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure QOS_OBJECT_HDR
Public ObjectType As UInteger
Public ObjectLength As UInteger
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure TC_GEN_FLOW
Public SendingFlowspec As FLOWSPEC
Public ReceivingFlowspec As FLOWSPEC
Public TcObjectsLength As UInteger
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public TcObjects() As QOS_OBJECT_HDR
End Structureimport ctypes
from ctypes import wintypes
class FLOWSPEC(ctypes.Structure):
_fields_ = [
("TokenRate", wintypes.DWORD),
("TokenBucketSize", wintypes.DWORD),
("PeakBandwidth", wintypes.DWORD),
("Latency", wintypes.DWORD),
("DelayVariation", wintypes.DWORD),
("ServiceType", wintypes.DWORD),
("MaxSduSize", wintypes.DWORD),
("MinimumPolicedSize", wintypes.DWORD),
]
class QOS_OBJECT_HDR(ctypes.Structure):
_fields_ = [
("ObjectType", wintypes.DWORD),
("ObjectLength", wintypes.DWORD),
]
class TC_GEN_FLOW(ctypes.Structure):
_fields_ = [
("SendingFlowspec", FLOWSPEC),
("ReceivingFlowspec", FLOWSPEC),
("TcObjectsLength", wintypes.DWORD),
("TcObjects", QOS_OBJECT_HDR * 1),
]#[repr(C)]
pub struct FLOWSPEC {
pub TokenRate: u32,
pub TokenBucketSize: u32,
pub PeakBandwidth: u32,
pub Latency: u32,
pub DelayVariation: u32,
pub ServiceType: u32,
pub MaxSduSize: u32,
pub MinimumPolicedSize: u32,
}
#[repr(C)]
pub struct QOS_OBJECT_HDR {
pub ObjectType: u32,
pub ObjectLength: u32,
}
#[repr(C)]
pub struct TC_GEN_FLOW {
pub SendingFlowspec: FLOWSPEC,
pub ReceivingFlowspec: FLOWSPEC,
pub TcObjectsLength: u32,
pub TcObjects: [QOS_OBJECT_HDR; 1],
}import "golang.org/x/sys/windows"
type FLOWSPEC struct {
TokenRate uint32
TokenBucketSize uint32
PeakBandwidth uint32
Latency uint32
DelayVariation uint32
ServiceType uint32
MaxSduSize uint32
MinimumPolicedSize uint32
}
type QOS_OBJECT_HDR struct {
ObjectType uint32
ObjectLength uint32
}
type TC_GEN_FLOW struct {
SendingFlowspec FLOWSPEC
ReceivingFlowspec FLOWSPEC
TcObjectsLength uint32
TcObjects [1]QOS_OBJECT_HDR
}type
FLOWSPEC = record
TokenRate: DWORD;
TokenBucketSize: DWORD;
PeakBandwidth: DWORD;
Latency: DWORD;
DelayVariation: DWORD;
ServiceType: DWORD;
MaxSduSize: DWORD;
MinimumPolicedSize: DWORD;
end;
QOS_OBJECT_HDR = record
ObjectType: DWORD;
ObjectLength: DWORD;
end;
TC_GEN_FLOW = record
SendingFlowspec: FLOWSPEC;
ReceivingFlowspec: FLOWSPEC;
TcObjectsLength: DWORD;
TcObjects: array[0..0] of QOS_OBJECT_HDR;
end;const FLOWSPEC = extern struct {
TokenRate: u32,
TokenBucketSize: u32,
PeakBandwidth: u32,
Latency: u32,
DelayVariation: u32,
ServiceType: u32,
MaxSduSize: u32,
MinimumPolicedSize: u32,
};
const QOS_OBJECT_HDR = extern struct {
ObjectType: u32,
ObjectLength: u32,
};
const TC_GEN_FLOW = extern struct {
SendingFlowspec: FLOWSPEC,
ReceivingFlowspec: FLOWSPEC,
TcObjectsLength: u32,
TcObjects: [1]QOS_OBJECT_HDR,
};type
FLOWSPEC {.bycopy.} = object
TokenRate: uint32
TokenBucketSize: uint32
PeakBandwidth: uint32
Latency: uint32
DelayVariation: uint32
ServiceType: uint32
MaxSduSize: uint32
MinimumPolicedSize: uint32
QOS_OBJECT_HDR {.bycopy.} = object
ObjectType: uint32
ObjectLength: uint32
TC_GEN_FLOW {.bycopy.} = object
SendingFlowspec: FLOWSPEC
ReceivingFlowspec: FLOWSPEC
TcObjectsLength: uint32
TcObjects: array[1, QOS_OBJECT_HDR]struct FLOWSPEC
{
uint TokenRate;
uint TokenBucketSize;
uint PeakBandwidth;
uint Latency;
uint DelayVariation;
uint ServiceType;
uint MaxSduSize;
uint MinimumPolicedSize;
}
struct QOS_OBJECT_HDR
{
uint ObjectType;
uint ObjectLength;
}
struct TC_GEN_FLOW
{
FLOWSPEC SendingFlowspec;
FLOWSPEC ReceivingFlowspec;
uint TcObjectsLength;
QOS_OBJECT_HDR[1] TcObjects;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; TC_GEN_FLOW サイズ: 76 バイト(x64)
dim st, 19 ; 4byte整数×19(構造体サイズ 76 / 4 切り上げ)
; SendingFlowspec : FLOWSPEC (+0, 32byte) varptr(st)+0 を基点に操作(32byte:入れ子/配列)
; ReceivingFlowspec : FLOWSPEC (+32, 32byte) varptr(st)+32 を基点に操作(32byte:入れ子/配列)
; TcObjectsLength : DWORD (+64, 4byte) st.16 = 値 / 値 = st.16 (lpoke/lpeek も可)
; TcObjects : QOS_OBJECT_HDR (+68, 8byte) varptr(st)+68 を基点に操作(8byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global FLOWSPEC
#field int TokenRate
#field int TokenBucketSize
#field int PeakBandwidth
#field int Latency
#field int DelayVariation
#field int ServiceType
#field int MaxSduSize
#field int MinimumPolicedSize
#endstruct
#defstruct global QOS_OBJECT_HDR
#field int ObjectType
#field int ObjectLength
#endstruct
#defstruct global TC_GEN_FLOW
#field FLOWSPEC SendingFlowspec
#field FLOWSPEC ReceivingFlowspec
#field int TcObjectsLength
#field QOS_OBJECT_HDR TcObjects 1
#endstruct
stdim st, TC_GEN_FLOW ; NSTRUCT 変数を確保
st->TcObjectsLength = 100
mes "TcObjectsLength=" + st->TcObjectsLength