ホーム › NetworkManagement.IpHelper › MIB_IFROW
MIB_IFROW
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| wszName | WCHAR | 512 | +0 | +0 | インターフェース名を格納する固定長ワイド文字配列。 |
| dwIndex | DWORD | 4 | +512 | +512 | インターフェースのインデックスを示す。 |
| dwType | DWORD | 4 | +516 | +516 | インターフェースの種別(イーサネット/ループバック等)を示すIANA ifType値。 |
| dwMtu | DWORD | 4 | +520 | +520 | インターフェースの最大転送単位(MTU)をバイト単位で示す。 |
| dwSpeed | DWORD | 4 | +524 | +524 | インターフェースの速度をbps(ビット毎秒)で示す。 |
| dwPhysAddrLen | DWORD | 4 | +528 | +528 | bPhysAddrに格納された物理アドレスのバイト長を示す。 |
| bPhysAddr | BYTE | 8 | +532 | +532 | インターフェースの物理(MAC)アドレスを格納する固定長バイト配列。 |
| dwAdminStatus | DWORD | 4 | +540 | +540 | インターフェースの管理状態(有効/無効)を示す。 |
| dwOperStatus | INTERNAL_IF_OPER_STATUS | 4 | +544 | +544 | インターフェースの実際の動作状態を示す列挙値。 |
| dwLastChange | DWORD | 4 | +548 | +548 | 動作状態が最後に変化した時刻を示す。 |
| dwInOctets | DWORD | 4 | +552 | +552 | 受信したオクテット(バイト)総数を保持する。 |
| dwInUcastPkts | DWORD | 4 | +556 | +556 | 受信したユニキャストパケット数を保持する。 |
| dwInNUcastPkts | DWORD | 4 | +560 | +560 | 受信した非ユニキャスト(ブロード/マルチキャスト)パケット数を保持する。 |
| dwInDiscards | DWORD | 4 | +564 | +564 | 受信して破棄したパケット数を保持する。 |
| dwInErrors | DWORD | 4 | +568 | +568 | エラーにより受信できなかったパケット数を保持する。 |
| dwInUnknownProtos | DWORD | 4 | +572 | +572 | プロトコル未知のため破棄した受信パケット数を保持する。 |
| dwOutOctets | DWORD | 4 | +576 | +576 | 送信したオクテット(バイト)総数を保持する。 |
| dwOutUcastPkts | DWORD | 4 | +580 | +580 | 送信したユニキャストパケット数を保持する。 |
| dwOutNUcastPkts | DWORD | 4 | +584 | +584 | 送信した非ユニキャストパケット数を保持する。 |
| dwOutDiscards | DWORD | 4 | +588 | +588 | 送信時に破棄したパケット数を保持する。 |
| dwOutErrors | DWORD | 4 | +592 | +592 | エラーにより送信できなかったパケット数を保持する。 |
| dwOutQLen | DWORD | 4 | +596 | +596 | 送信パケットキューの長さを示す。 |
| dwDescrLen | DWORD | 4 | +600 | +600 | bDescrに格納された説明文字列のバイト長を示す。 |
| bDescr | BYTE | 256 | +604 | +604 | インターフェースの説明文字列を格納する固定長バイト配列(ANSI)。 |
各言語での定義
#include <windows.h>
// MIB_IFROW (x64 860 / x86 860 バイト)
typedef struct MIB_IFROW {
WCHAR wszName[256];
DWORD dwIndex;
DWORD dwType;
DWORD dwMtu;
DWORD dwSpeed;
DWORD dwPhysAddrLen;
BYTE bPhysAddr[8];
DWORD dwAdminStatus;
INTERNAL_IF_OPER_STATUS dwOperStatus;
DWORD dwLastChange;
DWORD dwInOctets;
DWORD dwInUcastPkts;
DWORD dwInNUcastPkts;
DWORD dwInDiscards;
DWORD dwInErrors;
DWORD dwInUnknownProtos;
DWORD dwOutOctets;
DWORD dwOutUcastPkts;
DWORD dwOutNUcastPkts;
DWORD dwOutDiscards;
DWORD dwOutErrors;
DWORD dwOutQLen;
DWORD dwDescrLen;
BYTE bDescr[256];
} MIB_IFROW;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct MIB_IFROW
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] public string wszName;
public uint dwIndex;
public uint dwType;
public uint dwMtu;
public uint dwSpeed;
public uint dwPhysAddrLen;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] bPhysAddr;
public uint dwAdminStatus;
public int dwOperStatus;
public uint dwLastChange;
public uint dwInOctets;
public uint dwInUcastPkts;
public uint dwInNUcastPkts;
public uint dwInDiscards;
public uint dwInErrors;
public uint dwInUnknownProtos;
public uint dwOutOctets;
public uint dwOutUcastPkts;
public uint dwOutNUcastPkts;
public uint dwOutDiscards;
public uint dwOutErrors;
public uint dwOutQLen;
public uint dwDescrLen;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)] public byte[] bDescr;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure MIB_IFROW
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=256)> Public wszName As String
Public dwIndex As UInteger
Public dwType As UInteger
Public dwMtu As UInteger
Public dwSpeed As UInteger
Public dwPhysAddrLen As UInteger
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=8)> Public bPhysAddr() As Byte
Public dwAdminStatus As UInteger
Public dwOperStatus As Integer
Public dwLastChange As UInteger
Public dwInOctets As UInteger
Public dwInUcastPkts As UInteger
Public dwInNUcastPkts As UInteger
Public dwInDiscards As UInteger
Public dwInErrors As UInteger
Public dwInUnknownProtos As UInteger
Public dwOutOctets As UInteger
Public dwOutUcastPkts As UInteger
Public dwOutNUcastPkts As UInteger
Public dwOutDiscards As UInteger
Public dwOutErrors As UInteger
Public dwOutQLen As UInteger
Public dwDescrLen As UInteger
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=256)> Public bDescr() As Byte
End Structureimport ctypes
from ctypes import wintypes
class MIB_IFROW(ctypes.Structure):
_fields_ = [
("wszName", ctypes.c_wchar * 256),
("dwIndex", wintypes.DWORD),
("dwType", wintypes.DWORD),
("dwMtu", wintypes.DWORD),
("dwSpeed", wintypes.DWORD),
("dwPhysAddrLen", wintypes.DWORD),
("bPhysAddr", ctypes.c_ubyte * 8),
("dwAdminStatus", wintypes.DWORD),
("dwOperStatus", ctypes.c_int),
("dwLastChange", wintypes.DWORD),
("dwInOctets", wintypes.DWORD),
("dwInUcastPkts", wintypes.DWORD),
("dwInNUcastPkts", wintypes.DWORD),
("dwInDiscards", wintypes.DWORD),
("dwInErrors", wintypes.DWORD),
("dwInUnknownProtos", wintypes.DWORD),
("dwOutOctets", wintypes.DWORD),
("dwOutUcastPkts", wintypes.DWORD),
("dwOutNUcastPkts", wintypes.DWORD),
("dwOutDiscards", wintypes.DWORD),
("dwOutErrors", wintypes.DWORD),
("dwOutQLen", wintypes.DWORD),
("dwDescrLen", wintypes.DWORD),
("bDescr", ctypes.c_ubyte * 256),
]#[repr(C)]
pub struct MIB_IFROW {
pub wszName: [u16; 256],
pub dwIndex: u32,
pub dwType: u32,
pub dwMtu: u32,
pub dwSpeed: u32,
pub dwPhysAddrLen: u32,
pub bPhysAddr: [u8; 8],
pub dwAdminStatus: u32,
pub dwOperStatus: i32,
pub dwLastChange: u32,
pub dwInOctets: u32,
pub dwInUcastPkts: u32,
pub dwInNUcastPkts: u32,
pub dwInDiscards: u32,
pub dwInErrors: u32,
pub dwInUnknownProtos: u32,
pub dwOutOctets: u32,
pub dwOutUcastPkts: u32,
pub dwOutNUcastPkts: u32,
pub dwOutDiscards: u32,
pub dwOutErrors: u32,
pub dwOutQLen: u32,
pub dwDescrLen: u32,
pub bDescr: [u8; 256],
}import "golang.org/x/sys/windows"
type MIB_IFROW struct {
wszName [256]uint16
dwIndex uint32
dwType uint32
dwMtu uint32
dwSpeed uint32
dwPhysAddrLen uint32
bPhysAddr [8]byte
dwAdminStatus uint32
dwOperStatus int32
dwLastChange uint32
dwInOctets uint32
dwInUcastPkts uint32
dwInNUcastPkts uint32
dwInDiscards uint32
dwInErrors uint32
dwInUnknownProtos uint32
dwOutOctets uint32
dwOutUcastPkts uint32
dwOutNUcastPkts uint32
dwOutDiscards uint32
dwOutErrors uint32
dwOutQLen uint32
dwDescrLen uint32
bDescr [256]byte
}type
MIB_IFROW = record
wszName: array[0..255] of WideChar;
dwIndex: DWORD;
dwType: DWORD;
dwMtu: DWORD;
dwSpeed: DWORD;
dwPhysAddrLen: DWORD;
bPhysAddr: array[0..7] of Byte;
dwAdminStatus: DWORD;
dwOperStatus: Integer;
dwLastChange: DWORD;
dwInOctets: DWORD;
dwInUcastPkts: DWORD;
dwInNUcastPkts: DWORD;
dwInDiscards: DWORD;
dwInErrors: DWORD;
dwInUnknownProtos: DWORD;
dwOutOctets: DWORD;
dwOutUcastPkts: DWORD;
dwOutNUcastPkts: DWORD;
dwOutDiscards: DWORD;
dwOutErrors: DWORD;
dwOutQLen: DWORD;
dwDescrLen: DWORD;
bDescr: array[0..255] of Byte;
end;const MIB_IFROW = extern struct {
wszName: [256]u16,
dwIndex: u32,
dwType: u32,
dwMtu: u32,
dwSpeed: u32,
dwPhysAddrLen: u32,
bPhysAddr: [8]u8,
dwAdminStatus: u32,
dwOperStatus: i32,
dwLastChange: u32,
dwInOctets: u32,
dwInUcastPkts: u32,
dwInNUcastPkts: u32,
dwInDiscards: u32,
dwInErrors: u32,
dwInUnknownProtos: u32,
dwOutOctets: u32,
dwOutUcastPkts: u32,
dwOutNUcastPkts: u32,
dwOutDiscards: u32,
dwOutErrors: u32,
dwOutQLen: u32,
dwDescrLen: u32,
bDescr: [256]u8,
};type
MIB_IFROW {.bycopy.} = object
wszName: array[256, uint16]
dwIndex: uint32
dwType: uint32
dwMtu: uint32
dwSpeed: uint32
dwPhysAddrLen: uint32
bPhysAddr: array[8, uint8]
dwAdminStatus: uint32
dwOperStatus: int32
dwLastChange: uint32
dwInOctets: uint32
dwInUcastPkts: uint32
dwInNUcastPkts: uint32
dwInDiscards: uint32
dwInErrors: uint32
dwInUnknownProtos: uint32
dwOutOctets: uint32
dwOutUcastPkts: uint32
dwOutNUcastPkts: uint32
dwOutDiscards: uint32
dwOutErrors: uint32
dwOutQLen: uint32
dwDescrLen: uint32
bDescr: array[256, uint8]struct MIB_IFROW
{
wchar[256] wszName;
uint dwIndex;
uint dwType;
uint dwMtu;
uint dwSpeed;
uint dwPhysAddrLen;
ubyte[8] bPhysAddr;
uint dwAdminStatus;
int dwOperStatus;
uint dwLastChange;
uint dwInOctets;
uint dwInUcastPkts;
uint dwInNUcastPkts;
uint dwInDiscards;
uint dwInErrors;
uint dwInUnknownProtos;
uint dwOutOctets;
uint dwOutUcastPkts;
uint dwOutNUcastPkts;
uint dwOutDiscards;
uint dwOutErrors;
uint dwOutQLen;
uint dwDescrLen;
ubyte[256] bDescr;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; MIB_IFROW サイズ: 860 バイト(x64)
dim st, 215 ; 4byte整数×215(構造体サイズ 860 / 4 切り上げ)
; wszName : WCHAR (+0, 512byte) varptr(st)+0 を基点に操作(512byte:入れ子/配列)
; dwIndex : DWORD (+512, 4byte) st.128 = 値 / 値 = st.128 (lpoke/lpeek も可)
; dwType : DWORD (+516, 4byte) st.129 = 値 / 値 = st.129 (lpoke/lpeek も可)
; dwMtu : DWORD (+520, 4byte) st.130 = 値 / 値 = st.130 (lpoke/lpeek も可)
; dwSpeed : DWORD (+524, 4byte) st.131 = 値 / 値 = st.131 (lpoke/lpeek も可)
; dwPhysAddrLen : DWORD (+528, 4byte) st.132 = 値 / 値 = st.132 (lpoke/lpeek も可)
; bPhysAddr : BYTE (+532, 8byte) varptr(st)+532 を基点に操作(8byte:入れ子/配列)
; dwAdminStatus : DWORD (+540, 4byte) st.135 = 値 / 値 = st.135 (lpoke/lpeek も可)
; dwOperStatus : INTERNAL_IF_OPER_STATUS (+544, 4byte) st.136 = 値 / 値 = st.136 (lpoke/lpeek も可)
; dwLastChange : DWORD (+548, 4byte) st.137 = 値 / 値 = st.137 (lpoke/lpeek も可)
; dwInOctets : DWORD (+552, 4byte) st.138 = 値 / 値 = st.138 (lpoke/lpeek も可)
; dwInUcastPkts : DWORD (+556, 4byte) st.139 = 値 / 値 = st.139 (lpoke/lpeek も可)
; dwInNUcastPkts : DWORD (+560, 4byte) st.140 = 値 / 値 = st.140 (lpoke/lpeek も可)
; dwInDiscards : DWORD (+564, 4byte) st.141 = 値 / 値 = st.141 (lpoke/lpeek も可)
; dwInErrors : DWORD (+568, 4byte) st.142 = 値 / 値 = st.142 (lpoke/lpeek も可)
; dwInUnknownProtos : DWORD (+572, 4byte) st.143 = 値 / 値 = st.143 (lpoke/lpeek も可)
; dwOutOctets : DWORD (+576, 4byte) st.144 = 値 / 値 = st.144 (lpoke/lpeek も可)
; dwOutUcastPkts : DWORD (+580, 4byte) st.145 = 値 / 値 = st.145 (lpoke/lpeek も可)
; dwOutNUcastPkts : DWORD (+584, 4byte) st.146 = 値 / 値 = st.146 (lpoke/lpeek も可)
; dwOutDiscards : DWORD (+588, 4byte) st.147 = 値 / 値 = st.147 (lpoke/lpeek も可)
; dwOutErrors : DWORD (+592, 4byte) st.148 = 値 / 値 = st.148 (lpoke/lpeek も可)
; dwOutQLen : DWORD (+596, 4byte) st.149 = 値 / 値 = st.149 (lpoke/lpeek も可)
; dwDescrLen : DWORD (+600, 4byte) st.150 = 値 / 値 = st.150 (lpoke/lpeek も可)
; bDescr : BYTE (+604, 256byte) varptr(st)+604 を基点に操作(256byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global MIB_IFROW
#field wchar wszName 256
#field int dwIndex
#field int dwType
#field int dwMtu
#field int dwSpeed
#field int dwPhysAddrLen
#field byte bPhysAddr 8
#field int dwAdminStatus
#field int dwOperStatus
#field int dwLastChange
#field int dwInOctets
#field int dwInUcastPkts
#field int dwInNUcastPkts
#field int dwInDiscards
#field int dwInErrors
#field int dwInUnknownProtos
#field int dwOutOctets
#field int dwOutUcastPkts
#field int dwOutNUcastPkts
#field int dwOutDiscards
#field int dwOutErrors
#field int dwOutQLen
#field int dwDescrLen
#field byte bDescr 256
#endstruct
stdim st, MIB_IFROW ; NSTRUCT 変数を確保
st->dwIndex = 100
mes "dwIndex=" + st->dwIndex