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

IPSEC_STATISTICS1

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

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

フィールド

フィールドサイズx64x86説明
aggregateSaStatisticsIPSEC_AGGREGATE_SA_STATISTICS028+0+0SA全体の集計統計を保持する構造体。
espDropPacketStatisticsIPSEC_ESP_DROP_PACKET_STATISTICS020+28+28ESP処理で破棄したパケットの統計。
ahDropPacketStatisticsIPSEC_AH_DROP_PACKET_STATISTICS016+48+48AH処理で破棄したパケットの統計。
aggregateDropPacketStatisticsIPSEC_AGGREGATE_DROP_PACKET_STATISTICS140+64+64破棄パケットの集計統計。バージョン1構造体を使用。
inboundTrafficStatisticsIPSEC_TRAFFIC_STATISTICS156+104+104受信トラフィックのバイト数統計。バージョン1構造体を使用。
outboundTrafficStatisticsIPSEC_TRAFFIC_STATISTICS156+160+160送信トラフィックのバイト数統計。バージョン1構造体を使用。

各言語での定義

#include <windows.h>

// IPSEC_AGGREGATE_SA_STATISTICS0  (x64 28 / x86 28 バイト)
typedef struct IPSEC_AGGREGATE_SA_STATISTICS0 {
    DWORD activeSas;
    DWORD pendingSaNegotiations;
    DWORD totalSasAdded;
    DWORD totalSasDeleted;
    DWORD successfulRekeys;
    DWORD activeTunnels;
    DWORD offloadedSas;
} IPSEC_AGGREGATE_SA_STATISTICS0;

// IPSEC_ESP_DROP_PACKET_STATISTICS0  (x64 20 / x86 20 バイト)
typedef struct IPSEC_ESP_DROP_PACKET_STATISTICS0 {
    DWORD invalidSpisOnInbound;
    DWORD decryptionFailuresOnInbound;
    DWORD authenticationFailuresOnInbound;
    DWORD replayCheckFailuresOnInbound;
    DWORD saNotInitializedOnInbound;
} IPSEC_ESP_DROP_PACKET_STATISTICS0;

// IPSEC_AH_DROP_PACKET_STATISTICS0  (x64 16 / x86 16 バイト)
typedef struct IPSEC_AH_DROP_PACKET_STATISTICS0 {
    DWORD invalidSpisOnInbound;
    DWORD authenticationFailuresOnInbound;
    DWORD replayCheckFailuresOnInbound;
    DWORD saNotInitializedOnInbound;
} IPSEC_AH_DROP_PACKET_STATISTICS0;

// IPSEC_AGGREGATE_DROP_PACKET_STATISTICS1  (x64 40 / x86 40 バイト)
typedef struct IPSEC_AGGREGATE_DROP_PACKET_STATISTICS1 {
    DWORD invalidSpisOnInbound;
    DWORD decryptionFailuresOnInbound;
    DWORD authenticationFailuresOnInbound;
    DWORD udpEspValidationFailuresOnInbound;
    DWORD replayCheckFailuresOnInbound;
    DWORD invalidClearTextInbound;
    DWORD saNotInitializedOnInbound;
    DWORD receiveOverIncorrectSaInbound;
    DWORD secureReceivesNotMatchingFilters;
    DWORD totalDropPacketsInbound;
} IPSEC_AGGREGATE_DROP_PACKET_STATISTICS1;

// IPSEC_TRAFFIC_STATISTICS1  (x64 56 / x86 56 バイト)
typedef struct IPSEC_TRAFFIC_STATISTICS1 {
    ULONGLONG encryptedByteCount;
    ULONGLONG authenticatedAHByteCount;
    ULONGLONG authenticatedESPByteCount;
    ULONGLONG transportByteCount;
    ULONGLONG tunnelByteCount;
    ULONGLONG offloadByteCount;
    ULONGLONG totalSuccessfulPackets;
} IPSEC_TRAFFIC_STATISTICS1;

