ホーム › NetworkManagement.IpHelper › ICMPV6_ECHO_REPLY_LH
ICMPV6_ECHO_REPLY_LH
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Address | IPV6_ADDRESS_EX | 26 | +0 | +0 | 応答元ホストのIPv6アドレス情報を保持するIPV6_ADDRESS_EX構造体。 |
| Status | DWORD | 4 | +28 | +28 | エコー要求の結果ステータス(IP_STATUS)を示す。0は成功。 |
| RoundTripTime | DWORD | 4 | +32 | +32 | 往復応答時間をミリ秒単位で示す。 |
各言語での定義
#include <windows.h>
// IPV6_ADDRESS_EX (x64 26 / x86 26 バイト)
#pragma pack(push, 1)
typedef struct IPV6_ADDRESS_EX {
WORD sin6_port;
DWORD sin6_flowinfo;
WORD sin6_addr[8];
DWORD sin6_scope_id;
} IPV6_ADDRESS_EX;
#pragma pack(pop)
// ICMPV6_ECHO_REPLY_LH (x64 36 / x86 36 バイト)
typedef struct ICMPV6_ECHO_REPLY_LH {
IPV6_ADDRESS_EX Address;
DWORD Status;
DWORD RoundTripTime;
} ICMPV6_ECHO_REPLY_LH;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct IPV6_ADDRESS_EX
{
public ushort sin6_port;
public uint sin6_flowinfo;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public ushort[] sin6_addr;
public uint sin6_scope_id;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct ICMPV6_ECHO_REPLY_LH
{
public IPV6_ADDRESS_EX Address;
public uint Status;
public uint RoundTripTime;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure IPV6_ADDRESS_EX
Public sin6_port As UShort
Public sin6_flowinfo As UInteger
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=8)> Public sin6_addr() As UShort
Public sin6_scope_id As UInteger
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure ICMPV6_ECHO_REPLY_LH
Public Address As IPV6_ADDRESS_EX
Public Status As UInteger
Public RoundTripTime As UInteger
End Structureimport ctypes
from ctypes import wintypes
class IPV6_ADDRESS_EX(ctypes.Structure):
_pack_ = 1
_fields_ = [
("sin6_port", ctypes.c_ushort),
("sin6_flowinfo", wintypes.DWORD),
("sin6_addr", ctypes.c_ushort * 8),
("sin6_scope_id", wintypes.DWORD),
]
class ICMPV6_ECHO_REPLY_LH(ctypes.Structure):
_fields_ = [
("Address", IPV6_ADDRESS_EX),
("Status", wintypes.DWORD),
("RoundTripTime", wintypes.DWORD),
]#[repr(C, packed(1))]
pub struct IPV6_ADDRESS_EX {
pub sin6_port: u16,
pub sin6_flowinfo: u32,
pub sin6_addr: [u16; 8],
pub sin6_scope_id: u32,
}
#[repr(C)]
pub struct ICMPV6_ECHO_REPLY_LH {
pub Address: IPV6_ADDRESS_EX,
pub Status: u32,
pub RoundTripTime: u32,
}import "golang.org/x/sys/windows"
type IPV6_ADDRESS_EX struct {
sin6_port uint16
sin6_flowinfo uint32
sin6_addr [8]uint16
sin6_scope_id uint32
}
type ICMPV6_ECHO_REPLY_LH struct {
Address IPV6_ADDRESS_EX
Status uint32
RoundTripTime uint32
}type
IPV6_ADDRESS_EX = packed record
sin6_port: Word;
sin6_flowinfo: DWORD;
sin6_addr: array[0..7] of Word;
sin6_scope_id: DWORD;
end;
ICMPV6_ECHO_REPLY_LH = record
Address: IPV6_ADDRESS_EX;
Status: DWORD;
RoundTripTime: DWORD;
end;const IPV6_ADDRESS_EX = extern struct {
sin6_port: u16,
sin6_flowinfo: u32,
sin6_addr: [8]u16,
sin6_scope_id: u32,
};
const ICMPV6_ECHO_REPLY_LH = extern struct {
Address: IPV6_ADDRESS_EX,
Status: u32,
RoundTripTime: u32,
};type
IPV6_ADDRESS_EX {.packed.} = object
sin6_port: uint16
sin6_flowinfo: uint32
sin6_addr: array[8, uint16]
sin6_scope_id: uint32
ICMPV6_ECHO_REPLY_LH {.bycopy.} = object
Address: IPV6_ADDRESS_EX
Status: uint32
RoundTripTime: uint32align(1)
struct IPV6_ADDRESS_EX
{
ushort sin6_port;
uint sin6_flowinfo;
ushort[8] sin6_addr;
uint sin6_scope_id;
}
struct ICMPV6_ECHO_REPLY_LH
{
IPV6_ADDRESS_EX Address;
uint Status;
uint RoundTripTime;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; ICMPV6_ECHO_REPLY_LH サイズ: 36 バイト(x64)
dim st, 9 ; 4byte整数×9(構造体サイズ 36 / 4 切り上げ)
; Address : IPV6_ADDRESS_EX (+0, 26byte) varptr(st)+0 を基点に操作(26byte:入れ子/配列)
; Status : DWORD (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; RoundTripTime : DWORD (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global IPV6_ADDRESS_EX, pack=1
#field short sin6_port
#field int sin6_flowinfo
#field short sin6_addr 8
#field int sin6_scope_id
#endstruct
#defstruct global ICMPV6_ECHO_REPLY_LH
#field IPV6_ADDRESS_EX Address
#field int Status
#field int RoundTripTime
#endstruct
stdim st, ICMPV6_ECHO_REPLY_LH ; NSTRUCT 変数を確保
st->Status = 100
mes "Status=" + st->Status