source: Daodan/MSYS2/mingw32/i686-w64-mingw32/include/fltdefs.h@ 1175

Last change on this file since 1175 was 1166, checked in by rossy, 3 years ago

Daodan: Replace MinGW build env with an up-to-date MSYS2 env

File size: 5.0 KB
Line 
1/**
2 * This file is part of the mingw-w64 runtime package.
3 * No warranty is given; refer to the file DISCLAIMER within this package.
4 */
5#ifndef _FLTDEFS_H
6#define _FLTDEFS_H
7
8#include <winapifamily.h>
9
10#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
11
12typedef PVOID FILTER_HANDLE,*PFILTER_HANDLE;
13typedef PVOID INTERFACE_HANDLE,*PINTERFACE_HANDLE;
14
15#define PFEXPORT __declspec(dllexport)
16
17#ifdef __cplusplus
18#define EXTERNCDECL EXTERN_C
19#else
20#define EXTERNCDECL
21#endif
22
23#define PFAPIENTRY EXTERNCDECL DWORD PFEXPORT WINAPI
24
25typedef enum _GlobalFilter {
26 GF_FRAGMENTS = 2,GF_STRONGHOST = 8,GF_FRAGCACHE = 9
27} GLOBAL_FILTER,*PGLOBAL_FILTER;
28
29typedef enum _PfForwardAction {
30 PF_ACTION_FORWARD = 0,PF_ACTION_DROP
31} PFFORWARD_ACTION,*PPFFORWARD_ACTION;
32
33typedef enum _PfAddresType {
34 PF_IPV4,PF_IPV6
35} PFADDRESSTYPE,*PPFADDRESSTYPE;
36
37#define FILTER_PROTO(ProtoId) MAKELONG(MAKEWORD((ProtoId),0x00),0x00000)
38
39#define FILTER_PROTO_ANY FILTER_PROTO(0x00)
40#define FILTER_PROTO_ICMP FILTER_PROTO(0x01)
41#define FILTER_PROTO_TCP FILTER_PROTO(0x06)
42#define FILTER_PROTO_UDP FILTER_PROTO(0x11)
43
44#define FILTER_TCPUDP_PORT_ANY (WORD)0x0000
45
46#define FILTER_ICMP_TYPE_ANY (BYTE)0xff
47#define FILTER_ICMP_CODE_ANY (BYTE)0xff
48
49typedef struct _PF_FILTER_DESCRIPTOR {
50 DWORD dwFilterFlags;
51 DWORD dwRule;
52 PFADDRESSTYPE pfatType;
53 PBYTE SrcAddr;
54 PBYTE SrcMask;
55 PBYTE DstAddr;
56 PBYTE DstMask;
57 DWORD dwProtocol;
58 DWORD fLateBound;
59 WORD wSrcPort;
60 WORD wDstPort;
61 WORD wSrcPortHighRange;
62 WORD wDstPortHighRange;
63} PF_FILTER_DESCRIPTOR,*PPF_FILTER_DESCRIPTOR;
64
65typedef struct _PF_FILTER_STATS {
66 DWORD dwNumPacketsFiltered;
67 PF_FILTER_DESCRIPTOR info;
68} PF_FILTER_STATS,*PPF_FILTER_STATS;
69
70typedef struct _PF_INTERFACE_STATS {
71 PVOID pvDriverContext;
72 DWORD dwFlags;
73 DWORD dwInDrops;
74 DWORD dwOutDrops;
75 PFFORWARD_ACTION eaInAction;
76 PFFORWARD_ACTION eaOutAction;
77 DWORD dwNumInFilters;
78 DWORD dwNumOutFilters;
79 DWORD dwFrag;
80 DWORD dwSpoof;
81 DWORD dwReserved1;
82 DWORD dwReserved2;
83 LARGE_INTEGER liSYN;
84 LARGE_INTEGER liTotalLogged;
85 DWORD dwLostLogEntries;
86 PF_FILTER_STATS FilterInfo[1];
87} PF_INTERFACE_STATS,*PPF_INTERFACE_STATS;
88
89#define FILTERSIZE (sizeof(PF_FILTER_DESCRIPTOR) - (DWORD)(&((PPF_FILTER_DESCRIPTOR)0)->SrcAddr))
90
91#define FD_FLAGS_NOSYN 0x1
92
93#define FD_FLAGS_ALLFLAGS FD_FLAGS_NOSYN
94
95#define LB_SRC_ADDR_USE_SRCADDR_FLAG 0x00000001
96#define LB_SRC_ADDR_USE_DSTADDR_FLAG 0x00000002
97#define LB_DST_ADDR_USE_SRCADDR_FLAG 0x00000004
98#define LB_DST_ADDR_USE_DSTADDR_FLAG 0x00000008
99#define LB_SRC_MASK_LATE_FLAG 0x00000010
100#define LB_DST_MASK_LATE_FLAG 0x00000020
101
102typedef struct _PF_LATEBIND_INFO {
103 PBYTE SrcAddr;
104 PBYTE DstAddr;
105 PBYTE Mask;
106} PF_LATEBIND_INFO,*PPF_LATEBIND_INFO;
107
108typedef enum _PfFrameType {
109 PFFT_FILTER = 1,PFFT_FRAG = 2,PFFT_SPOOF = 3
110} PFFRAMETYPE,*PPFFRAMETYPE;
111
112typedef struct _pfLogFrame {
113 LARGE_INTEGER Timestamp;
114 PFFRAMETYPE pfeTypeOfFrame;
115 DWORD dwTotalSizeUsed;
116 DWORD dwFilterRule;
117 WORD wSizeOfAdditionalData;
118 WORD wSizeOfIpHeader;
119 DWORD dwInterfaceName;
120 DWORD dwIPIndex;
121 BYTE bPacketData[1];
122} PFLOGFRAME,*PPFLOGFRAME;
123
124#define ERROR_BASE 23000
125
126#define PFERROR_NO_PF_INTERFACE (ERROR_BASE + 0)
127#define PFERROR_NO_FILTERS_GIVEN (ERROR_BASE + 1)
128#define PFERROR_BUFFER_TOO_SMALL (ERROR_BASE + 2)
129#define ERROR_IPV6_NOT_IMPLEMENTED (ERROR_BASE + 3)
130
131PFAPIENTRY PfCreateInterface(DWORD dwName,PFFORWARD_ACTION inAction,PFFORWARD_ACTION outAction,WINBOOL bUseLog,WINBOOL bMustBeUnique,INTERFACE_HANDLE *ppInterface);
132PFAPIENTRY PfDeleteInterface(INTERFACE_HANDLE pInterface);
133PFAPIENTRY PfAddFiltersToInterface(INTERFACE_HANDLE ih,DWORD cInFilters,PPF_FILTER_DESCRIPTOR pfiltIn,DWORD cOutFilters,PPF_FILTER_DESCRIPTOR pfiltOut,PFILTER_HANDLE pfHandle);
134PFAPIENTRY PfRemoveFiltersFromInterface(INTERFACE_HANDLE ih,DWORD cInFilters,PPF_FILTER_DESCRIPTOR pfiltIn,DWORD cOutFilters,PPF_FILTER_DESCRIPTOR pfiltOut);
135PFAPIENTRY PfRemoveFilterHandles(INTERFACE_HANDLE pInterface,DWORD cFilters,PFILTER_HANDLE pvHandles);
136PFAPIENTRY PfUnBindInterface(INTERFACE_HANDLE pInterface);
137PFAPIENTRY PfBindInterfaceToIndex(INTERFACE_HANDLE pInterface,DWORD dwIndex,PFADDRESSTYPE pfatLinkType,PBYTE LinkIPAddress);
138PFAPIENTRY PfBindInterfaceToIPAddress(INTERFACE_HANDLE pInterface,PFADDRESSTYPE pfatType,PBYTE IPAddress);
139PFAPIENTRY PfRebindFilters(INTERFACE_HANDLE pInterface,PPF_LATEBIND_INFO pLateBindInfo);
140PFAPIENTRY PfAddGlobalFilterToInterface(INTERFACE_HANDLE pInterface,GLOBAL_FILTER gfFilter);
141PFAPIENTRY PfRemoveGlobalFilterFromInterface(INTERFACE_HANDLE pInterface,GLOBAL_FILTER gfFilter);
142PFAPIENTRY PfMakeLog(HANDLE hEvent);
143PFAPIENTRY PfSetLogBuffer(PBYTE pbBuffer,DWORD dwSize,DWORD dwThreshold,DWORD dwEntries,PDWORD pdwLoggedEntries,PDWORD pdwLostEntries,PDWORD pdwSizeUsed);
144PFAPIENTRY PfDeleteLog(VOID);
145PFAPIENTRY PfGetInterfaceStatistics(INTERFACE_HANDLE pInterface,PPF_INTERFACE_STATS ppfStats,PDWORD pdwBufferSize,WINBOOL fResetCounters);
146PFAPIENTRY PfTestPacket(INTERFACE_HANDLE pInInterface,INTERFACE_HANDLE pOutInterface,DWORD cBytes,PBYTE pbPacket,PPFFORWARD_ACTION ppAction);
147
148#endif /* WINAPI_PARTION_DESKTOP. */
149
150#endif
Note: See TracBrowser for help on using the repository browser.