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

L2TP_CONFIG_PARAMS1

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

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

フィールド

フィールドサイズx64x86説明
dwNumPortsDWORD4+0+0

RRAS サーバー上で L2TP 接続を受け入れるように構成されたポートの数を指定します。dwNumPorts の最大値は次の表のとおりです。値 0 は指定できません。

意味
1
Windows Web Server 2008
1000
Windows Server 2008 Standard
30000
Windows Server 2008 Datacenter および Windows Server 2008 Enterprise
注意 サービス開始時にレジストリで構成された上限 (Windows Server 2008 Standard および Windows Server 2008 Enterprise では既定で 1000) を超える値が dwNumPorts に含まれている場合、MprConfigServerGetInfoEx 関数および MprConfigServerSetInfoEx 関数は ERROR_SUCCESS_REBOOT_REQUIRED を返します。
dwPortFlagsDWORD4+4+4

RRAS サーバー上で L2TP 用に構成されたポートの種類を指定します。次の値がサポートされます。

意味
MPR_ENABLE_RAS_ON_DEVICE
設定されている場合、デバイス上で RAS が有効になります。
MPR_ENABLE_ROUTING_ON_DEVICE
設定されている場合、デバイス上でルーティングが有効になります。
dwTunnelConfigParamFlagsDWORD4+8+8TunnelConfigParamsのどのフィールドが有効かを示すフラグ。
TunnelConfigParamsL2TP_TUNNEL_CONFIG_PARAMS232/24+16+12L2TPトンネルの詳細構成パラメータ。

公式ドキュメント

L2TP_CONFIG_PARAMS 構造体は、RAS サーバー上のレイヤー 2 トンネリング プロトコル (L2TP) のデバイス構成を取得および設定するために使用します。

出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)

各言語での定義

#include <windows.h>

// L2TP_TUNNEL_CONFIG_PARAMS2  (x64 32 / x86 24 バイト)
typedef struct L2TP_TUNNEL_CONFIG_PARAMS2 {
    DWORD dwIdleTimeout;
    DWORD dwEncryptionType;
    DWORD dwSaLifeTime;
    DWORD dwSaDataSizeForRenegotiation;
    ROUTER_CUSTOM_IKEv2_POLICY0* customPolicy;
    DWORD dwMmSaLifeTime;
} L2TP_TUNNEL_CONFIG_PARAMS2;

