ホーム › Networking.WinSock › IPX_NETNUM_DATA
IPX_NETNUM_DATA
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| netnum | BYTE | 4 | +0 | +0 | 対象のIPXネットワーク番号(4バイト)である。 |
| hopcount | WORD | 2 | +4 | +4 | 宛先ネットワークまでのホップ数である。 |
| netdelay | WORD | 2 | +6 | +6 | 宛先ネットワークまでの遅延時間である。 |
| cardnum | INT | 4 | +8 | +8 | 経路に使用するアダプタ(カード)番号である。 |
| router | BYTE | 6 | +12 | +12 | 次ホップルータのノードアドレス(6バイト)である。 |
各言語での定義
#include <windows.h>
// IPX_NETNUM_DATA (x64 20 / x86 20 バイト)
typedef struct IPX_NETNUM_DATA {
BYTE netnum[4];
WORD hopcount;
WORD netdelay;
INT cardnum;
BYTE router[6];
} IPX_NETNUM_DATA;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct IPX_NETNUM_DATA
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public byte[] netnum;
public ushort hopcount;
public ushort netdelay;
public int cardnum;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] public byte[] router;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure IPX_NETNUM_DATA
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=4)> Public netnum() As Byte
Public hopcount As UShort
Public netdelay As UShort
Public cardnum As Integer
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=6)> Public router() As Byte
End Structureimport ctypes
from ctypes import wintypes
class IPX_NETNUM_DATA(ctypes.Structure):
_fields_ = [
("netnum", ctypes.c_ubyte * 4),
("hopcount", ctypes.c_ushort),
("netdelay", ctypes.c_ushort),
("cardnum", ctypes.c_int),
("router", ctypes.c_ubyte * 6),
]#[repr(C)]
pub struct IPX_NETNUM_DATA {
pub netnum: [u8; 4],
pub hopcount: u16,
pub netdelay: u16,
pub cardnum: i32,
pub router: [u8; 6],
}import "golang.org/x/sys/windows"
type IPX_NETNUM_DATA struct {
netnum [4]byte
hopcount uint16
netdelay uint16
cardnum int32
router [6]byte
}type
IPX_NETNUM_DATA = record
netnum: array[0..3] of Byte;
hopcount: Word;
netdelay: Word;
cardnum: Integer;
router: array[0..5] of Byte;
end;const IPX_NETNUM_DATA = extern struct {
netnum: [4]u8,
hopcount: u16,
netdelay: u16,
cardnum: i32,
router: [6]u8,
};type
IPX_NETNUM_DATA {.bycopy.} = object
netnum: array[4, uint8]
hopcount: uint16
netdelay: uint16
cardnum: int32
router: array[6, uint8]struct IPX_NETNUM_DATA
{
ubyte[4] netnum;
ushort hopcount;
ushort netdelay;
int cardnum;
ubyte[6] router;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; IPX_NETNUM_DATA サイズ: 20 バイト(x64)
dim st, 5 ; 4byte整数×5(構造体サイズ 20 / 4 切り上げ)
; netnum : BYTE (+0, 4byte) varptr(st)+0 を基点に操作(4byte:入れ子/配列)
; hopcount : WORD (+4, 2byte) wpoke st,4,値 / 値 = wpeek(st,4)
; netdelay : WORD (+6, 2byte) wpoke st,6,値 / 値 = wpeek(st,6)
; cardnum : INT (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; router : BYTE (+12, 6byte) varptr(st)+12 を基点に操作(6byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global IPX_NETNUM_DATA
#field byte netnum 4
#field short hopcount
#field short netdelay
#field int cardnum
#field byte router 6
#endstruct
stdim st, IPX_NETNUM_DATA ; NSTRUCT 変数を確保
st->hopcount = 100
mes "hopcount=" + st->hopcount