ホーム › Networking.WinSock › ATM_PVC_PARAMS
ATM_PVC_PARAMS
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| PvcConnectionId | ATM_CONNECTION_ID | 12 | +0 | +0 | PVC接続を識別するATM_CONNECTION_ID構造体。 |
| PvcQos | QOS | 80/72 | +12 | +12 | PVCに適用するサービス品質を保持するQOS構造体。 |
各言語での定義
#include <windows.h>
// ATM_CONNECTION_ID (x64 12 / x86 12 バイト)
typedef struct ATM_CONNECTION_ID {
DWORD DeviceNumber;
DWORD VPI;
DWORD VCI;
} ATM_CONNECTION_ID;
// FLOWSPEC (x64 32 / x86 32 バイト)
typedef struct FLOWSPEC {
DWORD TokenRate;
DWORD TokenBucketSize;
DWORD PeakBandwidth;
DWORD Latency;
DWORD DelayVariation;
DWORD ServiceType;
DWORD MaxSduSize;
DWORD MinimumPolicedSize;
} FLOWSPEC;
// WSABUF (x64 16 / x86 8 バイト)
typedef struct WSABUF {
DWORD len;
LPSTR buf;
} WSABUF;
// QOS (x64 80 / x86 72 バイト)
typedef struct QOS {
FLOWSPEC SendingFlowspec;
FLOWSPEC ReceivingFlowspec;
WSABUF ProviderSpecific;
} QOS;
// ATM_PVC_PARAMS (x64 92 / x86 84 バイト)
#pragma pack(push, 4)
typedef struct ATM_PVC_PARAMS {
ATM_CONNECTION_ID PvcConnectionId;
QOS PvcQos;
} ATM_PVC_PARAMS;
#pragma pack(pop)using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct ATM_CONNECTION_ID
{
public uint DeviceNumber;
public uint VPI;
public uint VCI;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct FLOWSPEC
{
public uint TokenRate;
public uint TokenBucketSize;
public uint PeakBandwidth;
public uint Latency;
public uint DelayVariation;
public uint ServiceType;
public uint MaxSduSize;
public uint MinimumPolicedSize;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WSABUF
{
public uint len;
public IntPtr buf;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct QOS
{
public FLOWSPEC SendingFlowspec;
public FLOWSPEC ReceivingFlowspec;
public WSABUF ProviderSpecific;
}
[StructLayout(LayoutKind.Sequential, Pack = 4, CharSet = CharSet.Unicode)]
public struct ATM_PVC_PARAMS
{
public ATM_CONNECTION_ID PvcConnectionId;
public QOS PvcQos;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure ATM_CONNECTION_ID
Public DeviceNumber As UInteger
Public VPI As UInteger
Public VCI As UInteger
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure FLOWSPEC
Public TokenRate As UInteger
Public TokenBucketSize As UInteger
Public PeakBandwidth As UInteger
Public Latency As UInteger
Public DelayVariation As UInteger
Public ServiceType As UInteger
Public MaxSduSize As UInteger
Public MinimumPolicedSize As UInteger
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WSABUF
Public len As UInteger
Public buf As IntPtr
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure QOS
Public SendingFlowspec As FLOWSPEC
Public ReceivingFlowspec As FLOWSPEC
Public ProviderSpecific As WSABUF
End Structure
<StructLayout(LayoutKind.Sequential, Pack:=4, CharSet:=CharSet.Unicode)>
Public Structure ATM_PVC_PARAMS
Public PvcConnectionId As ATM_CONNECTION_ID
Public PvcQos As QOS
End Structureimport ctypes
from ctypes import wintypes
class ATM_CONNECTION_ID(ctypes.Structure):
_fields_ = [
("DeviceNumber", wintypes.DWORD),
("VPI", wintypes.DWORD),
("VCI", wintypes.DWORD),
]
class FLOWSPEC(ctypes.Structure):
_fields_ = [
("TokenRate", wintypes.DWORD),
("TokenBucketSize", wintypes.DWORD),
("PeakBandwidth", wintypes.DWORD),
("Latency", wintypes.DWORD),
("DelayVariation", wintypes.DWORD),
("ServiceType", wintypes.DWORD),
("MaxSduSize", wintypes.DWORD),
("MinimumPolicedSize", wintypes.DWORD),
]
class WSABUF(ctypes.Structure):
_fields_ = [
("len", wintypes.DWORD),
("buf", ctypes.c_void_p),
]
class QOS(ctypes.Structure):
_fields_ = [
("SendingFlowspec", FLOWSPEC),
("ReceivingFlowspec", FLOWSPEC),
("ProviderSpecific", WSABUF),
]
class ATM_PVC_PARAMS(ctypes.Structure):
_pack_ = 4
_fields_ = [
("PvcConnectionId", ATM_CONNECTION_ID),
("PvcQos", QOS),
]#[repr(C)]
pub struct ATM_CONNECTION_ID {
pub DeviceNumber: u32,
pub VPI: u32,
pub VCI: u32,
}
#[repr(C)]
pub struct FLOWSPEC {
pub TokenRate: u32,
pub TokenBucketSize: u32,
pub PeakBandwidth: u32,
pub Latency: u32,
pub DelayVariation: u32,
pub ServiceType: u32,
pub MaxSduSize: u32,
pub MinimumPolicedSize: u32,
}
#[repr(C)]
pub struct WSABUF {
pub len: u32,
pub buf: *mut core::ffi::c_void,
}
#[repr(C)]
pub struct QOS {
pub SendingFlowspec: FLOWSPEC,
pub ReceivingFlowspec: FLOWSPEC,
pub ProviderSpecific: WSABUF,
}
#[repr(C, packed(4))]
pub struct ATM_PVC_PARAMS {
pub PvcConnectionId: ATM_CONNECTION_ID,
pub PvcQos: QOS,
}import "golang.org/x/sys/windows"
type ATM_CONNECTION_ID struct {
DeviceNumber uint32
VPI uint32
VCI uint32
}
type FLOWSPEC struct {
TokenRate uint32
TokenBucketSize uint32
PeakBandwidth uint32
Latency uint32
DelayVariation uint32
ServiceType uint32
MaxSduSize uint32
MinimumPolicedSize uint32
}
type WSABUF struct {
len uint32
buf uintptr
}
type QOS struct {
SendingFlowspec FLOWSPEC
ReceivingFlowspec FLOWSPEC
ProviderSpecific WSABUF
}
type ATM_PVC_PARAMS struct {
PvcConnectionId ATM_CONNECTION_ID
PvcQos QOS
}type
ATM_CONNECTION_ID = record
DeviceNumber: DWORD;
VPI: DWORD;
VCI: DWORD;
end;
FLOWSPEC = record
TokenRate: DWORD;
TokenBucketSize: DWORD;
PeakBandwidth: DWORD;
Latency: DWORD;
DelayVariation: DWORD;
ServiceType: DWORD;
MaxSduSize: DWORD;
MinimumPolicedSize: DWORD;
end;
WSABUF = record
len: DWORD;
buf: Pointer;
end;
QOS = record
SendingFlowspec: FLOWSPEC;
ReceivingFlowspec: FLOWSPEC;
ProviderSpecific: WSABUF;
end;
ATM_PVC_PARAMS = packed record
PvcConnectionId: ATM_CONNECTION_ID;
PvcQos: QOS;
end;const ATM_CONNECTION_ID = extern struct {
DeviceNumber: u32,
VPI: u32,
VCI: u32,
};
const FLOWSPEC = extern struct {
TokenRate: u32,
TokenBucketSize: u32,
PeakBandwidth: u32,
Latency: u32,
DelayVariation: u32,
ServiceType: u32,
MaxSduSize: u32,
MinimumPolicedSize: u32,
};
const WSABUF = extern struct {
len: u32,
buf: ?*anyopaque,
};
const QOS = extern struct {
SendingFlowspec: FLOWSPEC,
ReceivingFlowspec: FLOWSPEC,
ProviderSpecific: WSABUF,
};
const ATM_PVC_PARAMS = extern struct {
PvcConnectionId: ATM_CONNECTION_ID,
PvcQos: QOS,
};type
ATM_CONNECTION_ID {.bycopy.} = object
DeviceNumber: uint32
VPI: uint32
VCI: uint32
FLOWSPEC {.bycopy.} = object
TokenRate: uint32
TokenBucketSize: uint32
PeakBandwidth: uint32
Latency: uint32
DelayVariation: uint32
ServiceType: uint32
MaxSduSize: uint32
MinimumPolicedSize: uint32
WSABUF {.bycopy.} = object
len: uint32
buf: pointer
QOS {.bycopy.} = object
SendingFlowspec: FLOWSPEC
ReceivingFlowspec: FLOWSPEC
ProviderSpecific: WSABUF
ATM_PVC_PARAMS {.packed.} = object
PvcConnectionId: ATM_CONNECTION_ID
PvcQos: QOSstruct ATM_CONNECTION_ID
{
uint DeviceNumber;
uint VPI;
uint VCI;
}
struct FLOWSPEC
{
uint TokenRate;
uint TokenBucketSize;
uint PeakBandwidth;
uint Latency;
uint DelayVariation;
uint ServiceType;
uint MaxSduSize;
uint MinimumPolicedSize;
}
struct WSABUF
{
uint len;
void* buf;
}
struct QOS
{
FLOWSPEC SendingFlowspec;
FLOWSPEC ReceivingFlowspec;
WSABUF ProviderSpecific;
}
align(4)
struct ATM_PVC_PARAMS
{
ATM_CONNECTION_ID PvcConnectionId;
QOS PvcQos;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; ATM_PVC_PARAMS サイズ: 84 バイト(x86)
dim st, 21 ; 4byte整数×21(構造体サイズ 84 / 4 切り上げ)
; PvcConnectionId : ATM_CONNECTION_ID (+0, 12byte) varptr(st)+0 を基点に操作(12byte:入れ子/配列)
; PvcQos : QOS (+12, 72byte) varptr(st)+12 を基点に操作(72byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; ATM_PVC_PARAMS サイズ: 92 バイト(x64)
dim st, 23 ; 4byte整数×23(構造体サイズ 92 / 4 切り上げ)
; PvcConnectionId : ATM_CONNECTION_ID (+0, 12byte) varptr(st)+0 を基点に操作(12byte:入れ子/配列)
; PvcQos : QOS (+12, 80byte) varptr(st)+12 を基点に操作(80byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global ATM_CONNECTION_ID
#field int DeviceNumber
#field int VPI
#field int VCI
#endstruct
#defstruct global FLOWSPEC
#field int TokenRate
#field int TokenBucketSize
#field int PeakBandwidth
#field int Latency
#field int DelayVariation
#field int ServiceType
#field int MaxSduSize
#field int MinimumPolicedSize
#endstruct
#defstruct global WSABUF
#field int len
#field intptr buf
#endstruct
#defstruct global QOS
#field FLOWSPEC SendingFlowspec
#field FLOWSPEC ReceivingFlowspec
#field WSABUF ProviderSpecific
#endstruct
#defstruct global ATM_PVC_PARAMS, pack=4
#field ATM_CONNECTION_ID PvcConnectionId
#field QOS PvcQos
#endstruct
stdim st, ATM_PVC_PARAMS ; NSTRUCT 変数を確保