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

RASPPPIPV6

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

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

フィールド

フィールドサイズx64x86説明
dwSizeDWORD4+0+0この構造体のバイト単位のサイズ。
dwErrorDWORD4+4+4IPv6CPプロトコル制御の結果エラーコード。0なら正常。
bLocalInterfaceIdentifierBYTE8+8+8ローカル側IPv6インターフェイス識別子(8バイト)。
bPeerInterfaceIdentifierBYTE8+16+16ピア側IPv6インターフェイス識別子(8バイト)。
bLocalCompressionProtocolBYTE2+24+24ローカル側の圧縮プロトコル識別バイト(2バイト)。
bPeerCompressionProtocolBYTE2+26+26ピア側の圧縮プロトコル識別バイト(2バイト)。

各言語での定義

#include <windows.h>

// RASPPPIPV6  (x64 28 / x86 28 バイト)
typedef struct RASPPPIPV6 {
    DWORD dwSize;
    DWORD dwError;
    BYTE bLocalInterfaceIdentifier[8];
    BYTE bPeerInterfaceIdentifier[8];
    BYTE bLocalCompressionProtocol[2];
    BYTE bPeerCompressionProtocol[2];
} RASPPPIPV6;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct RASPPPIPV6
{
    public uint dwSize;
    public uint dwError;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] bLocalInterfaceIdentifier;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] bPeerInterfaceIdentifier;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] bLocalCompressionProtocol;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] bPeerCompressionProtocol;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure RASPPPIPV6
    Public dwSize As UInteger
    Public dwError As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=8)> Public bLocalInterfaceIdentifier() As Byte
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=8)> Public bPeerInterfaceIdentifier() As Byte
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=2)> Public bLocalCompressionProtocol() As Byte
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=2)> Public bPeerCompressionProtocol() As Byte
End Structure
import ctypes
from ctypes import wintypes

class RASPPPIPV6(ctypes.Structure):
    _fields_ = [
        ("dwSize", wintypes.DWORD),
        ("dwError", wintypes.DWORD),
        ("bLocalInterfaceIdentifier", ctypes.c_ubyte * 8),
        ("bPeerInterfaceIdentifier", ctypes.c_ubyte * 8),
        ("bLocalCompressionProtocol", ctypes.c_ubyte * 2),
        ("bPeerCompressionProtocol", ctypes.c_ubyte * 2),
    ]
#[repr(C)]
pub struct RASPPPIPV6 {
    pub dwSize: u32,
    pub dwError: u32,
    pub bLocalInterfaceIdentifier: [u8; 8],
    pub bPeerInterfaceIdentifier: [u8; 8],
    pub bLocalCompressionProtocol: [u8; 2],
    pub bPeerCompressionProtocol: [u8; 2],
}
import "golang.org/x/sys/windows"

type RASPPPIPV6 struct {
	dwSize uint32
	dwError uint32
	bLocalInterfaceIdentifier [8]byte
	bPeerInterfaceIdentifier [8]byte
	bLocalCompressionProtocol [2]byte
	bPeerCompressionProtocol [2]byte
}
type
  RASPPPIPV6 = record
    dwSize: DWORD;
    dwError: DWORD;
    bLocalInterfaceIdentifier: array[0..7] of Byte;
    bPeerInterfaceIdentifier: array[0..7] of Byte;
    bLocalCompressionProtocol: array[0..1] of Byte;
    bPeerCompressionProtocol: array[0..1] of Byte;
  end;
const RASPPPIPV6 = extern struct {
    dwSize: u32,
    dwError: u32,
    bLocalInterfaceIdentifier: [8]u8,
    bPeerInterfaceIdentifier: [8]u8,
    bLocalCompressionProtocol: [2]u8,
    bPeerCompressionProtocol: [2]u8,
};
type
  RASPPPIPV6 {.bycopy.} = object
    dwSize: uint32
    dwError: uint32
    bLocalInterfaceIdentifier: array[8, uint8]
    bPeerInterfaceIdentifier: array[8, uint8]
    bLocalCompressionProtocol: array[2, uint8]
    bPeerCompressionProtocol: array[2, uint8]
struct RASPPPIPV6
{
    uint dwSize;
    uint dwError;
    ubyte[8] bLocalInterfaceIdentifier;
    ubyte[8] bPeerInterfaceIdentifier;
    ubyte[2] bLocalCompressionProtocol;
    ubyte[2] bPeerCompressionProtocol;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; RASPPPIPV6 サイズ: 28 バイト(x64)
dim st, 7    ; 4byte整数×7(構造体サイズ 28 / 4 切り上げ)
; dwSize : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; dwError : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; bLocalInterfaceIdentifier : BYTE (+8, 8byte)  varptr(st)+8 を基点に操作(8byte:入れ子/配列)
; bPeerInterfaceIdentifier : BYTE (+16, 8byte)  varptr(st)+16 を基点に操作(8byte:入れ子/配列)
; bLocalCompressionProtocol : BYTE (+24, 2byte)  varptr(st)+24 を基点に操作(2byte:入れ子/配列)
; bPeerCompressionProtocol : BYTE (+26, 2byte)  varptr(st)+26 を基点に操作(2byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global RASPPPIPV6
    #field int dwSize
    #field int dwError
    #field byte bLocalInterfaceIdentifier 8
    #field byte bPeerInterfaceIdentifier 8
    #field byte bLocalCompressionProtocol 2
    #field byte bPeerCompressionProtocol 2
#endstruct

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