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

RSVP_FILTERSPEC_V6_FLOW

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

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

フィールド

フィールドサイズx64x86説明
AddressIN_ADDR_IPV616+0+0IPv6アドレスを示すIN_ADDR_IPV6。
UnUsedBYTE1+16+16未使用の予約バイト。
FlowLabelBYTE3+17+17IPv6フローラベルを格納するバイト配列の先頭要素。

各言語での定義

#include <windows.h>

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

// RSVP_FILTERSPEC_V6_FLOW  (x64 20 / x86 20 バイト)
typedef struct RSVP_FILTERSPEC_V6_FLOW {
    IN_ADDR_IPV6 Address;
    BYTE UnUsed;
    BYTE FlowLabel[3];
} RSVP_FILTERSPEC_V6_FLOW;
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_FLOW
{
    public IN_ADDR_IPV6 Address;
    public byte UnUsed;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] FlowLabel;
}
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_FLOW
    Public Address As IN_ADDR_IPV6
    Public UnUsed As Byte
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=3)> Public FlowLabel() As Byte
End Structure
import ctypes
from ctypes import wintypes

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

class RSVP_FILTERSPEC_V6_FLOW(ctypes.Structure):
    _fields_ = [
        ("Address", IN_ADDR_IPV6),
        ("UnUsed", ctypes.c_ubyte),
        ("FlowLabel", ctypes.c_ubyte * 3),
    ]
#[repr(C)]
pub struct IN_ADDR_IPV6 {
    pub Addr: [u8; 16],
}

#[repr(C)]
pub struct RSVP_FILTERSPEC_V6_FLOW {
    pub Address: IN_ADDR_IPV6,
    pub UnUsed: u8,
    pub FlowLabel: [u8; 3],
}
import "golang.org/x/sys/windows"

type IN_ADDR_IPV6 struct {
	Addr [16]byte
}

type RSVP_FILTERSPEC_V6_FLOW struct {
	Address IN_ADDR_IPV6
	UnUsed byte
	FlowLabel [3]byte
}
type
  IN_ADDR_IPV6 = record
    Addr: array[0..15] of Byte;
  end;

  RSVP_FILTERSPEC_V6_FLOW = record
    Address: IN_ADDR_IPV6;
    UnUsed: Byte;
    FlowLabel: array[0..2] of Byte;
  end;
const IN_ADDR_IPV6 = extern struct {
    Addr: [16]u8,
};

const RSVP_FILTERSPEC_V6_FLOW = extern struct {
    Address: IN_ADDR_IPV6,
    UnUsed: u8,
    FlowLabel: [3]u8,
};
type
  IN_ADDR_IPV6 {.bycopy.} = object
    Addr: array[16, uint8]

  RSVP_FILTERSPEC_V6_FLOW {.bycopy.} = object
    Address: IN_ADDR_IPV6
    UnUsed: uint8
    FlowLabel: array[3, uint8]
struct IN_ADDR_IPV6
{
    ubyte[16] Addr;
}

struct RSVP_FILTERSPEC_V6_FLOW
{
    IN_ADDR_IPV6 Address;
    ubyte UnUsed;
    ubyte[3] FlowLabel;
}

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_FLOW サイズ: 20 バイト(x64)
dim st, 5    ; 4byte整数×5(構造体サイズ 20 / 4 切り上げ)
; Address : IN_ADDR_IPV6 (+0, 16byte)  varptr(st)+0 を基点に操作(16byte:入れ子/配列)
; UnUsed : BYTE (+16, 1byte)  poke st,16,値  /  値 = peek(st,16)
; FlowLabel : BYTE (+17, 3byte)  varptr(st)+17 を基点に操作(3byte:入れ子/配列)
; ※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_FLOW
    #field IN_ADDR_IPV6 Address
    #field byte UnUsed
    #field byte FlowLabel 3
#endstruct

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