Win32 API 日本語リファレンス
ホームNetworking.WinSock › SOCKET_SECURITY_SETTINGS_IPSEC

SOCKET_SECURITY_SETTINGS_IPSEC

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

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

フィールド

フィールドサイズx64x86説明
SecurityProtocolSOCKET_SECURITY_PROTOCOL4+0+0IPsec使用を示すSOCKET_SECURITY_PROTOCOL列挙値。
SecurityFlagsDWORD4+4+4セキュリティ動作を制御するフラグのビットマスク。
IpsecFlagsDWORD4+8+8IPsec固有の動作を制御するフラグのビットマスク。
AuthipMMPolicyKeyGUID16+12+12AuthIPのメインモードポリシーを識別するGUID。
AuthipQMPolicyKeyGUID16+28+28AuthIPのクイックモードポリシーを識別するGUID。
ReservedGUID16+44+44予約済みのGUID。将来利用のため通常ゼロにする。
Reserved2ULONGLONG8+64+64予約済みの64ビット値。通常ゼロにする。
UserNameStringLenDWORD4+72+72AllStrings内のユーザー名文字列の長さを文字数で示す。
DomainNameStringLenDWORD4+76+76AllStrings内のドメイン名文字列の長さを文字数で示す。
PasswordStringLenDWORD4+80+80AllStrings内のパスワード文字列の長さを文字数で示す。
AllStringsWCHAR2+84+84ユーザー名・ドメイン名・パスワードを連結した可変長WCHAR配列の先頭。

各言語での定義

#include <windows.h>

// SOCKET_SECURITY_SETTINGS_IPSEC  (x64 88 / x86 88 バイト)
typedef struct SOCKET_SECURITY_SETTINGS_IPSEC {
    SOCKET_SECURITY_PROTOCOL SecurityProtocol;
    DWORD SecurityFlags;
    DWORD IpsecFlags;
    GUID AuthipMMPolicyKey;
    GUID AuthipQMPolicyKey;
    GUID Reserved;
    ULONGLONG Reserved2;
    DWORD UserNameStringLen;
    DWORD DomainNameStringLen;
    DWORD PasswordStringLen;
    WCHAR AllStrings[1];
} SOCKET_SECURITY_SETTINGS_IPSEC;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SOCKET_SECURITY_SETTINGS_IPSEC
{
    public int SecurityProtocol;
    public uint SecurityFlags;
    public uint IpsecFlags;
    public Guid AuthipMMPolicyKey;
    public Guid AuthipQMPolicyKey;
    public Guid Reserved;
    public ulong Reserved2;
    public uint UserNameStringLen;
    public uint DomainNameStringLen;
    public uint PasswordStringLen;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 1)] public string AllStrings;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SOCKET_SECURITY_SETTINGS_IPSEC
    Public SecurityProtocol As Integer
    Public SecurityFlags As UInteger
    Public IpsecFlags As UInteger
    Public AuthipMMPolicyKey As Guid
    Public AuthipQMPolicyKey As Guid
    Public Reserved As Guid
    Public Reserved2 As ULong
    Public UserNameStringLen As UInteger
    Public DomainNameStringLen As UInteger
    Public PasswordStringLen As UInteger
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=1)> Public AllStrings As String
End Structure
import ctypes
from ctypes import wintypes

class SOCKET_SECURITY_SETTINGS_IPSEC(ctypes.Structure):
    _fields_ = [
        ("SecurityProtocol", ctypes.c_int),
        ("SecurityFlags", wintypes.DWORD),
        ("IpsecFlags", wintypes.DWORD),
        ("AuthipMMPolicyKey", GUID),
        ("AuthipQMPolicyKey", GUID),
        ("Reserved", GUID),
        ("Reserved2", ctypes.c_ulonglong),
        ("UserNameStringLen", wintypes.DWORD),
        ("DomainNameStringLen", wintypes.DWORD),
        ("PasswordStringLen", wintypes.DWORD),
        ("AllStrings", ctypes.c_wchar * 1),
    ]
#[repr(C)]
pub struct SOCKET_SECURITY_SETTINGS_IPSEC {
    pub SecurityProtocol: i32,
    pub SecurityFlags: u32,
    pub IpsecFlags: u32,
    pub AuthipMMPolicyKey: GUID,
    pub AuthipQMPolicyKey: GUID,
    pub Reserved: GUID,
    pub Reserved2: u64,
    pub UserNameStringLen: u32,
    pub DomainNameStringLen: u32,
    pub PasswordStringLen: u32,
    pub AllStrings: [u16; 1],
}
import "golang.org/x/sys/windows"