// L2TP_CONFIG_PARAMS1  (x64 48 / x86 36 バイト)
typedef struct L2TP_CONFIG_PARAMS1 {
    DWORD dwNumPorts;
    DWORD dwPortFlags;
    DWORD dwTunnelConfigParamFlags;
    L2TP_TUNNEL_CONFIG_PARAMS2 TunnelConfigParams;
} L2TP_CONFIG_PARAMS1;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct L2TP_TUNNEL_CONFIG_PARAMS2
{
    public uint dwIdleTimeout;
    public uint dwEncryptionType;
    public uint dwSaLifeTime;
    public uint dwSaDataSizeForRenegotiation;
    public IntPtr customPolicy;
    public uint dwMmSaLifeTime;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct L2TP_CONFIG_PARAMS1
{
    public uint dwNumPorts;
    public uint dwPortFlags;
    public uint dwTunnelConfigParamFlags;
    public L2TP_TUNNEL_CONFIG_PARAMS2 TunnelConfigParams;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure L2TP_TUNNEL_CONFIG_PARAMS2
    Public dwIdleTimeout As UInteger
    Public dwEncryptionType As UInteger
    Public dwSaLifeTime As UInteger
    Public dwSaDataSizeForRenegotiation As UInteger
    Public customPolicy As IntPtr
    Public dwMmSaLifeTime As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure L2TP_CONFIG_PARAMS1
    Public dwNumPorts As UInteger
    Public dwPortFlags As UInteger
    Public dwTunnelConfigParamFlags As UInteger
    Public TunnelConfigParams As L2TP_TUNNEL_CONFIG_PARAMS2
End Structure
import ctypes
from ctypes import wintypes

class L2TP_TUNNEL_CONFIG_PARAMS2(ctypes.Structure):
    _fields_ = [
        ("dwIdleTimeout", wintypes.DWORD),
        ("dwEncryptionType", wintypes.DWORD),
        ("dwSaLifeTime", wintypes.DWORD),
        ("dwSaDataSizeForRenegotiation", wintypes.DWORD),
        ("customPolicy", ctypes.c_void_p),
        ("dwMmSaLifeTime", wintypes.DWORD),
    ]

class L2TP_CONFIG_PARAMS1(ctypes.Structure):
    _fields_ = [
        ("dwNumPorts", wintypes.DWORD),
        ("dwPortFlags", wintypes.DWORD),
        ("dwTunnelConfigParamFlags", wintypes.DWORD),
        ("TunnelConfigParams", L2TP_TUNNEL_CONFIG_PARAMS2),
    ]
#[repr(C)]
pub struct L2TP_TUNNEL_CONFIG_PARAMS2 {
    pub dwIdleTimeout: u32,
    pub dwEncryptionType: u32,
    pub dwSaLifeTime: u32,
    pub dwSaDataSizeForRenegotiation: u32,
    pub customPolicy: *mut core::ffi::c_void,
    pub dwMmSaLifeTime: u32,
}

#[repr(C)]
pub struct L2TP_CONFIG_PARAMS1 {
    pub dwNumPorts: u32,
    pub dwPortFlags: u32,
    pub dwTunnelConfigParamFlags: u32,
    pub TunnelConfigParams: L2TP_TUNNEL_CONFIG_PARAMS2,
}
import "golang.org/x/sys/windows"

type L2TP_TUNNEL_CONFIG_PARAMS2 struct {
	dwIdleTimeout uint32
	dwEncryptionType uint32
	dwSaLifeTime uint32
	dwSaDataSizeForRenegotiation uint32
	customPolicy uintptr
	dwMmSaLifeTime uint32
}

type L2TP_CONFIG_PARAMS1 struct {
	dwNumPorts uint32
	dwPortFlags uint32
	dwTunnelConfigParamFlags uint32
	TunnelConfigParams L2TP_TUNNEL_CONFIG_PARAMS2
}
type
  L2TP_TUNNEL_CONFIG_PARAMS2 = record
    dwIdleTimeout: DWORD;
    dwEncryptionType: DWORD;
    dwSaLifeTime: DWORD;
    dwSaDataSizeForRenegotiation: DWORD;
    customPolicy: Pointer;
    dwMmSaLifeTime: DWORD;
  end;

  L2TP_CONFIG_PARAMS1 = record
    dwNumPorts: DWORD;
    dwPortFlags: DWORD;
    dwTunnelConfigParamFlags: DWORD;
    TunnelConfigParams: L2TP_TUNNEL_CONFIG_PARAMS2;
  end;
const L2TP_TUNNEL_CONFIG_PARAMS2 = extern struct {
    dwIdleTimeout: u32,
    dwEncryptionType: u32,
    dwSaLifeTime: u32,
    dwSaDataSizeForRenegotiation: u32,
    customPolicy: ?*anyopaque,
    dwMmSaLifeTime: u32,
};

const L2TP_CONFIG_PARAMS1 = extern struct {
    dwNumPorts: u32,
    dwPortFlags: u32,
    dwTunnelConfigParamFlags: u32,
    TunnelConfigParams: L2TP_TUNNEL_CONFIG_PARAMS2,
};
type
  L2TP_TUNNEL_CONFIG_PARAMS2 {.bycopy.} = object
    dwIdleTimeout: uint32
    dwEncryptionType: uint32
    dwSaLifeTime: uint32
    dwSaDataSizeForRenegotiation: uint32
    customPolicy: pointer
    dwMmSaLifeTime: uint32

  L2TP_CONFIG_PARAMS1 {.bycopy.} = object
    dwNumPorts: uint32
    dwPortFlags: uint32
    dwTunnelConfigParamFlags: uint32
    TunnelConfigParams: L2TP_TUNNEL_CONFIG_PARAMS2
struct L2TP_TUNNEL_CONFIG_PARAMS2
{
    uint dwIdleTimeout;
    uint dwEncryptionType;
    uint dwSaLifeTime;
    uint dwSaDataSizeForRenegotiation;
    void* customPolicy;
    uint dwMmSaLifeTime;
}

struct L2TP_CONFIG_PARAMS1
{
    uint dwNumPorts;
    uint dwPortFlags;
    uint dwTunnelConfigParamFlags;
    L2TP_TUNNEL_CONFIG_PARAMS2 TunnelConfigParams;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; L2TP_CONFIG_PARAMS1 サイズ: 36 バイト(x86)
dim st, 9    ; 4byte整数×9(構造体サイズ 36 / 4 切り上げ)
; dwNumPorts : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; dwPortFlags : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; dwTunnelConfigParamFlags : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; TunnelConfigParams : L2TP_TUNNEL_CONFIG_PARAMS2 (+12, 24byte)  varptr(st)+12 を基点に操作(24byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; L2TP_CONFIG_PARAMS1 サイズ: 48 バイト(x64)
dim st, 12    ; 4byte整数×12(構造体サイズ 48 / 4 切り上げ)
; dwNumPorts : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; dwPortFlags : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; dwTunnelConfigParamFlags : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; TunnelConfigParams : L2TP_TUNNEL_CONFIG_PARAMS2 (+16, 32byte)  varptr(st)+16 を基点に操作(32byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global L2TP_TUNNEL_CONFIG_PARAMS2
    #field int dwIdleTimeout
    #field int dwEncryptionType
    #field int dwSaLifeTime
    #field int dwSaDataSizeForRenegotiation
    #field intptr customPolicy
    #field int dwMmSaLifeTime
#endstruct

#defstruct global L2TP_CONFIG_PARAMS1
    #field int dwNumPorts
    #field int dwPortFlags
    #field int dwTunnelConfigParamFlags
    #field L2TP_TUNNEL_CONFIG_PARAMS2 TunnelConfigParams
#endstruct

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