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

ATM_BLLI

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

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

フィールド

フィールドサイズx64x86説明
Layer2ProtocolDWORD4+0+0B-LLI内の第2層(データリンク)プロトコルを示す。
Layer2UserSpecifiedProtocolDWORD4+4+4ユーザー指定の第2層プロトコル値を示す。
Layer3ProtocolDWORD4+8+8B-LLI内の第3層(ネットワーク)プロトコルを示す。
Layer3UserSpecifiedProtocolDWORD4+12+12ユーザー指定の第3層プロトコル値を示す。
Layer3IPIDWORD4+16+16第3層のISO/IEC TR 9577 IPI(初期プロトコル識別子)を示す。
SnapIDBYTE5+20+20SNAPプロトコル識別用のIDバイト列の先頭。

各言語での定義

#include <windows.h>

// ATM_BLLI  (x64 28 / x86 28 バイト)
typedef struct ATM_BLLI {
    DWORD Layer2Protocol;
    DWORD Layer2UserSpecifiedProtocol;
    DWORD Layer3Protocol;
    DWORD Layer3UserSpecifiedProtocol;
    DWORD Layer3IPI;
    BYTE SnapID[5];
} ATM_BLLI;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct ATM_BLLI
{
    public uint Layer2Protocol;
    public uint Layer2UserSpecifiedProtocol;
    public uint Layer3Protocol;
    public uint Layer3UserSpecifiedProtocol;
    public uint Layer3IPI;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] public byte[] SnapID;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure ATM_BLLI
    Public Layer2Protocol As UInteger
    Public Layer2UserSpecifiedProtocol As UInteger
    Public Layer3Protocol As UInteger
    Public Layer3UserSpecifiedProtocol As UInteger
    Public Layer3IPI As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=5)> Public SnapID() As Byte
End Structure
import ctypes
from ctypes import wintypes

class ATM_BLLI(ctypes.Structure):
    _fields_ = [
        ("Layer2Protocol", wintypes.DWORD),
        ("Layer2UserSpecifiedProtocol", wintypes.DWORD),
        ("Layer3Protocol", wintypes.DWORD),
        ("Layer3UserSpecifiedProtocol", wintypes.DWORD),
        ("Layer3IPI", wintypes.DWORD),
        ("SnapID", ctypes.c_ubyte * 5),
    ]
#[repr(C)]
pub struct ATM_BLLI {
    pub Layer2Protocol: u32,
    pub Layer2UserSpecifiedProtocol: u32,
    pub Layer3Protocol: u32,
    pub Layer3UserSpecifiedProtocol: u32,
    pub Layer3IPI: u32,
    pub SnapID: [u8; 5],
}
import "golang.org/x/sys/windows"

type ATM_BLLI struct {
	Layer2Protocol uint32
	Layer2UserSpecifiedProtocol uint32
	Layer3Protocol uint32
	Layer3UserSpecifiedProtocol uint32
	Layer3IPI uint32
	SnapID [5]byte
}
type
  ATM_BLLI = record
    Layer2Protocol: DWORD;
    Layer2UserSpecifiedProtocol: DWORD;
    Layer3Protocol: DWORD;
    Layer3UserSpecifiedProtocol: DWORD;
    Layer3IPI: DWORD;
    SnapID: array[0..4] of Byte;
  end;
const ATM_BLLI = extern struct {
    Layer2Protocol: u32,
    Layer2UserSpecifiedProtocol: u32,
    Layer3Protocol: u32,
    Layer3UserSpecifiedProtocol: u32,
    Layer3IPI: u32,
    SnapID: [5]u8,
};
type
  ATM_BLLI {.bycopy.} = object
    Layer2Protocol: uint32
    Layer2UserSpecifiedProtocol: uint32
    Layer3Protocol: uint32
    Layer3UserSpecifiedProtocol: uint32
    Layer3IPI: uint32
    SnapID: array[5, uint8]
struct ATM_BLLI
{
    uint Layer2Protocol;
    uint Layer2UserSpecifiedProtocol;
    uint Layer3Protocol;
    uint Layer3UserSpecifiedProtocol;
    uint Layer3IPI;
    ubyte[5] SnapID;
}

HSP用 定義

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

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

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