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

RAS_PORT_1

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

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

フィールド

フィールドサイズx64x86説明
hPortHANDLE8/4+0+0RASポートを識別するハンドル。
hConnectionHANDLE8/4+8+4このポートに関連付く接続のハンドル。
dwHardwareConditionRAS_HARDWARE_CONDITION4+16+8ハードウェアの状態を表すRAS_HARDWARE_CONDITION列挙値。
dwLineSpeedDWORD4+20+12回線速度(ビット毎秒、bps)。
dwBytesXmitedDWORD4+24+16送信されたバイト数。
dwBytesRcvedDWORD4+28+20受信したバイト数。
dwFramesXmitedDWORD4+32+24送信されたフレーム数。
dwFramesRcvedDWORD4+36+28受信したフレーム数。
dwCrcErrDWORD4+40+32発生したCRCエラーの数。
dwTimeoutErrDWORD4+44+36発生したタイムアウトエラーの数。
dwAlignmentErrDWORD4+48+40発生したアラインメントエラーの数。
dwHardwareOverrunErrDWORD4+52+44発生したハードウェアオーバーランエラーの数。
dwFramingErrDWORD4+56+48発生したフレーミングエラーの数。
dwBufferOverrunErrDWORD4+60+52発生したバッファオーバーランエラーの数。
dwCompressionRatioInDWORD4+64+56受信データの圧縮率(%)。
dwCompressionRatioOutDWORD4+68+60送信データの圧縮率(%)。

各言語での定義

#include <windows.h>

