ホーム › Networking.WinSock › IN_RECVERR
IN_RECVERR
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| protocol | IPPROTO | 4 | +0 | +0 | エラーを報告したプロトコルを示す値である。 |
| info | DWORD | 4 | +4 | +4 | エラーに付随する追加情報(MTU値等)である。 |
| type | BYTE | 1 | +8 | +8 | ICMPエラーのタイプ値である。 |
| code | BYTE | 1 | +9 | +9 | ICMPエラーのコード値である。 |
各言語での定義
#include <windows.h>
// IN_RECVERR (x64 12 / x86 12 バイト)
typedef struct IN_RECVERR {
IPPROTO protocol;
DWORD info;
BYTE type;
BYTE code;
} IN_RECVERR;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct IN_RECVERR
{
public int protocol;
public uint info;
public byte type;
public byte code;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure IN_RECVERR
Public protocol As Integer
Public info As UInteger
Public type As Byte
Public code As Byte
End Structureimport ctypes
from ctypes import wintypes
class IN_RECVERR(ctypes.Structure):
_fields_ = [
("protocol", ctypes.c_int),
("info", wintypes.DWORD),
("type", ctypes.c_ubyte),
("code", ctypes.c_ubyte),
]#[repr(C)]
pub struct IN_RECVERR {
pub protocol: i32,
pub info: u32,
pub type: u8,
pub code: u8,
}import "golang.org/x/sys/windows"
type IN_RECVERR struct {
protocol int32
info uint32
type byte
code byte
}type
IN_RECVERR = record
protocol: Integer;
info: DWORD;
type: Byte;
code: Byte;
end;const IN_RECVERR = extern struct {
protocol: i32,
info: u32,
type: u8,
code: u8,
};type
IN_RECVERR {.bycopy.} = object
protocol: int32
info: uint32
type: uint8
code: uint8struct IN_RECVERR
{
int protocol;
uint info;
ubyte type;
ubyte code;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; IN_RECVERR サイズ: 12 バイト(x64)
dim st, 3 ; 4byte整数×3(構造体サイズ 12 / 4 切り上げ)
; protocol : IPPROTO (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; info : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; type : BYTE (+8, 1byte) poke st,8,値 / 値 = peek(st,8)
; code : BYTE (+9, 1byte) poke st,9,値 / 値 = peek(st,9)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global IN_RECVERR
#field int protocol
#field int info
#field byte type
#field byte code
#endstruct
stdim st, IN_RECVERR ; NSTRUCT 変数を確保
st->protocol = 100
mes "protocol=" + st->protocol