ホーム › NetworkManagement.Dhcp › DHCP_SERVER_OPTIONS
DHCP_SERVER_OPTIONS
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| MessageType | BYTE* | 8/4 | +0 | +0 | DHCPメッセージタイプ(オプション53)の値を指すポインタ。NULL可。 |
| SubnetMask | DWORD* | 8/4 | +8 | +4 | サブネットマスク(オプション1)の値を指すポインタ。NULL可。 |
| RequestedAddress | DWORD* | 8/4 | +16 | +8 | クライアントが要求するIPアドレス(オプション50)を指すポインタ。NULL可。 |
| RequestLeaseTime | DWORD* | 8/4 | +24 | +12 | 要求するリース時間(オプション51)を秒単位で指すポインタ。NULL可。 |
| OverlayFields | BYTE* | 8/4 | +32 | +16 | オーバーレイフィールド(オプション52)を指すポインタ。sname/fileの再利用を表す。NULL可。 |
| RouterAddress | DWORD* | 8/4 | +40 | +20 | デフォルトゲートウェイ(オプション3)のアドレスを指すポインタ。NULL可。 |
| Server | DWORD* | 8/4 | +48 | +24 | DHCPサーバー識別子(オプション54)を指すポインタ。NULL可。 |
| ParameterRequestList | BYTE* | 8/4 | +56 | +28 | クライアントの要求パラメータ一覧(オプション55)を指すポインタ。NULL可。 |
| ParameterRequestListLength | DWORD | 4 | +64 | +32 | ParameterRequestListのバイト数を示す。 |
| MachineName | LPSTR | 8/4 | +72 | +36 | クライアントのホスト名(オプション12)を示すANSI文字列。NULL可。 |
| MachineNameLength | DWORD | 4 | +80 | +40 | MachineNameの長さをバイト単位で示す。 |
| ClientHardwareAddressType | BYTE | 1 | +84 | +44 | クライアントハードウェアアドレスの種別(htype)を示す。 |
| ClientHardwareAddressLength | BYTE | 1 | +85 | +45 | クライアントハードウェアアドレスのバイト長を示す。 |
| ClientHardwareAddress | BYTE* | 8/4 | +88 | +48 | クライアントのMACアドレス等のバイト列を指すポインタ。NULL可。 |
| ClassIdentifier | LPSTR | 8/4 | +96 | +52 | ベンダークラス識別子(オプション60)を示すANSI文字列。NULL可。 |
| ClassIdentifierLength | DWORD | 4 | +104 | +56 | ClassIdentifierの長さをバイト単位で示す。 |
| VendorClass | BYTE* | 8/4 | +112 | +60 | ベンダー固有情報のバイト列を指すポインタ。NULL可。 |
| VendorClassLength | DWORD | 4 | +120 | +64 | VendorClassのバイト数を示す。 |
| DNSFlags | DWORD | 4 | +124 | +68 | 動的DNS登録に関する制御フラグを示す。 |
| DNSNameLength | DWORD | 4 | +128 | +72 | DNSNameの長さをバイト単位で示す。 |
| DNSName | BYTE* | 8/4 | +136 | +76 | 登録対象のDNS名を保持するバイト列を指すポインタ。NULL可。 |
| DSDomainNameRequested | BOOLEAN | 1 | +144 | +80 | ディレクトリサービスのドメイン名が要求されたかを示すブール値。 |
| DSDomainName | LPSTR | 8/4 | +152 | +84 | ディレクトリサービスのドメイン名を示すANSI文字列。NULL可。 |
| DSDomainNameLen | DWORD | 4 | +160 | +88 | DSDomainNameの長さをバイト単位で示す。 |
| ScopeId | DWORD* | 8/4 | +168 | +92 | オプション適用対象のスコープIDを指すポインタ。NULL可。 |
各言語での定義
#include <windows.h>
// DHCP_SERVER_OPTIONS (x64 176 / x86 96 バイト)
typedef struct DHCP_SERVER_OPTIONS {
BYTE* MessageType;
DWORD* SubnetMask;
DWORD* RequestedAddress;
DWORD* RequestLeaseTime;
BYTE* OverlayFields;
DWORD* RouterAddress;
DWORD* Server;
BYTE* ParameterRequestList;
DWORD ParameterRequestListLength;
LPSTR MachineName;
DWORD MachineNameLength;
BYTE ClientHardwareAddressType;
BYTE ClientHardwareAddressLength;
BYTE* ClientHardwareAddress;
LPSTR ClassIdentifier;
DWORD ClassIdentifierLength;
BYTE* VendorClass;
DWORD VendorClassLength;
DWORD DNSFlags;
DWORD DNSNameLength;
BYTE* DNSName;
BOOLEAN DSDomainNameRequested;
LPSTR DSDomainName;
DWORD DSDomainNameLen;
DWORD* ScopeId;
} DHCP_SERVER_OPTIONS;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DHCP_SERVER_OPTIONS
{
public IntPtr MessageType;
public IntPtr SubnetMask;
public IntPtr RequestedAddress;
public IntPtr RequestLeaseTime;
public IntPtr OverlayFields;
public IntPtr RouterAddress;
public IntPtr Server;
public IntPtr ParameterRequestList;
public uint ParameterRequestListLength;
public IntPtr MachineName;
public uint MachineNameLength;
public byte ClientHardwareAddressType;
public byte ClientHardwareAddressLength;
public IntPtr ClientHardwareAddress;
public IntPtr ClassIdentifier;
public uint ClassIdentifierLength;
public IntPtr VendorClass;
public uint VendorClassLength;
public uint DNSFlags;
public uint DNSNameLength;
public IntPtr DNSName;
[MarshalAs(UnmanagedType.U1)] public bool DSDomainNameRequested;
public IntPtr DSDomainName;
public uint DSDomainNameLen;
public IntPtr ScopeId;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DHCP_SERVER_OPTIONS
Public MessageType As IntPtr
Public SubnetMask As IntPtr
Public RequestedAddress As IntPtr
Public RequestLeaseTime As IntPtr
Public OverlayFields As IntPtr
Public RouterAddress As IntPtr
Public Server As IntPtr
Public ParameterRequestList As IntPtr
Public ParameterRequestListLength As UInteger
Public MachineName As IntPtr
Public MachineNameLength As UInteger
Public ClientHardwareAddressType As Byte
Public ClientHardwareAddressLength As Byte
Public ClientHardwareAddress As IntPtr
Public ClassIdentifier As IntPtr
Public ClassIdentifierLength As UInteger
Public VendorClass As IntPtr
Public VendorClassLength As UInteger
Public DNSFlags As UInteger
Public DNSNameLength As UInteger
Public DNSName As IntPtr
<MarshalAs(UnmanagedType.U1)> Public DSDomainNameRequested As Boolean
Public DSDomainName As IntPtr
Public DSDomainNameLen As UInteger
Public ScopeId As IntPtr
End Structureimport ctypes
from ctypes import wintypes
class DHCP_SERVER_OPTIONS(ctypes.Structure):
_fields_ = [
("MessageType", ctypes.c_void_p),
("SubnetMask", ctypes.c_void_p),
("RequestedAddress", ctypes.c_void_p),
("RequestLeaseTime", ctypes.c_void_p),
("OverlayFields", ctypes.c_void_p),
("RouterAddress", ctypes.c_void_p),
("Server", ctypes.c_void_p),
("ParameterRequestList", ctypes.c_void_p),
("ParameterRequestListLength", wintypes.DWORD),
("MachineName", ctypes.c_void_p),
("MachineNameLength", wintypes.DWORD),
("ClientHardwareAddressType", ctypes.c_ubyte),
("ClientHardwareAddressLength", ctypes.c_ubyte),
("ClientHardwareAddress", ctypes.c_void_p),
("ClassIdentifier", ctypes.c_void_p),
("ClassIdentifierLength", wintypes.DWORD),
("VendorClass", ctypes.c_void_p),
("VendorClassLength", wintypes.DWORD),
("DNSFlags", wintypes.DWORD),
("DNSNameLength", wintypes.DWORD),
("DNSName", ctypes.c_void_p),
("DSDomainNameRequested", ctypes.c_byte),
("DSDomainName", ctypes.c_void_p),
("DSDomainNameLen", wintypes.DWORD),
("ScopeId", ctypes.c_void_p),
]#[repr(C)]
pub struct DHCP_SERVER_OPTIONS {
pub MessageType: *mut core::ffi::c_void,
pub SubnetMask: *mut core::ffi::c_void,
pub RequestedAddress: *mut core::ffi::c_void,
pub RequestLeaseTime: *mut core::ffi::c_void,
pub OverlayFields: *mut core::ffi::c_void,
pub RouterAddress: *mut core::ffi::c_void,
pub Server: *mut core::ffi::c_void,
pub ParameterRequestList: *mut core::ffi::c_void,
pub ParameterRequestListLength: u32,
pub MachineName: *mut core::ffi::c_void,
pub MachineNameLength: u32,
pub ClientHardwareAddressType: u8,
pub ClientHardwareAddressLength: u8,
pub ClientHardwareAddress: *mut core::ffi::c_void,
pub ClassIdentifier: *mut core::ffi::c_void,
pub ClassIdentifierLength: u32,
pub VendorClass: *mut core::ffi::c_void,
pub VendorClassLength: u32,
pub DNSFlags: u32,
pub DNSNameLength: u32,
pub DNSName: *mut core::ffi::c_void,
pub DSDomainNameRequested: u8,
pub DSDomainName: *mut core::ffi::c_void,
pub DSDomainNameLen: u32,
pub ScopeId: *mut core::ffi::c_void,
}import "golang.org/x/sys/windows"
type DHCP_SERVER_OPTIONS struct {
MessageType uintptr
SubnetMask uintptr
RequestedAddress uintptr
RequestLeaseTime uintptr
OverlayFields uintptr
RouterAddress uintptr
Server uintptr
ParameterRequestList uintptr
ParameterRequestListLength uint32
MachineName uintptr
MachineNameLength uint32
ClientHardwareAddressType byte
ClientHardwareAddressLength byte
ClientHardwareAddress uintptr
ClassIdentifier uintptr
ClassIdentifierLength uint32
VendorClass uintptr
VendorClassLength uint32
DNSFlags uint32
DNSNameLength uint32
DNSName uintptr
DSDomainNameRequested byte
DSDomainName uintptr
DSDomainNameLen uint32
ScopeId uintptr
}type
DHCP_SERVER_OPTIONS = record
MessageType: Pointer;
SubnetMask: Pointer;
RequestedAddress: Pointer;
RequestLeaseTime: Pointer;
OverlayFields: Pointer;
RouterAddress: Pointer;
Server: Pointer;
ParameterRequestList: Pointer;
ParameterRequestListLength: DWORD;
MachineName: Pointer;
MachineNameLength: DWORD;
ClientHardwareAddressType: Byte;
ClientHardwareAddressLength: Byte;
ClientHardwareAddress: Pointer;
ClassIdentifier: Pointer;
ClassIdentifierLength: DWORD;
VendorClass: Pointer;
VendorClassLength: DWORD;
DNSFlags: DWORD;
DNSNameLength: DWORD;
DNSName: Pointer;
DSDomainNameRequested: ByteBool;
DSDomainName: Pointer;
DSDomainNameLen: DWORD;
ScopeId: Pointer;
end;const DHCP_SERVER_OPTIONS = extern struct {
MessageType: ?*anyopaque,
SubnetMask: ?*anyopaque,
RequestedAddress: ?*anyopaque,
RequestLeaseTime: ?*anyopaque,
OverlayFields: ?*anyopaque,
RouterAddress: ?*anyopaque,
Server: ?*anyopaque,
ParameterRequestList: ?*anyopaque,
ParameterRequestListLength: u32,
MachineName: ?*anyopaque,
MachineNameLength: u32,
ClientHardwareAddressType: u8,
ClientHardwareAddressLength: u8,
ClientHardwareAddress: ?*anyopaque,
ClassIdentifier: ?*anyopaque,
ClassIdentifierLength: u32,
VendorClass: ?*anyopaque,
VendorClassLength: u32,
DNSFlags: u32,
DNSNameLength: u32,
DNSName: ?*anyopaque,
DSDomainNameRequested: u8,
DSDomainName: ?*anyopaque,
DSDomainNameLen: u32,
ScopeId: ?*anyopaque,
};type
DHCP_SERVER_OPTIONS {.bycopy.} = object
MessageType: pointer
SubnetMask: pointer
RequestedAddress: pointer
RequestLeaseTime: pointer
OverlayFields: pointer
RouterAddress: pointer
Server: pointer
ParameterRequestList: pointer
ParameterRequestListLength: uint32
MachineName: pointer
MachineNameLength: uint32
ClientHardwareAddressType: uint8
ClientHardwareAddressLength: uint8
ClientHardwareAddress: pointer
ClassIdentifier: pointer
ClassIdentifierLength: uint32
VendorClass: pointer
VendorClassLength: uint32
DNSFlags: uint32
DNSNameLength: uint32
DNSName: pointer
DSDomainNameRequested: uint8
DSDomainName: pointer
DSDomainNameLen: uint32
ScopeId: pointerstruct DHCP_SERVER_OPTIONS
{
void* MessageType;
void* SubnetMask;
void* RequestedAddress;
void* RequestLeaseTime;
void* OverlayFields;
void* RouterAddress;
void* Server;
void* ParameterRequestList;
uint ParameterRequestListLength;
void* MachineName;
uint MachineNameLength;
ubyte ClientHardwareAddressType;
ubyte ClientHardwareAddressLength;
void* ClientHardwareAddress;
void* ClassIdentifier;
uint ClassIdentifierLength;
void* VendorClass;
uint VendorClassLength;
uint DNSFlags;
uint DNSNameLength;
void* DNSName;
ubyte DSDomainNameRequested;
void* DSDomainName;
uint DSDomainNameLen;
void* ScopeId;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; DHCP_SERVER_OPTIONS サイズ: 96 バイト(x86)
dim st, 24 ; 4byte整数×24(構造体サイズ 96 / 4 切り上げ)
; MessageType : BYTE* (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; SubnetMask : DWORD* (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; RequestedAddress : DWORD* (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; RequestLeaseTime : DWORD* (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; OverlayFields : BYTE* (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; RouterAddress : DWORD* (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; Server : DWORD* (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; ParameterRequestList : BYTE* (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; ParameterRequestListLength : DWORD (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; MachineName : LPSTR (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; MachineNameLength : DWORD (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; ClientHardwareAddressType : BYTE (+44, 1byte) poke st,44,値 / 値 = peek(st,44)
; ClientHardwareAddressLength : BYTE (+45, 1byte) poke st,45,値 / 値 = peek(st,45)
; ClientHardwareAddress : BYTE* (+48, 4byte) st.12 = 値 / 値 = st.12 (lpoke/lpeek も可)
; ClassIdentifier : LPSTR (+52, 4byte) st.13 = 値 / 値 = st.13 (lpoke/lpeek も可)
; ClassIdentifierLength : DWORD (+56, 4byte) st.14 = 値 / 値 = st.14 (lpoke/lpeek も可)
; VendorClass : BYTE* (+60, 4byte) st.15 = 値 / 値 = st.15 (lpoke/lpeek も可)
; VendorClassLength : DWORD (+64, 4byte) st.16 = 値 / 値 = st.16 (lpoke/lpeek も可)
; DNSFlags : DWORD (+68, 4byte) st.17 = 値 / 値 = st.17 (lpoke/lpeek も可)
; DNSNameLength : DWORD (+72, 4byte) st.18 = 値 / 値 = st.18 (lpoke/lpeek も可)
; DNSName : BYTE* (+76, 4byte) st.19 = 値 / 値 = st.19 (lpoke/lpeek も可)
; DSDomainNameRequested : BOOLEAN (+80, 1byte) poke st,80,値 / 値 = peek(st,80)
; DSDomainName : LPSTR (+84, 4byte) st.21 = 値 / 値 = st.21 (lpoke/lpeek も可)
; DSDomainNameLen : DWORD (+88, 4byte) st.22 = 値 / 値 = st.22 (lpoke/lpeek も可)
; ScopeId : DWORD* (+92, 4byte) st.23 = 値 / 値 = st.23 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DHCP_SERVER_OPTIONS サイズ: 176 バイト(x64)
dim st, 44 ; 4byte整数×44(構造体サイズ 176 / 4 切り上げ)
; MessageType : BYTE* (+0, 8byte) qpoke st,0,値 / qpeek(st,0) ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; SubnetMask : DWORD* (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; RequestedAddress : DWORD* (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; RequestLeaseTime : DWORD* (+24, 8byte) qpoke st,24,値 / qpeek(st,24) ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; OverlayFields : BYTE* (+32, 8byte) qpoke st,32,値 / qpeek(st,32) ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; RouterAddress : DWORD* (+40, 8byte) qpoke st,40,値 / qpeek(st,40) ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; Server : DWORD* (+48, 8byte) qpoke st,48,値 / qpeek(st,48) ※IronHSPのみ。3.7/3.8は lpoke st,48,下位 : lpoke st,52,上位
; ParameterRequestList : BYTE* (+56, 8byte) qpoke st,56,値 / qpeek(st,56) ※IronHSPのみ。3.7/3.8は lpoke st,56,下位 : lpoke st,60,上位
; ParameterRequestListLength : DWORD (+64, 4byte) st.16 = 値 / 値 = st.16 (lpoke/lpeek も可)
; MachineName : LPSTR (+72, 8byte) qpoke st,72,値 / qpeek(st,72) ※IronHSPのみ。3.7/3.8は lpoke st,72,下位 : lpoke st,76,上位
; MachineNameLength : DWORD (+80, 4byte) st.20 = 値 / 値 = st.20 (lpoke/lpeek も可)
; ClientHardwareAddressType : BYTE (+84, 1byte) poke st,84,値 / 値 = peek(st,84)
; ClientHardwareAddressLength : BYTE (+85, 1byte) poke st,85,値 / 値 = peek(st,85)
; ClientHardwareAddress : BYTE* (+88, 8byte) qpoke st,88,値 / qpeek(st,88) ※IronHSPのみ。3.7/3.8は lpoke st,88,下位 : lpoke st,92,上位
; ClassIdentifier : LPSTR (+96, 8byte) qpoke st,96,値 / qpeek(st,96) ※IronHSPのみ。3.7/3.8は lpoke st,96,下位 : lpoke st,100,上位
; ClassIdentifierLength : DWORD (+104, 4byte) st.26 = 値 / 値 = st.26 (lpoke/lpeek も可)
; VendorClass : BYTE* (+112, 8byte) qpoke st,112,値 / qpeek(st,112) ※IronHSPのみ。3.7/3.8は lpoke st,112,下位 : lpoke st,116,上位
; VendorClassLength : DWORD (+120, 4byte) st.30 = 値 / 値 = st.30 (lpoke/lpeek も可)
; DNSFlags : DWORD (+124, 4byte) st.31 = 値 / 値 = st.31 (lpoke/lpeek も可)
; DNSNameLength : DWORD (+128, 4byte) st.32 = 値 / 値 = st.32 (lpoke/lpeek も可)
; DNSName : BYTE* (+136, 8byte) qpoke st,136,値 / qpeek(st,136) ※IronHSPのみ。3.7/3.8は lpoke st,136,下位 : lpoke st,140,上位
; DSDomainNameRequested : BOOLEAN (+144, 1byte) poke st,144,値 / 値 = peek(st,144)
; DSDomainName : LPSTR (+152, 8byte) qpoke st,152,値 / qpeek(st,152) ※IronHSPのみ。3.7/3.8は lpoke st,152,下位 : lpoke st,156,上位
; DSDomainNameLen : DWORD (+160, 4byte) st.40 = 値 / 値 = st.40 (lpoke/lpeek も可)
; ScopeId : DWORD* (+168, 8byte) qpoke st,168,値 / qpeek(st,168) ※IronHSPのみ。3.7/3.8は lpoke st,168,下位 : lpoke st,172,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DHCP_SERVER_OPTIONS
#field intptr MessageType
#field intptr SubnetMask
#field intptr RequestedAddress
#field intptr RequestLeaseTime
#field intptr OverlayFields
#field intptr RouterAddress
#field intptr Server
#field intptr ParameterRequestList
#field int ParameterRequestListLength
#field intptr MachineName
#field int MachineNameLength
#field byte ClientHardwareAddressType
#field byte ClientHardwareAddressLength
#field intptr ClientHardwareAddress
#field intptr ClassIdentifier
#field int ClassIdentifierLength
#field intptr VendorClass
#field int VendorClassLength
#field int DNSFlags
#field int DNSNameLength
#field intptr DNSName
#field bool1 DSDomainNameRequested
#field intptr DSDomainName
#field int DSDomainNameLen
#field intptr ScopeId
#endstruct
stdim st, DHCP_SERVER_OPTIONS ; NSTRUCT 変数を確保
st->ParameterRequestListLength = 100
mes "ParameterRequestListLength=" + st->ParameterRequestListLength