ホーム › NetworkManagement.Rras › VPN_TS_IP_ADDRESS
VPN_TS_IP_ADDRESS
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Type | WORD | 2 | +0 | +0 | トラフィックセレクタのIPアドレス種別(IPv4/IPv6)を表すWORD。 |
| Anonymous | _Anonymous_e__Union | 16 | +8 | +4 | 種別に応じてIPv4またはIPv6アドレスを保持する共用体。 |
共用体: _Anonymous_e__Union x64 16B / x86 16B
| フィールド | 型 | サイズ | x64 | x86 |
|---|---|---|---|---|
| v4 | IN_ADDR | 8/4 | +0 | +0 |
| v6 | IN6_ADDR | 16 | +0 | +0 |
各言語での定義
#include <windows.h>
// VPN_TS_IP_ADDRESS (x64 24 / x86 20 バイト)
typedef struct VPN_TS_IP_ADDRESS {
WORD Type;
_Anonymous_e__Union Anonymous;
} VPN_TS_IP_ADDRESS;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct VPN_TS_IP_ADDRESS
{
public ushort Type;
public _Anonymous_e__Union Anonymous;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure VPN_TS_IP_ADDRESS
Public Type As UShort
Public Anonymous As _Anonymous_e__Union
End Structureimport ctypes
from ctypes import wintypes
class VPN_TS_IP_ADDRESS(ctypes.Structure):
_fields_ = [
("Type", ctypes.c_ushort),
("Anonymous", _Anonymous_e__Union),
]#[repr(C)]
pub struct VPN_TS_IP_ADDRESS {
pub Type: u16,
pub Anonymous: _Anonymous_e__Union,
}import "golang.org/x/sys/windows"
type VPN_TS_IP_ADDRESS struct {
Type uint16
Anonymous _Anonymous_e__Union
}type
VPN_TS_IP_ADDRESS = record
Type: Word;
Anonymous: _Anonymous_e__Union;
end;const VPN_TS_IP_ADDRESS = extern struct {
Type: u16,
Anonymous: _Anonymous_e__Union,
};type
VPN_TS_IP_ADDRESS {.bycopy.} = object
Type: uint16
Anonymous: _Anonymous_e__Unionstruct VPN_TS_IP_ADDRESS
{
ushort Type;
_Anonymous_e__Union Anonymous;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; VPN_TS_IP_ADDRESS サイズ: 20 バイト(x86)
dim st, 5 ; 4byte整数×5(構造体サイズ 20 / 4 切り上げ)
; Type : WORD (+0, 2byte) wpoke st,0,値 / 値 = wpeek(st,0)
; Anonymous : _Anonymous_e__Union (+4, 16byte) varptr(st)+4 を基点に操作(16byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; VPN_TS_IP_ADDRESS サイズ: 24 バイト(x64)
dim st, 6 ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; Type : WORD (+0, 2byte) wpoke st,0,値 / 値 = wpeek(st,0)
; Anonymous : _Anonymous_e__Union (+8, 16byte) varptr(st)+8 を基点に操作(16byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global VPN_TS_IP_ADDRESS
#field short Type
#field byte Anonymous 16
#endstruct
stdim st, VPN_TS_IP_ADDRESS ; NSTRUCT 変数を確保
st->Type = 100
mes "Type=" + st->Type
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。