2 * This file has no copyright assigned and is placed in the Public Domain.
3 * This file is part of the w64 mingw-runtime package.
4 * No warranty is given; refer to the file DISCLAIMER.PD within this package.
9 typedef PVOID FILTER_HANDLE
,*PFILTER_HANDLE
;
10 typedef PVOID INTERFACE_HANDLE
,*PINTERFACE_HANDLE
;
13 #define EXTERNCDECL EXTERN_C
18 #define PFAPIENTRY EXTERNCDECL DWORD WINAPI
20 typedef enum _GlobalFilter
{
21 GF_FRAGMENTS
= 2,GF_STRONGHOST
= 8,GF_FRAGCACHE
= 9
22 } GLOBAL_FILTER
,*PGLOBAL_FILTER
;
24 typedef enum _PfForwardAction
{
25 PF_ACTION_FORWARD
= 0,PF_ACTION_DROP
26 } PFFORWARD_ACTION
,*PPFFORWARD_ACTION
;
28 typedef enum _PfAddresType
{
30 } PFADDRESSTYPE
,*PPFADDRESSTYPE
;
32 #define FILTER_PROTO(ProtoId) MAKELONG(MAKEWORD((ProtoId),0x00),0x00000)
34 #define FILTER_PROTO_ANY FILTER_PROTO(0x00)
35 #define FILTER_PROTO_ICMP FILTER_PROTO(0x01)
36 #define FILTER_PROTO_TCP FILTER_PROTO(0x06)
37 #define FILTER_PROTO_UDP FILTER_PROTO(0x11)
39 #define FILTER_TCPUDP_PORT_ANY (WORD)0x0000
41 #define FILTER_ICMP_TYPE_ANY (BYTE)0xff
42 #define FILTER_ICMP_CODE_ANY (BYTE)0xff
44 typedef struct _PF_FILTER_DESCRIPTOR
{
47 PFADDRESSTYPE pfatType
;
56 WORD wSrcPortHighRange
;
57 WORD wDstPortHighRange
;
58 } PF_FILTER_DESCRIPTOR
,*PPF_FILTER_DESCRIPTOR
;
60 typedef struct _PF_FILTER_STATS
{
61 DWORD dwNumPacketsFiltered
;
62 PF_FILTER_DESCRIPTOR info
;
63 } PF_FILTER_STATS
,*PPF_FILTER_STATS
;
65 typedef struct _PF_INTERFACE_STATS
{
66 PVOID pvDriverContext
;
70 PFFORWARD_ACTION eaInAction
;
71 PFFORWARD_ACTION eaOutAction
;
73 DWORD dwNumOutFilters
;
79 LARGE_INTEGER liTotalLogged
;
80 DWORD dwLostLogEntries
;
81 PF_FILTER_STATS FilterInfo
[1];
82 } PF_INTERFACE_STATS
,*PPF_INTERFACE_STATS
;
84 #define FILTERSIZE (sizeof(PF_FILTER_DESCRIPTOR) - (DWORD)(&((PPF_FILTER_DESCRIPTOR)0)->SrcAddr))
86 #define FD_FLAGS_NOSYN 0x1
88 #define FD_FLAGS_ALLFLAGS FD_FLAGS_NOSYN
90 #define LB_SRC_ADDR_USE_SRCADDR_FLAG 0x00000001
91 #define LB_SRC_ADDR_USE_DSTADDR_FLAG 0x00000002
92 #define LB_DST_ADDR_USE_SRCADDR_FLAG 0x00000004
93 #define LB_DST_ADDR_USE_DSTADDR_FLAG 0x00000008
94 #define LB_SRC_MASK_LATE_FLAG 0x00000010
95 #define LB_DST_MASK_LATE_FLAG 0x00000020
97 typedef struct _PF_LATEBIND_INFO
{
101 } PF_LATEBIND_INFO
,*PPF_LATEBIND_INFO
;
103 typedef enum _PfFrameType
{
104 PFFT_FILTER
= 1,PFFT_FRAG
= 2,PFFT_SPOOF
= 3
105 } PFFRAMETYPE
,*PPFFRAMETYPE
;
107 typedef struct _pfLogFrame
{
108 LARGE_INTEGER Timestamp
;
109 PFFRAMETYPE pfeTypeOfFrame
;
110 DWORD dwTotalSizeUsed
;
112 WORD wSizeOfAdditionalData
;
113 WORD wSizeOfIpHeader
;
114 DWORD dwInterfaceName
;
117 } PFLOGFRAME
,*PPFLOGFRAME
;
119 #define ERROR_BASE 23000
121 #define PFERROR_NO_PF_INTERFACE (ERROR_BASE + 0)
122 #define PFERROR_NO_FILTERS_GIVEN (ERROR_BASE + 1)
123 #define PFERROR_BUFFER_TOO_SMALL (ERROR_BASE + 2)
124 #define ERROR_IPV6_NOT_IMPLEMENTED (ERROR_BASE + 3)
126 PFAPIENTRY
PfCreateInterface(DWORD dwName
,PFFORWARD_ACTION inAction
,PFFORWARD_ACTION outAction
,BOOL bUseLog
,BOOL bMustBeUnique
,INTERFACE_HANDLE
*ppInterface
);
127 PFAPIENTRY
PfDeleteInterface(INTERFACE_HANDLE pInterface
);
128 PFAPIENTRY
PfAddFiltersToInterface(INTERFACE_HANDLE ih
,DWORD cInFilters
,PPF_FILTER_DESCRIPTOR pfiltIn
,DWORD cOutFilters
,PPF_FILTER_DESCRIPTOR pfiltOut
,PFILTER_HANDLE pfHandle
);
129 PFAPIENTRY
PfRemoveFiltersFromInterface(INTERFACE_HANDLE ih
,DWORD cInFilters
,PPF_FILTER_DESCRIPTOR pfiltIn
,DWORD cOutFilters
,PPF_FILTER_DESCRIPTOR pfiltOut
);
130 PFAPIENTRY
PfRemoveFilterHandles(INTERFACE_HANDLE pInterface
,DWORD cFilters
,PFILTER_HANDLE pvHandles
);
131 PFAPIENTRY
PfUnBindInterface(INTERFACE_HANDLE pInterface
);
132 PFAPIENTRY
PfBindInterfaceToIndex(INTERFACE_HANDLE pInterface
,DWORD dwIndex
,PFADDRESSTYPE pfatLinkType
,PBYTE LinkIPAddress
);
133 PFAPIENTRY
PfBindInterfaceToIPAddress(INTERFACE_HANDLE pInterface
,PFADDRESSTYPE pfatType
,PBYTE IPAddress
);
134 PFAPIENTRY
PfRebindFilters(INTERFACE_HANDLE pInterface
,PPF_LATEBIND_INFO pLateBindInfo
);
135 PFAPIENTRY
PfAddGlobalFilterToInterface(INTERFACE_HANDLE pInterface
,GLOBAL_FILTER gfFilter
);
136 PFAPIENTRY
PfRemoveGlobalFilterFromInterface(INTERFACE_HANDLE pInterface
,GLOBAL_FILTER gfFilter
);
137 PFAPIENTRY
PfMakeLog(HANDLE hEvent
);
138 PFAPIENTRY
PfSetLogBuffer(PBYTE pbBuffer
,DWORD dwSize
,DWORD dwThreshold
,DWORD dwEntries
,PDWORD pdwLoggedEntries
,PDWORD pdwLostEntries
,PDWORD pdwSizeUsed
);
139 PFAPIENTRY
PfDeleteLog(VOID
);
140 PFAPIENTRY
PfGetInterfaceStatistics(INTERFACE_HANDLE pInterface
,PPF_INTERFACE_STATS ppfStats
,PDWORD pdwBufferSize
,BOOL fResetCounters
);
141 PFAPIENTRY
PfTestPacket(INTERFACE_HANDLE pInInterface
,INTERFACE_HANDLE pOutInterface
,DWORD cBytes
,PBYTE pbPacket
,PPFFORWARD_ACTION ppAction
);