Win32 API 日本語リファレンス
ホームNetworking.WinSock › ATM_TRAFFIC_DESCRIPTOR_IE

ATM_TRAFFIC_DESCRIPTOR_IE

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

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

フィールド

フィールドサイズx64x86説明
ForwardATM_TD28+0+0順方向のトラフィック記述子を保持するATM_TD構造体。
BackwardATM_TD28+28+28逆方向のトラフィック記述子を保持するATM_TD構造体。
BestEffortBOOL4+56+56ベストエフォート転送を要求するかを示すBOOL値。

各言語での定義

#include <windows.h>

// ATM_TD  (x64 28 / x86 28 バイト)
typedef struct ATM_TD {
    DWORD PeakCellRate_CLP0;
    DWORD PeakCellRate_CLP01;
    DWORD SustainableCellRate_CLP0;
    DWORD SustainableCellRate_CLP01;
    DWORD MaxBurstSize_CLP0;
    DWORD MaxBurstSize_CLP01;
    BOOL Tagging;
} ATM_TD;

// ATM_TRAFFIC_DESCRIPTOR_IE  (x64 60 / x86 60 バイト)
typedef struct ATM_TRAFFIC_DESCRIPTOR_IE {
    ATM_TD Forward;
    ATM_TD Backward;
    BOOL BestEffort;
} ATM_TRAFFIC_DESCRIPTOR_IE;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct ATM_TD
{
    public uint PeakCellRate_CLP0;
    public uint PeakCellRate_CLP01;
    public uint SustainableCellRate_CLP0;
    public uint SustainableCellRate_CLP01;
    public uint MaxBurstSize_CLP0;
    public uint MaxBurstSize_CLP01;
    [MarshalAs(UnmanagedType.Bool)] public bool Tagging;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct ATM_TRAFFIC_DESCRIPTOR_IE
{
    public ATM_TD Forward;
    public ATM_TD Backward;
    [MarshalAs(UnmanagedType.Bool)] public bool BestEffort;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure ATM_TD
    Public PeakCellRate_CLP0 As UInteger
    Public PeakCellRate_CLP01 As UInteger
    Public SustainableCellRate_CLP0 As UInteger
    Public SustainableCellRate_CLP01 As UInteger
    Public MaxBurstSize_CLP0 As UInteger
    Public MaxBurstSize_CLP01 As UInteger
    <MarshalAs(UnmanagedType.Bool)> Public Tagging As Boolean
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure ATM_TRAFFIC_DESCRIPTOR_IE
    Public Forward As ATM_TD
    Public Backward As ATM_TD
    <MarshalAs(UnmanagedType.Bool)> Public BestEffort As Boolean
End Structure
import ctypes
from ctypes import wintypes

class ATM_TD(ctypes.Structure):
    _fields_ = [
        ("PeakCellRate_CLP0", wintypes.DWORD),
        ("PeakCellRate_CLP01", wintypes.DWORD),
        ("SustainableCellRate_CLP0", wintypes.DWORD),
        ("SustainableCellRate_CLP01", wintypes.DWORD),
        ("MaxBurstSize_CLP0", wintypes.DWORD),
        ("MaxBurstSize_CLP01", wintypes.DWORD),
        ("Tagging", wintypes.BOOL),
    ]

class ATM_TRAFFIC_DESCRIPTOR_IE(ctypes.Structure):
    _fields_ = [
        ("Forward", ATM_TD),
        ("Backward", ATM_TD),
        ("BestEffort", wintypes.BOOL),
    ]
#[repr(C)]
pub struct ATM_TD {
    pub PeakCellRate_CLP0: u32,
    pub PeakCellRate_CLP01: u32,
    pub SustainableCellRate_CLP0: u32,
    pub SustainableCellRate_CLP01: u32,
    pub MaxBurstSize_CLP0: u32,
    pub MaxBurstSize_CLP01: u32,
    pub Tagging: i32,
}

#[repr(C)]
pub struct ATM_TRAFFIC_DESCRIPTOR_IE {
    pub Forward: ATM_TD,
    pub Backward: ATM_TD,
    pub BestEffort: i32,
}
import "golang.org/x/sys/windows"

type ATM_TD struct {
	PeakCellRate_CLP0 uint32
	PeakCellRate_CLP01 uint32
	SustainableCellRate_CLP0 uint32
	SustainableCellRate_CLP01 uint32
	MaxBurstSize_CLP0 uint32
	MaxBurstSize_CLP01 uint32
	Tagging int32
}

type ATM_TRAFFIC_DESCRIPTOR_IE struct {
	Forward ATM_TD
	Backward ATM_TD
	BestEffort int32
}
type
  ATM_TD = record
    PeakCellRate_CLP0: DWORD;
    PeakCellRate_CLP01: DWORD;
    SustainableCellRate_CLP0: DWORD;
    SustainableCellRate_CLP01: DWORD;
    MaxBurstSize_CLP0: DWORD;
    MaxBurstSize_CLP01: DWORD;
    Tagging: BOOL;
  end;

  ATM_TRAFFIC_DESCRIPTOR_IE = record
    Forward: ATM_TD;
    Backward: ATM_TD;
    BestEffort: BOOL;
  end;
const ATM_TD = extern struct {
    PeakCellRate_CLP0: u32,
    PeakCellRate_CLP01: u32,
    SustainableCellRate_CLP0: u32,
    SustainableCellRate_CLP01: u32,
    MaxBurstSize_CLP0: u32,
    MaxBurstSize_CLP01: u32,
    Tagging: i32,
};

const ATM_TRAFFIC_DESCRIPTOR_IE = extern struct {
    Forward: ATM_TD,
    Backward: ATM_TD,
    BestEffort: i32,
};
type
  ATM_TD {.bycopy.} = object
    PeakCellRate_CLP0: uint32
    PeakCellRate_CLP01: uint32
    SustainableCellRate_CLP0: uint32
    SustainableCellRate_CLP01: uint32
    MaxBurstSize_CLP0: uint32
    MaxBurstSize_CLP01: uint32
    Tagging: int32

  ATM_TRAFFIC_DESCRIPTOR_IE {.bycopy.} = object
    Forward: ATM_TD
    Backward: ATM_TD
    BestEffort: int32
struct ATM_TD
{
    uint PeakCellRate_CLP0;
    uint PeakCellRate_CLP01;
    uint SustainableCellRate_CLP0;
    uint SustainableCellRate_CLP01;
    uint MaxBurstSize_CLP0;
    uint MaxBurstSize_CLP01;
    int Tagging;
}

struct ATM_TRAFFIC_DESCRIPTOR_IE
{
    ATM_TD Forward;
    ATM_TD Backward;
    int BestEffort;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; ATM_TRAFFIC_DESCRIPTOR_IE サイズ: 60 バイト(x64)
dim st, 15    ; 4byte整数×15(構造体サイズ 60 / 4 切り上げ)
; Forward : ATM_TD (+0, 28byte)  varptr(st)+0 を基点に操作(28byte:入れ子/配列)
; Backward : ATM_TD (+28, 28byte)  varptr(st)+28 を基点に操作(28byte:入れ子/配列)
; BestEffort : BOOL (+56, 4byte)  st.14 = 値  /  値 = st.14   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global ATM_TD
    #field int PeakCellRate_CLP0
    #field int PeakCellRate_CLP01
    #field int SustainableCellRate_CLP0
    #field int SustainableCellRate_CLP01
    #field int MaxBurstSize_CLP0
    #field int MaxBurstSize_CLP01
    #field bool Tagging
#endstruct

#defstruct global ATM_TRAFFIC_DESCRIPTOR_IE
    #field ATM_TD Forward
    #field ATM_TD Backward
    #field bool BestEffort
#endstruct

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