ホーム › NetworkManagement.QoS › CONTROL_SERVICE
CONTROL_SERVICE
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Length | DWORD | 4 | +0 | +0 | この構造体のバイト長。 |
| Service | DWORD | 4 | +4 | +4 | 制御サービスの種別を示す値。 |
| Overrides | AD_GENERAL_PARAMS | 20 | +8 | +8 | サービスで上書きする一般パラメータを示すAD_GENERAL_PARAMS。 |
| Anonymous | _Anonymous_e__Union | 16 | +28 | +28 | サービス種別に応じたパラメータを保持する共用体。 |
共用体: _Anonymous_e__Union x64 16B / x86 16B
| フィールド | 型 | サイズ | x64 | x86 |
|---|---|---|---|---|
| Guaranteed | AD_GUARANTEED | 16 | +0 | +0 |
| ParamBuffer | PARAM_BUFFER | 12 | +0 | +0 |
各言語での定義
#include <windows.h>
// AD_GENERAL_PARAMS (x64 20 / x86 20 バイト)
typedef struct AD_GENERAL_PARAMS {
DWORD IntServAwareHopCount;
DWORD PathBandwidthEstimate;
DWORD MinimumLatency;
DWORD PathMTU;
DWORD Flags;
} AD_GENERAL_PARAMS;
// CONTROL_SERVICE (x64 44 / x86 44 バイト)
typedef struct CONTROL_SERVICE {
DWORD Length;
DWORD Service;
AD_GENERAL_PARAMS Overrides;
_Anonymous_e__Union Anonymous;
} CONTROL_SERVICE;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct AD_GENERAL_PARAMS
{
public uint IntServAwareHopCount;
public uint PathBandwidthEstimate;
public uint MinimumLatency;
public uint PathMTU;
public uint Flags;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct CONTROL_SERVICE
{
public uint Length;
public uint Service;
public AD_GENERAL_PARAMS Overrides;
public _Anonymous_e__Union Anonymous;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure AD_GENERAL_PARAMS
Public IntServAwareHopCount As UInteger
Public PathBandwidthEstimate As UInteger
Public MinimumLatency As UInteger
Public PathMTU As UInteger
Public Flags As UInteger
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure CONTROL_SERVICE
Public Length As UInteger
Public Service As UInteger
Public Overrides As AD_GENERAL_PARAMS
Public Anonymous As _Anonymous_e__Union
End Structureimport ctypes
from ctypes import wintypes
class AD_GENERAL_PARAMS(ctypes.Structure):
_fields_ = [
("IntServAwareHopCount", wintypes.DWORD),
("PathBandwidthEstimate", wintypes.DWORD),
("MinimumLatency", wintypes.DWORD),
("PathMTU", wintypes.DWORD),
("Flags", wintypes.DWORD),
]
class CONTROL_SERVICE(ctypes.Structure):
_fields_ = [
("Length", wintypes.DWORD),
("Service", wintypes.DWORD),
("Overrides", AD_GENERAL_PARAMS),
("Anonymous", _Anonymous_e__Union),
]#[repr(C)]
pub struct AD_GENERAL_PARAMS {
pub IntServAwareHopCount: u32,
pub PathBandwidthEstimate: u32,
pub MinimumLatency: u32,
pub PathMTU: u32,
pub Flags: u32,
}
#[repr(C)]
pub struct CONTROL_SERVICE {
pub Length: u32,
pub Service: u32,
pub Overrides: AD_GENERAL_PARAMS,
pub Anonymous: _Anonymous_e__Union,
}import "golang.org/x/sys/windows"
type AD_GENERAL_PARAMS struct {
IntServAwareHopCount uint32
PathBandwidthEstimate uint32
MinimumLatency uint32
PathMTU uint32
Flags uint32
}
type CONTROL_SERVICE struct {
Length uint32
Service uint32
Overrides AD_GENERAL_PARAMS
Anonymous _Anonymous_e__Union
}type
AD_GENERAL_PARAMS = record
IntServAwareHopCount: DWORD;
PathBandwidthEstimate: DWORD;
MinimumLatency: DWORD;
PathMTU: DWORD;
Flags: DWORD;
end;
CONTROL_SERVICE = record
Length: DWORD;
Service: DWORD;
Overrides: AD_GENERAL_PARAMS;
Anonymous: _Anonymous_e__Union;
end;const AD_GENERAL_PARAMS = extern struct {
IntServAwareHopCount: u32,
PathBandwidthEstimate: u32,
MinimumLatency: u32,
PathMTU: u32,
Flags: u32,
};
const CONTROL_SERVICE = extern struct {
Length: u32,
Service: u32,
Overrides: AD_GENERAL_PARAMS,
Anonymous: _Anonymous_e__Union,
};type
AD_GENERAL_PARAMS {.bycopy.} = object
IntServAwareHopCount: uint32
PathBandwidthEstimate: uint32
MinimumLatency: uint32
PathMTU: uint32
Flags: uint32
CONTROL_SERVICE {.bycopy.} = object
Length: uint32
Service: uint32
Overrides: AD_GENERAL_PARAMS
Anonymous: _Anonymous_e__Unionstruct AD_GENERAL_PARAMS
{
uint IntServAwareHopCount;
uint PathBandwidthEstimate;
uint MinimumLatency;
uint PathMTU;
uint Flags;
}
struct CONTROL_SERVICE
{
uint Length;
uint Service;
AD_GENERAL_PARAMS Overrides;
_Anonymous_e__Union Anonymous;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; CONTROL_SERVICE サイズ: 44 バイト(x64)
dim st, 11 ; 4byte整数×11(構造体サイズ 44 / 4 切り上げ)
; Length : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; Service : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; Overrides : AD_GENERAL_PARAMS (+8, 20byte) varptr(st)+8 を基点に操作(20byte:入れ子/配列)
; Anonymous : _Anonymous_e__Union (+28, 16byte) varptr(st)+28 を基点に操作(16byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global AD_GENERAL_PARAMS
#field int IntServAwareHopCount
#field int PathBandwidthEstimate
#field int MinimumLatency
#field int PathMTU
#field int Flags
#endstruct
#defstruct global CONTROL_SERVICE
#field int Length
#field int Service
#field AD_GENERAL_PARAMS Overrides
#field byte Anonymous 16
#endstruct
stdim st, CONTROL_SERVICE ; NSTRUCT 変数を確保
st->Length = 100
mes "Length=" + st->Length
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。