ホーム › NetworkManagement.Rras › RAS_CONNECTION_1
RAS_CONNECTION_1
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| hConnection | HANDLE | 8/4 | +0 | +0 | 接続を識別するハンドル。 |
| hInterface | HANDLE | 8/4 | +8 | +4 | 接続に関連付くルーターインターフェイスのハンドル。 |
| PppInfo | PPP_INFO | 232 | +16 | +8 | 接続のPPPプロジェクション情報(PPP_INFO)。 |
| dwBytesXmited | DWORD | 4 | +248 | +240 | 送信されたバイト数。 |
| dwBytesRcved | DWORD | 4 | +252 | +244 | 受信したバイト数。 |
| dwFramesXmited | DWORD | 4 | +256 | +248 | 送信されたフレーム数。 |
| dwFramesRcved | DWORD | 4 | +260 | +252 | 受信したフレーム数。 |
| dwCrcErr | DWORD | 4 | +264 | +256 | 発生したCRCエラーの数。 |
| dwTimeoutErr | DWORD | 4 | +268 | +260 | 発生したタイムアウトエラーの数。 |
| dwAlignmentErr | DWORD | 4 | +272 | +264 | 発生したアラインメントエラーの数。 |
| dwHardwareOverrunErr | DWORD | 4 | +276 | +268 | 発生したハードウェアオーバーランエラーの数。 |
| dwFramingErr | DWORD | 4 | +280 | +272 | 発生したフレーミングエラーの数。 |
| dwBufferOverrunErr | DWORD | 4 | +284 | +276 | 発生したバッファオーバーランエラーの数。 |
| dwCompressionRatioIn | DWORD | 4 | +288 | +280 | 受信データの圧縮率(%)。 |
| dwCompressionRatioOut | DWORD | 4 | +292 | +284 | 送信データの圧縮率(%)。 |
各言語での定義
#include <windows.h>
// PPP_NBFCP_INFO (x64 40 / x86 40 バイト)
typedef struct PPP_NBFCP_INFO {
DWORD dwError;
WCHAR wszWksta[17];
} PPP_NBFCP_INFO;
// PPP_IPCP_INFO (x64 68 / x86 68 バイト)
typedef struct PPP_IPCP_INFO {
DWORD dwError;
WCHAR wszAddress[16];
WCHAR wszRemoteAddress[16];
} PPP_IPCP_INFO;
// PPP_IPXCP_INFO (x64 52 / x86 52 バイト)
typedef struct PPP_IPXCP_INFO {
DWORD dwError;
WCHAR wszAddress[23];
} PPP_IPXCP_INFO;
// PPP_ATCP_INFO (x64 72 / x86 72 バイト)
typedef struct PPP_ATCP_INFO {
DWORD dwError;
WCHAR wszAddress[33];
} PPP_ATCP_INFO;
// PPP_INFO (x64 232 / x86 232 バイト)
typedef struct PPP_INFO {
PPP_NBFCP_INFO nbf;
PPP_IPCP_INFO ip;
PPP_IPXCP_INFO ipx;
PPP_ATCP_INFO at;
} PPP_INFO;
// RAS_CONNECTION_1 (x64 296 / x86 288 バイト)
typedef struct RAS_CONNECTION_1 {
HANDLE hConnection;
HANDLE hInterface;
PPP_INFO PppInfo;
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_CONNECTION_1;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct PPP_NBFCP_INFO
{
public uint dwError;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 17)] public string wszWksta;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct PPP_IPCP_INFO
{
public uint dwError;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 16)] public string wszAddress;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 16)] public string wszRemoteAddress;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct PPP_IPXCP_INFO
{
public uint dwError;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 23)] public string wszAddress;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct PPP_ATCP_INFO
{
public uint dwError;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 33)] public string wszAddress;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct PPP_INFO
{
public PPP_NBFCP_INFO nbf;
public PPP_IPCP_INFO ip;
public PPP_IPXCP_INFO ipx;
public PPP_ATCP_INFO at;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct RAS_CONNECTION_1
{
public IntPtr hConnection;
public IntPtr hInterface;
public PPP_INFO PppInfo;
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 PPP_NBFCP_INFO
Public dwError As UInteger
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=17)> Public wszWksta As String
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure PPP_IPCP_INFO
Public dwError As UInteger
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=16)> Public wszAddress As String
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=16)> Public wszRemoteAddress As String
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure PPP_IPXCP_INFO
Public dwError As UInteger
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=23)> Public wszAddress As String
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure PPP_ATCP_INFO
Public dwError As UInteger
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=33)> Public wszAddress As String
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure PPP_INFO
Public nbf As PPP_NBFCP_INFO
Public ip As PPP_IPCP_INFO
Public ipx As PPP_IPXCP_INFO
Public at As PPP_ATCP_INFO
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure RAS_CONNECTION_1
Public hConnection As IntPtr
Public hInterface As IntPtr
Public PppInfo As PPP_INFO
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 Structureimport ctypes
from ctypes import wintypes
class PPP_NBFCP_INFO(ctypes.Structure):
_fields_ = [
("dwError", wintypes.DWORD),
("wszWksta", ctypes.c_wchar * 17),
]
class PPP_IPCP_INFO(ctypes.Structure):
_fields_ = [
("dwError", wintypes.DWORD),
("wszAddress", ctypes.c_wchar * 16),
("wszRemoteAddress", ctypes.c_wchar * 16),
]
class PPP_IPXCP_INFO(ctypes.Structure):
_fields_ = [
("dwError", wintypes.DWORD),
("wszAddress", ctypes.c_wchar * 23),
]
class PPP_ATCP_INFO(ctypes.Structure):
_fields_ = [
("dwError", wintypes.DWORD),
("wszAddress", ctypes.c_wchar * 33),
]
class PPP_INFO(ctypes.Structure):
_fields_ = [
("nbf", PPP_NBFCP_INFO),
("ip", PPP_IPCP_INFO),
("ipx", PPP_IPXCP_INFO),
("at", PPP_ATCP_INFO),
]
class RAS_CONNECTION_1(ctypes.Structure):
_fields_ = [
("hConnection", ctypes.c_void_p),
("hInterface", ctypes.c_void_p),
("PppInfo", PPP_INFO),
("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 PPP_NBFCP_INFO {
pub dwError: u32,
pub wszWksta: [u16; 17],
}
#[repr(C)]
pub struct PPP_IPCP_INFO {
pub dwError: u32,
pub wszAddress: [u16; 16],
pub wszRemoteAddress: [u16; 16],
}
#[repr(C)]
pub struct PPP_IPXCP_INFO {
pub dwError: u32,
pub wszAddress: [u16; 23],
}
#[repr(C)]
pub struct PPP_ATCP_INFO {
pub dwError: u32,
pub wszAddress: [u16; 33],
}
#[repr(C)]
pub struct PPP_INFO {
pub nbf: PPP_NBFCP_INFO,
pub ip: PPP_IPCP_INFO,
pub ipx: PPP_IPXCP_INFO,
pub at: PPP_ATCP_INFO,
}
#[repr(C)]
pub struct RAS_CONNECTION_1 {
pub hConnection: *mut core::ffi::c_void,
pub hInterface: *mut core::ffi::c_void,
pub PppInfo: PPP_INFO,
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 PPP_NBFCP_INFO struct {
dwError uint32
wszWksta [17]uint16
}
type PPP_IPCP_INFO struct {
dwError uint32
wszAddress [16]uint16
wszRemoteAddress [16]uint16
}
type PPP_IPXCP_INFO struct {
dwError uint32
wszAddress [23]uint16
}
type PPP_ATCP_INFO struct {
dwError uint32
wszAddress [33]uint16
}
type PPP_INFO struct {
nbf PPP_NBFCP_INFO
ip PPP_IPCP_INFO
ipx PPP_IPXCP_INFO
at PPP_ATCP_INFO
}
type RAS_CONNECTION_1 struct {
hConnection uintptr
hInterface uintptr
PppInfo PPP_INFO
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
PPP_NBFCP_INFO = record
dwError: DWORD;
wszWksta: array[0..16] of WideChar;
end;
PPP_IPCP_INFO = record
dwError: DWORD;
wszAddress: array[0..15] of WideChar;
wszRemoteAddress: array[0..15] of WideChar;
end;
PPP_IPXCP_INFO = record
dwError: DWORD;
wszAddress: array[0..22] of WideChar;
end;
PPP_ATCP_INFO = record
dwError: DWORD;
wszAddress: array[0..32] of WideChar;
end;
PPP_INFO = record
nbf: PPP_NBFCP_INFO;
ip: PPP_IPCP_INFO;
ipx: PPP_IPXCP_INFO;
at: PPP_ATCP_INFO;
end;
RAS_CONNECTION_1 = record
hConnection: Pointer;
hInterface: Pointer;
PppInfo: PPP_INFO;
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 PPP_NBFCP_INFO = extern struct {
dwError: u32,
wszWksta: [17]u16,
};
const PPP_IPCP_INFO = extern struct {
dwError: u32,
wszAddress: [16]u16,
wszRemoteAddress: [16]u16,
};
const PPP_IPXCP_INFO = extern struct {
dwError: u32,
wszAddress: [23]u16,
};
const PPP_ATCP_INFO = extern struct {
dwError: u32,
wszAddress: [33]u16,
};
const PPP_INFO = extern struct {
nbf: PPP_NBFCP_INFO,
ip: PPP_IPCP_INFO,
ipx: PPP_IPXCP_INFO,
at: PPP_ATCP_INFO,
};
const RAS_CONNECTION_1 = extern struct {
hConnection: ?*anyopaque,
hInterface: ?*anyopaque,
PppInfo: PPP_INFO,
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
PPP_NBFCP_INFO {.bycopy.} = object
dwError: uint32
wszWksta: array[17, uint16]
PPP_IPCP_INFO {.bycopy.} = object
dwError: uint32
wszAddress: array[16, uint16]
wszRemoteAddress: array[16, uint16]
PPP_IPXCP_INFO {.bycopy.} = object
dwError: uint32
wszAddress: array[23, uint16]
PPP_ATCP_INFO {.bycopy.} = object
dwError: uint32
wszAddress: array[33, uint16]
PPP_INFO {.bycopy.} = object
nbf: PPP_NBFCP_INFO
ip: PPP_IPCP_INFO
ipx: PPP_IPXCP_INFO
at: PPP_ATCP_INFO
RAS_CONNECTION_1 {.bycopy.} = object
hConnection: pointer
hInterface: pointer
PppInfo: PPP_INFO
dwBytesXmited: uint32
dwBytesRcved: uint32
dwFramesXmited: uint32
dwFramesRcved: uint32
dwCrcErr: uint32
dwTimeoutErr: uint32
dwAlignmentErr: uint32
dwHardwareOverrunErr: uint32
dwFramingErr: uint32
dwBufferOverrunErr: uint32
dwCompressionRatioIn: uint32
dwCompressionRatioOut: uint32struct PPP_NBFCP_INFO
{
uint dwError;
wchar[17] wszWksta;
}
struct PPP_IPCP_INFO
{
uint dwError;
wchar[16] wszAddress;
wchar[16] wszRemoteAddress;
}
struct PPP_IPXCP_INFO
{
uint dwError;
wchar[23] wszAddress;
}
struct PPP_ATCP_INFO
{
uint dwError;
wchar[33] wszAddress;
}
struct PPP_INFO
{
PPP_NBFCP_INFO nbf;
PPP_IPCP_INFO ip;
PPP_IPXCP_INFO ipx;
PPP_ATCP_INFO at;
}
struct RAS_CONNECTION_1
{
void* hConnection;
void* hInterface;
PPP_INFO PppInfo;
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_CONNECTION_1 サイズ: 288 バイト(x86)
dim st, 72 ; 4byte整数×72(構造体サイズ 288 / 4 切り上げ)
; hConnection : HANDLE (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; hInterface : HANDLE (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; PppInfo : PPP_INFO (+8, 232byte) varptr(st)+8 を基点に操作(232byte:入れ子/配列)
; dwBytesXmited : DWORD (+240, 4byte) st.60 = 値 / 値 = st.60 (lpoke/lpeek も可)
; dwBytesRcved : DWORD (+244, 4byte) st.61 = 値 / 値 = st.61 (lpoke/lpeek も可)
; dwFramesXmited : DWORD (+248, 4byte) st.62 = 値 / 値 = st.62 (lpoke/lpeek も可)
; dwFramesRcved : DWORD (+252, 4byte) st.63 = 値 / 値 = st.63 (lpoke/lpeek も可)
; dwCrcErr : DWORD (+256, 4byte) st.64 = 値 / 値 = st.64 (lpoke/lpeek も可)
; dwTimeoutErr : DWORD (+260, 4byte) st.65 = 値 / 値 = st.65 (lpoke/lpeek も可)
; dwAlignmentErr : DWORD (+264, 4byte) st.66 = 値 / 値 = st.66 (lpoke/lpeek も可)
; dwHardwareOverrunErr : DWORD (+268, 4byte) st.67 = 値 / 値 = st.67 (lpoke/lpeek も可)
; dwFramingErr : DWORD (+272, 4byte) st.68 = 値 / 値 = st.68 (lpoke/lpeek も可)
; dwBufferOverrunErr : DWORD (+276, 4byte) st.69 = 値 / 値 = st.69 (lpoke/lpeek も可)
; dwCompressionRatioIn : DWORD (+280, 4byte) st.70 = 値 / 値 = st.70 (lpoke/lpeek も可)
; dwCompressionRatioOut : DWORD (+284, 4byte) st.71 = 値 / 値 = st.71 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; RAS_CONNECTION_1 サイズ: 296 バイト(x64)
dim st, 74 ; 4byte整数×74(構造体サイズ 296 / 4 切り上げ)
; hConnection : HANDLE (+0, 8byte) qpoke st,0,値 / qpeek(st,0) ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; hInterface : HANDLE (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; PppInfo : PPP_INFO (+16, 232byte) varptr(st)+16 を基点に操作(232byte:入れ子/配列)
; dwBytesXmited : DWORD (+248, 4byte) st.62 = 値 / 値 = st.62 (lpoke/lpeek も可)
; dwBytesRcved : DWORD (+252, 4byte) st.63 = 値 / 値 = st.63 (lpoke/lpeek も可)
; dwFramesXmited : DWORD (+256, 4byte) st.64 = 値 / 値 = st.64 (lpoke/lpeek も可)
; dwFramesRcved : DWORD (+260, 4byte) st.65 = 値 / 値 = st.65 (lpoke/lpeek も可)
; dwCrcErr : DWORD (+264, 4byte) st.66 = 値 / 値 = st.66 (lpoke/lpeek も可)
; dwTimeoutErr : DWORD (+268, 4byte) st.67 = 値 / 値 = st.67 (lpoke/lpeek も可)
; dwAlignmentErr : DWORD (+272, 4byte) st.68 = 値 / 値 = st.68 (lpoke/lpeek も可)
; dwHardwareOverrunErr : DWORD (+276, 4byte) st.69 = 値 / 値 = st.69 (lpoke/lpeek も可)
; dwFramingErr : DWORD (+280, 4byte) st.70 = 値 / 値 = st.70 (lpoke/lpeek も可)
; dwBufferOverrunErr : DWORD (+284, 4byte) st.71 = 値 / 値 = st.71 (lpoke/lpeek も可)
; dwCompressionRatioIn : DWORD (+288, 4byte) st.72 = 値 / 値 = st.72 (lpoke/lpeek も可)
; dwCompressionRatioOut : DWORD (+292, 4byte) st.73 = 値 / 値 = st.73 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global PPP_NBFCP_INFO
#field int dwError
#field wchar wszWksta 17
#endstruct
#defstruct global PPP_IPCP_INFO
#field int dwError
#field wchar wszAddress 16
#field wchar wszRemoteAddress 16
#endstruct
#defstruct global PPP_IPXCP_INFO
#field int dwError
#field wchar wszAddress 23
#endstruct
#defstruct global PPP_ATCP_INFO
#field int dwError
#field wchar wszAddress 33
#endstruct
#defstruct global PPP_INFO
#field PPP_NBFCP_INFO nbf
#field PPP_IPCP_INFO ip
#field PPP_IPXCP_INFO ipx
#field PPP_ATCP_INFO at
#endstruct
#defstruct global RAS_CONNECTION_1
#field intptr hConnection
#field intptr hInterface
#field PPP_INFO PppInfo
#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_CONNECTION_1 ; NSTRUCT 変数を確保
st->dwBytesXmited = 100
mes "dwBytesXmited=" + st->dwBytesXmited