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

WLAN_BSS_ENTRY

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

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

フィールド

フィールドサイズx64x86説明
dot11SsidDOT11_SSID36+0+0BSSのSSID。
uPhyIdDWORD4+36+36BSSを検出したPHYのID。
dot11BssidBYTE6+40+40BSSのBSSID(6バイト)。
dot11BssTypeDOT11_BSS_TYPE4+48+48BSSの種類(インフラ/独立)。
dot11BssPhyTypeDOT11_PHY_TYPE4+52+52BSSのPHYタイプ。
lRssiINT4+56+56受信信号強度をdBm単位で示す。負の値となる。
uLinkQualityDWORD4+60+60リンク品質を示す値(0〜100)。
bInRegDomainBOOLEAN1+64+64BSSが現在の規制ドメイン内にあるかを示す真偽値。
usBeaconPeriodWORD2+66+66ビーコン周期(TU単位)。
ullTimestampULONGLONG8+72+72BSSのタイムスタンプ(マイクロ秒)。
ullHostTimestampULONGLONG8+80+80ビーコン/プローブ応答受信時のホストタイムスタンプ。
usCapabilityInformationWORD2+88+88BSSの能力情報フィールド。
ulChCenterFrequencyDWORD4+92+92チャネルの中心周波数(kHz)。
wlanRateSetWLAN_RATE_SET256+96+96BSSがサポートするレートセット。
ulIeOffsetDWORD4+352+352情報要素(IE)への先頭からのオフセット(バイト)。
ulIeSizeDWORD4+356+356情報要素(IE)のサイズ(バイト)。

各言語での定義

#include <windows.h>

// DOT11_SSID  (x64 36 / x86 36 バイト)
typedef struct DOT11_SSID {
    DWORD uSSIDLength;
    BYTE ucSSID[32];
} DOT11_SSID;

// WLAN_RATE_SET  (x64 256 / x86 256 バイト)
typedef struct WLAN_RATE_SET {
    DWORD uRateSetLength;
    WORD usRateSet[126];
} WLAN_RATE_SET;

// WLAN_BSS_ENTRY  (x64 360 / x86 360 バイト)
typedef struct WLAN_BSS_ENTRY {
    DOT11_SSID dot11Ssid;
    DWORD uPhyId;
    BYTE dot11Bssid[6];
    DOT11_BSS_TYPE dot11BssType;
    DOT11_PHY_TYPE dot11BssPhyType;
    INT lRssi;
    DWORD uLinkQuality;
    BOOLEAN bInRegDomain;
    WORD usBeaconPeriod;
    ULONGLONG ullTimestamp;
    ULONGLONG ullHostTimestamp;
    WORD usCapabilityInformation;
    DWORD ulChCenterFrequency;
    WLAN_RATE_SET wlanRateSet;
    DWORD ulIeOffset;
    DWORD ulIeSize;
} WLAN_BSS_ENTRY;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DOT11_SSID
{
    public uint uSSIDLength;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] ucSSID;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WLAN_RATE_SET
{
    public uint uRateSetLength;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 126)] public ushort[] usRateSet;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WLAN_BSS_ENTRY
{
    public DOT11_SSID dot11Ssid;
    public uint uPhyId;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] public byte[] dot11Bssid;
    public int dot11BssType;
    public int dot11BssPhyType;
    public int lRssi;
    public uint uLinkQuality;
    [MarshalAs(UnmanagedType.U1)] public bool bInRegDomain;
    public ushort usBeaconPeriod;
    public ulong ullTimestamp;
    public ulong ullHostTimestamp;
    public ushort usCapabilityInformation;
    public uint ulChCenterFrequency;
    public WLAN_RATE_SET wlanRateSet;
    public uint ulIeOffset;
    public uint ulIeSize;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DOT11_SSID
    Public uSSIDLength As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=32)> Public ucSSID() As Byte
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WLAN_RATE_SET
    Public uRateSetLength As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=126)> Public usRateSet() As UShort
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WLAN_BSS_ENTRY
    Public dot11Ssid As DOT11_SSID
    Public uPhyId As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=6)> Public dot11Bssid() As Byte
    Public dot11BssType As Integer
    Public dot11BssPhyType As Integer
    Public lRssi As Integer
    Public uLinkQuality As UInteger
    <MarshalAs(UnmanagedType.U1)> Public bInRegDomain As Boolean
    Public usBeaconPeriod As UShort
    Public ullTimestamp As ULong
    Public ullHostTimestamp As ULong
    Public usCapabilityInformation As UShort
    Public ulChCenterFrequency As UInteger
    Public wlanRateSet As WLAN_RATE_SET
    Public ulIeOffset As UInteger
    Public ulIeSize As UInteger
End Structure
import ctypes
from ctypes import wintypes

class DOT11_SSID(ctypes.Structure):
    _fields_ = [
        ("uSSIDLength", wintypes.DWORD),
        ("ucSSID", ctypes.c_ubyte * 32),
    ]

