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

DOT11_PEER_INFO

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

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

フィールド

フィールドサイズx64x86説明
MacAddressBYTE6+0+0ピアのMACアドレス(6バイト)。
usCapabilityInformationWORD2+6+6ピアの能力情報フィールド(802.11 Capabilityビット)。
AuthAlgoDOT11_AUTH_ALGORITHM4+8+8ピアとの間で使用される認証アルゴリズム。
UnicastCipherAlgoDOT11_CIPHER_ALGORITHM4+12+12ユニキャスト通信に使用される暗号アルゴリズム。
MulticastCipherAlgoDOT11_CIPHER_ALGORITHM4+16+16マルチキャスト通信に使用される暗号アルゴリズム。
bWpsEnabledBOOLEAN1+20+20WPSが有効かを示す真偽値。
usListenIntervalWORD2+22+22ピアのリッスンインターバル(ビーコン周期単位)。
ucSupportedRatesBYTE255+24+24ピアがサポートするレートの配列。
usAssociationIDWORD2+280+280アソシエーションID(AID)。
AssociationStateDOT11_ASSOCIATION_STATE4+284+284ピアのアソシエーション状態。
PowerModeDOT11_POWER_MODE4+288+288ピアの電源管理モード。
liAssociationUpTimeLONGLONG8+296+296アソシエーション確立からの経過時間。
StatisticsDOT11_PEER_STATISTICS48+304+304ピアに関する送受信・復号の統計情報。

各言語での定義

#include <windows.h>

// DOT11_PEER_STATISTICS  (x64 48 / x86 48 バイト)
typedef struct DOT11_PEER_STATISTICS {
    ULONGLONG ullDecryptSuccessCount;
    ULONGLONG ullDecryptFailureCount;
    ULONGLONG ullTxPacketSuccessCount;
    ULONGLONG ullTxPacketFailureCount;
    ULONGLONG ullRxPacketSuccessCount;
    ULONGLONG ullRxPacketFailureCount;
} DOT11_PEER_STATISTICS;

// DOT11_PEER_INFO  (x64 352 / x86 352 バイト)
typedef struct DOT11_PEER_INFO {
    BYTE MacAddress[6];
    WORD usCapabilityInformation;
    DOT11_AUTH_ALGORITHM AuthAlgo;
    DOT11_CIPHER_ALGORITHM UnicastCipherAlgo;
    DOT11_CIPHER_ALGORITHM MulticastCipherAlgo;
    BOOLEAN bWpsEnabled;
    WORD usListenInterval;
    BYTE ucSupportedRates[255];
    WORD usAssociationID;
    DOT11_ASSOCIATION_STATE AssociationState;
    DOT11_POWER_MODE PowerMode;
    LONGLONG liAssociationUpTime;
    DOT11_PEER_STATISTICS Statistics;
} DOT11_PEER_INFO;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DOT11_PEER_STATISTICS
{
    public ulong ullDecryptSuccessCount;
    public ulong ullDecryptFailureCount;
    public ulong ullTxPacketSuccessCount;
    public ulong ullTxPacketFailureCount;
    public ulong ullRxPacketSuccessCount;
    public ulong ullRxPacketFailureCount;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DOT11_PEER_INFO
{
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] public byte[] MacAddress;
    public ushort usCapabilityInformation;
    public int AuthAlgo;
    public int UnicastCipherAlgo;
    public int MulticastCipherAlgo;
    [MarshalAs(UnmanagedType.U1)] public bool bWpsEnabled;
    public ushort usListenInterval;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 255)] public byte[] ucSupportedRates;
    public ushort usAssociationID;
    public int AssociationState;
    public int PowerMode;
    public long liAssociationUpTime;
    public DOT11_PEER_STATISTICS Statistics;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DOT11_PEER_STATISTICS
    Public ullDecryptSuccessCount As ULong
    Public ullDecryptFailureCount As ULong
    Public ullTxPacketSuccessCount As ULong
    Public ullTxPacketFailureCount As ULong
    Public ullRxPacketSuccessCount As ULong
    Public ullRxPacketFailureCount As ULong
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DOT11_PEER_INFO
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=6)> Public MacAddress() As Byte
    Public usCapabilityInformation As UShort
    Public AuthAlgo As Integer
    Public UnicastCipherAlgo As Integer
    Public MulticastCipherAlgo As Integer
    <MarshalAs(UnmanagedType.U1)> Public bWpsEnabled As Boolean
    Public usListenInterval As UShort
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=255)> Public ucSupportedRates() As Byte
    Public usAssociationID As UShort
    Public AssociationState As Integer
    Public PowerMode As Integer
    Public liAssociationUpTime As Long
    Public Statistics As DOT11_PEER_STATISTICS
