ホーム › NetworkManagement.WindowsFilteringPlatform › IPSEC_SA_BUNDLE1
IPSEC_SA_BUNDLE1
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| flags | IPSEC_SA_BUNDLE_FLAGS | 4 | +0 | +0 | SAバンドルの動作を制御するフラグ(IPSEC_SA_BUNDLE_FLAGS)。 |
| lifetime | IPSEC_SA_LIFETIME0 | 12 | +4 | +4 | SAの有効期間(バイト/秒/パケット数)。 |
| idleTimeoutSeconds | DWORD | 4 | +16 | +16 | アイドル状態でSAを削除するまでの秒数。 |
| ndAllowClearTimeoutSeconds | DWORD | 4 | +20 | +20 | 近隣探索の平文許可タイムアウト秒数。 |
| ipsecId | IPSEC_ID0* | 8/4 | +24 | +24 | このバンドルに関連付くIPsec ID情報へのポインター。 |
| napContext | DWORD | 4 | +32 | +28 | ネットワークアクセス保護(NAP)のコンテキスト値。 |
| qmSaId | DWORD | 4 | +36 | +32 | クイックモードSAを識別する値。 |
| numSAs | DWORD | 4 | +40 | +36 | saList配列の要素数。 |
| saList | IPSEC_SA0* | 8/4 | +48 | +40 | バンドルを構成するIPSEC_SA0の配列へのポインター。 |
| keyModuleState | IPSEC_KEYMODULE_STATE0* | 8/4 | +56 | +44 | キーイングモジュールの状態情報へのポインター。 |
| ipVersion | FWP_IP_VERSION | 4 | +64 | +48 | 対象のIPバージョン(IPv4/IPv6)。 |
| Anonymous | _Anonymous_e__Union | 4 | +68 | +52 | IPバージョンに応じた送信先アドレスを保持する共用体。 |
| mmSaId | ULONGLONG | 8 | +72 | +56 | メインモードSAを識別するULONGLONG値。 |
| pfsGroup | IPSEC_PFS_GROUP | 4 | +80 | +64 | Perfect Forward Secrecyに使用するDiffie-Hellmanグループ。 |
| saLookupContext | GUID | 16 | +84 | +68 | SA検索に用いるコンテキストを識別するGUID。 |
| qmFilterId | ULONGLONG | 8 | +104 | +88 | クイックモードフィルターを識別するID。バージョン1で追加。 |
共用体: _Anonymous_e__Union x64 4B / x86 4B
| フィールド | 型 | サイズ | x64 | x86 |
|---|---|---|---|---|
| peerV4PrivateAddress | DWORD | 4 | +0 | +0 |
各言語での定義
#include <windows.h>
// IPSEC_SA_LIFETIME0 (x64 12 / x86 12 バイト)
typedef struct IPSEC_SA_LIFETIME0 {
DWORD lifetimeSeconds;
DWORD lifetimeKilobytes;
DWORD lifetimePackets;
} IPSEC_SA_LIFETIME0;
// IPSEC_SA_BUNDLE1 (x64 112 / x86 96 バイト)
typedef struct IPSEC_SA_BUNDLE1 {
IPSEC_SA_BUNDLE_FLAGS flags;
IPSEC_SA_LIFETIME0 lifetime;
DWORD idleTimeoutSeconds;
DWORD ndAllowClearTimeoutSeconds;
IPSEC_ID0* ipsecId;
DWORD napContext;
DWORD qmSaId;
DWORD numSAs;
IPSEC_SA0* saList;
IPSEC_KEYMODULE_STATE0* keyModuleState;
FWP_IP_VERSION ipVersion;
_Anonymous_e__Union Anonymous;
ULONGLONG mmSaId;
IPSEC_PFS_GROUP pfsGroup;
GUID saLookupContext;
ULONGLONG qmFilterId;
} IPSEC_SA_BUNDLE1;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct IPSEC_SA_LIFETIME0
{
public uint lifetimeSeconds;
public uint lifetimeKilobytes;
public uint lifetimePackets;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct IPSEC_SA_BUNDLE1
{
public uint flags;
public IPSEC_SA_LIFETIME0 lifetime;
public uint idleTimeoutSeconds;
public uint ndAllowClearTimeoutSeconds;
public IntPtr ipsecId;
public uint napContext;
public uint qmSaId;
public uint numSAs;
public IntPtr saList;
public IntPtr keyModuleState;
public int ipVersion;
public _Anonymous_e__Union Anonymous;
public ulong mmSaId;
public int pfsGroup;
public Guid saLookupContext;
public ulong qmFilterId;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure IPSEC_SA_LIFETIME0
Public lifetimeSeconds As UInteger
Public lifetimeKilobytes As UInteger
Public lifetimePackets As UInteger
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure IPSEC_SA_BUNDLE1
Public flags As UInteger
Public lifetime As IPSEC_SA_LIFETIME0
Public idleTimeoutSeconds As UInteger
Public ndAllowClearTimeoutSeconds As UInteger
Public ipsecId As IntPtr
Public napContext As UInteger
Public qmSaId As UInteger
Public numSAs As UInteger
Public saList As IntPtr
Public keyModuleState As IntPtr
Public ipVersion As Integer
Public Anonymous As _Anonymous_e__Union
Public mmSaId As ULong
Public pfsGroup As Integer
Public saLookupContext As Guid
Public qmFilterId As ULong
End Structureimport ctypes
from ctypes import wintypes
class IPSEC_SA_LIFETIME0(ctypes.Structure):
_fields_ = [
("lifetimeSeconds", wintypes.DWORD),
("lifetimeKilobytes", wintypes.DWORD),
("lifetimePackets", wintypes.DWORD),
]
class IPSEC_SA_BUNDLE1(ctypes.Structure):
_fields_ = [
("flags", wintypes.DWORD),
("lifetime", IPSEC_SA_LIFETIME0),
("idleTimeoutSeconds", wintypes.DWORD),
("ndAllowClearTimeoutSeconds", wintypes.DWORD),
("ipsecId", ctypes.c_void_p),
("napContext", wintypes.DWORD),
("qmSaId", wintypes.DWORD),
("numSAs", wintypes.DWORD),
("saList", ctypes.c_void_p),
("keyModuleState", ctypes.c_void_p),
("ipVersion", ctypes.c_int),
("Anonymous", _Anonymous_e__Union),
("mmSaId", ctypes.c_ulonglong),
("pfsGroup", ctypes.c_int),
("saLookupContext", GUID),
("qmFilterId", ctypes.c_ulonglong),
]#[repr(C)]
pub struct IPSEC_SA_LIFETIME0 {
pub lifetimeSeconds: u32,
pub lifetimeKilobytes: u32,
pub lifetimePackets: u32,
}
#[repr(C)]
pub struct IPSEC_SA_BUNDLE1 {
pub flags: u32,
pub lifetime: IPSEC_SA_LIFETIME0,
pub idleTimeoutSeconds: u32,
pub ndAllowClearTimeoutSeconds: u32,
pub ipsecId: *mut core::ffi::c_void,
pub napContext: u32,
pub qmSaId: u32,
pub numSAs: u32,
pub saList: *mut core::ffi::c_void,
pub keyModuleState: *mut core::ffi::c_void,
pub ipVersion: i32,
pub Anonymous: _Anonymous_e__Union,
pub mmSaId: u64,
pub pfsGroup: i32,
pub saLookupContext: GUID,
pub qmFilterId: u64,
}import "golang.org/x/sys/windows"
type IPSEC_SA_LIFETIME0 struct {
lifetimeSeconds uint32
lifetimeKilobytes uint32
lifetimePackets uint32
}
type IPSEC_SA_BUNDLE1 struct {
flags uint32
lifetime IPSEC_SA_LIFETIME0
idleTimeoutSeconds uint32
ndAllowClearTimeoutSeconds uint32
ipsecId uintptr
napContext uint32
qmSaId uint32
numSAs uint32
saList uintptr
keyModuleState uintptr
ipVersion int32
Anonymous _Anonymous_e__Union
mmSaId uint64
pfsGroup int32
saLookupContext windows.GUID
qmFilterId uint64
}type
IPSEC_SA_LIFETIME0 = record
lifetimeSeconds: DWORD;
lifetimeKilobytes: DWORD;
lifetimePackets: DWORD;
end;
IPSEC_SA_BUNDLE1 = record
flags: DWORD;
lifetime: IPSEC_SA_LIFETIME0;
idleTimeoutSeconds: DWORD;
ndAllowClearTimeoutSeconds: DWORD;
ipsecId: Pointer;
napContext: DWORD;
qmSaId: DWORD;
numSAs: DWORD;
saList: Pointer;
keyModuleState: Pointer;
ipVersion: Integer;
Anonymous: _Anonymous_e__Union;
mmSaId: UInt64;
pfsGroup: Integer;
saLookupContext: TGUID;
qmFilterId: UInt64;
end;const IPSEC_SA_LIFETIME0 = extern struct {
lifetimeSeconds: u32,
lifetimeKilobytes: u32,
lifetimePackets: u32,
};
const IPSEC_SA_BUNDLE1 = extern struct {
flags: u32,
lifetime: IPSEC_SA_LIFETIME0,
idleTimeoutSeconds: u32,
ndAllowClearTimeoutSeconds: u32,
ipsecId: ?*anyopaque,
napContext: u32,
qmSaId: u32,
numSAs: u32,
saList: ?*anyopaque,
keyModuleState: ?*anyopaque,
ipVersion: i32,
Anonymous: _Anonymous_e__Union,
mmSaId: u64,
pfsGroup: i32,
saLookupContext: GUID,
qmFilterId: u64,
};type
IPSEC_SA_LIFETIME0 {.bycopy.} = object
lifetimeSeconds: uint32
lifetimeKilobytes: uint32
lifetimePackets: uint32
IPSEC_SA_BUNDLE1 {.bycopy.} = object
flags: uint32
lifetime: IPSEC_SA_LIFETIME0
idleTimeoutSeconds: uint32
ndAllowClearTimeoutSeconds: uint32
ipsecId: pointer
napContext: uint32
qmSaId: uint32
numSAs: uint32
saList: pointer
keyModuleState: pointer
ipVersion: int32
Anonymous: _Anonymous_e__Union
mmSaId: uint64
pfsGroup: int32
saLookupContext: GUID
qmFilterId: uint64struct IPSEC_SA_LIFETIME0
{
uint lifetimeSeconds;
uint lifetimeKilobytes;
uint lifetimePackets;
}
struct IPSEC_SA_BUNDLE1
{
uint flags;
IPSEC_SA_LIFETIME0 lifetime;
uint idleTimeoutSeconds;
uint ndAllowClearTimeoutSeconds;
void* ipsecId;
uint napContext;
uint qmSaId;
uint numSAs;
void* saList;
void* keyModuleState;
int ipVersion;
_Anonymous_e__Union Anonymous;
ulong mmSaId;
int pfsGroup;
GUID saLookupContext;
ulong qmFilterId;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; IPSEC_SA_BUNDLE1 サイズ: 96 バイト(x86)
dim st, 24 ; 4byte整数×24(構造体サイズ 96 / 4 切り上げ)
; flags : IPSEC_SA_BUNDLE_FLAGS (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; lifetime : IPSEC_SA_LIFETIME0 (+4, 12byte) varptr(st)+4 を基点に操作(12byte:入れ子/配列)
; idleTimeoutSeconds : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; ndAllowClearTimeoutSeconds : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; ipsecId : IPSEC_ID0* (+24, 4byte) varptr(st)+24 を基点に操作(4byte:入れ子/配列)
; napContext : DWORD (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; qmSaId : DWORD (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; numSAs : DWORD (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; saList : IPSEC_SA0* (+40, 4byte) varptr(st)+40 を基点に操作(4byte:入れ子/配列)
; keyModuleState : IPSEC_KEYMODULE_STATE0* (+44, 4byte) varptr(st)+44 を基点に操作(4byte:入れ子/配列)
; ipVersion : FWP_IP_VERSION (+48, 4byte) st.12 = 値 / 値 = st.12 (lpoke/lpeek も可)
; Anonymous : _Anonymous_e__Union (+52, 4byte) varptr(st)+52 を基点に操作(4byte:入れ子/配列)
; mmSaId : ULONGLONG (+56, 8byte) qpoke st,56,値 / qpeek(st,56) ※IronHSPのみ。3.7/3.8は lpoke st,56,下位 : lpoke st,60,上位
; pfsGroup : IPSEC_PFS_GROUP (+64, 4byte) st.16 = 値 / 値 = st.16 (lpoke/lpeek も可)
; saLookupContext : GUID (+68, 16byte) varptr(st)+68 を基点に操作(16byte:入れ子/配列)
; qmFilterId : ULONGLONG (+88, 8byte) qpoke st,88,値 / qpeek(st,88) ※IronHSPのみ。3.7/3.8は lpoke st,88,下位 : lpoke st,92,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; IPSEC_SA_BUNDLE1 サイズ: 112 バイト(x64)
dim st, 28 ; 4byte整数×28(構造体サイズ 112 / 4 切り上げ)
; flags : IPSEC_SA_BUNDLE_FLAGS (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; lifetime : IPSEC_SA_LIFETIME0 (+4, 12byte) varptr(st)+4 を基点に操作(12byte:入れ子/配列)
; idleTimeoutSeconds : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; ndAllowClearTimeoutSeconds : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; ipsecId : IPSEC_ID0* (+24, 8byte) varptr(st)+24 を基点に操作(8byte:入れ子/配列)
; napContext : DWORD (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; qmSaId : DWORD (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; numSAs : DWORD (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; saList : IPSEC_SA0* (+48, 8byte) varptr(st)+48 を基点に操作(8byte:入れ子/配列)
; keyModuleState : IPSEC_KEYMODULE_STATE0* (+56, 8byte) varptr(st)+56 を基点に操作(8byte:入れ子/配列)
; ipVersion : FWP_IP_VERSION (+64, 4byte) st.16 = 値 / 値 = st.16 (lpoke/lpeek も可)
; Anonymous : _Anonymous_e__Union (+68, 4byte) varptr(st)+68 を基点に操作(4byte:入れ子/配列)
; mmSaId : ULONGLONG (+72, 8byte) qpoke st,72,値 / qpeek(st,72) ※IronHSPのみ。3.7/3.8は lpoke st,72,下位 : lpoke st,76,上位
; pfsGroup : IPSEC_PFS_GROUP (+80, 4byte) st.20 = 値 / 値 = st.20 (lpoke/lpeek も可)
; saLookupContext : GUID (+84, 16byte) varptr(st)+84 を基点に操作(16byte:入れ子/配列)
; qmFilterId : ULONGLONG (+104, 8byte) qpoke st,104,値 / qpeek(st,104) ※IronHSPのみ。3.7/3.8は lpoke st,104,下位 : lpoke st,108,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global IPSEC_SA_LIFETIME0
#field int lifetimeSeconds
#field int lifetimeKilobytes
#field int lifetimePackets
#endstruct
#defstruct global GUID, pack=1
#field int Data1
#field short Data2
#field short Data3
#field byte Data4 8
#endstruct
#defstruct global IPSEC_SA_BUNDLE1
#field int flags
#field IPSEC_SA_LIFETIME0 lifetime
#field int idleTimeoutSeconds
#field int ndAllowClearTimeoutSeconds
#field intptr ipsecId
#field int napContext
#field int qmSaId
#field int numSAs
#field intptr saList
#field intptr keyModuleState
#field int ipVersion
#field byte Anonymous 4
#field int64 mmSaId
#field int pfsGroup
#field GUID saLookupContext
#field int64 qmFilterId
#endstruct
stdim st, IPSEC_SA_BUNDLE1 ; NSTRUCT 変数を確保
st->flags = 100
mes "flags=" + st->flags
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。