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

DHCP_FAILOVER_RELATIONSHIP

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

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

フィールド

フィールドサイズx64x86説明
PrimaryServerDWORD4+0+0プライマリ サーバーの IP アドレスを格納する DHCP_IP_ADDRESS 構造体です。
SecondaryServerDWORD4+4+4セカンダリ サーバーの IP アドレスを格納する DHCP_IP_ADDRESS 構造体です。
ModeDHCP_FAILOVER_MODE4+8+8フェールオーバー リレーションシップのモードを指定する DHCP_FAILOVER_MODE 列挙型です。
ServerTypeDHCP_FAILOVER_SERVER4+12+12フェールオーバー リレーションシップにおいて、そのサーバーがプライマリ サーバーであるかセカンダリ サーバーであるかを指定する DHCP_FAILOVER_SERVER 列挙型です
StateFSM_STATE4+16+16フェールオーバー リレーションシップの状態を指定する FSM_STATE 列挙型です。
PrevStateFSM_STATE4+20+20フェールオーバー リレーションシップの直前の状態を指定する FSM_STATE 列挙型です。
McltDWORD4+24+24最大クライアント リード タイム (MCLT) を秒単位で指定する値です。MCLT は、パートナー サーバーが認識しているリース時間を超えて、一方のサーバーがクライアントのリースを延長できる最大時間です。
SafePeriodDWORD4+28+28サーバーが COMMUNICATION-INT 状態から PARTNER-DOWN 状態へ遷移するまでに待機する時間 (秒単位) です。このタイマーは、サーバーが COMMUNICATION-INT 状態に入った時点で開始されます。
RelationshipNameLPWSTR8/4+32+32一意のフェールオーバー リレーションシップ名を表す、null で終わる Unicode 文字列へのポインターです。
PrimaryServerNameLPWSTR8/4+40+36プライマリ サーバーのホスト名を表す、null で終わる Unicode 文字列へのポインターです。
SecondaryServerNameLPWSTR8/4+48+40セカンダリ サーバーのホスト名を表す、null で終わる Unicode 文字列へのポインターです。
pScopesDHCP_IP_ARRAY*8/4+56+44フェールオーバー リレーションシップに含まれ、そのスコープを定義する IPv4 サブネット アドレスの一覧を格納する LPDHCP_IP_ARRAY 構造体へのポインターです。
PercentageBYTE1+64+48フェールオーバー リレーションシップにおいて、プライマリ サーバーが分担するクライアント負荷の割合を指定する値です。
SharedSecretLPWSTR8/4+72+52フェールオーバー リレーションシップに関連付けられた共有シークレット キーを表す、null で終わる Unicode 文字列へのポインターです。

公式ドキュメント

DHCP_FAILOVER_RELATIONSHIP 構造体は、DHCPv4 サーバーのフェールオーバー リレーションシップに関する情報を定義します。

出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)

各言語での定義

#include <windows.h>

