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

NDIS_TIMESTAMP_CAPABILITIES

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

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

フィールド

フィールドサイズx64x86説明
HeaderNDIS_OBJECT_HEADER4+0+0構造体の型・リビジョン・サイズを示すNDISオブジェクトヘッダー。
HardwareClockFrequencyHzULONGLONG8+8+8ハードウェアクロックの周波数(Hz)。
CrossTimestampBOOLEAN1+16+16クロスタイムスタンプ(システムとハードウェアの同時取得)の対応可否。
Reserved1ULONGLONG8+24+24予約フィールド。0を設定する。
Reserved2ULONGLONG8+32+32予約フィールド。0を設定する。
TimestampFlagsNDIS_TIMESTAMP_CAPABILITY_FLAGS14+40+40サポートするタイムスタンプ機能を示すフラグ群。

各言語での定義

#include <windows.h>

// NDIS_OBJECT_HEADER  (x64 4 / x86 4 バイト)
typedef struct NDIS_OBJECT_HEADER {
    BYTE Type;
    BYTE Revision;
    WORD Size;
} NDIS_OBJECT_HEADER;

// NDIS_TIMESTAMP_CAPABILITY_FLAGS  (x64 14 / x86 14 バイト)
typedef struct NDIS_TIMESTAMP_CAPABILITY_FLAGS {
    BOOLEAN PtpV2OverUdpIPv4EventMsgReceiveHw;
    BOOLEAN PtpV2OverUdpIPv4AllMsgReceiveHw;
    BOOLEAN PtpV2OverUdpIPv4EventMsgTransmitHw;
    BOOLEAN PtpV2OverUdpIPv4AllMsgTransmitHw;
    BOOLEAN PtpV2OverUdpIPv6EventMsgReceiveHw;
    BOOLEAN PtpV2OverUdpIPv6AllMsgReceiveHw;
    BOOLEAN PtpV2OverUdpIPv6EventMsgTransmitHw;
    BOOLEAN PtpV2OverUdpIPv6AllMsgTransmitHw;
    BOOLEAN AllReceiveHw;
    BOOLEAN AllTransmitHw;
    BOOLEAN TaggedTransmitHw;
    BOOLEAN AllReceiveSw;
    BOOLEAN AllTransmitSw;
    BOOLEAN TaggedTransmitSw;
} NDIS_TIMESTAMP_CAPABILITY_FLAGS;

