ホーム › Networking.WinSock › ADDRINFOEX7
ADDRINFOEX7
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| ai_flags | INT | 4 | +0 | +0 | アドレス取得時の動作を制御するフラグである。 |
| ai_family | INT | 4 | +4 | +4 | アドレスファミリである。AF_INET/AF_INET6等。 |
| ai_socktype | INT | 4 | +8 | +8 | ソケットタイプである。SOCK_STREAM/SOCK_DGRAM等。 |
| ai_protocol | INT | 4 | +12 | +12 | プロトコルである。IPPROTO_TCP等。 |
| ai_addrlen | UINT_PTR | 8/4 | +16 | +16 | ai_addrが指すアドレスの長さをバイト単位で示す。 |
| ai_canonname | LPWSTR | 8/4 | +24 | +20 | 正規ホスト名文字列(Unicode)である。NULL可。 |
| ai_addr | SOCKADDR* | 8/4 | +32 | +24 | SOCKADDR構造体へのポインタである。 |
| ai_blob | void* | 8/4 | +40 | +28 | 名前空間プロバイダ固有のデータブロブへのポインタである。NULL可。 |
| ai_bloblen | UINT_PTR | 8/4 | +48 | +32 | ai_blobのサイズをバイト単位で示す。 |
| ai_provider | GUID* | 8/4 | +56 | +36 | 名前空間プロバイダを識別するGUIDへのポインタである。 |
| ai_next | ADDRINFOEX7* | 8/4 | +64 | +40 | 次のADDRINFOEX7エントリへのポインタである。NULLで終端。 |
| ai_version | INT | 4 | +72 | +44 | この構造体のバージョン番号である。 |
| ai_fqdn | LPWSTR | 8/4 | +80 | +48 | 解決された完全修飾ドメイン名(FQDN)文字列である。 |
| ai_interfaceindex | INT | 4 | +88 | +52 | アドレス解決に使用したインタフェースのインデックスである。 |
| ai_resolutionhandle | HANDLE | 8/4 | +96 | +56 | 名前解決処理を識別するハンドルである。 |
| ai_ttl | DWORD | 4 | +104 | +60 | DNSレコードの有効期間(TTL)を秒単位で示す。 |
| ai_numservers | DWORD | 4 | +108 | +64 | ai_servers配列に含まれるDNSサーバの数である。 |
| ai_servers | ADDRINFO_DNS_SERVER* | 8/4 | +112 | +68 | 応答を返したDNSサーバ情報(ADDRINFO_DNS_SERVER)配列へのポインタである。 |
| ai_responseflags | ULONGLONG | 8 | +120 | +72 | DNS応答に関するフラグの集合である。 |
| ai_extraflags | ULONGLONG | 8 | +128 | +80 | 追加の拡張フラグの集合である。 |
各言語での定義
#include <windows.h>
// ADDRINFOEX7 (x64 136 / x86 88 バイト)
typedef struct ADDRINFOEX7 {
INT ai_flags;
INT ai_family;
INT ai_socktype;
INT ai_protocol;
UINT_PTR ai_addrlen;
LPWSTR ai_canonname;
SOCKADDR* ai_addr;
void* ai_blob;
UINT_PTR ai_bloblen;
GUID* ai_provider;
ADDRINFOEX7* ai_next;
INT ai_version;
LPWSTR ai_fqdn;
INT ai_interfaceindex;
HANDLE ai_resolutionhandle;
DWORD ai_ttl;
DWORD ai_numservers;
ADDRINFO_DNS_SERVER* ai_servers;
ULONGLONG ai_responseflags;
ULONGLONG ai_extraflags;
} ADDRINFOEX7;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct ADDRINFOEX7
{
public int ai_flags;
public int ai_family;
public int ai_socktype;
public int ai_protocol;
public UIntPtr ai_addrlen;
public IntPtr ai_canonname;
public IntPtr ai_addr;
public IntPtr ai_blob;
public UIntPtr ai_bloblen;
public IntPtr ai_provider;
public IntPtr ai_next;
public int ai_version;
public IntPtr ai_fqdn;
public int ai_interfaceindex;
public IntPtr ai_resolutionhandle;
public uint ai_ttl;
public uint ai_numservers;
public IntPtr ai_servers;
public ulong ai_responseflags;
public ulong ai_extraflags;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure ADDRINFOEX7
Public ai_flags As Integer
Public ai_family As Integer
Public ai_socktype As Integer
Public ai_protocol As Integer
Public ai_addrlen As UIntPtr
Public ai_canonname As IntPtr
Public ai_addr As IntPtr
Public ai_blob As IntPtr
Public ai_bloblen As UIntPtr
Public ai_provider As IntPtr
Public ai_next As IntPtr
Public ai_version As Integer
Public ai_fqdn As IntPtr
Public ai_interfaceindex As Integer
Public ai_resolutionhandle As IntPtr
Public ai_ttl As UInteger
Public ai_numservers As UInteger
Public ai_servers As IntPtr
Public ai_responseflags As ULong
Public ai_extraflags As ULong
End Structureimport ctypes
from ctypes import wintypes
class ADDRINFOEX7(ctypes.Structure):
_fields_ = [
("ai_flags", ctypes.c_int),
("ai_family", ctypes.c_int),
("ai_socktype", ctypes.c_int),
("ai_protocol", ctypes.c_int),
("ai_addrlen", ctypes.c_size_t),
("ai_canonname", ctypes.c_void_p),
("ai_addr", ctypes.c_void_p),
("ai_blob", ctypes.c_void_p),
("ai_bloblen", ctypes.c_size_t),
("ai_provider", ctypes.c_void_p),
("ai_next", ctypes.c_void_p),
("ai_version", ctypes.c_int),
("ai_fqdn", ctypes.c_void_p),
("ai_interfaceindex", ctypes.c_int),
("ai_resolutionhandle", ctypes.c_void_p),
("ai_ttl", wintypes.DWORD),
("ai_numservers", wintypes.DWORD),
("ai_servers", ctypes.c_void_p),
("ai_responseflags", ctypes.c_ulonglong),
("ai_extraflags", ctypes.c_ulonglong),
]#[repr(C)]
pub struct ADDRINFOEX7 {
pub ai_flags: i32,
pub ai_family: i32,
pub ai_socktype: i32,
pub ai_protocol: i32,
pub ai_addrlen: usize,
pub ai_canonname: *mut core::ffi::c_void,
pub ai_addr: *mut core::ffi::c_void,
pub ai_blob: *mut core::ffi::c_void,
pub ai_bloblen: usize,
pub ai_provider: *mut core::ffi::c_void,
pub ai_next: *mut core::ffi::c_void,
pub ai_version: i32,
pub ai_fqdn: *mut core::ffi::c_void,
pub ai_interfaceindex: i32,
pub ai_resolutionhandle: *mut core::ffi::c_void,
pub ai_ttl: u32,
pub ai_numservers: u32,
pub ai_servers: *mut core::ffi::c_void,
pub ai_responseflags: u64,
pub ai_extraflags: u64,
}import "golang.org/x/sys/windows"
type ADDRINFOEX7 struct {
ai_flags int32
ai_family int32
ai_socktype int32
ai_protocol int32
ai_addrlen uintptr
ai_canonname uintptr
ai_addr uintptr
ai_blob uintptr
ai_bloblen uintptr
ai_provider uintptr
ai_next uintptr
ai_version int32
ai_fqdn uintptr
ai_interfaceindex int32
ai_resolutionhandle uintptr
ai_ttl uint32
ai_numservers uint32
ai_servers uintptr
ai_responseflags uint64
ai_extraflags uint64
}type
ADDRINFOEX7 = record
ai_flags: Integer;
ai_family: Integer;
ai_socktype: Integer;
ai_protocol: Integer;
ai_addrlen: NativeUInt;
ai_canonname: Pointer;
ai_addr: Pointer;
ai_blob: Pointer;
ai_bloblen: NativeUInt;
ai_provider: Pointer;
ai_next: Pointer;
ai_version: Integer;
ai_fqdn: Pointer;
ai_interfaceindex: Integer;
ai_resolutionhandle: Pointer;
ai_ttl: DWORD;
ai_numservers: DWORD;
ai_servers: Pointer;
ai_responseflags: UInt64;
ai_extraflags: UInt64;
end;const ADDRINFOEX7 = extern struct {
ai_flags: i32,
ai_family: i32,
ai_socktype: i32,
ai_protocol: i32,
ai_addrlen: usize,
ai_canonname: ?*anyopaque,
ai_addr: ?*anyopaque,
ai_blob: ?*anyopaque,
ai_bloblen: usize,
ai_provider: ?*anyopaque,
ai_next: ?*anyopaque,
ai_version: i32,
ai_fqdn: ?*anyopaque,
ai_interfaceindex: i32,
ai_resolutionhandle: ?*anyopaque,
ai_ttl: u32,
ai_numservers: u32,
ai_servers: ?*anyopaque,
ai_responseflags: u64,
ai_extraflags: u64,
};type
ADDRINFOEX7 {.bycopy.} = object
ai_flags: int32
ai_family: int32
ai_socktype: int32
ai_protocol: int32
ai_addrlen: uint
ai_canonname: pointer
ai_addr: pointer
ai_blob: pointer
ai_bloblen: uint
ai_provider: pointer
ai_next: pointer
ai_version: int32
ai_fqdn: pointer
ai_interfaceindex: int32
ai_resolutionhandle: pointer
ai_ttl: uint32
ai_numservers: uint32
ai_servers: pointer
ai_responseflags: uint64
ai_extraflags: uint64struct ADDRINFOEX7
{
int ai_flags;
int ai_family;
int ai_socktype;
int ai_protocol;
size_t ai_addrlen;
void* ai_canonname;
void* ai_addr;
void* ai_blob;
size_t ai_bloblen;
void* ai_provider;
void* ai_next;
int ai_version;
void* ai_fqdn;
int ai_interfaceindex;
void* ai_resolutionhandle;
uint ai_ttl;
uint ai_numservers;
void* ai_servers;
ulong ai_responseflags;
ulong ai_extraflags;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; ADDRINFOEX7 サイズ: 88 バイト(x86)
dim st, 22 ; 4byte整数×22(構造体サイズ 88 / 4 切り上げ)
; ai_flags : INT (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; ai_family : INT (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; ai_socktype : INT (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; ai_protocol : INT (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; ai_addrlen : UINT_PTR (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; ai_canonname : LPWSTR (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; ai_addr : SOCKADDR* (+24, 4byte) varptr(st)+24 を基点に操作(4byte:入れ子/配列)
; ai_blob : void* (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; ai_bloblen : UINT_PTR (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; ai_provider : GUID* (+36, 4byte) varptr(st)+36 を基点に操作(4byte:入れ子/配列)
; ai_next : ADDRINFOEX7* (+40, 4byte) varptr(st)+40 を基点に操作(4byte:入れ子/配列)
; ai_version : INT (+44, 4byte) st.11 = 値 / 値 = st.11 (lpoke/lpeek も可)
; ai_fqdn : LPWSTR (+48, 4byte) st.12 = 値 / 値 = st.12 (lpoke/lpeek も可)
; ai_interfaceindex : INT (+52, 4byte) st.13 = 値 / 値 = st.13 (lpoke/lpeek も可)
; ai_resolutionhandle : HANDLE (+56, 4byte) st.14 = 値 / 値 = st.14 (lpoke/lpeek も可)
; ai_ttl : DWORD (+60, 4byte) st.15 = 値 / 値 = st.15 (lpoke/lpeek も可)
; ai_numservers : DWORD (+64, 4byte) st.16 = 値 / 値 = st.16 (lpoke/lpeek も可)
; ai_servers : ADDRINFO_DNS_SERVER* (+68, 4byte) varptr(st)+68 を基点に操作(4byte:入れ子/配列)
; ai_responseflags : ULONGLONG (+72, 8byte) qpoke st,72,値 / qpeek(st,72) ※IronHSPのみ。3.7/3.8は lpoke st,72,下位 : lpoke st,76,上位
; ai_extraflags : ULONGLONG (+80, 8byte) qpoke st,80,値 / qpeek(st,80) ※IronHSPのみ。3.7/3.8は lpoke st,80,下位 : lpoke st,84,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; ADDRINFOEX7 サイズ: 136 バイト(x64)
dim st, 34 ; 4byte整数×34(構造体サイズ 136 / 4 切り上げ)
; ai_flags : INT (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; ai_family : INT (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; ai_socktype : INT (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; ai_protocol : INT (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; ai_addrlen : UINT_PTR (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; ai_canonname : LPWSTR (+24, 8byte) qpoke st,24,値 / qpeek(st,24) ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; ai_addr : SOCKADDR* (+32, 8byte) varptr(st)+32 を基点に操作(8byte:入れ子/配列)
; ai_blob : void* (+40, 8byte) qpoke st,40,値 / qpeek(st,40) ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; ai_bloblen : UINT_PTR (+48, 8byte) qpoke st,48,値 / qpeek(st,48) ※IronHSPのみ。3.7/3.8は lpoke st,48,下位 : lpoke st,52,上位
; ai_provider : GUID* (+56, 8byte) varptr(st)+56 を基点に操作(8byte:入れ子/配列)
; ai_next : ADDRINFOEX7* (+64, 8byte) varptr(st)+64 を基点に操作(8byte:入れ子/配列)
; ai_version : INT (+72, 4byte) st.18 = 値 / 値 = st.18 (lpoke/lpeek も可)
; ai_fqdn : LPWSTR (+80, 8byte) qpoke st,80,値 / qpeek(st,80) ※IronHSPのみ。3.7/3.8は lpoke st,80,下位 : lpoke st,84,上位
; ai_interfaceindex : INT (+88, 4byte) st.22 = 値 / 値 = st.22 (lpoke/lpeek も可)
; ai_resolutionhandle : HANDLE (+96, 8byte) qpoke st,96,値 / qpeek(st,96) ※IronHSPのみ。3.7/3.8は lpoke st,96,下位 : lpoke st,100,上位
; ai_ttl : DWORD (+104, 4byte) st.26 = 値 / 値 = st.26 (lpoke/lpeek も可)
; ai_numservers : DWORD (+108, 4byte) st.27 = 値 / 値 = st.27 (lpoke/lpeek も可)
; ai_servers : ADDRINFO_DNS_SERVER* (+112, 8byte) varptr(st)+112 を基点に操作(8byte:入れ子/配列)
; ai_responseflags : ULONGLONG (+120, 8byte) qpoke st,120,値 / qpeek(st,120) ※IronHSPのみ。3.7/3.8は lpoke st,120,下位 : lpoke st,124,上位
; ai_extraflags : ULONGLONG (+128, 8byte) qpoke st,128,値 / qpeek(st,128) ※IronHSPのみ。3.7/3.8は lpoke st,128,下位 : lpoke st,132,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global ADDRINFOEX7
#field int ai_flags
#field int ai_family
#field int ai_socktype
#field int ai_protocol
#field intptr ai_addrlen
#field intptr ai_canonname
#field intptr ai_addr
#field intptr ai_blob
#field intptr ai_bloblen
#field intptr ai_provider
#field intptr ai_next
#field int ai_version
#field intptr ai_fqdn
#field int ai_interfaceindex
#field intptr ai_resolutionhandle
#field int ai_ttl
#field int ai_numservers
#field intptr ai_servers
#field int64 ai_responseflags
#field int64 ai_extraflags
#endstruct
stdim st, ADDRINFOEX7 ; NSTRUCT 変数を確保
st->ai_flags = 100
mes "ai_flags=" + st->ai_flags