type SOCKET_SECURITY_SETTINGS_IPSEC struct {
	SecurityProtocol int32
	SecurityFlags uint32
	IpsecFlags uint32
	AuthipMMPolicyKey windows.GUID
	AuthipQMPolicyKey windows.GUID
	Reserved windows.GUID
	Reserved2 uint64
	UserNameStringLen uint32
	DomainNameStringLen uint32
	PasswordStringLen uint32
	AllStrings [1]uint16
}
type
  SOCKET_SECURITY_SETTINGS_IPSEC = record
    SecurityProtocol: Integer;
    SecurityFlags: DWORD;
    IpsecFlags: DWORD;
    AuthipMMPolicyKey: TGUID;
    AuthipQMPolicyKey: TGUID;
    Reserved: TGUID;
    Reserved2: UInt64;
    UserNameStringLen: DWORD;
    DomainNameStringLen: DWORD;
    PasswordStringLen: DWORD;
    AllStrings: array[0..0] of WideChar;
  end;
const SOCKET_SECURITY_SETTINGS_IPSEC = extern struct {
    SecurityProtocol: i32,
    SecurityFlags: u32,
    IpsecFlags: u32,
    AuthipMMPolicyKey: GUID,
    AuthipQMPolicyKey: GUID,
    Reserved: GUID,
    Reserved2: u64,
    UserNameStringLen: u32,
    DomainNameStringLen: u32,
    PasswordStringLen: u32,
    AllStrings: [1]u16,
};
type
  SOCKET_SECURITY_SETTINGS_IPSEC {.bycopy.} = object
    SecurityProtocol: int32
    SecurityFlags: uint32
    IpsecFlags: uint32
    AuthipMMPolicyKey: GUID
    AuthipQMPolicyKey: GUID
    Reserved: GUID
    Reserved2: uint64
    UserNameStringLen: uint32
    DomainNameStringLen: uint32
    PasswordStringLen: uint32
    AllStrings: array[1, uint16]
struct SOCKET_SECURITY_SETTINGS_IPSEC
{
    int SecurityProtocol;
    uint SecurityFlags;
    uint IpsecFlags;
    GUID AuthipMMPolicyKey;
    GUID AuthipQMPolicyKey;
    GUID Reserved;
    ulong Reserved2;
    uint UserNameStringLen;
    uint DomainNameStringLen;
    uint PasswordStringLen;
    wchar[1] AllStrings;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; SOCKET_SECURITY_SETTINGS_IPSEC サイズ: 88 バイト(x64)
dim st, 22    ; 4byte整数×22(構造体サイズ 88 / 4 切り上げ)
; SecurityProtocol : SOCKET_SECURITY_PROTOCOL (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; SecurityFlags : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; IpsecFlags : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; AuthipMMPolicyKey : GUID (+12, 16byte)  varptr(st)+12 を基点に操作(16byte:入れ子/配列)
; AuthipQMPolicyKey : GUID (+28, 16byte)  varptr(st)+28 を基点に操作(16byte:入れ子/配列)
; Reserved : GUID (+44, 16byte)  varptr(st)+44 を基点に操作(16byte:入れ子/配列)
; Reserved2 : ULONGLONG (+64, 8byte)  qpoke st,64,値 / qpeek(st,64)  ※IronHSPのみ。3.7/3.8は lpoke st,64,下位 : lpoke st,68,上位
; UserNameStringLen : DWORD (+72, 4byte)  st.18 = 値  /  値 = st.18   (lpoke/lpeek も可)
; DomainNameStringLen : DWORD (+76, 4byte)  st.19 = 値  /  値 = st.19   (lpoke/lpeek も可)
; PasswordStringLen : DWORD (+80, 4byte)  st.20 = 値  /  値 = st.20   (lpoke/lpeek も可)
; AllStrings : WCHAR (+84, 2byte)  varptr(st)+84 を基点に操作(2byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global GUID, pack=1
    #field int Data1
    #field short Data2
    #field short Data3
    #field byte Data4 8
#endstruct

#defstruct global SOCKET_SECURITY_SETTINGS_IPSEC
    #field int SecurityProtocol
    #field int SecurityFlags
    #field int IpsecFlags
    #field GUID AuthipMMPolicyKey
    #field GUID AuthipQMPolicyKey
    #field GUID Reserved
    #field int64 Reserved2
    #field int UserNameStringLen
    #field int DomainNameStringLen
    #field int PasswordStringLen
    #field wchar AllStrings 1
#endstruct

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