End Structure
import ctypes
from ctypes import wintypes

class DOT11_PEER_STATISTICS(ctypes.Structure):
    _fields_ = [
        ("ullDecryptSuccessCount", ctypes.c_ulonglong),
        ("ullDecryptFailureCount", ctypes.c_ulonglong),
        ("ullTxPacketSuccessCount", ctypes.c_ulonglong),
        ("ullTxPacketFailureCount", ctypes.c_ulonglong),
        ("ullRxPacketSuccessCount", ctypes.c_ulonglong),
        ("ullRxPacketFailureCount", ctypes.c_ulonglong),
    ]

class DOT11_PEER_INFO(ctypes.Structure):
    _fields_ = [
        ("MacAddress", ctypes.c_ubyte * 6),
        ("usCapabilityInformation", ctypes.c_ushort),
        ("AuthAlgo", ctypes.c_int),
        ("UnicastCipherAlgo", ctypes.c_int),
        ("MulticastCipherAlgo", ctypes.c_int),
        ("bWpsEnabled", ctypes.c_byte),
        ("usListenInterval", ctypes.c_ushort),
        ("ucSupportedRates", ctypes.c_ubyte * 255),
        ("usAssociationID", ctypes.c_ushort),
        ("AssociationState", ctypes.c_int),
        ("PowerMode", ctypes.c_int),
        ("liAssociationUpTime", ctypes.c_longlong),
        ("Statistics", DOT11_PEER_STATISTICS),
    ]
#[repr(C)]
pub struct DOT11_PEER_STATISTICS {
    pub ullDecryptSuccessCount: u64,
    pub ullDecryptFailureCount: u64,
    pub ullTxPacketSuccessCount: u64,
    pub ullTxPacketFailureCount: u64,
    pub ullRxPacketSuccessCount: u64,
    pub ullRxPacketFailureCount: u64,
}

#[repr(C)]
pub struct DOT11_PEER_INFO {
    pub MacAddress: [u8; 6],
    pub usCapabilityInformation: u16,
    pub AuthAlgo: i32,
    pub UnicastCipherAlgo: i32,
    pub MulticastCipherAlgo: i32,
    pub bWpsEnabled: u8,
    pub usListenInterval: u16,
    pub ucSupportedRates: [u8; 255],
    pub usAssociationID: u16,
    pub AssociationState: i32,
    pub PowerMode: i32,
    pub liAssociationUpTime: i64,
    pub Statistics: DOT11_PEER_STATISTICS,
}
import "golang.org/x/sys/windows"

type DOT11_PEER_STATISTICS struct {
	ullDecryptSuccessCount uint64
	ullDecryptFailureCount uint64
	ullTxPacketSuccessCount uint64
	ullTxPacketFailureCount uint64
	ullRxPacketSuccessCount uint64
	ullRxPacketFailureCount uint64
}

type DOT11_PEER_INFO struct {
	MacAddress [6]byte
	usCapabilityInformation uint16
	AuthAlgo int32
	UnicastCipherAlgo int32
	MulticastCipherAlgo int32
	bWpsEnabled byte
	usListenInterval uint16
	ucSupportedRates [255]byte
	usAssociationID uint16
	AssociationState int32
	PowerMode int32
	liAssociationUpTime int64
	Statistics DOT11_PEER_STATISTICS
}
type
  DOT11_PEER_STATISTICS = record
    ullDecryptSuccessCount: UInt64;
    ullDecryptFailureCount: UInt64;
    ullTxPacketSuccessCount: UInt64;
    ullTxPacketFailureCount: UInt64;
    ullRxPacketSuccessCount: UInt64;
    ullRxPacketFailureCount: UInt64;
  end;

  DOT11_PEER_INFO = record
    MacAddress: array[0..5] of Byte;
    usCapabilityInformation: Word;
    AuthAlgo: Integer;
    UnicastCipherAlgo: Integer;
    MulticastCipherAlgo: Integer;
    bWpsEnabled: ByteBool;
    usListenInterval: Word;
    ucSupportedRates: array[0..254] of Byte;
    usAssociationID: Word;
    AssociationState: Integer;
    PowerMode: Integer;
    liAssociationUpTime: Int64;
    Statistics: DOT11_PEER_STATISTICS;
  end;
const DOT11_PEER_STATISTICS = extern struct {
    ullDecryptSuccessCount: u64,
    ullDecryptFailureCount: u64,
    ullTxPacketSuccessCount: u64,
    ullTxPacketFailureCount: u64,
    ullRxPacketSuccessCount: u64,
    ullRxPacketFailureCount: u64,
};

