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

IKEEXT_PROPOSAL0

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

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

フィールド

フィールドサイズx64x86説明
cipherAlgorithmIKEEXT_CIPHER_ALGORITHM012+0+0提案する暗号アルゴリズムの構成。
integrityAlgorithmIKEEXT_INTEGRITY_ALGORITHM04+12+12提案する完全性アルゴリズムの構成。
maxLifetimeSecondsDWORD4+16+16SAの最大有効期間(秒単位)。
dhGroupIKEEXT_DH_GROUP4+20+20鍵交換に用いるDiffie-Hellmanグループを示す列挙値。
quickModeLimitDWORD4+24+24このメインモードSAで許可されるクイックモードSAの上限数。

各言語での定義

#include <windows.h>

// IKEEXT_CIPHER_ALGORITHM0  (x64 12 / x86 12 バイト)
typedef struct IKEEXT_CIPHER_ALGORITHM0 {
    IKEEXT_CIPHER_TYPE algoIdentifier;
    DWORD keyLen;
    DWORD rounds;
} IKEEXT_CIPHER_ALGORITHM0;

// IKEEXT_INTEGRITY_ALGORITHM0  (x64 4 / x86 4 バイト)
typedef struct IKEEXT_INTEGRITY_ALGORITHM0 {
    IKEEXT_INTEGRITY_TYPE algoIdentifier;
} IKEEXT_INTEGRITY_ALGORITHM0;

