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

MIB_IPMCAST_IF_TABLE

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

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

フィールド

フィールドサイズx64x86説明
dwNumEntriesDWORD4+0+0テーブル内のインターフェイス エントリの数を指定します。
tableMIB_IPMCAST_IF_ENTRY24+4+4インターフェイス エントリのテーブルへのポインターです。このテーブルは MIB_IPMCAST_IF_TABLE 構造体の配列として実装されています。

公式ドキュメント

MIB_IPMCAST_IF_TABLE 構造体は、IP マルチキャスト インターフェイス エントリのテーブルを格納します。

解説(Remarks)

Windows Vista 以降向けにリリースされた Microsoft Windows Software Development Kit (SDK) では、ヘッダー ファイルの構成が変更されています。この構造体は Iprtrmib.h ヘッダー ファイルではなく、Ipmib.h ヘッダー ファイルで定義されています。Ipmib.h ヘッダー ファイルは Iprtrmib.h に自動的にインクルードされ、Iprtrmib.hIphlpapi.h ヘッダー ファイルに自動的にインクルードされます。Ipmib.h および Iprtrmib.h ヘッダー ファイルを直接使用しないでください。

出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)

各言語での定義

#include <windows.h>

// MIB_IPMCAST_IF_ENTRY  (x64 24 / x86 24 バイト)
typedef struct MIB_IPMCAST_IF_ENTRY {
    DWORD dwIfIndex;
    DWORD dwTtl;
    DWORD dwProtocol;
    DWORD dwRateLimit;
    DWORD ulInMcastOctets;
    DWORD ulOutMcastOctets;
} MIB_IPMCAST_IF_ENTRY;

// MIB_IPMCAST_IF_TABLE  (x64 28 / x86 28 バイト)
typedef struct MIB_IPMCAST_IF_TABLE {
    DWORD dwNumEntries;
    MIB_IPMCAST_IF_ENTRY table[1];
} MIB_IPMCAST_IF_TABLE;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct MIB_IPMCAST_IF_ENTRY
{
    public uint dwIfIndex;
    public uint dwTtl;
    public uint dwProtocol;
    public uint dwRateLimit;
    public uint ulInMcastOctets;
    public uint ulOutMcastOctets;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct MIB_IPMCAST_IF_TABLE
{
    public uint dwNumEntries;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public MIB_IPMCAST_IF_ENTRY[] table;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure MIB_IPMCAST_IF_ENTRY
    Public dwIfIndex As UInteger
    Public dwTtl As UInteger
    Public dwProtocol As UInteger
    Public dwRateLimit As UInteger
    Public ulInMcastOctets As UInteger
    Public ulOutMcastOctets As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure MIB_IPMCAST_IF_TABLE
    Public dwNumEntries As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public table() As MIB_IPMCAST_IF_ENTRY
End Structure
import ctypes
from ctypes import wintypes

class MIB_IPMCAST_IF_ENTRY(ctypes.Structure):
    _fields_ = [
        ("dwIfIndex", wintypes.DWORD),
        ("dwTtl", wintypes.DWORD),
        ("dwProtocol", wintypes.DWORD),
        ("dwRateLimit", wintypes.DWORD),
        ("ulInMcastOctets", wintypes.DWORD),
        ("ulOutMcastOctets", wintypes.DWORD),
    ]

class MIB_IPMCAST_IF_TABLE(ctypes.Structure):
    _fields_ = [
        ("dwNumEntries", wintypes.DWORD),
        ("table", MIB_IPMCAST_IF_ENTRY * 1),
    ]
#[repr(C)]
pub struct MIB_IPMCAST_IF_ENTRY {
    pub dwIfIndex: u32,
    pub dwTtl: u32,
    pub dwProtocol: u32,
    pub dwRateLimit: u32,
    pub ulInMcastOctets: u32,
    pub ulOutMcastOctets: u32,
}

#[repr(C)]
pub struct MIB_IPMCAST_IF_TABLE {
    pub dwNumEntries: u32,
    pub table: [MIB_IPMCAST_IF_ENTRY; 1],
}
import "golang.org/x/sys/windows"

type MIB_IPMCAST_IF_ENTRY struct {
	dwIfIndex uint32
	dwTtl uint32
	dwProtocol uint32
	dwRateLimit uint32
	ulInMcastOctets uint32
	ulOutMcastOctets uint32
}

type MIB_IPMCAST_IF_TABLE struct {
	dwNumEntries uint32
	table [1]MIB_IPMCAST_IF_ENTRY
}
type
  MIB_IPMCAST_IF_ENTRY = record
    dwIfIndex: DWORD;
    dwTtl: DWORD;
    dwProtocol: DWORD;
    dwRateLimit: DWORD;
    ulInMcastOctets: DWORD;
    ulOutMcastOctets: DWORD;
  end;

  MIB_IPMCAST_IF_TABLE = record
    dwNumEntries: DWORD;
    table: array[0..0] of MIB_IPMCAST_IF_ENTRY;
  end;
const MIB_IPMCAST_IF_ENTRY = extern struct {
    dwIfIndex: u32,
    dwTtl: u32,
    dwProtocol: u32,
    dwRateLimit: u32,
    ulInMcastOctets: u32,
    ulOutMcastOctets: u32,
};

const MIB_IPMCAST_IF_TABLE = extern struct {
    dwNumEntries: u32,
    table: [1]MIB_IPMCAST_IF_ENTRY,
};
type
  MIB_IPMCAST_IF_ENTRY {.bycopy.} = object
    dwIfIndex: uint32
    dwTtl: uint32
    dwProtocol: uint32
    dwRateLimit: uint32
    ulInMcastOctets: uint32
    ulOutMcastOctets: uint32

  MIB_IPMCAST_IF_TABLE {.bycopy.} = object
    dwNumEntries: uint32
    table: array[1, MIB_IPMCAST_IF_ENTRY]
struct MIB_IPMCAST_IF_ENTRY
{
    uint dwIfIndex;
    uint dwTtl;
    uint dwProtocol;
    uint dwRateLimit;
    uint ulInMcastOctets;
    uint ulOutMcastOctets;
}

struct MIB_IPMCAST_IF_TABLE
{
    uint dwNumEntries;
    MIB_IPMCAST_IF_ENTRY[1] table;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; MIB_IPMCAST_IF_TABLE サイズ: 28 バイト(x64)
dim st, 7    ; 4byte整数×7(構造体サイズ 28 / 4 切り上げ)
; dwNumEntries : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; table : MIB_IPMCAST_IF_ENTRY (+4, 24byte)  varptr(st)+4 を基点に操作(24byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global MIB_IPMCAST_IF_ENTRY
    #field int dwIfIndex
    #field int dwTtl
    #field int dwProtocol
    #field int dwRateLimit
    #field int ulInMcastOctets
    #field int ulOutMcastOctets
#endstruct

#defstruct global MIB_IPMCAST_IF_TABLE
    #field int dwNumEntries
    #field MIB_IPMCAST_IF_ENTRY table 1
#endstruct

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