// IPSEC_STATISTICS1  (x64 216 / x86 216 バイト)
typedef struct IPSEC_STATISTICS1 {
    IPSEC_AGGREGATE_SA_STATISTICS0 aggregateSaStatistics;
    IPSEC_ESP_DROP_PACKET_STATISTICS0 espDropPacketStatistics;
    IPSEC_AH_DROP_PACKET_STATISTICS0 ahDropPacketStatistics;
    IPSEC_AGGREGATE_DROP_PACKET_STATISTICS1 aggregateDropPacketStatistics;
    IPSEC_TRAFFIC_STATISTICS1 inboundTrafficStatistics;
    IPSEC_TRAFFIC_STATISTICS1 outboundTrafficStatistics;
} IPSEC_STATISTICS1;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct IPSEC_AGGREGATE_SA_STATISTICS0
{
    public uint activeSas;
    public uint pendingSaNegotiations;
    public uint totalSasAdded;
    public uint totalSasDeleted;
    public uint successfulRekeys;
    public uint activeTunnels;
    public uint offloadedSas;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct IPSEC_ESP_DROP_PACKET_STATISTICS0
{
    public uint invalidSpisOnInbound;
    public uint decryptionFailuresOnInbound;
    public uint authenticationFailuresOnInbound;
    public uint replayCheckFailuresOnInbound;
    public uint saNotInitializedOnInbound;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct IPSEC_AH_DROP_PACKET_STATISTICS0
{
    public uint invalidSpisOnInbound;
    public uint authenticationFailuresOnInbound;
    public uint replayCheckFailuresOnInbound;
    public uint saNotInitializedOnInbound;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct IPSEC_AGGREGATE_DROP_PACKET_STATISTICS1
{
    public uint invalidSpisOnInbound;
    public uint decryptionFailuresOnInbound;
    public uint authenticationFailuresOnInbound;
    public uint udpEspValidationFailuresOnInbound;
    public uint replayCheckFailuresOnInbound;
    public uint invalidClearTextInbound;
    public uint saNotInitializedOnInbound;
    public uint receiveOverIncorrectSaInbound;
    public uint secureReceivesNotMatchingFilters;
    public uint totalDropPacketsInbound;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct IPSEC_TRAFFIC_STATISTICS1
{
    public ulong encryptedByteCount;
    public ulong authenticatedAHByteCount;
    public ulong authenticatedESPByteCount;
    public ulong transportByteCount;
    public ulong tunnelByteCount;
    public ulong offloadByteCount;
    public ulong totalSuccessfulPackets;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct IPSEC_STATISTICS1
{
    public IPSEC_AGGREGATE_SA_STATISTICS0 aggregateSaStatistics;
    public IPSEC_ESP_DROP_PACKET_STATISTICS0 espDropPacketStatistics;
    public IPSEC_AH_DROP_PACKET_STATISTICS0 ahDropPacketStatistics;
    public IPSEC_AGGREGATE_DROP_PACKET_STATISTICS1 aggregateDropPacketStatistics;
    public IPSEC_TRAFFIC_STATISTICS1 inboundTrafficStatistics;
    public IPSEC_TRAFFIC_STATISTICS1 outboundTrafficStatistics;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure IPSEC_AGGREGATE_SA_STATISTICS0
    Public activeSas As UInteger
    Public pendingSaNegotiations As UInteger
    Public totalSasAdded As UInteger
    Public totalSasDeleted As UInteger
    Public successfulRekeys As UInteger
    Public activeTunnels As UInteger
    Public offloadedSas As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure IPSEC_ESP_DROP_PACKET_STATISTICS0
    Public invalidSpisOnInbound As UInteger
    Public decryptionFailuresOnInbound As UInteger
    Public authenticationFailuresOnInbound As UInteger
    Public replayCheckFailuresOnInbound As UInteger
    Public saNotInitializedOnInbound As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure IPSEC_AH_DROP_PACKET_STATISTICS0
    Public invalidSpisOnInbound As UInteger
    Public authenticationFailuresOnInbound As UInteger
    Public replayCheckFailuresOnInbound As UInteger
    Public saNotInitializedOnInbound As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure IPSEC_AGGREGATE_DROP_PACKET_STATISTICS1
    Public invalidSpisOnInbound As UInteger
    Public decryptionFailuresOnInbound As UInteger
    Public authenticationFailuresOnInbound As UInteger
    Public udpEspValidationFailuresOnInbound As UInteger
    Public replayCheckFailuresOnInbound As UInteger
    Public invalidClearTextInbound As UInteger
    Public saNotInitializedOnInbound As UInteger
    Public receiveOverIncorrectSaInbound As UInteger
    Public secureReceivesNotMatchingFilters As UInteger
    Public totalDropPacketsInbound As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure IPSEC_TRAFFIC_STATISTICS1
    Public encryptedByteCount As ULong
    Public authenticatedAHByteCount As ULong
    Public authenticatedESPByteCount As ULong
    Public transportByteCount As ULong
    Public tunnelByteCount As ULong
    Public offloadByteCount As ULong
    Public totalSuccessfulPackets As ULong
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure IPSEC_STATISTICS1
    Public aggregateSaStatistics As IPSEC_AGGREGATE_SA_STATISTICS0
    Public espDropPacketStatistics As IPSEC_ESP_DROP_PACKET_STATISTICS0
    Public ahDropPacketStatistics As IPSEC_AH_DROP_PACKET_STATISTICS0
    Public aggregateDropPacketStatistics As IPSEC_AGGREGATE_DROP_PACKET_STATISTICS1
    Public inboundTrafficStatistics As IPSEC_TRAFFIC_STATISTICS1
    Public outboundTrafficStatistics As IPSEC_TRAFFIC_STATISTICS1
End Structure
import ctypes
from ctypes import wintypes

class IPSEC_AGGREGATE_SA_STATISTICS0(ctypes.Structure):
    _fields_ = [
        ("activeSas", wintypes.DWORD),
        ("pendingSaNegotiations", wintypes.DWORD),
        ("totalSasAdded", wintypes.DWORD),
        ("totalSasDeleted", wintypes.DWORD),
        ("successfulRekeys", wintypes.DWORD),
        ("activeTunnels", wintypes.DWORD),
        ("offloadedSas", wintypes.DWORD),
    ]

class IPSEC_ESP_DROP_PACKET_STATISTICS0(ctypes.Structure):
    _fields_ = [
        ("invalidSpisOnInbound", wintypes.DWORD),
        ("decryptionFailuresOnInbound", wintypes.DWORD),
        ("authenticationFailuresOnInbound", wintypes.DWORD),
        ("replayCheckFailuresOnInbound", wintypes.DWORD),
        ("saNotInitializedOnInbound", wintypes.DWORD),
    ]

class IPSEC_AH_DROP_PACKET_STATISTICS0(ctypes.Structure):
    _fields_ = [
        ("invalidSpisOnInbound", wintypes.DWORD),
        ("authenticationFailuresOnInbound", wintypes.DWORD),
        ("replayCheckFailuresOnInbound", wintypes.DWORD),
        ("saNotInitializedOnInbound", wintypes.DWORD),
    ]

class IPSEC_AGGREGATE_DROP_PACKET_STATISTICS1(ctypes.Structure):
    _fields_ = [
        ("invalidSpisOnInbound", wintypes.DWORD),
        ("decryptionFailuresOnInbound", wintypes.DWORD),
        ("authenticationFailuresOnInbound", wintypes.DWORD),
        ("udpEspValidationFailuresOnInbound", wintypes.DWORD),
        ("replayCheckFailuresOnInbound", wintypes.DWORD),
        ("invalidClearTextInbound", wintypes.DWORD),
        ("saNotInitializedOnInbound", wintypes.DWORD),
        ("receiveOverIncorrectSaInbound", wintypes.DWORD),
        ("secureReceivesNotMatchingFilters", wintypes.DWORD),
        ("totalDropPacketsInbound", wintypes.DWORD),
    ]

class IPSEC_TRAFFIC_STATISTICS1(ctypes.Structure):
    _fields_ = [
        ("encryptedByteCount", ctypes.c_ulonglong),
        ("authenticatedAHByteCount", ctypes.c_ulonglong),
        ("authenticatedESPByteCount", ctypes.c_ulonglong),
        ("transportByteCount", ctypes.c_ulonglong),
        ("tunnelByteCount", ctypes.c_ulonglong),
        ("offloadByteCount", ctypes.c_ulonglong),
        ("totalSuccessfulPackets", ctypes.c_ulonglong),
    ]

class IPSEC_STATISTICS1(ctypes.Structure):
    _fields_ = [
        ("aggregateSaStatistics", IPSEC_AGGREGATE_SA_STATISTICS0),
        ("espDropPacketStatistics", IPSEC_ESP_DROP_PACKET_STATISTICS0),
        ("ahDropPacketStatistics", IPSEC_AH_DROP_PACKET_STATISTICS0),
        ("aggregateDropPacketStatistics", IPSEC_AGGREGATE_DROP_PACKET_STATISTICS1),
        ("inboundTrafficStatistics", IPSEC_TRAFFIC_STATISTICS1),
        ("outboundTrafficStatistics", IPSEC_TRAFFIC_STATISTICS1),
    ]
#[repr(C)]
pub struct IPSEC_AGGREGATE_SA_STATISTICS0 {
    pub activeSas: u32,
    pub pendingSaNegotiations: u32,
    pub totalSasAdded: u32,
    pub totalSasDeleted: u32,
    pub successfulRekeys: u32,
    pub activeTunnels: u32,
    pub offloadedSas: u32,
}

#[repr(C)]
pub struct IPSEC_ESP_DROP_PACKET_STATISTICS0 {
    pub invalidSpisOnInbound: u32,
    pub decryptionFailuresOnInbound: u32,
    pub authenticationFailuresOnInbound: u32,
    pub replayCheckFailuresOnInbound: u32,
    pub saNotInitializedOnInbound: u32,
}

#[repr(C)]
pub struct IPSEC_AH_DROP_PACKET_STATISTICS0 {
    pub invalidSpisOnInbound: u32,
    pub authenticationFailuresOnInbound: u32,
    pub replayCheckFailuresOnInbound: u32,
    pub saNotInitializedOnInbound: u32,
}

#[repr(C)]
pub struct IPSEC_AGGREGATE_DROP_PACKET_STATISTICS1 {
    pub invalidSpisOnInbound: u32,
    pub decryptionFailuresOnInbound: u32,
    pub authenticationFailuresOnInbound: u32,
    pub udpEspValidationFailuresOnInbound: u32,
    pub replayCheckFailuresOnInbound: u32,
    pub invalidClearTextInbound: u32,
    pub saNotInitializedOnInbound: u32,
    pub receiveOverIncorrectSaInbound: u32,
    pub secureReceivesNotMatchingFilters: u32,
    pub totalDropPacketsInbound: u32,
}

#[repr(C)]
pub struct IPSEC_TRAFFIC_STATISTICS1 {
    pub encryptedByteCount: u64,
    pub authenticatedAHByteCount: u64,
    pub authenticatedESPByteCount: u64,
    pub transportByteCount: u64,
    pub tunnelByteCount: u64,
    pub offloadByteCount: u64,
    pub totalSuccessfulPackets: u64,
}

#[repr(C)]
pub struct IPSEC_STATISTICS1 {
    pub aggregateSaStatistics: IPSEC_AGGREGATE_SA_STATISTICS0,
    pub espDropPacketStatistics: IPSEC_ESP_DROP_PACKET_STATISTICS0,
    pub ahDropPacketStatistics: IPSEC_AH_DROP_PACKET_STATISTICS0,
    pub aggregateDropPacketStatistics: IPSEC_AGGREGATE_DROP_PACKET_STATISTICS1,
    pub inboundTrafficStatistics: IPSEC_TRAFFIC_STATISTICS1,
    pub outboundTrafficStatistics: IPSEC_TRAFFIC_STATISTICS1,
}
import "golang.org/x/sys/windows"

type IPSEC_AGGREGATE_SA_STATISTICS0 struct {
	activeSas uint32
	pendingSaNegotiations uint32
	totalSasAdded uint32
	totalSasDeleted uint32
	successfulRekeys uint32
	activeTunnels uint32
	offloadedSas uint32
}

type IPSEC_ESP_DROP_PACKET_STATISTICS0 struct {
	invalidSpisOnInbound uint32
	decryptionFailuresOnInbound uint32
	authenticationFailuresOnInbound uint32
	replayCheckFailuresOnInbound uint32
	saNotInitializedOnInbound uint32
}

type IPSEC_AH_DROP_PACKET_STATISTICS0 struct {
	invalidSpisOnInbound uint32
	authenticationFailuresOnInbound uint32
	replayCheckFailuresOnInbound uint32
	saNotInitializedOnInbound uint32
}

type IPSEC_AGGREGATE_DROP_PACKET_STATISTICS1 struct {
	invalidSpisOnInbound uint32
	decryptionFailuresOnInbound uint32
	authenticationFailuresOnInbound uint32
	udpEspValidationFailuresOnInbound uint32
	replayCheckFailuresOnInbound uint32
	invalidClearTextInbound uint32
	saNotInitializedOnInbound uint32
	receiveOverIncorrectSaInbound uint32
	secureReceivesNotMatchingFilters uint32
	totalDropPacketsInbound uint32
}

type IPSEC_TRAFFIC_STATISTICS1 struct {
	encryptedByteCount uint64
	authenticatedAHByteCount uint64
	authenticatedESPByteCount uint64
	transportByteCount uint64
	tunnelByteCount uint64
	offloadByteCount uint64
	totalSuccessfulPackets uint64
}

type IPSEC_STATISTICS1 struct {
	aggregateSaStatistics IPSEC_AGGREGATE_SA_STATISTICS0
	espDropPacketStatistics IPSEC_ESP_DROP_PACKET_STATISTICS0
	ahDropPacketStatistics IPSEC_AH_DROP_PACKET_STATISTICS0
	aggregateDropPacketStatistics IPSEC_AGGREGATE_DROP_PACKET_STATISTICS1
	inboundTrafficStatistics IPSEC_TRAFFIC_STATISTICS1
	outboundTrafficStatistics IPSEC_TRAFFIC_STATISTICS1
}
type
  IPSEC_AGGREGATE_SA_STATISTICS0 = record
    activeSas: DWORD;
    pendingSaNegotiations: DWORD;
    totalSasAdded: DWORD;
    totalSasDeleted: DWORD;
    successfulRekeys: DWORD;
    activeTunnels: DWORD;
    offloadedSas: DWORD;
  end;

  IPSEC_ESP_DROP_PACKET_STATISTICS0 = record
    invalidSpisOnInbound: DWORD;
    decryptionFailuresOnInbound: DWORD;
    authenticationFailuresOnInbound: DWORD;
    replayCheckFailuresOnInbound: DWORD;
    saNotInitializedOnInbound: DWORD;
  end;

  IPSEC_AH_DROP_PACKET_STATISTICS0 = record
    invalidSpisOnInbound: DWORD;
    authenticationFailuresOnInbound: DWORD;
    replayCheckFailuresOnInbound: DWORD;
    saNotInitializedOnInbound: DWORD;
  end;

  IPSEC_AGGREGATE_DROP_PACKET_STATISTICS1 = record
    invalidSpisOnInbound: DWORD;
    decryptionFailuresOnInbound: DWORD;
    authenticationFailuresOnInbound: DWORD;
    udpEspValidationFailuresOnInbound: DWORD;
    replayCheckFailuresOnInbound: DWORD;
    invalidClearTextInbound: DWORD;
    saNotInitializedOnInbound: DWORD;
    receiveOverIncorrectSaInbound: DWORD;
    secureReceivesNotMatchingFilters: DWORD;
    totalDropPacketsInbound: DWORD;
  end;

  IPSEC_TRAFFIC_STATISTICS1 = record
    encryptedByteCount: UInt64;
    authenticatedAHByteCount: UInt64;
    authenticatedESPByteCount: UInt64;
    transportByteCount: UInt64;
    tunnelByteCount: UInt64;
    offloadByteCount: UInt64;
    totalSuccessfulPackets: UInt64;
  end;

  IPSEC_STATISTICS1 = record
    aggregateSaStatistics: IPSEC_AGGREGATE_SA_STATISTICS0;
    espDropPacketStatistics: IPSEC_ESP_DROP_PACKET_STATISTICS0;
    ahDropPacketStatistics: IPSEC_AH_DROP_PACKET_STATISTICS0;
    aggregateDropPacketStatistics: IPSEC_AGGREGATE_DROP_PACKET_STATISTICS1;
    inboundTrafficStatistics: IPSEC_TRAFFIC_STATISTICS1;
    outboundTrafficStatistics: IPSEC_TRAFFIC_STATISTICS1;
  end;
const IPSEC_AGGREGATE_SA_STATISTICS0 = extern struct {
    activeSas: u32,
    pendingSaNegotiations: u32,
    totalSasAdded: u32,
    totalSasDeleted: u32,
    successfulRekeys: u32,
    activeTunnels: u32,
    offloadedSas: u32,
};

const IPSEC_ESP_DROP_PACKET_STATISTICS0 = extern struct {
    invalidSpisOnInbound: u32,
    decryptionFailuresOnInbound: u32,
    authenticationFailuresOnInbound: u32,
    replayCheckFailuresOnInbound: u32,
    saNotInitializedOnInbound: u32,
};

const IPSEC_AH_DROP_PACKET_STATISTICS0 = extern struct {
    invalidSpisOnInbound: u32,
    authenticationFailuresOnInbound: u32,
    replayCheckFailuresOnInbound: u32,
    saNotInitializedOnInbound: u32,
};

const IPSEC_AGGREGATE_DROP_PACKET_STATISTICS1 = extern struct {
    invalidSpisOnInbound: u32,
    decryptionFailuresOnInbound: u32,
    authenticationFailuresOnInbound: u32,
    udpEspValidationFailuresOnInbound: u32,
    replayCheckFailuresOnInbound: u32,
    invalidClearTextInbound: u32,
    saNotInitializedOnInbound: u32,
    receiveOverIncorrectSaInbound: u32,
    secureReceivesNotMatchingFilters: u32,
    totalDropPacketsInbound: u32,
};

const IPSEC_TRAFFIC_STATISTICS1 = extern struct {
    encryptedByteCount: u64,
    authenticatedAHByteCount: u64,
    authenticatedESPByteCount: u64,
    transportByteCount: u64,
    tunnelByteCount: u64,
    offloadByteCount: u64,
    totalSuccessfulPackets: u64,
};

const IPSEC_STATISTICS1 = extern struct {
    aggregateSaStatistics: IPSEC_AGGREGATE_SA_STATISTICS0,
    espDropPacketStatistics: IPSEC_ESP_DROP_PACKET_STATISTICS0,
    ahDropPacketStatistics: IPSEC_AH_DROP_PACKET_STATISTICS0,
    aggregateDropPacketStatistics: IPSEC_AGGREGATE_DROP_PACKET_STATISTICS1,
    inboundTrafficStatistics: IPSEC_TRAFFIC_STATISTICS1,
    outboundTrafficStatistics: IPSEC_TRAFFIC_STATISTICS1,
};
type
  IPSEC_AGGREGATE_SA_STATISTICS0 {.bycopy.} = object
    activeSas: uint32
    pendingSaNegotiations: uint32
    totalSasAdded: uint32
    totalSasDeleted: uint32
    successfulRekeys: uint32
    activeTunnels: uint32
    offloadedSas: uint32

  IPSEC_ESP_DROP_PACKET_STATISTICS0 {.bycopy.} = object
    invalidSpisOnInbound: uint32
    decryptionFailuresOnInbound: uint32
    authenticationFailuresOnInbound: uint32
    replayCheckFailuresOnInbound: uint32
    saNotInitializedOnInbound: uint32

  IPSEC_AH_DROP_PACKET_STATISTICS0 {.bycopy.} = object
    invalidSpisOnInbound: uint32
    authenticationFailuresOnInbound: uint32
    replayCheckFailuresOnInbound: uint32
    saNotInitializedOnInbound: uint32

  IPSEC_AGGREGATE_DROP_PACKET_STATISTICS1 {.bycopy.} = object
    invalidSpisOnInbound: uint32
    decryptionFailuresOnInbound: uint32
    authenticationFailuresOnInbound: uint32
    udpEspValidationFailuresOnInbound: uint32
    replayCheckFailuresOnInbound: uint32
    invalidClearTextInbound: uint32
    saNotInitializedOnInbound: uint32
    receiveOverIncorrectSaInbound: uint32
    secureReceivesNotMatchingFilters: uint32
    totalDropPacketsInbound: uint32

  IPSEC_TRAFFIC_STATISTICS1 {.bycopy.} = object
    encryptedByteCount: uint64
    authenticatedAHByteCount: uint64
    authenticatedESPByteCount: uint64
    transportByteCount: uint64
    tunnelByteCount: uint64
    offloadByteCount: uint64
    totalSuccessfulPackets: uint64

  IPSEC_STATISTICS1 {.bycopy.} = object
    aggregateSaStatistics: IPSEC_AGGREGATE_SA_STATISTICS0
    espDropPacketStatistics: IPSEC_ESP_DROP_PACKET_STATISTICS0
    ahDropPacketStatistics: IPSEC_AH_DROP_PACKET_STATISTICS0
    aggregateDropPacketStatistics: IPSEC_AGGREGATE_DROP_PACKET_STATISTICS1
    inboundTrafficStatistics: IPSEC_TRAFFIC_STATISTICS1
    outboundTrafficStatistics: IPSEC_TRAFFIC_STATISTICS1
struct IPSEC_AGGREGATE_SA_STATISTICS0
{
    uint activeSas;
    uint pendingSaNegotiations;
    uint totalSasAdded;
    uint totalSasDeleted;
    uint successfulRekeys;
    uint activeTunnels;
    uint offloadedSas;
}

struct IPSEC_ESP_DROP_PACKET_STATISTICS0
{
    uint invalidSpisOnInbound;
    uint decryptionFailuresOnInbound;
    uint authenticationFailuresOnInbound;
    uint replayCheckFailuresOnInbound;
    uint saNotInitializedOnInbound;
}

struct IPSEC_AH_DROP_PACKET_STATISTICS0
{
    uint invalidSpisOnInbound;
    uint authenticationFailuresOnInbound;
    uint replayCheckFailuresOnInbound;
    uint saNotInitializedOnInbound;
}

struct IPSEC_AGGREGATE_DROP_PACKET_STATISTICS1
{
    uint invalidSpisOnInbound;
    uint decryptionFailuresOnInbound;
    uint authenticationFailuresOnInbound;
    uint udpEspValidationFailuresOnInbound;
    uint replayCheckFailuresOnInbound;
    uint invalidClearTextInbound;
    uint saNotInitializedOnInbound;
    uint receiveOverIncorrectSaInbound;
    uint secureReceivesNotMatchingFilters;
    uint totalDropPacketsInbound;
}

struct IPSEC_TRAFFIC_STATISTICS1
{
    ulong encryptedByteCount;
    ulong authenticatedAHByteCount;
    ulong authenticatedESPByteCount;
    ulong transportByteCount;
    ulong tunnelByteCount;
    ulong offloadByteCount;
    ulong totalSuccessfulPackets;
}

struct IPSEC_STATISTICS1
{
    IPSEC_AGGREGATE_SA_STATISTICS0 aggregateSaStatistics;
    IPSEC_ESP_DROP_PACKET_STATISTICS0 espDropPacketStatistics;
    IPSEC_AH_DROP_PACKET_STATISTICS0 ahDropPacketStatistics;
    IPSEC_AGGREGATE_DROP_PACKET_STATISTICS1 aggregateDropPacketStatistics;
    IPSEC_TRAFFIC_STATISTICS1 inboundTrafficStatistics;
    IPSEC_TRAFFIC_STATISTICS1 outboundTrafficStatistics;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; IPSEC_STATISTICS1 サイズ: 216 バイト(x64)
dim st, 54    ; 4byte整数×54(構造体サイズ 216 / 4 切り上げ)
; aggregateSaStatistics : IPSEC_AGGREGATE_SA_STATISTICS0 (+0, 28byte)  varptr(st)+0 を基点に操作(28byte:入れ子/配列)
; espDropPacketStatistics : IPSEC_ESP_DROP_PACKET_STATISTICS0 (+28, 20byte)  varptr(st)+28 を基点に操作(20byte:入れ子/配列)
; ahDropPacketStatistics : IPSEC_AH_DROP_PACKET_STATISTICS0 (+48, 16byte)  varptr(st)+48 を基点に操作(16byte:入れ子/配列)
; aggregateDropPacketStatistics : IPSEC_AGGREGATE_DROP_PACKET_STATISTICS1 (+64, 40byte)  varptr(st)+64 を基点に操作(40byte:入れ子/配列)
; inboundTrafficStatistics : IPSEC_TRAFFIC_STATISTICS1 (+104, 56byte)  varptr(st)+104 を基点に操作(56byte:入れ子/配列)
; outboundTrafficStatistics : IPSEC_TRAFFIC_STATISTICS1 (+160, 56byte)  varptr(st)+160 を基点に操作(56byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global IPSEC_AGGREGATE_SA_STATISTICS0
    #field int activeSas
    #field int pendingSaNegotiations
    #field int totalSasAdded
    #field int totalSasDeleted
    #field int successfulRekeys
    #field int activeTunnels
    #field int offloadedSas
#endstruct

#defstruct global IPSEC_ESP_DROP_PACKET_STATISTICS0
    #field int invalidSpisOnInbound
    #field int decryptionFailuresOnInbound
    #field int authenticationFailuresOnInbound
    #field int replayCheckFailuresOnInbound
    #field int saNotInitializedOnInbound
#endstruct

#defstruct global IPSEC_AH_DROP_PACKET_STATISTICS0
    #field int invalidSpisOnInbound
    #field int authenticationFailuresOnInbound
    #field int replayCheckFailuresOnInbound
    #field int saNotInitializedOnInbound
#endstruct

#defstruct global IPSEC_AGGREGATE_DROP_PACKET_STATISTICS1
    #field int invalidSpisOnInbound
    #field int decryptionFailuresOnInbound
    #field int authenticationFailuresOnInbound
    #field int udpEspValidationFailuresOnInbound
    #field int replayCheckFailuresOnInbound
    #field int invalidClearTextInbound
    #field int saNotInitializedOnInbound
    #field int receiveOverIncorrectSaInbound
    #field int secureReceivesNotMatchingFilters
    #field int totalDropPacketsInbound
#endstruct

#defstruct global IPSEC_TRAFFIC_STATISTICS1
    #field int64 encryptedByteCount
    #field int64 authenticatedAHByteCount
    #field int64 authenticatedESPByteCount
    #field int64 transportByteCount
    #field int64 tunnelByteCount
    #field int64 offloadByteCount
    #field int64 totalSuccessfulPackets
#endstruct

#defstruct global IPSEC_STATISTICS1
    #field IPSEC_AGGREGATE_SA_STATISTICS0 aggregateSaStatistics
    #field IPSEC_ESP_DROP_PACKET_STATISTICS0 espDropPacketStatistics
    #field IPSEC_AH_DROP_PACKET_STATISTICS0 ahDropPacketStatistics
    #field IPSEC_AGGREGATE_DROP_PACKET_STATISTICS1 aggregateDropPacketStatistics
    #field IPSEC_TRAFFIC_STATISTICS1 inboundTrafficStatistics
    #field IPSEC_TRAFFIC_STATISTICS1 outboundTrafficStatistics
#endstruct

stdim st, IPSEC_STATISTICS1        ; NSTRUCT 変数を確保