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

DNS_SVCB_PARAM_IPV6

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

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

フィールド

フィールドサイズx64x86説明
cIpsWORD2+0+0rgIps配列に格納されたIPv6アドレス数を示す。
rgIpsIP6_ADDRESS16+8+8サービスのIPv6ヒントアドレス群を保持する可変長配列の先頭。

各言語での定義

#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_SVCB_PARAM_IPV6  (x64 24 / x86 24 バイト)
typedef struct DNS_SVCB_PARAM_IPV6 {
    WORD cIps;
    IP6_ADDRESS rgIps[1];
} DNS_SVCB_PARAM_IPV6;
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_SVCB_PARAM_IPV6
{
    public ushort cIps;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public IP6_ADDRESS[] rgIps;
}
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_SVCB_PARAM_IPV6
    Public cIps As UShort
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public rgIps() 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_SVCB_PARAM_IPV6(ctypes.Structure):
    _fields_ = [
        ("cIps", ctypes.c_ushort),
        ("rgIps", IP6_ADDRESS * 1),
    ]
#[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_SVCB_PARAM_IPV6 {
    pub cIps: u16,
    pub rgIps: [IP6_ADDRESS; 1],
}
import "golang.org/x/sys/windows"

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

type DNS_SVCB_PARAM_IPV6 struct {
	cIps uint16
	rgIps [1]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_SVCB_PARAM_IPV6 = record
    cIps: Word;
    rgIps: array[0..0] of IP6_ADDRESS;
  end;
const IP6_ADDRESS = extern struct {
    IP6Qword: [2]u64,
    IP6Dword: [4]u32,
    IP6Word: [8]u16,
    IP6Byte: [16]u8,
};

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

  DNS_SVCB_PARAM_IPV6 {.bycopy.} = object
    cIps: uint16
    rgIps: array[1, IP6_ADDRESS]
struct IP6_ADDRESS
{
    ulong[2] IP6Qword;
    uint[4] IP6Dword;
    ushort[8] IP6Word;
    ubyte[16] IP6Byte;
}

struct DNS_SVCB_PARAM_IPV6
{
    ushort cIps;
    IP6_ADDRESS[1] rgIps;
}

HSP用 定義

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

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

stdim st, DNS_SVCB_PARAM_IPV6        ; NSTRUCT 変数を確保
st->cIps = 100
mes "cIps=" + st->cIps
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。