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

PPP_IPV6_CP_INFO

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

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

フィールド

フィールドサイズx64x86説明
dwVersionDWORD4+0+0構造体のバージョン番号。
dwSizeDWORD4+4+4この構造体のバイト単位のサイズ。
dwErrorDWORD4+8+8IPv6制御プロトコルのエラーコード。0なら正常。
bInterfaceIdentifierBYTE8+12+12ローカルのIPv6インターフェイス識別子(8バイト)。
bRemoteInterfaceIdentifierBYTE8+20+20リモートのIPv6インターフェイス識別子(8バイト)。
dwOptionsDWORD4+28+28ローカルのIPv6CPオプションフラグ。
dwRemoteOptionsDWORD4+32+32リモートのIPv6CPオプションフラグ。
bPrefixBYTE8+36+36割り当てられたIPv6プレフィックス(8バイト)。
dwPrefixLengthDWORD4+44+44IPv6プレフィックスの長さ(ビット数)。

各言語での定義

#include <windows.h>

// PPP_IPV6_CP_INFO  (x64 48 / x86 48 バイト)
typedef struct PPP_IPV6_CP_INFO {
    DWORD dwVersion;
    DWORD dwSize;
    DWORD dwError;
    BYTE bInterfaceIdentifier[8];
    BYTE bRemoteInterfaceIdentifier[8];
    DWORD dwOptions;
    DWORD dwRemoteOptions;
    BYTE bPrefix[8];
    DWORD dwPrefixLength;
} PPP_IPV6_CP_INFO;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct PPP_IPV6_CP_INFO
{
    public uint dwVersion;
    public uint dwSize;
    public uint dwError;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] bInterfaceIdentifier;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] bRemoteInterfaceIdentifier;
    public uint dwOptions;
    public uint dwRemoteOptions;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] bPrefix;
    public uint dwPrefixLength;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure PPP_IPV6_CP_INFO
    Public dwVersion As UInteger
    Public dwSize As UInteger
    Public dwError As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=8)> Public bInterfaceIdentifier() As Byte
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=8)> Public bRemoteInterfaceIdentifier() As Byte
    Public dwOptions As UInteger
    Public dwRemoteOptions As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=8)> Public bPrefix() As Byte
    Public dwPrefixLength As UInteger
End Structure
import ctypes
from ctypes import wintypes

class PPP_IPV6_CP_INFO(ctypes.Structure):
    _fields_ = [
        ("dwVersion", wintypes.DWORD),
        ("dwSize", wintypes.DWORD),
        ("dwError", wintypes.DWORD),
        ("bInterfaceIdentifier", ctypes.c_ubyte * 8),
        ("bRemoteInterfaceIdentifier", ctypes.c_ubyte * 8),
        ("dwOptions", wintypes.DWORD),
        ("dwRemoteOptions", wintypes.DWORD),
        ("bPrefix", ctypes.c_ubyte * 8),
        ("dwPrefixLength", wintypes.DWORD),
    ]
#[repr(C)]
pub struct PPP_IPV6_CP_INFO {
    pub dwVersion: u32,
    pub dwSize: u32,
    pub dwError: u32,
    pub bInterfaceIdentifier: [u8; 8],
    pub bRemoteInterfaceIdentifier: [u8; 8],
    pub dwOptions: u32,
    pub dwRemoteOptions: u32,
    pub bPrefix: [u8; 8],
    pub dwPrefixLength: u32,
}
import "golang.org/x/sys/windows"

type PPP_IPV6_CP_INFO struct {
	dwVersion uint32
	dwSize uint32
	dwError uint32
	bInterfaceIdentifier [8]byte
	bRemoteInterfaceIdentifier [8]byte
	dwOptions uint32
	dwRemoteOptions uint32
	bPrefix [8]byte
	dwPrefixLength uint32
}
type
  PPP_IPV6_CP_INFO = record
    dwVersion: DWORD;
    dwSize: DWORD;
    dwError: DWORD;
    bInterfaceIdentifier: array[0..7] of Byte;
    bRemoteInterfaceIdentifier: array[0..7] of Byte;
    dwOptions: DWORD;
    dwRemoteOptions: DWORD;
    bPrefix: array[0..7] of Byte;
    dwPrefixLength: DWORD;
  end;
const PPP_IPV6_CP_INFO = extern struct {
    dwVersion: u32,
    dwSize: u32,
    dwError: u32,
    bInterfaceIdentifier: [8]u8,
    bRemoteInterfaceIdentifier: [8]u8,
    dwOptions: u32,
    dwRemoteOptions: u32,
    bPrefix: [8]u8,
    dwPrefixLength: u32,
};
type
  PPP_IPV6_CP_INFO {.bycopy.} = object
    dwVersion: uint32
    dwSize: uint32
    dwError: uint32
    bInterfaceIdentifier: array[8, uint8]
    bRemoteInterfaceIdentifier: array[8, uint8]
    dwOptions: uint32
    dwRemoteOptions: uint32
    bPrefix: array[8, uint8]
    dwPrefixLength: uint32
struct PPP_IPV6_CP_INFO
{
    uint dwVersion;
    uint dwSize;
    uint dwError;
    ubyte[8] bInterfaceIdentifier;
    ubyte[8] bRemoteInterfaceIdentifier;
    uint dwOptions;
    uint dwRemoteOptions;
    ubyte[8] bPrefix;
    uint dwPrefixLength;
}

HSP用 定義

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

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

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