Win32 API 日本語リファレンス
ホームNetworkManagement.Rras › IKEV2_TUNNEL_CONFIG_PARAMS4

IKEV2_TUNNEL_CONFIG_PARAMS4

構造体
サイズx64: 104 バイト / x86: 64 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
dwIdleTimeoutDWORD4+0+0トンネルがアイドル状態で切断されるまでの秒数。
dwNetworkBlackoutTimeDWORD4+4+4ネットワーク中断を許容する時間(秒)。
dwSaLifeTimeDWORD4+8+8IPsec SAの有効期間(秒)。
dwSaDataSizeForRenegotiationDWORD4+12+12SA再ネゴシエーションの閾値となるデータ量(KB)。
dwConfigOptionsDWORD4+16+16トンネル構成のオプションフラグ。
dwTotalCertificatesDWORD4+20+20certificateNamesが指す証明書ブロブ配列の要素数。
certificateNamesCRYPT_INTEGER_BLOB*8/4+24+24信頼するルート証明書名のブロブ配列へのポインタ。
machineCertificateNameCRYPT_INTEGER_BLOB16/8+32+28サーバーマシン証明書の名前を保持するブロブ。
dwEncryptionTypeDWORD4+48+36データ暗号化の種別を表す列挙値。
customPolicyROUTER_CUSTOM_IKEv2_POLICY0*8/4+56+40IKEv2のカスタム暗号ポリシーへのポインタ。NULLなら既定。
dwTotalEkusDWORD4+64+44certificateEKUsが指すEKU配列の要素数。
certificateEKUsMPR_CERT_EKU*8/4+72+48証明書選択に使用する拡張キー使用法(EKU)配列へのポインタ。
machineCertificateHashCRYPT_INTEGER_BLOB16/8+80+52サーバーマシン証明書のハッシュを保持するブロブ。
dwMmSaLifeTimeDWORD4+96+60メインモード(フェーズ1)SAの有効期間(秒)。

各言語での定義

#include <windows.h>

// CRYPT_INTEGER_BLOB  (x64 16 / x86 8 バイト)
typedef struct CRYPT_INTEGER_BLOB {
    DWORD cbData;
    BYTE* pbData;
} CRYPT_INTEGER_BLOB;

