ホーム › NetworkManagement.WiFi › DOT11_PORT_STATE
DOT11_PORT_STATE
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| PeerMacAddress | BYTE | 6 | +0 | +0 | 通信相手の6バイトMACアドレス。ポート状態の対象ピアを示す。 |
| uSessionId | DWORD | 4 | +8 | +8 | ポート状態に関連付けられたセッションID。 |
| bPortControlled | BOOL | 4 | +12 | +12 | ポートが802.1X制御下にあるかを示すBOOL。TRUEで制御ポート。 |
| bPortAuthorized | BOOL | 4 | +16 | +16 | ポートが認証済みでデータ通過可能かを示すBOOL。TRUEで認可済み。 |
各言語での定義
#include <windows.h>
// DOT11_PORT_STATE (x64 20 / x86 20 バイト)
typedef struct DOT11_PORT_STATE {
BYTE PeerMacAddress[6];
DWORD uSessionId;
BOOL bPortControlled;
BOOL bPortAuthorized;
} DOT11_PORT_STATE;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DOT11_PORT_STATE
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] public byte[] PeerMacAddress;
public uint uSessionId;
[MarshalAs(UnmanagedType.Bool)] public bool bPortControlled;
[MarshalAs(UnmanagedType.Bool)] public bool bPortAuthorized;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DOT11_PORT_STATE
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=6)> Public PeerMacAddress() As Byte
Public uSessionId As UInteger
<MarshalAs(UnmanagedType.Bool)> Public bPortControlled As Boolean
<MarshalAs(UnmanagedType.Bool)> Public bPortAuthorized As Boolean
End Structureimport ctypes
from ctypes import wintypes
class DOT11_PORT_STATE(ctypes.Structure):
_fields_ = [
("PeerMacAddress", ctypes.c_ubyte * 6),
("uSessionId", wintypes.DWORD),
("bPortControlled", wintypes.BOOL),
("bPortAuthorized", wintypes.BOOL),
]#[repr(C)]
pub struct DOT11_PORT_STATE {
pub PeerMacAddress: [u8; 6],
pub uSessionId: u32,
pub bPortControlled: i32,
pub bPortAuthorized: i32,
}import "golang.org/x/sys/windows"
type DOT11_PORT_STATE struct {
PeerMacAddress [6]byte
uSessionId uint32
bPortControlled int32
bPortAuthorized int32
}type
DOT11_PORT_STATE = record
PeerMacAddress: array[0..5] of Byte;
uSessionId: DWORD;
bPortControlled: BOOL;
bPortAuthorized: BOOL;
end;const DOT11_PORT_STATE = extern struct {
PeerMacAddress: [6]u8,
uSessionId: u32,
bPortControlled: i32,
bPortAuthorized: i32,
};type
DOT11_PORT_STATE {.bycopy.} = object
PeerMacAddress: array[6, uint8]
uSessionId: uint32
bPortControlled: int32
bPortAuthorized: int32struct DOT11_PORT_STATE
{
ubyte[6] PeerMacAddress;
uint uSessionId;
int bPortControlled;
int bPortAuthorized;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DOT11_PORT_STATE サイズ: 20 バイト(x64)
dim st, 5 ; 4byte整数×5(構造体サイズ 20 / 4 切り上げ)
; PeerMacAddress : BYTE (+0, 6byte) varptr(st)+0 を基点に操作(6byte:入れ子/配列)
; uSessionId : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; bPortControlled : BOOL (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; bPortAuthorized : BOOL (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DOT11_PORT_STATE
#field byte PeerMacAddress 6
#field int uSessionId
#field bool bPortControlled
#field bool bPortAuthorized
#endstruct
stdim st, DOT11_PORT_STATE ; NSTRUCT 変数を確保
st->uSessionId = 100
mes "uSessionId=" + st->uSessionId