Win32 API 日本語リファレンス
ホームNetworkManagement.Dns › DNS_AAAA_DATA

DNS_AAAA_DATA

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

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

フィールド

フィールドサイズx64x86説明
Ip6AddressIP6_ADDRESS16+0+0AAAAレコードのIPv6アドレスを128ビットで保持する。

各言語での定義

#include <windows.h>

// IP6_ADDRESS  (x64 16 / x86 16 バイト)
typedef struct IP6_ADDRESS {
    ULONGLONG IP6Qword[2];
    DWORD IP6Dword[4];
    WORD IP6Word[8];
    BYTE IP6Byte[16];
} IP6_ADDRESS;

// DNS_AAAA_DATA  (x64 16 / x86 16 バイト)
typedef struct DNS_AAAA_DATA {
    IP6_ADDRESS Ip6Address;
} DNS_AAAA_DATA;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct IP6_ADDRESS
{
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public ulong[] IP6Qword;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public uint[] IP6Dword;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public ushort[] IP6Word;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] IP6Byte;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DNS_AAAA_DATA
{
    public IP6_ADDRESS Ip6Address;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure IP6_ADDRESS
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=2)> Public IP6Qword() As ULong
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=4)> Public IP6Dword() As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=8)> Public IP6Word() As UShort
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=16)> Public IP6Byte() As Byte
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DNS_AAAA_DATA
    Public Ip6Address As IP6_ADDRESS
End Structure
import ctypes
from ctypes import wintypes

class IP6_ADDRESS(ctypes.Structure):
    _fields_ = [
        ("IP6Qword", ctypes.c_ulonglong * 2),
        ("IP6Dword", wintypes.DWORD * 4),
        ("IP6Word", ctypes.c_ushort * 8),
        ("IP6Byte", ctypes.c_ubyte * 16),
    ]

class DNS_AAAA_DATA(ctypes.Structure):
    _fields_ = [
        ("Ip6Address", IP6_ADDRESS),
    ]
#[repr(C)]
pub struct IP6_ADDRESS {
    pub IP6Qword: [u64; 2],
    pub IP6Dword: [u32; 4],
    pub IP6Word: [u16; 8],
    pub IP6Byte: [u8; 16],
}

#[repr(C)]
pub struct DNS_AAAA_DATA {
    pub Ip6Address: IP6_ADDRESS,
}
import "golang.org/x/sys/windows"

type IP6_ADDRESS struct {
	IP6Qword [2]uint64
	IP6Dword [4]uint32
	IP6Word [8]uint16
	IP6Byte [16]byte
}

type DNS_AAAA_DATA struct {
	Ip6Address IP6_ADDRESS
}
type
  IP6_ADDRESS = record
    IP6Qword: array[0..1] of UInt64;
    IP6Dword: array[0..3] of DWORD;
    IP6Word: array[0..7] of Word;
    IP6Byte: array[0..15] of Byte;
  end;

  DNS_AAAA_DATA = record
    Ip6Address: IP6_ADDRESS;
  end;
const IP6_ADDRESS = extern struct {
    IP6Qword: [2]u64,
    IP6Dword: [4]u32,
    IP6Word: [8]u16,
    IP6Byte: [16]u8,
};

const DNS_AAAA_DATA = extern struct {
    Ip6Address: IP6_ADDRESS,
};
type
  IP6_ADDRESS {.bycopy.} = object
    IP6Qword: array[2, uint64]
    IP6Dword: array[4, uint32]
    IP6Word: array[8, uint16]
    IP6Byte: array[16, uint8]

  DNS_AAAA_DATA {.bycopy.} = object
    Ip6Address: IP6_ADDRESS
struct IP6_ADDRESS
{
    ulong[2] IP6Qword;
    uint[4] IP6Dword;
    ushort[8] IP6Word;
    ubyte[16] IP6Byte;
}

struct DNS_AAAA_DATA
{
    IP6_ADDRESS Ip6Address;
}

HSP用 定義

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

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

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