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

RSVP_FILTERSPEC_V6_GPI

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

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

フィールド

フィールドサイズx64x86説明
AddressIN_ADDR_IPV616+0+0IPv6アドレスを示すIN_ADDR_IPV6。
GeneralPortIdDWORD4+16+16汎用ポート識別子(GPI)を示す値。

各言語での定義

#include <windows.h>

// IN_ADDR_IPV6  (x64 16 / x86 16 バイト)
typedef struct IN_ADDR_IPV6 {
    BYTE Addr[16];
} IN_ADDR_IPV6;

// RSVP_FILTERSPEC_V6_GPI  (x64 20 / x86 20 バイト)
typedef struct RSVP_FILTERSPEC_V6_GPI {
    IN_ADDR_IPV6 Address;
    DWORD GeneralPortId;
} RSVP_FILTERSPEC_V6_GPI;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct IN_ADDR_IPV6
{
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] Addr;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct RSVP_FILTERSPEC_V6_GPI
{
    public IN_ADDR_IPV6 Address;
    public uint GeneralPortId;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure IN_ADDR_IPV6
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=16)> Public Addr() As Byte
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure RSVP_FILTERSPEC_V6_GPI
    Public Address As IN_ADDR_IPV6
    Public GeneralPortId As UInteger
End Structure
import ctypes
from ctypes import wintypes

class IN_ADDR_IPV6(ctypes.Structure):
    _fields_ = [
        ("Addr", ctypes.c_ubyte * 16),
    ]

class RSVP_FILTERSPEC_V6_GPI(ctypes.Structure):
    _fields_ = [
        ("Address", IN_ADDR_IPV6),
        ("GeneralPortId", wintypes.DWORD),
    ]
#[repr(C)]
pub struct IN_ADDR_IPV6 {
    pub Addr: [u8; 16],
}

#[repr(C)]
pub struct RSVP_FILTERSPEC_V6_GPI {
    pub Address: IN_ADDR_IPV6,
    pub GeneralPortId: u32,
}
import "golang.org/x/sys/windows"

type IN_ADDR_IPV6 struct {
	Addr [16]byte
}

type RSVP_FILTERSPEC_V6_GPI struct {
	Address IN_ADDR_IPV6
	GeneralPortId uint32
}
type
  IN_ADDR_IPV6 = record
    Addr: array[0..15] of Byte;
  end;

  RSVP_FILTERSPEC_V6_GPI = record
    Address: IN_ADDR_IPV6;
    GeneralPortId: DWORD;
  end;
const IN_ADDR_IPV6 = extern struct {
    Addr: [16]u8,
};

const RSVP_FILTERSPEC_V6_GPI = extern struct {
    Address: IN_ADDR_IPV6,
    GeneralPortId: u32,
};
type
  IN_ADDR_IPV6 {.bycopy.} = object
    Addr: array[16, uint8]

  RSVP_FILTERSPEC_V6_GPI {.bycopy.} = object
    Address: IN_ADDR_IPV6
    GeneralPortId: uint32
struct IN_ADDR_IPV6
{
    ubyte[16] Addr;
}

struct RSVP_FILTERSPEC_V6_GPI
{
    IN_ADDR_IPV6 Address;
    uint GeneralPortId;
}

HSP用 定義

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

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

#defstruct global RSVP_FILTERSPEC_V6_GPI
    #field IN_ADDR_IPV6 Address
    #field int GeneralPortId
#endstruct

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