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

DL_TEREDO_ADDRESS

構造体
サイズx64: 22 バイト / x86: 14 バイトパッキング1

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

フィールド

フィールドサイズx64x86説明
ReservedBYTE6+0+0予約済みバイト列。通常ゼロにする。
Anonymous_Anonymous_e__Union16/8+6+6TeredoアドレスのフラグやポートをビットフィールドやEUI形式で保持する無名共用体。

共用体: _Anonymous_e__Union x64 16B / x86 8B

フィールドサイズx64x86説明
Eui64DL_EUI6416/8+0+0
Anonymous_Anonymous_e__Struct8/4+0+0TeredoアドレスのフラグやポートをビットフィールドやEUI形式で保持する無名共用体。

各言語での定義

#include <windows.h>

// DL_TEREDO_ADDRESS  (x64 22 / x86 14 バイト)
#pragma pack(push, 1)
typedef struct DL_TEREDO_ADDRESS {
    BYTE Reserved[6];
    _Anonymous_e__Union Anonymous;
} DL_TEREDO_ADDRESS;
#pragma pack(pop)
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct DL_TEREDO_ADDRESS
{
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] public byte[] Reserved;
    public _Anonymous_e__Union Anonymous;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure DL_TEREDO_ADDRESS
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=6)> Public Reserved() As Byte
    Public Anonymous As _Anonymous_e__Union
End Structure
import ctypes
from ctypes import wintypes

class DL_TEREDO_ADDRESS(ctypes.Structure):
    _pack_ = 1
    _fields_ = [
        ("Reserved", ctypes.c_ubyte * 6),
        ("Anonymous", _Anonymous_e__Union),
    ]
#[repr(C, packed(1))]
pub struct DL_TEREDO_ADDRESS {
    pub Reserved: [u8; 6],
    pub Anonymous: _Anonymous_e__Union,
}
import "golang.org/x/sys/windows"

type DL_TEREDO_ADDRESS struct {
	Reserved [6]byte
	Anonymous _Anonymous_e__Union
}
type
  DL_TEREDO_ADDRESS = packed record
    Reserved: array[0..5] of Byte;
    Anonymous: _Anonymous_e__Union;
  end;
const DL_TEREDO_ADDRESS = extern struct {
    Reserved: [6]u8,
    Anonymous: _Anonymous_e__Union,
};
type
  DL_TEREDO_ADDRESS {.packed.} = object
    Reserved: array[6, uint8]
    Anonymous: _Anonymous_e__Union
align(1)
struct DL_TEREDO_ADDRESS
{
    ubyte[6] Reserved;
    _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整数の配列変数で操作します。(x86 レイアウト)
; DL_TEREDO_ADDRESS サイズ: 14 バイト(x86)
dim st, 4    ; 4byte整数×4(構造体サイズ 14 / 4 切り上げ)
; Reserved : BYTE (+0, 6byte)  varptr(st)+0 を基点に操作(6byte:入れ子/配列)
; Anonymous : _Anonymous_e__Union (+6, 8byte)  varptr(st)+6 を基点に操作(8byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DL_TEREDO_ADDRESS サイズ: 22 バイト(x64)
dim st, 6    ; 4byte整数×6(構造体サイズ 22 / 4 切り上げ)
; Reserved : BYTE (+0, 6byte)  varptr(st)+0 を基点に操作(6byte:入れ子/配列)
; Anonymous : _Anonymous_e__Union (+6, 16byte)  varptr(st)+6 を基点に操作(16byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DL_TEREDO_ADDRESS, pack=1
    #field byte Reserved 6
    #field byte Anonymous 16
#endstruct

stdim st, DL_TEREDO_ADDRESS        ; NSTRUCT 変数を確保
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。