class WLAN_RATE_SET(ctypes.Structure):
    _fields_ = [
        ("uRateSetLength", wintypes.DWORD),
        ("usRateSet", ctypes.c_ushort * 126),
    ]

class WLAN_BSS_ENTRY(ctypes.Structure):
    _fields_ = [
        ("dot11Ssid", DOT11_SSID),
        ("uPhyId", wintypes.DWORD),
        ("dot11Bssid", ctypes.c_ubyte * 6),
        ("dot11BssType", ctypes.c_int),
        ("dot11BssPhyType", ctypes.c_int),
        ("lRssi", ctypes.c_int),
        ("uLinkQuality", wintypes.DWORD),
        ("bInRegDomain", ctypes.c_byte),
        ("usBeaconPeriod", ctypes.c_ushort),
        ("ullTimestamp", ctypes.c_ulonglong),
        ("ullHostTimestamp", ctypes.c_ulonglong),
        ("usCapabilityInformation", ctypes.c_ushort),
        ("ulChCenterFrequency", wintypes.DWORD),
        ("wlanRateSet", WLAN_RATE_SET),
        ("ulIeOffset", wintypes.DWORD),
        ("ulIeSize", wintypes.DWORD),
    ]
#[repr(C)]
pub struct DOT11_SSID {
    pub uSSIDLength: u32,
    pub ucSSID: [u8; 32],
}

#[repr(C)]
pub struct WLAN_RATE_SET {
    pub uRateSetLength: u32,
    pub usRateSet: [u16; 126],
}

#[repr(C)]
pub struct WLAN_BSS_ENTRY {
    pub dot11Ssid: DOT11_SSID,
    pub uPhyId: u32,
    pub dot11Bssid: [u8; 6],
    pub dot11BssType: i32,
    pub dot11BssPhyType: i32,
    pub lRssi: i32,
    pub uLinkQuality: u32,
    pub bInRegDomain: u8,
    pub usBeaconPeriod: u16,
    pub ullTimestamp: u64,
    pub ullHostTimestamp: u64,
    pub usCapabilityInformation: u16,
    pub ulChCenterFrequency: u32,
    pub wlanRateSet: WLAN_RATE_SET,
    pub ulIeOffset: u32,
    pub ulIeSize: u32,
}
import "golang.org/x/sys/windows"

type DOT11_SSID struct {
	uSSIDLength uint32
	ucSSID [32]byte
}

type WLAN_RATE_SET struct {
	uRateSetLength uint32
	usRateSet [126]uint16
}

type WLAN_BSS_ENTRY struct {
	dot11Ssid DOT11_SSID
	uPhyId uint32
	dot11Bssid [6]byte
	dot11BssType int32
	dot11BssPhyType int32
	lRssi int32
	uLinkQuality uint32
	bInRegDomain byte
	usBeaconPeriod uint16
	ullTimestamp uint64
	ullHostTimestamp uint64
	usCapabilityInformation uint16
	ulChCenterFrequency uint32
	wlanRateSet WLAN_RATE_SET
	ulIeOffset uint32
	ulIeSize uint32
}
type
  DOT11_SSID = record
    uSSIDLength: DWORD;
    ucSSID: array[0..31] of Byte;
  end;

  WLAN_RATE_SET = record
    uRateSetLength: DWORD;
    usRateSet: array[0..125] of Word;
  end;

  WLAN_BSS_ENTRY = record
    dot11Ssid: DOT11_SSID;
    uPhyId: DWORD;
    dot11Bssid: array[0..5] of Byte;
    dot11BssType: Integer;
    dot11BssPhyType: Integer;
    lRssi: Integer;
    uLinkQuality: DWORD;
    bInRegDomain: ByteBool;
    usBeaconPeriod: Word;
    ullTimestamp: UInt64;
    ullHostTimestamp: UInt64;
    usCapabilityInformation: Word;
    ulChCenterFrequency: DWORD;
    wlanRateSet: WLAN_RATE_SET;
    ulIeOffset: DWORD;
    ulIeSize: DWORD;
  end;
const DOT11_SSID = extern struct {
    uSSIDLength: u32,
    ucSSID: [32]u8,
};

const WLAN_RATE_SET = extern struct {
    uRateSetLength: u32,
    usRateSet: [126]u16,
};