// RAS_PORT_1  (x64 72 / x86 64 バイト)
typedef struct RAS_PORT_1 {
    HANDLE hPort;
    HANDLE hConnection;
    RAS_HARDWARE_CONDITION dwHardwareCondition;
    DWORD dwLineSpeed;
    DWORD dwBytesXmited;
    DWORD dwBytesRcved;
    DWORD dwFramesXmited;
    DWORD dwFramesRcved;
    DWORD dwCrcErr;
    DWORD dwTimeoutErr;
    DWORD dwAlignmentErr;
    DWORD dwHardwareOverrunErr;
    DWORD dwFramingErr;
    DWORD dwBufferOverrunErr;
    DWORD dwCompressionRatioIn;
    DWORD dwCompressionRatioOut;
} RAS_PORT_1;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct RAS_PORT_1
{
    public IntPtr hPort;
    public IntPtr hConnection;
    public int dwHardwareCondition;
    public uint dwLineSpeed;
    public uint dwBytesXmited;
    public uint dwBytesRcved;
    public uint dwFramesXmited;
    public uint dwFramesRcved;
    public uint dwCrcErr;
    public uint dwTimeoutErr;
    public uint dwAlignmentErr;
    public uint dwHardwareOverrunErr;
    public uint dwFramingErr;
    public uint dwBufferOverrunErr;
    public uint dwCompressionRatioIn;
    public uint dwCompressionRatioOut;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure RAS_PORT_1
    Public hPort As IntPtr
    Public hConnection As IntPtr
    Public dwHardwareCondition As Integer
    Public dwLineSpeed As UInteger
    Public dwBytesXmited As UInteger
    Public dwBytesRcved As UInteger
    Public dwFramesXmited As UInteger
    Public dwFramesRcved As UInteger
    Public dwCrcErr As UInteger
    Public dwTimeoutErr As UInteger
    Public dwAlignmentErr As UInteger
    Public dwHardwareOverrunErr As UInteger
    Public dwFramingErr As UInteger
    Public dwBufferOverrunErr As UInteger
    Public dwCompressionRatioIn As UInteger
    Public dwCompressionRatioOut As UInteger
End Structure
import ctypes
from ctypes import wintypes

class RAS_PORT_1(ctypes.Structure):
    _fields_ = [
        ("hPort", ctypes.c_void_p),
        ("hConnection", ctypes.c_void_p),
        ("dwHardwareCondition", ctypes.c_int),
        ("dwLineSpeed", wintypes.DWORD),
        ("dwBytesXmited", wintypes.DWORD),
        ("dwBytesRcved", wintypes.DWORD),
        ("dwFramesXmited", wintypes.DWORD),
        ("dwFramesRcved", wintypes.DWORD),
        ("dwCrcErr", wintypes.DWORD),
        ("dwTimeoutErr", wintypes.DWORD),
        ("dwAlignmentErr", wintypes.DWORD),
        ("dwHardwareOverrunErr", wintypes.DWORD),
        ("dwFramingErr", wintypes.DWORD),
        ("dwBufferOverrunErr", wintypes.DWORD),
        ("dwCompressionRatioIn", wintypes.DWORD),
        ("dwCompressionRatioOut", wintypes.DWORD),
    ]
#[repr(C)]
pub struct RAS_PORT_1 {
    pub hPort: *mut core::ffi::c_void,
    pub hConnection: *mut core::ffi::c_void,
    pub dwHardwareCondition: i32,
    pub dwLineSpeed: u32,
    pub dwBytesXmited: u32,
    pub dwBytesRcved: u32,
    pub dwFramesXmited: u32,
    pub dwFramesRcved: u32,
    pub dwCrcErr: u32,
    pub dwTimeoutErr: u32,
    pub dwAlignmentErr: u32,
    pub dwHardwareOverrunErr: u32,
    pub dwFramingErr: u32,
    pub dwBufferOverrunErr: u32,
    pub dwCompressionRatioIn: u32,
    pub dwCompressionRatioOut: u32,
}
import "golang.org/x/sys/windows"

type RAS_PORT_1 struct {
	hPort uintptr
	hConnection uintptr
	dwHardwareCondition int32
	dwLineSpeed uint32
	dwBytesXmited uint32
	dwBytesRcved uint32
	dwFramesXmited uint32
	dwFramesRcved uint32
	dwCrcErr uint32
	dwTimeoutErr uint32
	dwAlignmentErr uint32
	dwHardwareOverrunErr uint32
	dwFramingErr uint32
	dwBufferOverrunErr uint32
	dwCompressionRatioIn uint32
	dwCompressionRatioOut uint32
}
type
  RAS_PORT_1 = record
    hPort: Pointer;
    hConnection: Pointer;
    dwHardwareCondition: Integer;
    dwLineSpeed: DWORD;
    dwBytesXmited: DWORD;
    dwBytesRcved: DWORD;
    dwFramesXmited: DWORD;
    dwFramesRcved: DWORD;
    dwCrcErr: DWORD;
    dwTimeoutErr: DWORD;
    dwAlignmentErr: DWORD;
    dwHardwareOverrunErr: DWORD;
    dwFramingErr: DWORD;
    dwBufferOverrunErr: DWORD;
    dwCompressionRatioIn: DWORD;
    dwCompressionRatioOut: DWORD;
  end;
const RAS_PORT_1 = extern struct {
    hPort: ?*anyopaque,
    hConnection: ?*anyopaque,
    dwHardwareCondition: i32,
    dwLineSpeed: u32,
    dwBytesXmited: u32,
    dwBytesRcved: u32,
    dwFramesXmited: u32,
    dwFramesRcved: u32,
    dwCrcErr: u32,
    dwTimeoutErr: u32,
    dwAlignmentErr: u32,
    dwHardwareOverrunErr: u32,
    dwFramingErr: u32,
    dwBufferOverrunErr: u32,
    dwCompressionRatioIn: u32,
    dwCompressionRatioOut: u32,
};
type
  RAS_PORT_1 {.bycopy.} = object
    hPort: pointer
    hConnection: pointer
    dwHardwareCondition: int32
    dwLineSpeed: uint32
    dwBytesXmited: uint32
    dwBytesRcved: uint32
    dwFramesXmited: uint32
    dwFramesRcved: uint32
    dwCrcErr: uint32
    dwTimeoutErr: uint32
    dwAlignmentErr: uint32
    dwHardwareOverrunErr: uint32
    dwFramingErr: uint32
    dwBufferOverrunErr: uint32
    dwCompressionRatioIn: uint32
    dwCompressionRatioOut: uint32
struct RAS_PORT_1
{
    void* hPort;
    void* hConnection;
    int dwHardwareCondition;
    uint dwLineSpeed;
    uint dwBytesXmited;
    uint dwBytesRcved;
    uint dwFramesXmited;
    uint dwFramesRcved;
    uint dwCrcErr;
    uint dwTimeoutErr;
    uint dwAlignmentErr;
    uint dwHardwareOverrunErr;
    uint dwFramingErr;
    uint dwBufferOverrunErr;
    uint dwCompressionRatioIn;
    uint dwCompressionRatioOut;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; RAS_PORT_1 サイズ: 64 バイト(x86)
dim st, 16    ; 4byte整数×16(構造体サイズ 64 / 4 切り上げ)
; hPort : HANDLE (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; hConnection : HANDLE (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; dwHardwareCondition : RAS_HARDWARE_CONDITION (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; dwLineSpeed : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; dwBytesXmited : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; dwBytesRcved : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; dwFramesXmited : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; dwFramesRcved : DWORD (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; dwCrcErr : DWORD (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; dwTimeoutErr : DWORD (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; dwAlignmentErr : DWORD (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; dwHardwareOverrunErr : DWORD (+44, 4byte)  st.11 = 値  /  値 = st.11   (lpoke/lpeek も可)
; dwFramingErr : DWORD (+48, 4byte)  st.12 = 値  /  値 = st.12   (lpoke/lpeek も可)
; dwBufferOverrunErr : DWORD (+52, 4byte)  st.13 = 値  /  値 = st.13   (lpoke/lpeek も可)
; dwCompressionRatioIn : DWORD (+56, 4byte)  st.14 = 値  /  値 = st.14   (lpoke/lpeek も可)
; dwCompressionRatioOut : DWORD (+60, 4byte)  st.15 = 値  /  値 = st.15   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; RAS_PORT_1 サイズ: 72 バイト(x64)
dim st, 18    ; 4byte整数×18(構造体サイズ 72 / 4 切り上げ)
; hPort : HANDLE (+0, 8byte)  qpoke st,0,値 / qpeek(st,0)  ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; hConnection : HANDLE (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; dwHardwareCondition : RAS_HARDWARE_CONDITION (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; dwLineSpeed : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; dwBytesXmited : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; dwBytesRcved : DWORD (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; dwFramesXmited : DWORD (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; dwFramesRcved : DWORD (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; dwCrcErr : DWORD (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; dwTimeoutErr : DWORD (+44, 4byte)  st.11 = 値  /  値 = st.11   (lpoke/lpeek も可)
; dwAlignmentErr : DWORD (+48, 4byte)  st.12 = 値  /  値 = st.12   (lpoke/lpeek も可)
; dwHardwareOverrunErr : DWORD (+52, 4byte)  st.13 = 値  /  値 = st.13   (lpoke/lpeek も可)
; dwFramingErr : DWORD (+56, 4byte)  st.14 = 値  /  値 = st.14   (lpoke/lpeek も可)
; dwBufferOverrunErr : DWORD (+60, 4byte)  st.15 = 値  /  値 = st.15   (lpoke/lpeek も可)
; dwCompressionRatioIn : DWORD (+64, 4byte)  st.16 = 値  /  値 = st.16   (lpoke/lpeek も可)
; dwCompressionRatioOut : DWORD (+68, 4byte)  st.17 = 値  /  値 = st.17   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global RAS_PORT_1
    #field intptr hPort
    #field intptr hConnection
    #field int dwHardwareCondition
    #field int dwLineSpeed
    #field int dwBytesXmited
    #field int dwBytesRcved
    #field int dwFramesXmited
    #field int dwFramesRcved
    #field int dwCrcErr
    #field int dwTimeoutErr
    #field int dwAlignmentErr
    #field int dwHardwareOverrunErr
    #field int dwFramingErr
    #field int dwBufferOverrunErr
    #field int dwCompressionRatioIn
    #field int dwCompressionRatioOut
#endstruct

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