// IKEEXT_PROPOSAL0  (x64 28 / x86 28 バイト)
typedef struct IKEEXT_PROPOSAL0 {
    IKEEXT_CIPHER_ALGORITHM0 cipherAlgorithm;
    IKEEXT_INTEGRITY_ALGORITHM0 integrityAlgorithm;
    DWORD maxLifetimeSeconds;
    IKEEXT_DH_GROUP dhGroup;
    DWORD quickModeLimit;
} IKEEXT_PROPOSAL0;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct IKEEXT_CIPHER_ALGORITHM0
{
    public int algoIdentifier;
    public uint keyLen;
    public uint rounds;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct IKEEXT_INTEGRITY_ALGORITHM0
{
    public int algoIdentifier;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct IKEEXT_PROPOSAL0
{
    public IKEEXT_CIPHER_ALGORITHM0 cipherAlgorithm;
    public IKEEXT_INTEGRITY_ALGORITHM0 integrityAlgorithm;
    public uint maxLifetimeSeconds;
    public int dhGroup;
    public uint quickModeLimit;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure IKEEXT_CIPHER_ALGORITHM0
    Public algoIdentifier As Integer
    Public keyLen As UInteger
    Public rounds As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure IKEEXT_INTEGRITY_ALGORITHM0
    Public algoIdentifier As Integer
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure IKEEXT_PROPOSAL0
    Public cipherAlgorithm As IKEEXT_CIPHER_ALGORITHM0
    Public integrityAlgorithm As IKEEXT_INTEGRITY_ALGORITHM0
    Public maxLifetimeSeconds As UInteger
    Public dhGroup As Integer
    Public quickModeLimit As UInteger
End Structure
import ctypes
from ctypes import wintypes

class IKEEXT_CIPHER_ALGORITHM0(ctypes.Structure):
    _fields_ = [
        ("algoIdentifier", ctypes.c_int),
        ("keyLen", wintypes.DWORD),
        ("rounds", wintypes.DWORD),
    ]

class IKEEXT_INTEGRITY_ALGORITHM0(ctypes.Structure):
    _fields_ = [
        ("algoIdentifier", ctypes.c_int),
    ]

class IKEEXT_PROPOSAL0(ctypes.Structure):
    _fields_ = [
        ("cipherAlgorithm", IKEEXT_CIPHER_ALGORITHM0),
        ("integrityAlgorithm", IKEEXT_INTEGRITY_ALGORITHM0),
        ("maxLifetimeSeconds", wintypes.DWORD),
        ("dhGroup", ctypes.c_int),
        ("quickModeLimit", wintypes.DWORD),
    ]
#[repr(C)]
pub struct IKEEXT_CIPHER_ALGORITHM0 {
    pub algoIdentifier: i32,
    pub keyLen: u32,
    pub rounds: u32,
}

#[repr(C)]
pub struct IKEEXT_INTEGRITY_ALGORITHM0 {
    pub algoIdentifier: i32,
}

#[repr(C)]
pub struct IKEEXT_PROPOSAL0 {
    pub cipherAlgorithm: IKEEXT_CIPHER_ALGORITHM0,
    pub integrityAlgorithm: IKEEXT_INTEGRITY_ALGORITHM0,
    pub maxLifetimeSeconds: u32,
    pub dhGroup: i32,
    pub quickModeLimit: u32,
}
import "golang.org/x/sys/windows"

type IKEEXT_CIPHER_ALGORITHM0 struct {
	algoIdentifier int32
	keyLen uint32
	rounds uint32
}

type IKEEXT_INTEGRITY_ALGORITHM0 struct {
	algoIdentifier int32
}

type IKEEXT_PROPOSAL0 struct {
	cipherAlgorithm IKEEXT_CIPHER_ALGORITHM0
	integrityAlgorithm IKEEXT_INTEGRITY_ALGORITHM0
	maxLifetimeSeconds uint32
	dhGroup int32
	quickModeLimit uint32
}
type
  IKEEXT_CIPHER_ALGORITHM0 = record
    algoIdentifier: Integer;
    keyLen: DWORD;
    rounds: DWORD;
  end;

  IKEEXT_INTEGRITY_ALGORITHM0 = record
    algoIdentifier: Integer;
  end;

  IKEEXT_PROPOSAL0 = record
    cipherAlgorithm: IKEEXT_CIPHER_ALGORITHM0;
    integrityAlgorithm: IKEEXT_INTEGRITY_ALGORITHM0;
    maxLifetimeSeconds: DWORD;
    dhGroup: Integer;
    quickModeLimit: DWORD;
  end;
const IKEEXT_CIPHER_ALGORITHM0 = extern struct {
    algoIdentifier: i32,
    keyLen: u32,
    rounds: u32,
};

const IKEEXT_INTEGRITY_ALGORITHM0 = extern struct {
    algoIdentifier: i32,
};

const IKEEXT_PROPOSAL0 = extern struct {
    cipherAlgorithm: IKEEXT_CIPHER_ALGORITHM0,
    integrityAlgorithm: IKEEXT_INTEGRITY_ALGORITHM0,
    maxLifetimeSeconds: u32,
    dhGroup: i32,
    quickModeLimit: u32,
};
type
  IKEEXT_CIPHER_ALGORITHM0 {.bycopy.} = object
    algoIdentifier: int32
    keyLen: uint32
    rounds: uint32

  IKEEXT_INTEGRITY_ALGORITHM0 {.bycopy.} = object
    algoIdentifier: int32

  IKEEXT_PROPOSAL0 {.bycopy.} = object
    cipherAlgorithm: IKEEXT_CIPHER_ALGORITHM0
    integrityAlgorithm: IKEEXT_INTEGRITY_ALGORITHM0
    maxLifetimeSeconds: uint32
    dhGroup: int32
    quickModeLimit: uint32
struct IKEEXT_CIPHER_ALGORITHM0
{
    int algoIdentifier;
    uint keyLen;
    uint rounds;
}

struct IKEEXT_INTEGRITY_ALGORITHM0
{
    int algoIdentifier;
}

struct IKEEXT_PROPOSAL0
{
    IKEEXT_CIPHER_ALGORITHM0 cipherAlgorithm;
    IKEEXT_INTEGRITY_ALGORITHM0 integrityAlgorithm;
    uint maxLifetimeSeconds;
    int dhGroup;
    uint quickModeLimit;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; IKEEXT_PROPOSAL0 サイズ: 28 バイト(x64)
dim st, 7    ; 4byte整数×7(構造体サイズ 28 / 4 切り上げ)
; cipherAlgorithm : IKEEXT_CIPHER_ALGORITHM0 (+0, 12byte)  varptr(st)+0 を基点に操作(12byte:入れ子/配列)
; integrityAlgorithm : IKEEXT_INTEGRITY_ALGORITHM0 (+12, 4byte)  varptr(st)+12 を基点に操作(4byte:入れ子/配列)
; maxLifetimeSeconds : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; dhGroup : IKEEXT_DH_GROUP (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; quickModeLimit : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global IKEEXT_CIPHER_ALGORITHM0
    #field int algoIdentifier
    #field int keyLen
    #field int rounds
#endstruct

#defstruct global IKEEXT_INTEGRITY_ALGORITHM0
    #field int algoIdentifier
#endstruct

#defstruct global IKEEXT_PROPOSAL0
    #field IKEEXT_CIPHER_ALGORITHM0 cipherAlgorithm
    #field IKEEXT_INTEGRITY_ALGORITHM0 integrityAlgorithm
    #field int maxLifetimeSeconds
    #field int dhGroup
    #field int quickModeLimit
#endstruct

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