ホーム › Networking.WinSock › ADDRINFOEXA
ADDRINFOEXA
構造体サイズ=各フィールドのバイト数(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 | LPSTR | 8/4 | +24 | +20 | 正規ホスト名文字列(ANSI)である。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 | ADDRINFOEXA* | 8/4 | +64 | +40 | 次のADDRINFOEXAエントリへのポインタである。NULLで終端。 |
各言語での定義
#include <windows.h>
// ADDRINFOEXA (x64 72 / x86 44 バイト)
typedef struct ADDRINFOEXA {
INT ai_flags;
INT ai_family;
INT ai_socktype;
INT ai_protocol;
UINT_PTR ai_addrlen;
LPSTR ai_canonname;
SOCKADDR* ai_addr;
void* ai_blob;
UINT_PTR ai_bloblen;
GUID* ai_provider;
ADDRINFOEXA* ai_next;
} ADDRINFOEXA;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct ADDRINFOEXA
{
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;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure ADDRINFOEXA
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
End Structureimport ctypes
from ctypes import wintypes
class ADDRINFOEXA(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),
]#[repr(C)]
pub struct ADDRINFOEXA {
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,
}import "golang.org/x/sys/windows"
type ADDRINFOEXA 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
}type
ADDRINFOEXA = 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;
end;const ADDRINFOEXA = 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,
};type
ADDRINFOEXA {.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: pointerstruct ADDRINFOEXA
{
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;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; ADDRINFOEXA サイズ: 44 バイト(x86)
dim st, 11 ; 4byte整数×11(構造体サイズ 44 / 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 : LPSTR (+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 : ADDRINFOEXA* (+40, 4byte) varptr(st)+40 を基点に操作(4byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; ADDRINFOEXA サイズ: 72 バイト(x64)
dim st, 18 ; 4byte整数×18(構造体サイズ 72 / 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 : LPSTR (+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 : ADDRINFOEXA* (+64, 8byte) varptr(st)+64 を基点に操作(8byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global ADDRINFOEXA
#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
#endstruct
stdim st, ADDRINFOEXA ; NSTRUCT 変数を確保
st->ai_flags = 100
mes "ai_flags=" + st->ai_flags