ホーム › NetworkManagement.WindowsFilteringPlatform › IPSEC_TUNNEL_POLICY3
IPSEC_TUNNEL_POLICY3
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| flags | DWORD | 4 | +0 | +0 | IPsecトンネルポリシーの動作を制御するフラグ。 |
| numIpsecProposals | DWORD | 4 | +4 | +4 | ipsecProposals配列の要素数。 |
| ipsecProposals | IPSEC_PROPOSAL0* | 8/4 | +8 | +8 | IPsecプロポーザルの配列へのポインター。 |
| tunnelEndpoints | IPSEC_TUNNEL_ENDPOINTS2 | 72/64 | +16 | +16 | トンネルのローカル/リモートエンドポイント(複数アドレス対応)。 |
| saIdleTimeout | IPSEC_SA_IDLE_TIMEOUT0 | 8 | +88 | +80 | SAのアイドルタイムアウト設定。 |
| emPolicy | IKEEXT_EM_POLICY2* | 8/4 | +96 | +88 | 拡張モードポリシーへのポインター。NULL可。 |
| fwdPathSaLifetime | DWORD | 4 | +104 | +92 | 転送パスSAの有効期間(秒単位)。 |
| compartmentId | DWORD | 4 | +108 | +96 | ネットワークコンパートメント(分離区画)のID。 |
| numTrafficSelectorPolicy | DWORD | 4 | +112 | +100 | trafficSelectorPolicies配列の要素数。 |
| trafficSelectorPolicies | IPSEC_TRAFFIC_SELECTOR_POLICY0* | 8/4 | +120 | +104 | トラフィックセレクターポリシーの配列へのポインター。 |
各言語での定義
#include <windows.h>
// IPSEC_TUNNEL_ENDPOINTS2 (x64 72 / x86 64 バイト)
typedef struct IPSEC_TUNNEL_ENDPOINTS2 {
FWP_IP_VERSION ipVersion;
_Anonymous1_e__Union Anonymous1;
_Anonymous2_e__Union Anonymous2;
ULONGLONG localIfLuid;
LPWSTR remoteFqdn;
DWORD numAddresses;
IPSEC_TUNNEL_ENDPOINT0* remoteAddresses;
} IPSEC_TUNNEL_ENDPOINTS2;
// IPSEC_SA_IDLE_TIMEOUT0 (x64 8 / x86 8 バイト)
typedef struct IPSEC_SA_IDLE_TIMEOUT0 {
DWORD idleTimeoutSeconds;
DWORD idleTimeoutSecondsFailOver;
} IPSEC_SA_IDLE_TIMEOUT0;
// IPSEC_TUNNEL_POLICY3 (x64 128 / x86 112 バイト)
typedef struct IPSEC_TUNNEL_POLICY3 {
DWORD flags;
DWORD numIpsecProposals;
IPSEC_PROPOSAL0* ipsecProposals;
IPSEC_TUNNEL_ENDPOINTS2 tunnelEndpoints;
IPSEC_SA_IDLE_TIMEOUT0 saIdleTimeout;
IKEEXT_EM_POLICY2* emPolicy;
DWORD fwdPathSaLifetime;
DWORD compartmentId;
DWORD numTrafficSelectorPolicy;
IPSEC_TRAFFIC_SELECTOR_POLICY0* trafficSelectorPolicies;
} IPSEC_TUNNEL_POLICY3;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct IPSEC_TUNNEL_ENDPOINTS2
{
public int ipVersion;
public _Anonymous1_e__Union Anonymous1;
public _Anonymous2_e__Union Anonymous2;
public ulong localIfLuid;
public IntPtr remoteFqdn;
public uint numAddresses;
public IntPtr remoteAddresses;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct IPSEC_SA_IDLE_TIMEOUT0
{
public uint idleTimeoutSeconds;
public uint idleTimeoutSecondsFailOver;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct IPSEC_TUNNEL_POLICY3
{
public uint flags;
public uint numIpsecProposals;
public IntPtr ipsecProposals;
public IPSEC_TUNNEL_ENDPOINTS2 tunnelEndpoints;
public IPSEC_SA_IDLE_TIMEOUT0 saIdleTimeout;
public IntPtr emPolicy;
public uint fwdPathSaLifetime;
public uint compartmentId;
public uint numTrafficSelectorPolicy;
public IntPtr trafficSelectorPolicies;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure IPSEC_TUNNEL_ENDPOINTS2
Public ipVersion As Integer
Public Anonymous1 As _Anonymous1_e__Union
Public Anonymous2 As _Anonymous2_e__Union
Public localIfLuid As ULong
Public remoteFqdn As IntPtr
Public numAddresses As UInteger
Public remoteAddresses As IntPtr
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure IPSEC_SA_IDLE_TIMEOUT0
Public idleTimeoutSeconds As UInteger
Public idleTimeoutSecondsFailOver As UInteger
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure IPSEC_TUNNEL_POLICY3
Public flags As UInteger
Public numIpsecProposals As UInteger
Public ipsecProposals As IntPtr
Public tunnelEndpoints As IPSEC_TUNNEL_ENDPOINTS2
Public saIdleTimeout As IPSEC_SA_IDLE_TIMEOUT0
Public emPolicy As IntPtr
Public fwdPathSaLifetime As UInteger
Public compartmentId As UInteger
Public numTrafficSelectorPolicy As UInteger
Public trafficSelectorPolicies As IntPtr
End Structureimport ctypes
from ctypes import wintypes
class IPSEC_TUNNEL_ENDPOINTS2(ctypes.Structure):
_fields_ = [
("ipVersion", ctypes.c_int),
("Anonymous1", _Anonymous1_e__Union),
("Anonymous2", _Anonymous2_e__Union),
("localIfLuid", ctypes.c_ulonglong),
("remoteFqdn", ctypes.c_void_p),
("numAddresses", wintypes.DWORD),
("remoteAddresses", ctypes.c_void_p),
]
class IPSEC_SA_IDLE_TIMEOUT0(ctypes.Structure):
_fields_ = [
("idleTimeoutSeconds", wintypes.DWORD),
("idleTimeoutSecondsFailOver", wintypes.DWORD),
]
class IPSEC_TUNNEL_POLICY3(ctypes.Structure):
_fields_ = [
("flags", wintypes.DWORD),
("numIpsecProposals", wintypes.DWORD),
("ipsecProposals", ctypes.c_void_p),
("tunnelEndpoints", IPSEC_TUNNEL_ENDPOINTS2),
("saIdleTimeout", IPSEC_SA_IDLE_TIMEOUT0),
("emPolicy", ctypes.c_void_p),
("fwdPathSaLifetime", wintypes.DWORD),
("compartmentId", wintypes.DWORD),
("numTrafficSelectorPolicy", wintypes.DWORD),
("trafficSelectorPolicies", ctypes.c_void_p),
]#[repr(C)]
pub struct IPSEC_TUNNEL_ENDPOINTS2 {
pub ipVersion: i32,
pub Anonymous1: _Anonymous1_e__Union,
pub Anonymous2: _Anonymous2_e__Union,
pub localIfLuid: u64,
pub remoteFqdn: *mut core::ffi::c_void,
pub numAddresses: u32,
pub remoteAddresses: *mut core::ffi::c_void,
}
#[repr(C)]
pub struct IPSEC_SA_IDLE_TIMEOUT0 {
pub idleTimeoutSeconds: u32,
pub idleTimeoutSecondsFailOver: u32,
}
#[repr(C)]
pub struct IPSEC_TUNNEL_POLICY3 {
pub flags: u32,
pub numIpsecProposals: u32,
pub ipsecProposals: *mut core::ffi::c_void,
pub tunnelEndpoints: IPSEC_TUNNEL_ENDPOINTS2,
pub saIdleTimeout: IPSEC_SA_IDLE_TIMEOUT0,
pub emPolicy: *mut core::ffi::c_void,
pub fwdPathSaLifetime: u32,
pub compartmentId: u32,
pub numTrafficSelectorPolicy: u32,
pub trafficSelectorPolicies: *mut core::ffi::c_void,
}import "golang.org/x/sys/windows"
type IPSEC_TUNNEL_ENDPOINTS2 struct {
ipVersion int32
Anonymous1 _Anonymous1_e__Union
Anonymous2 _Anonymous2_e__Union
localIfLuid uint64
remoteFqdn uintptr
numAddresses uint32
remoteAddresses uintptr
}
type IPSEC_SA_IDLE_TIMEOUT0 struct {
idleTimeoutSeconds uint32
idleTimeoutSecondsFailOver uint32
}
type IPSEC_TUNNEL_POLICY3 struct {
flags uint32
numIpsecProposals uint32
ipsecProposals uintptr
tunnelEndpoints IPSEC_TUNNEL_ENDPOINTS2
saIdleTimeout IPSEC_SA_IDLE_TIMEOUT0
emPolicy uintptr
fwdPathSaLifetime uint32
compartmentId uint32
numTrafficSelectorPolicy uint32
trafficSelectorPolicies uintptr
}type
IPSEC_TUNNEL_ENDPOINTS2 = record
ipVersion: Integer;
Anonymous1: _Anonymous1_e__Union;
Anonymous2: _Anonymous2_e__Union;
localIfLuid: UInt64;
remoteFqdn: Pointer;
numAddresses: DWORD;
remoteAddresses: Pointer;
end;
IPSEC_SA_IDLE_TIMEOUT0 = record
idleTimeoutSeconds: DWORD;
idleTimeoutSecondsFailOver: DWORD;
end;
IPSEC_TUNNEL_POLICY3 = record
flags: DWORD;
numIpsecProposals: DWORD;
ipsecProposals: Pointer;
tunnelEndpoints: IPSEC_TUNNEL_ENDPOINTS2;
saIdleTimeout: IPSEC_SA_IDLE_TIMEOUT0;
emPolicy: Pointer;
fwdPathSaLifetime: DWORD;
compartmentId: DWORD;
numTrafficSelectorPolicy: DWORD;
trafficSelectorPolicies: Pointer;
end;const IPSEC_TUNNEL_ENDPOINTS2 = extern struct {
ipVersion: i32,
Anonymous1: _Anonymous1_e__Union,
Anonymous2: _Anonymous2_e__Union,
localIfLuid: u64,
remoteFqdn: ?*anyopaque,
numAddresses: u32,
remoteAddresses: ?*anyopaque,
};
const IPSEC_SA_IDLE_TIMEOUT0 = extern struct {
idleTimeoutSeconds: u32,
idleTimeoutSecondsFailOver: u32,
};
const IPSEC_TUNNEL_POLICY3 = extern struct {
flags: u32,
numIpsecProposals: u32,
ipsecProposals: ?*anyopaque,
tunnelEndpoints: IPSEC_TUNNEL_ENDPOINTS2,
saIdleTimeout: IPSEC_SA_IDLE_TIMEOUT0,
emPolicy: ?*anyopaque,
fwdPathSaLifetime: u32,
compartmentId: u32,
numTrafficSelectorPolicy: u32,
trafficSelectorPolicies: ?*anyopaque,
};type
IPSEC_TUNNEL_ENDPOINTS2 {.bycopy.} = object
ipVersion: int32
Anonymous1: _Anonymous1_e__Union
Anonymous2: _Anonymous2_e__Union
localIfLuid: uint64
remoteFqdn: pointer
numAddresses: uint32
remoteAddresses: pointer
IPSEC_SA_IDLE_TIMEOUT0 {.bycopy.} = object
idleTimeoutSeconds: uint32
idleTimeoutSecondsFailOver: uint32
IPSEC_TUNNEL_POLICY3 {.bycopy.} = object
flags: uint32
numIpsecProposals: uint32
ipsecProposals: pointer
tunnelEndpoints: IPSEC_TUNNEL_ENDPOINTS2
saIdleTimeout: IPSEC_SA_IDLE_TIMEOUT0
emPolicy: pointer
fwdPathSaLifetime: uint32
compartmentId: uint32
numTrafficSelectorPolicy: uint32
trafficSelectorPolicies: pointerstruct IPSEC_TUNNEL_ENDPOINTS2
{
int ipVersion;
_Anonymous1_e__Union Anonymous1;
_Anonymous2_e__Union Anonymous2;
ulong localIfLuid;
void* remoteFqdn;
uint numAddresses;
void* remoteAddresses;
}
struct IPSEC_SA_IDLE_TIMEOUT0
{
uint idleTimeoutSeconds;
uint idleTimeoutSecondsFailOver;
}
struct IPSEC_TUNNEL_POLICY3
{
uint flags;
uint numIpsecProposals;
void* ipsecProposals;
IPSEC_TUNNEL_ENDPOINTS2 tunnelEndpoints;
IPSEC_SA_IDLE_TIMEOUT0 saIdleTimeout;
void* emPolicy;
uint fwdPathSaLifetime;
uint compartmentId;
uint numTrafficSelectorPolicy;
void* trafficSelectorPolicies;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; IPSEC_TUNNEL_POLICY3 サイズ: 112 バイト(x86)
dim st, 28 ; 4byte整数×28(構造体サイズ 112 / 4 切り上げ)
; flags : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; numIpsecProposals : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; ipsecProposals : IPSEC_PROPOSAL0* (+8, 4byte) varptr(st)+8 を基点に操作(4byte:入れ子/配列)
; tunnelEndpoints : IPSEC_TUNNEL_ENDPOINTS2 (+16, 64byte) varptr(st)+16 を基点に操作(64byte:入れ子/配列)
; saIdleTimeout : IPSEC_SA_IDLE_TIMEOUT0 (+80, 8byte) varptr(st)+80 を基点に操作(8byte:入れ子/配列)
; emPolicy : IKEEXT_EM_POLICY2* (+88, 4byte) varptr(st)+88 を基点に操作(4byte:入れ子/配列)
; fwdPathSaLifetime : DWORD (+92, 4byte) st.23 = 値 / 値 = st.23 (lpoke/lpeek も可)
; compartmentId : DWORD (+96, 4byte) st.24 = 値 / 値 = st.24 (lpoke/lpeek も可)
; numTrafficSelectorPolicy : DWORD (+100, 4byte) st.25 = 値 / 値 = st.25 (lpoke/lpeek も可)
; trafficSelectorPolicies : IPSEC_TRAFFIC_SELECTOR_POLICY0* (+104, 4byte) varptr(st)+104 を基点に操作(4byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; IPSEC_TUNNEL_POLICY3 サイズ: 128 バイト(x64)
dim st, 32 ; 4byte整数×32(構造体サイズ 128 / 4 切り上げ)
; flags : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; numIpsecProposals : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; ipsecProposals : IPSEC_PROPOSAL0* (+8, 8byte) varptr(st)+8 を基点に操作(8byte:入れ子/配列)
; tunnelEndpoints : IPSEC_TUNNEL_ENDPOINTS2 (+16, 72byte) varptr(st)+16 を基点に操作(72byte:入れ子/配列)
; saIdleTimeout : IPSEC_SA_IDLE_TIMEOUT0 (+88, 8byte) varptr(st)+88 を基点に操作(8byte:入れ子/配列)
; emPolicy : IKEEXT_EM_POLICY2* (+96, 8byte) varptr(st)+96 を基点に操作(8byte:入れ子/配列)
; fwdPathSaLifetime : DWORD (+104, 4byte) st.26 = 値 / 値 = st.26 (lpoke/lpeek も可)
; compartmentId : DWORD (+108, 4byte) st.27 = 値 / 値 = st.27 (lpoke/lpeek も可)
; numTrafficSelectorPolicy : DWORD (+112, 4byte) st.28 = 値 / 値 = st.28 (lpoke/lpeek も可)
; trafficSelectorPolicies : IPSEC_TRAFFIC_SELECTOR_POLICY0* (+120, 8byte) varptr(st)+120 を基点に操作(8byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global IPSEC_TUNNEL_ENDPOINTS2
#field int ipVersion
#field byte Anonymous1 16
#field byte Anonymous2 16
#field int64 localIfLuid
#field intptr remoteFqdn
#field int numAddresses
#field intptr remoteAddresses
#endstruct
#defstruct global IPSEC_SA_IDLE_TIMEOUT0
#field int idleTimeoutSeconds
#field int idleTimeoutSecondsFailOver
#endstruct
#defstruct global IPSEC_TUNNEL_POLICY3
#field int flags
#field int numIpsecProposals
#field intptr ipsecProposals
#field IPSEC_TUNNEL_ENDPOINTS2 tunnelEndpoints
#field IPSEC_SA_IDLE_TIMEOUT0 saIdleTimeout
#field intptr emPolicy
#field int fwdPathSaLifetime
#field int compartmentId
#field int numTrafficSelectorPolicy
#field intptr trafficSelectorPolicies
#endstruct
stdim st, IPSEC_TUNNEL_POLICY3 ; NSTRUCT 変数を確保
st->flags = 100
mes "flags=" + st->flags