const WLAN_BSS_ENTRY = extern struct {
    dot11Ssid: DOT11_SSID,
    uPhyId: u32,
    dot11Bssid: [6]u8,
    dot11BssType: i32,
    dot11BssPhyType: i32,
    lRssi: i32,
    uLinkQuality: u32,
    bInRegDomain: u8,
    usBeaconPeriod: u16,
    ullTimestamp: u64,
    ullHostTimestamp: u64,
    usCapabilityInformation: u16,
    ulChCenterFrequency: u32,
    wlanRateSet: WLAN_RATE_SET,
    ulIeOffset: u32,
    ulIeSize: u32,
};
type
  DOT11_SSID {.bycopy.} = object
    uSSIDLength: uint32
    ucSSID: array[32, uint8]

  WLAN_RATE_SET {.bycopy.} = object
    uRateSetLength: uint32
    usRateSet: array[126, uint16]

  WLAN_BSS_ENTRY {.bycopy.} = object
    dot11Ssid: DOT11_SSID
    uPhyId: uint32
    dot11Bssid: array[6, uint8]
    dot11BssType: int32
    dot11BssPhyType: int32
    lRssi: int32
    uLinkQuality: uint32
    bInRegDomain: uint8
    usBeaconPeriod: uint16
    ullTimestamp: uint64
    ullHostTimestamp: uint64
    usCapabilityInformation: uint16
    ulChCenterFrequency: uint32
    wlanRateSet: WLAN_RATE_SET
    ulIeOffset: uint32
    ulIeSize: uint32
struct DOT11_SSID
{
    uint uSSIDLength;
    ubyte[32] ucSSID;
}

struct WLAN_RATE_SET
{
    uint uRateSetLength;
    ushort[126] usRateSet;
}

struct WLAN_BSS_ENTRY
{
    DOT11_SSID dot11Ssid;
    uint uPhyId;
    ubyte[6] dot11Bssid;
    int dot11BssType;
    int dot11BssPhyType;
    int lRssi;
    uint uLinkQuality;
    ubyte bInRegDomain;
    ushort usBeaconPeriod;
    ulong ullTimestamp;
    ulong ullHostTimestamp;
    ushort usCapabilityInformation;
    uint ulChCenterFrequency;
    WLAN_RATE_SET wlanRateSet;
    uint ulIeOffset;
    uint ulIeSize;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; WLAN_BSS_ENTRY サイズ: 360 バイト(x64)
dim st, 90    ; 4byte整数×90(構造体サイズ 360 / 4 切り上げ)
; dot11Ssid : DOT11_SSID (+0, 36byte)  varptr(st)+0 を基点に操作(36byte:入れ子/配列)
; uPhyId : DWORD (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; dot11Bssid : BYTE (+40, 6byte)  varptr(st)+40 を基点に操作(6byte:入れ子/配列)
; dot11BssType : DOT11_BSS_TYPE (+48, 4byte)  st.12 = 値  /  値 = st.12   (lpoke/lpeek も可)
; dot11BssPhyType : DOT11_PHY_TYPE (+52, 4byte)  st.13 = 値  /  値 = st.13   (lpoke/lpeek も可)
; lRssi : INT (+56, 4byte)  st.14 = 値  /  値 = st.14   (lpoke/lpeek も可)
; uLinkQuality : DWORD (+60, 4byte)  st.15 = 値  /  値 = st.15   (lpoke/lpeek も可)
; bInRegDomain : BOOLEAN (+64, 1byte)  poke st,64,値  /  値 = peek(st,64)
; usBeaconPeriod : WORD (+66, 2byte)  wpoke st,66,値  /  値 = wpeek(st,66)
; ullTimestamp : ULONGLONG (+72, 8byte)  qpoke st,72,値 / qpeek(st,72)  ※IronHSPのみ。3.7/3.8は lpoke st,72,下位 : lpoke st,76,上位
; ullHostTimestamp : ULONGLONG (+80, 8byte)  qpoke st,80,値 / qpeek(st,80)  ※IronHSPのみ。3.7/3.8は lpoke st,80,下位 : lpoke st,84,上位
; usCapabilityInformation : WORD (+88, 2byte)  wpoke st,88,値  /  値 = wpeek(st,88)
; ulChCenterFrequency : DWORD (+92, 4byte)  st.23 = 値  /  値 = st.23   (lpoke/lpeek も可)
; wlanRateSet : WLAN_RATE_SET (+96, 256byte)  varptr(st)+96 を基点に操作(256byte:入れ子/配列)
; ulIeOffset : DWORD (+352, 4byte)  st.88 = 値  /  値 = st.88   (lpoke/lpeek も可)
; ulIeSize : DWORD (+356, 4byte)  st.89 = 値  /  値 = st.89   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global DOT11_SSID
    #field int uSSIDLength
    #field byte ucSSID 32
#endstruct

#defstruct global WLAN_RATE_SET
    #field int uRateSetLength
    #field short usRateSet 126
#endstruct

#defstruct global WLAN_BSS_ENTRY
    #field DOT11_SSID dot11Ssid
    #field int uPhyId
    #field byte dot11Bssid 6
    #field int dot11BssType
    #field int dot11BssPhyType
    #field int lRssi
    #field int uLinkQuality
    #field bool1 bInRegDomain
    #field short usBeaconPeriod
    #field int64 ullTimestamp
    #field int64 ullHostTimestamp
    #field short usCapabilityInformation
    #field int ulChCenterFrequency
    #field WLAN_RATE_SET wlanRateSet
    #field int ulIeOffset
    #field int ulIeSize
#endstruct

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