// IKEV2_TUNNEL_CONFIG_PARAMS4  (x64 104 / x86 64 バイト)
typedef struct IKEV2_TUNNEL_CONFIG_PARAMS4 {
    DWORD dwIdleTimeout;
    DWORD dwNetworkBlackoutTime;
    DWORD dwSaLifeTime;
    DWORD dwSaDataSizeForRenegotiation;
    DWORD dwConfigOptions;
    DWORD dwTotalCertificates;
    CRYPT_INTEGER_BLOB* certificateNames;
    CRYPT_INTEGER_BLOB machineCertificateName;
    DWORD dwEncryptionType;
    ROUTER_CUSTOM_IKEv2_POLICY0* customPolicy;
    DWORD dwTotalEkus;
    MPR_CERT_EKU* certificateEKUs;
    CRYPT_INTEGER_BLOB machineCertificateHash;
    DWORD dwMmSaLifeTime;
} IKEV2_TUNNEL_CONFIG_PARAMS4;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct CRYPT_INTEGER_BLOB
{
    public uint cbData;
    public IntPtr pbData;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct IKEV2_TUNNEL_CONFIG_PARAMS4
{
    public uint dwIdleTimeout;
    public uint dwNetworkBlackoutTime;
    public uint dwSaLifeTime;
    public uint dwSaDataSizeForRenegotiation;
    public uint dwConfigOptions;
    public uint dwTotalCertificates;
    public IntPtr certificateNames;
    public CRYPT_INTEGER_BLOB machineCertificateName;
    public uint dwEncryptionType;
    public IntPtr customPolicy;
    public uint dwTotalEkus;
    public IntPtr certificateEKUs;
    public CRYPT_INTEGER_BLOB machineCertificateHash;
    public uint dwMmSaLifeTime;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure CRYPT_INTEGER_BLOB
    Public cbData As UInteger
    Public pbData As IntPtr
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure IKEV2_TUNNEL_CONFIG_PARAMS4
    Public dwIdleTimeout As UInteger
    Public dwNetworkBlackoutTime As UInteger
    Public dwSaLifeTime As UInteger
    Public dwSaDataSizeForRenegotiation As UInteger
    Public dwConfigOptions As UInteger
    Public dwTotalCertificates As UInteger
    Public certificateNames As IntPtr
    Public machineCertificateName As CRYPT_INTEGER_BLOB
    Public dwEncryptionType As UInteger
    Public customPolicy As IntPtr
    Public dwTotalEkus As UInteger
    Public certificateEKUs As IntPtr
    Public machineCertificateHash As CRYPT_INTEGER_BLOB
    Public dwMmSaLifeTime As UInteger
End Structure
import ctypes
from ctypes import wintypes

class CRYPT_INTEGER_BLOB(ctypes.Structure):
    _fields_ = [
        ("cbData", wintypes.DWORD),
        ("pbData", ctypes.c_void_p),
    ]

class IKEV2_TUNNEL_CONFIG_PARAMS4(ctypes.Structure):
    _fields_ = [
        ("dwIdleTimeout", wintypes.DWORD),
        ("dwNetworkBlackoutTime", wintypes.DWORD),
        ("dwSaLifeTime", wintypes.DWORD),
        ("dwSaDataSizeForRenegotiation", wintypes.DWORD),
        ("dwConfigOptions", wintypes.DWORD),
        ("dwTotalCertificates", wintypes.DWORD),
        ("certificateNames", ctypes.c_void_p),
        ("machineCertificateName", CRYPT_INTEGER_BLOB),
        ("dwEncryptionType", wintypes.DWORD),
        ("customPolicy", ctypes.c_void_p),
        ("dwTotalEkus", wintypes.DWORD),
        ("certificateEKUs", ctypes.c_void_p),
        ("machineCertificateHash", CRYPT_INTEGER_BLOB),
        ("dwMmSaLifeTime", wintypes.DWORD),
    ]
#[repr(C)]
pub struct CRYPT_INTEGER_BLOB {
    pub cbData: u32,
    pub pbData: *mut core::ffi::c_void,
}

#[repr(C)]
pub struct IKEV2_TUNNEL_CONFIG_PARAMS4 {
    pub dwIdleTimeout: u32,
    pub dwNetworkBlackoutTime: u32,
    pub dwSaLifeTime: u32,
    pub dwSaDataSizeForRenegotiation: u32,
    pub dwConfigOptions: u32,
    pub dwTotalCertificates: u32,
    pub certificateNames: *mut core::ffi::c_void,
    pub machineCertificateName: CRYPT_INTEGER_BLOB,
    pub dwEncryptionType: u32,
    pub customPolicy: *mut core::ffi::c_void,
    pub dwTotalEkus: u32,
    pub certificateEKUs: *mut core::ffi::c_void,
    pub machineCertificateHash: CRYPT_INTEGER_BLOB,
    pub dwMmSaLifeTime: u32,
}
import "golang.org/x/sys/windows"

type CRYPT_INTEGER_BLOB struct {
	cbData uint32
	pbData uintptr
}

type IKEV2_TUNNEL_CONFIG_PARAMS4 struct {
	dwIdleTimeout uint32
	dwNetworkBlackoutTime uint32
	dwSaLifeTime uint32
	dwSaDataSizeForRenegotiation uint32
	dwConfigOptions uint32
	dwTotalCertificates uint32
	certificateNames uintptr
	machineCertificateName CRYPT_INTEGER_BLOB
	dwEncryptionType uint32
	customPolicy uintptr
	dwTotalEkus uint32
	certificateEKUs uintptr
	machineCertificateHash CRYPT_INTEGER_BLOB
	dwMmSaLifeTime uint32
}
type
  CRYPT_INTEGER_BLOB = record
    cbData: DWORD;
    pbData: Pointer;
  end;

  IKEV2_TUNNEL_CONFIG_PARAMS4 = record
    dwIdleTimeout: DWORD;
    dwNetworkBlackoutTime: DWORD;
    dwSaLifeTime: DWORD;
    dwSaDataSizeForRenegotiation: DWORD;
    dwConfigOptions: DWORD;
    dwTotalCertificates: DWORD;
    certificateNames: Pointer;
    machineCertificateName: CRYPT_INTEGER_BLOB;
    dwEncryptionType: DWORD;
    customPolicy: Pointer;
    dwTotalEkus: DWORD;
    certificateEKUs: Pointer;
    machineCertificateHash: CRYPT_INTEGER_BLOB;
    dwMmSaLifeTime: DWORD;
  end;
const CRYPT_INTEGER_BLOB = extern struct {
    cbData: u32,
    pbData: ?*anyopaque,
};

const IKEV2_TUNNEL_CONFIG_PARAMS4 = extern struct {
    dwIdleTimeout: u32,
    dwNetworkBlackoutTime: u32,
    dwSaLifeTime: u32,
    dwSaDataSizeForRenegotiation: u32,
    dwConfigOptions: u32,
    dwTotalCertificates: u32,
    certificateNames: ?*anyopaque,
    machineCertificateName: CRYPT_INTEGER_BLOB,
    dwEncryptionType: u32,
    customPolicy: ?*anyopaque,
    dwTotalEkus: u32,
    certificateEKUs: ?*anyopaque,
    machineCertificateHash: CRYPT_INTEGER_BLOB,
    dwMmSaLifeTime: u32,
};
type
  CRYPT_INTEGER_BLOB {.bycopy.} = object
    cbData: uint32
    pbData: pointer

  IKEV2_TUNNEL_CONFIG_PARAMS4 {.bycopy.} = object
    dwIdleTimeout: uint32
    dwNetworkBlackoutTime: uint32
    dwSaLifeTime: uint32
    dwSaDataSizeForRenegotiation: uint32
    dwConfigOptions: uint32
    dwTotalCertificates: uint32
    certificateNames: pointer
    machineCertificateName: CRYPT_INTEGER_BLOB
    dwEncryptionType: uint32
    customPolicy: pointer
    dwTotalEkus: uint32
    certificateEKUs: pointer
    machineCertificateHash: CRYPT_INTEGER_BLOB
    dwMmSaLifeTime: uint32
struct CRYPT_INTEGER_BLOB
{
    uint cbData;
    void* pbData;
}

struct IKEV2_TUNNEL_CONFIG_PARAMS4
{
    uint dwIdleTimeout;
    uint dwNetworkBlackoutTime;
    uint dwSaLifeTime;
    uint dwSaDataSizeForRenegotiation;
    uint dwConfigOptions;
    uint dwTotalCertificates;
    void* certificateNames;
    CRYPT_INTEGER_BLOB machineCertificateName;
    uint dwEncryptionType;
    void* customPolicy;
    uint dwTotalEkus;
    void* certificateEKUs;
    CRYPT_INTEGER_BLOB machineCertificateHash;
    uint dwMmSaLifeTime;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; IKEV2_TUNNEL_CONFIG_PARAMS4 サイズ: 64 バイト(x86)
dim st, 16    ; 4byte整数×16(構造体サイズ 64 / 4 切り上げ)
; dwIdleTimeout : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; dwNetworkBlackoutTime : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; dwSaLifeTime : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; dwSaDataSizeForRenegotiation : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; dwConfigOptions : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; dwTotalCertificates : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; certificateNames : CRYPT_INTEGER_BLOB* (+24, 4byte)  varptr(st)+24 を基点に操作(4byte:入れ子/配列)
; machineCertificateName : CRYPT_INTEGER_BLOB (+28, 8byte)  varptr(st)+28 を基点に操作(8byte:入れ子/配列)
; dwEncryptionType : DWORD (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; customPolicy : ROUTER_CUSTOM_IKEv2_POLICY0* (+40, 4byte)  varptr(st)+40 を基点に操作(4byte:入れ子/配列)
; dwTotalEkus : DWORD (+44, 4byte)  st.11 = 値  /  値 = st.11   (lpoke/lpeek も可)
; certificateEKUs : MPR_CERT_EKU* (+48, 4byte)  varptr(st)+48 を基点に操作(4byte:入れ子/配列)
; machineCertificateHash : CRYPT_INTEGER_BLOB (+52, 8byte)  varptr(st)+52 を基点に操作(8byte:入れ子/配列)
; dwMmSaLifeTime : DWORD (+60, 4byte)  st.15 = 値  /  値 = st.15   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; IKEV2_TUNNEL_CONFIG_PARAMS4 サイズ: 104 バイト(x64)
dim st, 26    ; 4byte整数×26(構造体サイズ 104 / 4 切り上げ)
; dwIdleTimeout : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; dwNetworkBlackoutTime : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; dwSaLifeTime : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; dwSaDataSizeForRenegotiation : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; dwConfigOptions : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; dwTotalCertificates : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; certificateNames : CRYPT_INTEGER_BLOB* (+24, 8byte)  varptr(st)+24 を基点に操作(8byte:入れ子/配列)
; machineCertificateName : CRYPT_INTEGER_BLOB (+32, 16byte)  varptr(st)+32 を基点に操作(16byte:入れ子/配列)
; dwEncryptionType : DWORD (+48, 4byte)  st.12 = 値  /  値 = st.12   (lpoke/lpeek も可)
; customPolicy : ROUTER_CUSTOM_IKEv2_POLICY0* (+56, 8byte)  varptr(st)+56 を基点に操作(8byte:入れ子/配列)
; dwTotalEkus : DWORD (+64, 4byte)  st.16 = 値  /  値 = st.16   (lpoke/lpeek も可)
; certificateEKUs : MPR_CERT_EKU* (+72, 8byte)  varptr(st)+72 を基点に操作(8byte:入れ子/配列)
; machineCertificateHash : CRYPT_INTEGER_BLOB (+80, 16byte)  varptr(st)+80 を基点に操作(16byte:入れ子/配列)
; dwMmSaLifeTime : DWORD (+96, 4byte)  st.24 = 値  /  値 = st.24   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global CRYPT_INTEGER_BLOB
    #field int cbData
    #field intptr pbData
#endstruct

#defstruct global IKEV2_TUNNEL_CONFIG_PARAMS4
    #field int dwIdleTimeout
    #field int dwNetworkBlackoutTime
    #field int dwSaLifeTime
    #field int dwSaDataSizeForRenegotiation
    #field int dwConfigOptions
    #field int dwTotalCertificates
    #field intptr certificateNames
    #field CRYPT_INTEGER_BLOB machineCertificateName
    #field int dwEncryptionType
    #field intptr customPolicy
    #field int dwTotalEkus
    #field intptr certificateEKUs
    #field CRYPT_INTEGER_BLOB machineCertificateHash
    #field int dwMmSaLifeTime
#endstruct

stdim st, IKEV2_TUNNEL_CONFIG_PARAMS4        ; NSTRUCT 変数を確保
st->dwIdleTimeout = 100
mes "dwIdleTimeout=" + st->dwIdleTimeout