// NDIS_TIMESTAMP_CAPABILITIES  (x64 56 / x86 56 バイト)
typedef struct NDIS_TIMESTAMP_CAPABILITIES {
    NDIS_OBJECT_HEADER Header;
    ULONGLONG HardwareClockFrequencyHz;
    BOOLEAN CrossTimestamp;
    ULONGLONG Reserved1;
    ULONGLONG Reserved2;
    NDIS_TIMESTAMP_CAPABILITY_FLAGS TimestampFlags;
} NDIS_TIMESTAMP_CAPABILITIES;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NDIS_OBJECT_HEADER
{
    public byte Type;
    public byte Revision;
    public ushort Size;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NDIS_TIMESTAMP_CAPABILITY_FLAGS
{
    [MarshalAs(UnmanagedType.U1)] public bool PtpV2OverUdpIPv4EventMsgReceiveHw;
    [MarshalAs(UnmanagedType.U1)] public bool PtpV2OverUdpIPv4AllMsgReceiveHw;
    [MarshalAs(UnmanagedType.U1)] public bool PtpV2OverUdpIPv4EventMsgTransmitHw;
    [MarshalAs(UnmanagedType.U1)] public bool PtpV2OverUdpIPv4AllMsgTransmitHw;
    [MarshalAs(UnmanagedType.U1)] public bool PtpV2OverUdpIPv6EventMsgReceiveHw;
    [MarshalAs(UnmanagedType.U1)] public bool PtpV2OverUdpIPv6AllMsgReceiveHw;
    [MarshalAs(UnmanagedType.U1)] public bool PtpV2OverUdpIPv6EventMsgTransmitHw;
    [MarshalAs(UnmanagedType.U1)] public bool PtpV2OverUdpIPv6AllMsgTransmitHw;
    [MarshalAs(UnmanagedType.U1)] public bool AllReceiveHw;
    [MarshalAs(UnmanagedType.U1)] public bool AllTransmitHw;
    [MarshalAs(UnmanagedType.U1)] public bool TaggedTransmitHw;
    [MarshalAs(UnmanagedType.U1)] public bool AllReceiveSw;
    [MarshalAs(UnmanagedType.U1)] public bool AllTransmitSw;
    [MarshalAs(UnmanagedType.U1)] public bool TaggedTransmitSw;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NDIS_TIMESTAMP_CAPABILITIES
{
    public NDIS_OBJECT_HEADER Header;
    public ulong HardwareClockFrequencyHz;
    [MarshalAs(UnmanagedType.U1)] public bool CrossTimestamp;
    public ulong Reserved1;
    public ulong Reserved2;
    public NDIS_TIMESTAMP_CAPABILITY_FLAGS TimestampFlags;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NDIS_OBJECT_HEADER
    Public Type As Byte
    Public Revision As Byte
    Public Size As UShort
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NDIS_TIMESTAMP_CAPABILITY_FLAGS
    <MarshalAs(UnmanagedType.U1)> Public PtpV2OverUdpIPv4EventMsgReceiveHw As Boolean
    <MarshalAs(UnmanagedType.U1)> Public PtpV2OverUdpIPv4AllMsgReceiveHw As Boolean
    <MarshalAs(UnmanagedType.U1)> Public PtpV2OverUdpIPv4EventMsgTransmitHw As Boolean
    <MarshalAs(UnmanagedType.U1)> Public PtpV2OverUdpIPv4AllMsgTransmitHw As Boolean
    <MarshalAs(UnmanagedType.U1)> Public PtpV2OverUdpIPv6EventMsgReceiveHw As Boolean
    <MarshalAs(UnmanagedType.U1)> Public PtpV2OverUdpIPv6AllMsgReceiveHw As Boolean
    <MarshalAs(UnmanagedType.U1)> Public PtpV2OverUdpIPv6EventMsgTransmitHw As Boolean
    <MarshalAs(UnmanagedType.U1)> Public PtpV2OverUdpIPv6AllMsgTransmitHw As Boolean
    <MarshalAs(UnmanagedType.U1)> Public AllReceiveHw As Boolean
    <MarshalAs(UnmanagedType.U1)> Public AllTransmitHw As Boolean
    <MarshalAs(UnmanagedType.U1)> Public TaggedTransmitHw As Boolean
    <MarshalAs(UnmanagedType.U1)> Public AllReceiveSw As Boolean
    <MarshalAs(UnmanagedType.U1)> Public AllTransmitSw As Boolean
    <MarshalAs(UnmanagedType.U1)> Public TaggedTransmitSw As Boolean
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NDIS_TIMESTAMP_CAPABILITIES
    Public Header As NDIS_OBJECT_HEADER
    Public HardwareClockFrequencyHz As ULong
    <MarshalAs(UnmanagedType.U1)> Public CrossTimestamp As Boolean
    Public Reserved1 As ULong
    Public Reserved2 As ULong
    Public TimestampFlags As NDIS_TIMESTAMP_CAPABILITY_FLAGS
End Structure
import ctypes
from ctypes import wintypes

class NDIS_OBJECT_HEADER(ctypes.Structure):
    _fields_ = [
        ("Type", ctypes.c_ubyte),
        ("Revision", ctypes.c_ubyte),
        ("Size", ctypes.c_ushort),
    ]

class NDIS_TIMESTAMP_CAPABILITY_FLAGS(ctypes.Structure):
    _fields_ = [
        ("PtpV2OverUdpIPv4EventMsgReceiveHw", ctypes.c_byte),
        ("PtpV2OverUdpIPv4AllMsgReceiveHw", ctypes.c_byte),
        ("PtpV2OverUdpIPv4EventMsgTransmitHw", ctypes.c_byte),
        ("PtpV2OverUdpIPv4AllMsgTransmitHw", ctypes.c_byte),
        ("PtpV2OverUdpIPv6EventMsgReceiveHw", ctypes.c_byte),
        ("PtpV2OverUdpIPv6AllMsgReceiveHw", ctypes.c_byte),
        ("PtpV2OverUdpIPv6EventMsgTransmitHw", ctypes.c_byte),
        ("PtpV2OverUdpIPv6AllMsgTransmitHw", ctypes.c_byte),
        ("AllReceiveHw", ctypes.c_byte),
        ("AllTransmitHw", ctypes.c_byte),
        ("TaggedTransmitHw", ctypes.c_byte),
        ("AllReceiveSw", ctypes.c_byte),
        ("AllTransmitSw", ctypes.c_byte),
        ("TaggedTransmitSw", ctypes.c_byte),
    ]

class NDIS_TIMESTAMP_CAPABILITIES(ctypes.Structure):
    _fields_ = [
        ("Header", NDIS_OBJECT_HEADER),
        ("HardwareClockFrequencyHz", ctypes.c_ulonglong),
        ("CrossTimestamp", ctypes.c_byte),
        ("Reserved1", ctypes.c_ulonglong),
        ("Reserved2", ctypes.c_ulonglong),
        ("TimestampFlags", NDIS_TIMESTAMP_CAPABILITY_FLAGS),
    ]
#[repr(C)]
pub struct NDIS_OBJECT_HEADER {
    pub Type: u8,
    pub Revision: u8,
    pub Size: u16,
}

#[repr(C)]
pub struct NDIS_TIMESTAMP_CAPABILITY_FLAGS {
    pub PtpV2OverUdpIPv4EventMsgReceiveHw: u8,
    pub PtpV2OverUdpIPv4AllMsgReceiveHw: u8,
    pub PtpV2OverUdpIPv4EventMsgTransmitHw: u8,
    pub PtpV2OverUdpIPv4AllMsgTransmitHw: u8,
    pub PtpV2OverUdpIPv6EventMsgReceiveHw: u8,
    pub PtpV2OverUdpIPv6AllMsgReceiveHw: u8,
    pub PtpV2OverUdpIPv6EventMsgTransmitHw: u8,
    pub PtpV2OverUdpIPv6AllMsgTransmitHw: u8,
    pub AllReceiveHw: u8,
    pub AllTransmitHw: u8,
    pub TaggedTransmitHw: u8,
    pub AllReceiveSw: u8,
    pub AllTransmitSw: u8,
    pub TaggedTransmitSw: u8,
}

#[repr(C)]
pub struct NDIS_TIMESTAMP_CAPABILITIES {
    pub Header: NDIS_OBJECT_HEADER,
    pub HardwareClockFrequencyHz: u64,
    pub CrossTimestamp: u8,
    pub Reserved1: u64,
    pub Reserved2: u64,
    pub TimestampFlags: NDIS_TIMESTAMP_CAPABILITY_FLAGS,
}
import "golang.org/x/sys/windows"

type NDIS_OBJECT_HEADER struct {
	Type byte
	Revision byte
	Size uint16
}

type NDIS_TIMESTAMP_CAPABILITY_FLAGS struct {
	PtpV2OverUdpIPv4EventMsgReceiveHw byte
	PtpV2OverUdpIPv4AllMsgReceiveHw byte
	PtpV2OverUdpIPv4EventMsgTransmitHw byte
	PtpV2OverUdpIPv4AllMsgTransmitHw byte
	PtpV2OverUdpIPv6EventMsgReceiveHw byte
	PtpV2OverUdpIPv6AllMsgReceiveHw byte
	PtpV2OverUdpIPv6EventMsgTransmitHw byte
	PtpV2OverUdpIPv6AllMsgTransmitHw byte
	AllReceiveHw byte
	AllTransmitHw byte
	TaggedTransmitHw byte
	AllReceiveSw byte
	AllTransmitSw byte
	TaggedTransmitSw byte
}

type NDIS_TIMESTAMP_CAPABILITIES struct {
	Header NDIS_OBJECT_HEADER
	HardwareClockFrequencyHz uint64
	CrossTimestamp byte
	Reserved1 uint64
	Reserved2 uint64
	TimestampFlags NDIS_TIMESTAMP_CAPABILITY_FLAGS
}
type
  NDIS_OBJECT_HEADER = record
    Type: Byte;
    Revision: Byte;
    Size: Word;
  end;

  NDIS_TIMESTAMP_CAPABILITY_FLAGS = record
    PtpV2OverUdpIPv4EventMsgReceiveHw: ByteBool;
    PtpV2OverUdpIPv4AllMsgReceiveHw: ByteBool;
    PtpV2OverUdpIPv4EventMsgTransmitHw: ByteBool;
    PtpV2OverUdpIPv4AllMsgTransmitHw: ByteBool;
    PtpV2OverUdpIPv6EventMsgReceiveHw: ByteBool;
    PtpV2OverUdpIPv6AllMsgReceiveHw: ByteBool;
    PtpV2OverUdpIPv6EventMsgTransmitHw: ByteBool;
    PtpV2OverUdpIPv6AllMsgTransmitHw: ByteBool;
    AllReceiveHw: ByteBool;
    AllTransmitHw: ByteBool;
    TaggedTransmitHw: ByteBool;
    AllReceiveSw: ByteBool;
    AllTransmitSw: ByteBool;
    TaggedTransmitSw: ByteBool;
  end;

  NDIS_TIMESTAMP_CAPABILITIES = record
    Header: NDIS_OBJECT_HEADER;
    HardwareClockFrequencyHz: UInt64;
    CrossTimestamp: ByteBool;
    Reserved1: UInt64;
    Reserved2: UInt64;
    TimestampFlags: NDIS_TIMESTAMP_CAPABILITY_FLAGS;
  end;
const NDIS_OBJECT_HEADER = extern struct {
    Type: u8,
    Revision: u8,
    Size: u16,
};

const NDIS_TIMESTAMP_CAPABILITY_FLAGS = extern struct {
    PtpV2OverUdpIPv4EventMsgReceiveHw: u8,
    PtpV2OverUdpIPv4AllMsgReceiveHw: u8,
    PtpV2OverUdpIPv4EventMsgTransmitHw: u8,
    PtpV2OverUdpIPv4AllMsgTransmitHw: u8,
    PtpV2OverUdpIPv6EventMsgReceiveHw: u8,
    PtpV2OverUdpIPv6AllMsgReceiveHw: u8,
    PtpV2OverUdpIPv6EventMsgTransmitHw: u8,
    PtpV2OverUdpIPv6AllMsgTransmitHw: u8,
    AllReceiveHw: u8,
    AllTransmitHw: u8,
    TaggedTransmitHw: u8,
    AllReceiveSw: u8,
    AllTransmitSw: u8,
    TaggedTransmitSw: u8,
};

const NDIS_TIMESTAMP_CAPABILITIES = extern struct {
    Header: NDIS_OBJECT_HEADER,
    HardwareClockFrequencyHz: u64,
    CrossTimestamp: u8,
    Reserved1: u64,
    Reserved2: u64,
    TimestampFlags: NDIS_TIMESTAMP_CAPABILITY_FLAGS,
};
type
  NDIS_OBJECT_HEADER {.bycopy.} = object
    Type: uint8
    Revision: uint8
    Size: uint16

  NDIS_TIMESTAMP_CAPABILITY_FLAGS {.bycopy.} = object
    PtpV2OverUdpIPv4EventMsgReceiveHw: uint8
    PtpV2OverUdpIPv4AllMsgReceiveHw: uint8
    PtpV2OverUdpIPv4EventMsgTransmitHw: uint8
    PtpV2OverUdpIPv4AllMsgTransmitHw: uint8
    PtpV2OverUdpIPv6EventMsgReceiveHw: uint8
    PtpV2OverUdpIPv6AllMsgReceiveHw: uint8
    PtpV2OverUdpIPv6EventMsgTransmitHw: uint8
    PtpV2OverUdpIPv6AllMsgTransmitHw: uint8
    AllReceiveHw: uint8
    AllTransmitHw: uint8
    TaggedTransmitHw: uint8
    AllReceiveSw: uint8
    AllTransmitSw: uint8
    TaggedTransmitSw: uint8

  NDIS_TIMESTAMP_CAPABILITIES {.bycopy.} = object
    Header: NDIS_OBJECT_HEADER
    HardwareClockFrequencyHz: uint64
    CrossTimestamp: uint8
    Reserved1: uint64
    Reserved2: uint64
    TimestampFlags: NDIS_TIMESTAMP_CAPABILITY_FLAGS
struct NDIS_OBJECT_HEADER
{
    ubyte Type;
    ubyte Revision;
    ushort Size;
}

struct NDIS_TIMESTAMP_CAPABILITY_FLAGS
{
    ubyte PtpV2OverUdpIPv4EventMsgReceiveHw;
    ubyte PtpV2OverUdpIPv4AllMsgReceiveHw;
    ubyte PtpV2OverUdpIPv4EventMsgTransmitHw;
    ubyte PtpV2OverUdpIPv4AllMsgTransmitHw;
    ubyte PtpV2OverUdpIPv6EventMsgReceiveHw;
    ubyte PtpV2OverUdpIPv6AllMsgReceiveHw;
    ubyte PtpV2OverUdpIPv6EventMsgTransmitHw;
    ubyte PtpV2OverUdpIPv6AllMsgTransmitHw;
    ubyte AllReceiveHw;
    ubyte AllTransmitHw;
    ubyte TaggedTransmitHw;
    ubyte AllReceiveSw;
    ubyte AllTransmitSw;
    ubyte TaggedTransmitSw;
}

struct NDIS_TIMESTAMP_CAPABILITIES
{
    NDIS_OBJECT_HEADER Header;
    ulong HardwareClockFrequencyHz;
    ubyte CrossTimestamp;
    ulong Reserved1;
    ulong Reserved2;
    NDIS_TIMESTAMP_CAPABILITY_FLAGS TimestampFlags;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; NDIS_TIMESTAMP_CAPABILITIES サイズ: 56 バイト(x64)
dim st, 14    ; 4byte整数×14(構造体サイズ 56 / 4 切り上げ)
; Header : NDIS_OBJECT_HEADER (+0, 4byte)  varptr(st)+0 を基点に操作(4byte:入れ子/配列)
; HardwareClockFrequencyHz : ULONGLONG (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; CrossTimestamp : BOOLEAN (+16, 1byte)  poke st,16,値  /  値 = peek(st,16)
; Reserved1 : ULONGLONG (+24, 8byte)  qpoke st,24,値 / qpeek(st,24)  ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; Reserved2 : ULONGLONG (+32, 8byte)  qpoke st,32,値 / qpeek(st,32)  ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; TimestampFlags : NDIS_TIMESTAMP_CAPABILITY_FLAGS (+40, 14byte)  varptr(st)+40 を基点に操作(14byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global NDIS_OBJECT_HEADER
    #field byte Type
    #field byte Revision
    #field short Size
#endstruct

#defstruct global NDIS_TIMESTAMP_CAPABILITY_FLAGS
    #field bool1 PtpV2OverUdpIPv4EventMsgReceiveHw
    #field bool1 PtpV2OverUdpIPv4AllMsgReceiveHw
    #field bool1 PtpV2OverUdpIPv4EventMsgTransmitHw
    #field bool1 PtpV2OverUdpIPv4AllMsgTransmitHw
    #field bool1 PtpV2OverUdpIPv6EventMsgReceiveHw
    #field bool1 PtpV2OverUdpIPv6AllMsgReceiveHw
    #field bool1 PtpV2OverUdpIPv6EventMsgTransmitHw
    #field bool1 PtpV2OverUdpIPv6AllMsgTransmitHw
    #field bool1 AllReceiveHw
    #field bool1 AllTransmitHw
    #field bool1 TaggedTransmitHw
    #field bool1 AllReceiveSw
    #field bool1 AllTransmitSw
    #field bool1 TaggedTransmitSw
#endstruct

#defstruct global NDIS_TIMESTAMP_CAPABILITIES
    #field NDIS_OBJECT_HEADER Header
    #field int64 HardwareClockFrequencyHz
    #field bool1 CrossTimestamp
    #field int64 Reserved1
    #field int64 Reserved2
    #field NDIS_TIMESTAMP_CAPABILITY_FLAGS TimestampFlags
#endstruct

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