// DHCP_FAILOVER_RELATIONSHIP  (x64 80 / x86 56 バイト)
typedef struct DHCP_FAILOVER_RELATIONSHIP {
    DWORD PrimaryServer;
    DWORD SecondaryServer;
    DHCP_FAILOVER_MODE Mode;
    DHCP_FAILOVER_SERVER ServerType;
    FSM_STATE State;
    FSM_STATE PrevState;
    DWORD Mclt;
    DWORD SafePeriod;
    LPWSTR RelationshipName;
    LPWSTR PrimaryServerName;
    LPWSTR SecondaryServerName;
    DHCP_IP_ARRAY* pScopes;
    BYTE Percentage;
    LPWSTR SharedSecret;
} DHCP_FAILOVER_RELATIONSHIP;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DHCP_FAILOVER_RELATIONSHIP
{
    public uint PrimaryServer;
    public uint SecondaryServer;
    public int Mode;
    public int ServerType;
    public int State;
    public int PrevState;
    public uint Mclt;
    public uint SafePeriod;
    public IntPtr RelationshipName;
    public IntPtr PrimaryServerName;
    public IntPtr SecondaryServerName;
    public IntPtr pScopes;
    public byte Percentage;
    public IntPtr SharedSecret;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DHCP_FAILOVER_RELATIONSHIP
    Public PrimaryServer As UInteger
    Public SecondaryServer As UInteger
    Public Mode As Integer
    Public ServerType As Integer
    Public State As Integer
    Public PrevState As Integer
    Public Mclt As UInteger
    Public SafePeriod As UInteger
    Public RelationshipName As IntPtr
    Public PrimaryServerName As IntPtr
    Public SecondaryServerName As IntPtr
    Public pScopes As IntPtr
    Public Percentage As Byte
    Public SharedSecret As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class DHCP_FAILOVER_RELATIONSHIP(ctypes.Structure):
    _fields_ = [
        ("PrimaryServer", wintypes.DWORD),
        ("SecondaryServer", wintypes.DWORD),
        ("Mode", ctypes.c_int),
        ("ServerType", ctypes.c_int),
        ("State", ctypes.c_int),
        ("PrevState", ctypes.c_int),
        ("Mclt", wintypes.DWORD),
        ("SafePeriod", wintypes.DWORD),
        ("RelationshipName", ctypes.c_void_p),
        ("PrimaryServerName", ctypes.c_void_p),
        ("SecondaryServerName", ctypes.c_void_p),
        ("pScopes", ctypes.c_void_p),
        ("Percentage", ctypes.c_ubyte),
        ("SharedSecret", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct DHCP_FAILOVER_RELATIONSHIP {
    pub PrimaryServer: u32,
    pub SecondaryServer: u32,
    pub Mode: i32,
    pub ServerType: i32,
    pub State: i32,
    pub PrevState: i32,
    pub Mclt: u32,
    pub SafePeriod: u32,
    pub RelationshipName: *mut core::ffi::c_void,
    pub PrimaryServerName: *mut core::ffi::c_void,
    pub SecondaryServerName: *mut core::ffi::c_void,
    pub pScopes: *mut core::ffi::c_void,
    pub Percentage: u8,
    pub SharedSecret: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type DHCP_FAILOVER_RELATIONSHIP struct {
	PrimaryServer uint32
	SecondaryServer uint32
	Mode int32
	ServerType int32
	State int32
	PrevState int32
	Mclt uint32
	SafePeriod uint32
	RelationshipName uintptr
	PrimaryServerName uintptr
	SecondaryServerName uintptr
	pScopes uintptr
	Percentage byte
	SharedSecret uintptr
}
type
  DHCP_FAILOVER_RELATIONSHIP = record
    PrimaryServer: DWORD;
    SecondaryServer: DWORD;
    Mode: Integer;
    ServerType: Integer;
    State: Integer;
    PrevState: Integer;
    Mclt: DWORD;
    SafePeriod: DWORD;
    RelationshipName: Pointer;
    PrimaryServerName: Pointer;
    SecondaryServerName: Pointer;
    pScopes: Pointer;
    Percentage: Byte;
    SharedSecret: Pointer;
  end;
const DHCP_FAILOVER_RELATIONSHIP = extern struct {
    PrimaryServer: u32,
    SecondaryServer: u32,
    Mode: i32,
    ServerType: i32,
    State: i32,
    PrevState: i32,
    Mclt: u32,
    SafePeriod: u32,
    RelationshipName: ?*anyopaque,
    PrimaryServerName: ?*anyopaque,
    SecondaryServerName: ?*anyopaque,
    pScopes: ?*anyopaque,
    Percentage: u8,
    SharedSecret: ?*anyopaque,
};
type
  DHCP_FAILOVER_RELATIONSHIP {.bycopy.} = object
    PrimaryServer: uint32
    SecondaryServer: uint32
    Mode: int32
    ServerType: int32
    State: int32
    PrevState: int32
    Mclt: uint32
    SafePeriod: uint32
    RelationshipName: pointer
    PrimaryServerName: pointer
    SecondaryServerName: pointer
    pScopes: pointer
    Percentage: uint8
    SharedSecret: pointer
struct DHCP_FAILOVER_RELATIONSHIP
{
    uint PrimaryServer;
    uint SecondaryServer;
    int Mode;
    int ServerType;
    int State;
    int PrevState;
    uint Mclt;
    uint SafePeriod;
    void* RelationshipName;
    void* PrimaryServerName;
    void* SecondaryServerName;
    void* pScopes;
    ubyte Percentage;
    void* SharedSecret;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; DHCP_FAILOVER_RELATIONSHIP サイズ: 56 バイト(x86)
dim st, 14    ; 4byte整数×14(構造体サイズ 56 / 4 切り上げ)
; PrimaryServer : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; SecondaryServer : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; Mode : DHCP_FAILOVER_MODE (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; ServerType : DHCP_FAILOVER_SERVER (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; State : FSM_STATE (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; PrevState : FSM_STATE (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; Mclt : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; SafePeriod : DWORD (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; RelationshipName : LPWSTR (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; PrimaryServerName : LPWSTR (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; SecondaryServerName : LPWSTR (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; pScopes : DHCP_IP_ARRAY* (+44, 4byte)  varptr(st)+44 を基点に操作(4byte:入れ子/配列)
; Percentage : BYTE (+48, 1byte)  poke st,48,値  /  値 = peek(st,48)
; SharedSecret : LPWSTR (+52, 4byte)  st.13 = 値  /  値 = st.13   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DHCP_FAILOVER_RELATIONSHIP サイズ: 80 バイト(x64)
dim st, 20    ; 4byte整数×20(構造体サイズ 80 / 4 切り上げ)
; PrimaryServer : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; SecondaryServer : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; Mode : DHCP_FAILOVER_MODE (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; ServerType : DHCP_FAILOVER_SERVER (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; State : FSM_STATE (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; PrevState : FSM_STATE (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; Mclt : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; SafePeriod : DWORD (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; RelationshipName : LPWSTR (+32, 8byte)  qpoke st,32,値 / qpeek(st,32)  ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; PrimaryServerName : LPWSTR (+40, 8byte)  qpoke st,40,値 / qpeek(st,40)  ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; SecondaryServerName : LPWSTR (+48, 8byte)  qpoke st,48,値 / qpeek(st,48)  ※IronHSPのみ。3.7/3.8は lpoke st,48,下位 : lpoke st,52,上位
; pScopes : DHCP_IP_ARRAY* (+56, 8byte)  varptr(st)+56 を基点に操作(8byte:入れ子/配列)
; Percentage : BYTE (+64, 1byte)  poke st,64,値  /  値 = peek(st,64)
; SharedSecret : LPWSTR (+72, 8byte)  qpoke st,72,値 / qpeek(st,72)  ※IronHSPのみ。3.7/3.8は lpoke st,72,下位 : lpoke st,76,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DHCP_FAILOVER_RELATIONSHIP
    #field int PrimaryServer
    #field int SecondaryServer
    #field int Mode
    #field int ServerType
    #field int State
    #field int PrevState
    #field int Mclt
    #field int SafePeriod
    #field intptr RelationshipName
    #field intptr PrimaryServerName
    #field intptr SecondaryServerName
    #field intptr pScopes
    #field byte Percentage
    #field intptr SharedSecret
#endstruct

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