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

DHCPV6Prefix

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

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

フィールド

フィールドサイズx64x86説明
prefixBYTE16+0+0IPv6プレフィックスの先頭バイト。委任されたプレフィックスの一部を表す。
prefixLengthDWORD4+16+16プレフィックスのビット長を示す。委任プレフィックスのマスク長。
preferredLifeTimeDWORD4+20+20プレフィックスの優先有効期間を秒単位で示す。
validLifeTimeDWORD4+24+24プレフィックスの絶対有効期間を秒単位で示す。
statusStatusCode4+28+28プレフィックス処理の結果を示すStatusCode値。成功/失敗を表す。

各言語での定義

#include <windows.h>

// DHCPV6Prefix  (x64 32 / x86 32 バイト)
typedef struct DHCPV6Prefix {
    BYTE prefix[16];
    DWORD prefixLength;
    DWORD preferredLifeTime;
    DWORD validLifeTime;
    StatusCode status;
} DHCPV6Prefix;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DHCPV6Prefix
{
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] prefix;
    public uint prefixLength;
    public uint preferredLifeTime;
    public uint validLifeTime;
    public int status;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DHCPV6Prefix
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=16)> Public prefix() As Byte
    Public prefixLength As UInteger
    Public preferredLifeTime As UInteger
    Public validLifeTime As UInteger
    Public status As Integer
End Structure
import ctypes
from ctypes import wintypes

class DHCPV6Prefix(ctypes.Structure):
    _fields_ = [
        ("prefix", ctypes.c_ubyte * 16),
        ("prefixLength", wintypes.DWORD),
        ("preferredLifeTime", wintypes.DWORD),
        ("validLifeTime", wintypes.DWORD),
        ("status", ctypes.c_int),
    ]
#[repr(C)]
pub struct DHCPV6Prefix {
    pub prefix: [u8; 16],
    pub prefixLength: u32,
    pub preferredLifeTime: u32,
    pub validLifeTime: u32,
    pub status: i32,
}
import "golang.org/x/sys/windows"

type DHCPV6Prefix struct {
	prefix [16]byte
	prefixLength uint32
	preferredLifeTime uint32
	validLifeTime uint32
	status int32
}
type
  DHCPV6Prefix = record
    prefix: array[0..15] of Byte;
    prefixLength: DWORD;
    preferredLifeTime: DWORD;
    validLifeTime: DWORD;
    status: Integer;
  end;
const DHCPV6Prefix = extern struct {
    prefix: [16]u8,
    prefixLength: u32,
    preferredLifeTime: u32,
    validLifeTime: u32,
    status: i32,
};
type
  DHCPV6Prefix {.bycopy.} = object
    prefix: array[16, uint8]
    prefixLength: uint32
    preferredLifeTime: uint32
    validLifeTime: uint32
    status: int32
struct DHCPV6Prefix
{
    ubyte[16] prefix;
    uint prefixLength;
    uint preferredLifeTime;
    uint validLifeTime;
    int status;
}

HSP用 定義

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

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

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