ホーム › NetworkManagement.IpHelper › PF_FILTER_STATS
PF_FILTER_STATS
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| dwNumPacketsFiltered | DWORD | 4 | +0 | +0 | このフィルタによってフィルタ処理されたパケット数である。 |
| info | PF_FILTER_DESCRIPTOR | 64/44 | +8 | +4 | 対応するフィルタの記述子(PF_FILTER_DESCRIPTOR)である。 |
各言語での定義
#include <windows.h>
// PF_FILTER_DESCRIPTOR (x64 64 / x86 44 バイト)
typedef struct PF_FILTER_DESCRIPTOR {
DWORD dwFilterFlags;
DWORD dwRule;
PFADDRESSTYPE pfatType;
BYTE* SrcAddr;
BYTE* SrcMask;
BYTE* DstAddr;
BYTE* DstMask;
DWORD dwProtocol;
DWORD fLateBound;
WORD wSrcPort;
WORD wDstPort;
WORD wSrcPortHighRange;
WORD wDstPortHighRange;
} PF_FILTER_DESCRIPTOR;
// PF_FILTER_STATS (x64 72 / x86 48 バイト)
typedef struct PF_FILTER_STATS {
DWORD dwNumPacketsFiltered;
PF_FILTER_DESCRIPTOR info;
} PF_FILTER_STATS;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct PF_FILTER_DESCRIPTOR
{
public uint dwFilterFlags;
public uint dwRule;
public int pfatType;
public IntPtr SrcAddr;
public IntPtr SrcMask;
public IntPtr DstAddr;
public IntPtr DstMask;
public uint dwProtocol;
public uint fLateBound;
public ushort wSrcPort;
public ushort wDstPort;
public ushort wSrcPortHighRange;
public ushort wDstPortHighRange;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct PF_FILTER_STATS
{
public uint dwNumPacketsFiltered;
public PF_FILTER_DESCRIPTOR info;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure PF_FILTER_DESCRIPTOR
Public dwFilterFlags As UInteger
Public dwRule As UInteger
Public pfatType As Integer
Public SrcAddr As IntPtr
Public SrcMask As IntPtr
Public DstAddr As IntPtr
Public DstMask As IntPtr
Public dwProtocol As UInteger
Public fLateBound As UInteger
Public wSrcPort As UShort
Public wDstPort As UShort
Public wSrcPortHighRange As UShort
Public wDstPortHighRange As UShort
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure PF_FILTER_STATS
Public dwNumPacketsFiltered As UInteger
Public info As PF_FILTER_DESCRIPTOR
End Structureimport ctypes
from ctypes import wintypes
class PF_FILTER_DESCRIPTOR(ctypes.Structure):
_fields_ = [
("dwFilterFlags", wintypes.DWORD),
("dwRule", wintypes.DWORD),
("pfatType", ctypes.c_int),
("SrcAddr", ctypes.c_void_p),
("SrcMask", ctypes.c_void_p),
("DstAddr", ctypes.c_void_p),
("DstMask", ctypes.c_void_p),
("dwProtocol", wintypes.DWORD),
("fLateBound", wintypes.DWORD),
("wSrcPort", ctypes.c_ushort),
("wDstPort", ctypes.c_ushort),
("wSrcPortHighRange", ctypes.c_ushort),
("wDstPortHighRange", ctypes.c_ushort),
]
class PF_FILTER_STATS(ctypes.Structure):
_fields_ = [
("dwNumPacketsFiltered", wintypes.DWORD),
("info", PF_FILTER_DESCRIPTOR),
]#[repr(C)]
pub struct PF_FILTER_DESCRIPTOR {
pub dwFilterFlags: u32,
pub dwRule: u32,
pub pfatType: i32,
pub SrcAddr: *mut core::ffi::c_void,
pub SrcMask: *mut core::ffi::c_void,
pub DstAddr: *mut core::ffi::c_void,
pub DstMask: *mut core::ffi::c_void,
pub dwProtocol: u32,
pub fLateBound: u32,
pub wSrcPort: u16,
pub wDstPort: u16,
pub wSrcPortHighRange: u16,
pub wDstPortHighRange: u16,
}
#[repr(C)]
pub struct PF_FILTER_STATS {
pub dwNumPacketsFiltered: u32,
pub info: PF_FILTER_DESCRIPTOR,
}import "golang.org/x/sys/windows"
type PF_FILTER_DESCRIPTOR struct {
dwFilterFlags uint32
dwRule uint32
pfatType int32
SrcAddr uintptr
SrcMask uintptr
DstAddr uintptr
DstMask uintptr
dwProtocol uint32
fLateBound uint32
wSrcPort uint16
wDstPort uint16
wSrcPortHighRange uint16
wDstPortHighRange uint16
}
type PF_FILTER_STATS struct {
dwNumPacketsFiltered uint32
info PF_FILTER_DESCRIPTOR
}type
PF_FILTER_DESCRIPTOR = record
dwFilterFlags: DWORD;
dwRule: DWORD;
pfatType: Integer;
SrcAddr: Pointer;
SrcMask: Pointer;
DstAddr: Pointer;
DstMask: Pointer;
dwProtocol: DWORD;
fLateBound: DWORD;
wSrcPort: Word;
wDstPort: Word;
wSrcPortHighRange: Word;
wDstPortHighRange: Word;
end;
PF_FILTER_STATS = record
dwNumPacketsFiltered: DWORD;
info: PF_FILTER_DESCRIPTOR;
end;const PF_FILTER_DESCRIPTOR = extern struct {
dwFilterFlags: u32,
dwRule: u32,
pfatType: i32,
SrcAddr: ?*anyopaque,
SrcMask: ?*anyopaque,
DstAddr: ?*anyopaque,
DstMask: ?*anyopaque,
dwProtocol: u32,
fLateBound: u32,
wSrcPort: u16,
wDstPort: u16,
wSrcPortHighRange: u16,
wDstPortHighRange: u16,
};
const PF_FILTER_STATS = extern struct {
dwNumPacketsFiltered: u32,
info: PF_FILTER_DESCRIPTOR,
};type
PF_FILTER_DESCRIPTOR {.bycopy.} = object
dwFilterFlags: uint32
dwRule: uint32
pfatType: int32
SrcAddr: pointer
SrcMask: pointer
DstAddr: pointer
DstMask: pointer
dwProtocol: uint32
fLateBound: uint32
wSrcPort: uint16
wDstPort: uint16
wSrcPortHighRange: uint16
wDstPortHighRange: uint16
PF_FILTER_STATS {.bycopy.} = object
dwNumPacketsFiltered: uint32
info: PF_FILTER_DESCRIPTORstruct PF_FILTER_DESCRIPTOR
{
uint dwFilterFlags;
uint dwRule;
int pfatType;
void* SrcAddr;
void* SrcMask;
void* DstAddr;
void* DstMask;
uint dwProtocol;
uint fLateBound;
ushort wSrcPort;
ushort wDstPort;
ushort wSrcPortHighRange;
ushort wDstPortHighRange;
}
struct PF_FILTER_STATS
{
uint dwNumPacketsFiltered;
PF_FILTER_DESCRIPTOR info;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; PF_FILTER_STATS サイズ: 48 バイト(x86)
dim st, 12 ; 4byte整数×12(構造体サイズ 48 / 4 切り上げ)
; dwNumPacketsFiltered : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; info : PF_FILTER_DESCRIPTOR (+4, 44byte) varptr(st)+4 を基点に操作(44byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; PF_FILTER_STATS サイズ: 72 バイト(x64)
dim st, 18 ; 4byte整数×18(構造体サイズ 72 / 4 切り上げ)
; dwNumPacketsFiltered : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; info : PF_FILTER_DESCRIPTOR (+8, 64byte) varptr(st)+8 を基点に操作(64byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global PF_FILTER_DESCRIPTOR
#field int dwFilterFlags
#field int dwRule
#field int pfatType
#field intptr SrcAddr
#field intptr SrcMask
#field intptr DstAddr
#field intptr DstMask
#field int dwProtocol
#field int fLateBound
#field short wSrcPort
#field short wDstPort
#field short wSrcPortHighRange
#field short wDstPortHighRange
#endstruct
#defstruct global PF_FILTER_STATS
#field int dwNumPacketsFiltered
#field PF_FILTER_DESCRIPTOR info
#endstruct
stdim st, PF_FILTER_STATS ; NSTRUCT 変数を確保
st->dwNumPacketsFiltered = 100
mes "dwNumPacketsFiltered=" + st->dwNumPacketsFiltered