ホーム › Networking.WinSock › ADDRINFOEX3
ADDRINFOEX3
構造体サイズ=各フィールドのバイト数(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 | ADDRINFOEX3* | 8/4 | +64 | +40 | 次のADDRINFOEX3エントリへのポインタである。NULLで終端。 |
| ai_version | INT | 4 | +72 | +44 | この構造体のバージョン番号である。 |
| ai_fqdn | LPWSTR | 8/4 | +80 | +48 | 解決された完全修飾ドメイン名(FQDN)文字列である。 |
| ai_interfaceindex | INT | 4 | +88 | +52 | アドレス解決に使用したインタフェースのインデックスである。 |
各言語での定義
#include <windows.h>
// ADDRINFOEX3 (x64 96 / x86 56 バイト)
typedef struct ADDRINFOEX3 {
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;
ADDRINFOEX3* ai_next;
INT ai_version;
LPWSTR ai_fqdn;
INT ai_interfaceindex;
} ADDRINFOEX3;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct ADDRINFOEX3
{
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;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure ADDRINFOEX3
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
End Structureimport ctypes
from ctypes import wintypes
class ADDRINFOEX3(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),
]#[repr(C)]
pub struct ADDRINFOEX3 {
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,
}import "golang.org/x/sys/windows"
type ADDRINFOEX3 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
}type
ADDRINFOEX3 = 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;
end;const ADDRINFOEX3 = 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,
};type
ADDRINFOEX3 {.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: int32struct ADDRINFOEX3
{
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;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; ADDRINFOEX3 サイズ: 56 バイト(x86)
dim st, 14 ; 4byte整数×14(構造体サイズ 56 / 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 : ADDRINFOEX3* (+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 も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; ADDRINFOEX3 サイズ: 96 バイト(x64)
dim st, 24 ; 4byte整数×24(構造体サイズ 96 / 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 : ADDRINFOEX3* (+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 も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global ADDRINFOEX3
#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
#endstruct
stdim st, ADDRINFOEX3 ; NSTRUCT 変数を確保
st->ai_flags = 100
mes "ai_flags=" + st->ai_flags