const DOT11_PEER_INFO = extern struct {
    MacAddress: [6]u8,
    usCapabilityInformation: u16,
    AuthAlgo: i32,
    UnicastCipherAlgo: i32,
    MulticastCipherAlgo: i32,
    bWpsEnabled: u8,
    usListenInterval: u16,
    ucSupportedRates: [255]u8,
    usAssociationID: u16,
    AssociationState: i32,
    PowerMode: i32,
    liAssociationUpTime: i64,
    Statistics: DOT11_PEER_STATISTICS,
};
type
  DOT11_PEER_STATISTICS {.bycopy.} = object
    ullDecryptSuccessCount: uint64
    ullDecryptFailureCount: uint64
    ullTxPacketSuccessCount: uint64
    ullTxPacketFailureCount: uint64
    ullRxPacketSuccessCount: uint64
    ullRxPacketFailureCount: uint64

  DOT11_PEER_INFO {.bycopy.} = object
    MacAddress: array[6, uint8]
    usCapabilityInformation: uint16
    AuthAlgo: int32
    UnicastCipherAlgo: int32
    MulticastCipherAlgo: int32
    bWpsEnabled: uint8
    usListenInterval: uint16
    ucSupportedRates: array[255, uint8]
    usAssociationID: uint16
    AssociationState: int32
    PowerMode: int32
    liAssociationUpTime: int64
    Statistics: DOT11_PEER_STATISTICS
struct DOT11_PEER_STATISTICS
{
    ulong ullDecryptSuccessCount;
    ulong ullDecryptFailureCount;
    ulong ullTxPacketSuccessCount;
    ulong ullTxPacketFailureCount;
    ulong ullRxPacketSuccessCount;
    ulong ullRxPacketFailureCount;
}

struct DOT11_PEER_INFO
{
    ubyte[6] MacAddress;
    ushort usCapabilityInformation;
    int AuthAlgo;
    int UnicastCipherAlgo;
    int MulticastCipherAlgo;
    ubyte bWpsEnabled;
    ushort usListenInterval;
    ubyte[255] ucSupportedRates;
    ushort usAssociationID;
    int AssociationState;
    int PowerMode;
    long liAssociationUpTime;
    DOT11_PEER_STATISTICS Statistics;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DOT11_PEER_INFO サイズ: 352 バイト(x64)
dim st, 88    ; 4byte整数×88(構造体サイズ 352 / 4 切り上げ)
; MacAddress : BYTE (+0, 6byte)  varptr(st)+0 を基点に操作(6byte:入れ子/配列)
; usCapabilityInformation : WORD (+6, 2byte)  wpoke st,6,値  /  値 = wpeek(st,6)
; AuthAlgo : DOT11_AUTH_ALGORITHM (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; UnicastCipherAlgo : DOT11_CIPHER_ALGORITHM (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; MulticastCipherAlgo : DOT11_CIPHER_ALGORITHM (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; bWpsEnabled : BOOLEAN (+20, 1byte)  poke st,20,値  /  値 = peek(st,20)
; usListenInterval : WORD (+22, 2byte)  wpoke st,22,値  /  値 = wpeek(st,22)
; ucSupportedRates : BYTE (+24, 255byte)  varptr(st)+24 を基点に操作(255byte:入れ子/配列)
; usAssociationID : WORD (+280, 2byte)  wpoke st,280,値  /  値 = wpeek(st,280)
; AssociationState : DOT11_ASSOCIATION_STATE (+284, 4byte)  st.71 = 値  /  値 = st.71   (lpoke/lpeek も可)
; PowerMode : DOT11_POWER_MODE (+288, 4byte)  st.72 = 値  /  値 = st.72   (lpoke/lpeek も可)
; liAssociationUpTime : LONGLONG (+296, 8byte)  qpoke st,296,値 / qpeek(st,296)  ※IronHSPのみ。3.7/3.8は lpoke st,296,下位 : lpoke st,300,上位
; Statistics : DOT11_PEER_STATISTICS (+304, 48byte)  varptr(st)+304 を基点に操作(48byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global DOT11_PEER_STATISTICS
    #field int64 ullDecryptSuccessCount
    #field int64 ullDecryptFailureCount
    #field int64 ullTxPacketSuccessCount
    #field int64 ullTxPacketFailureCount
    #field int64 ullRxPacketSuccessCount
    #field int64 ullRxPacketFailureCount
#endstruct

#defstruct global DOT11_PEER_INFO
    #field byte MacAddress 6
    #field short usCapabilityInformation
    #field int AuthAlgo
    #field int UnicastCipherAlgo
    #field int MulticastCipherAlgo
    #field bool1 bWpsEnabled
    #field short usListenInterval
    #field byte ucSupportedRates 255
    #field short usAssociationID
    #field int AssociationState
    #field int PowerMode
    #field int64 liAssociationUpTime
    #field DOT11_PEER_STATISTICS Statistics
#endstruct

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