xref: /reactos/sdk/include/ddk/afilter.h (revision c2c66aff)
1*c2c66affSColin Finck /*
2*c2c66affSColin Finck  * afilter.h
3*c2c66affSColin Finck  *
4*c2c66affSColin Finck  * Address filtering for NDIS MACs
5*c2c66affSColin Finck  *
6*c2c66affSColin Finck  * This file is part of the w32api package.
7*c2c66affSColin Finck  *
8*c2c66affSColin Finck  * Contributors:
9*c2c66affSColin Finck  *   Created by Filip Navara <xnavara@volny.cz>
10*c2c66affSColin Finck  *
11*c2c66affSColin Finck  * THIS SOFTWARE IS NOT COPYRIGHTED
12*c2c66affSColin Finck  *
13*c2c66affSColin Finck  * This source code is offered for use in the public domain. You may
14*c2c66affSColin Finck  * use, modify or distribute it freely.
15*c2c66affSColin Finck  *
16*c2c66affSColin Finck  * This code is distributed in the hope that it will be useful but
17*c2c66affSColin Finck  * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
18*c2c66affSColin Finck  * DISCLAIMED. This includes but is not limited to warranties of
19*c2c66affSColin Finck  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20*c2c66affSColin Finck  *
21*c2c66affSColin Finck  */
22*c2c66affSColin Finck 
23*c2c66affSColin Finck #ifndef _ARC_FILTER_DEFS_
24*c2c66affSColin Finck #define _ARC_FILTER_DEFS_
25*c2c66affSColin Finck 
26*c2c66affSColin Finck #ifdef __cplusplus
27*c2c66affSColin Finck extern "C" {
28*c2c66affSColin Finck #endif
29*c2c66affSColin Finck 
30*c2c66affSColin Finck #define ARC_RECEIVE_BUFFERS            64
31*c2c66affSColin Finck #define ARCNET_ADDRESS_LEN             1
32*c2c66affSColin Finck #define ARC_PROTOCOL_HEADER_SIZE       (sizeof(ARC_PROTOCOL_HEADER))
33*c2c66affSColin Finck #define ARC_MAX_FRAME_SIZE             504
34*c2c66affSColin Finck #define ARC_MAX_ADDRESS_IDS            256
35*c2c66affSColin Finck #define ARC_MAX_FRAME_HEADER_SIZE      6
36*c2c66affSColin Finck #define ARC_MAX_PACKET_SIZE            576
37*c2c66affSColin Finck #define ARC_FILTER_MAX_OPENS           (sizeof(ULONG) * 8)
38*c2c66affSColin Finck 
39*c2c66affSColin Finck #define ARC_IS_BROADCAST(Address) (BOOLEAN)(!(Address))
40*c2c66affSColin Finck 
41*c2c66affSColin Finck #define ARC_QUERY_FILTER_CLASSES(Filter) ((Filter)->CombinedPacketFilter)
42*c2c66affSColin Finck #define ARC_QUERY_PACKET_FILTER(Filter, NdisFilterHandle) \
43*c2c66affSColin Finck         (((PARC_BINDING_INFO)(NdisFilterHandle))->PacketFilters)
44*c2c66affSColin Finck 
45*c2c66affSColin Finck typedef ULONG MASK, *PMASK;
46*c2c66affSColin Finck 
47*c2c66affSColin Finck typedef struct _ARC_BUFFER_LIST
48*c2c66affSColin Finck {
49*c2c66affSColin Finck   PVOID  Buffer;
50*c2c66affSColin Finck   UINT  Size;
51*c2c66affSColin Finck   UINT  BytesLeft;
52*c2c66affSColin Finck   struct _ARC_BUFFER_LIST  *Next;
53*c2c66affSColin Finck } ARC_BUFFER_LIST, *PARC_BUFFER_LIST;
54*c2c66affSColin Finck 
55*c2c66affSColin Finck typedef struct _ARC_PROTOCOL_HEADER
56*c2c66affSColin Finck {
57*c2c66affSColin Finck   UCHAR  SourceId[ARCNET_ADDRESS_LEN];
58*c2c66affSColin Finck   UCHAR  DestId[ARCNET_ADDRESS_LEN];
59*c2c66affSColin Finck   UCHAR  ProtId;
60*c2c66affSColin Finck } ARC_PROTOCOL_HEADER, *PARC_PROTOCOL_HEADER;
61*c2c66affSColin Finck 
62*c2c66affSColin Finck typedef struct _ARC_PACKET_HEADER
63*c2c66affSColin Finck {
64*c2c66affSColin Finck   ARC_PROTOCOL_HEADER  ProtHeader;
65*c2c66affSColin Finck   USHORT  FrameSequence;
66*c2c66affSColin Finck   UCHAR  SplitFlag;
67*c2c66affSColin Finck   UCHAR  LastSplitFlag;
68*c2c66affSColin Finck   UCHAR  FramesReceived;
69*c2c66affSColin Finck } ARC_PACKET_HEADER, *PARC_PACKET_HEADER;
70*c2c66affSColin Finck 
71*c2c66affSColin Finck typedef struct _ARC_PACKET
72*c2c66affSColin Finck {
73*c2c66affSColin Finck   ARC_PACKET_HEADER  Header;
74*c2c66affSColin Finck   struct _ARC_PACKET  *Next;
75*c2c66affSColin Finck   ULONG  TotalLength;
76*c2c66affSColin Finck   BOOLEAN  LastFrame;
77*c2c66affSColin Finck   PARC_BUFFER_LIST  FirstBuffer;
78*c2c66affSColin Finck   PARC_BUFFER_LIST  LastBuffer;
79*c2c66affSColin Finck   NDIS_PACKET  TmpNdisPacket;
80*c2c66affSColin Finck } ARC_PACKET, *PARC_PACKET;
81*c2c66affSColin Finck 
82*c2c66affSColin Finck typedef struct _ARC_BINDING_INFO
83*c2c66affSColin Finck {
84*c2c66affSColin Finck   PNDIS_OPEN_BLOCK  NdisBindingHandle;
85*c2c66affSColin Finck   PVOID  Reserved;
86*c2c66affSColin Finck   UINT  PacketFilters;
87*c2c66affSColin Finck   ULONG  References;
88*c2c66affSColin Finck   struct _ARC_BINDING_INFO  *NextOpen;
89*c2c66affSColin Finck   BOOLEAN  ReceivedAPacket;
90*c2c66affSColin Finck   UINT  OldPacketFilters;
91*c2c66affSColin Finck } ARC_BINDING_INFO,*PARC_BINDING_INFO;
92*c2c66affSColin Finck 
93*c2c66affSColin Finck typedef struct _ARC_FILTER
94*c2c66affSColin Finck {
95*c2c66affSColin Finck   struct _NDIS_MINIPORT_BLOCK  *Miniport;
96*c2c66affSColin Finck   UINT  CombinedPacketFilter;
97*c2c66affSColin Finck   PARC_BINDING_INFO  OpenList;
98*c2c66affSColin Finck   NDIS_HANDLE  ReceiveBufferPool;
99*c2c66affSColin Finck   PARC_BUFFER_LIST  FreeBufferList;
100*c2c66affSColin Finck   PARC_PACKET  FreePackets;
101*c2c66affSColin Finck   PARC_PACKET  OutstandingPackets;
102*c2c66affSColin Finck   UCHAR  AdapterAddress;
103*c2c66affSColin Finck   UINT  OldCombinedPacketFilter;
104*c2c66affSColin Finck } ARC_FILTER,*PARC_FILTER;
105*c2c66affSColin Finck 
106*c2c66affSColin Finck BOOLEAN
107*c2c66affSColin Finck NTAPI
108*c2c66affSColin Finck ArcCreateFilter(
109*c2c66affSColin Finck   IN struct _NDIS_MINIPORT_BLOCK  *Miniport,
110*c2c66affSColin Finck   IN UCHAR  AdapterAddress,
111*c2c66affSColin Finck   OUT PARC_FILTER  *Filter);
112*c2c66affSColin Finck 
113*c2c66affSColin Finck VOID
114*c2c66affSColin Finck NTAPI
115*c2c66affSColin Finck ArcDeleteFilter(
116*c2c66affSColin Finck   IN PARC_FILTER Filter);
117*c2c66affSColin Finck 
118*c2c66affSColin Finck BOOLEAN
119*c2c66affSColin Finck NTAPI
120*c2c66affSColin Finck ArcNoteFilterOpenAdapter(
121*c2c66affSColin Finck   IN PARC_FILTER  Filter,
122*c2c66affSColin Finck   IN NDIS_HANDLE  NdisBindingHandle,
123*c2c66affSColin Finck   OUT PNDIS_HANDLE  NdisFilterHandle);
124*c2c66affSColin Finck 
125*c2c66affSColin Finck NDIS_STATUS
126*c2c66affSColin Finck NTAPI
127*c2c66affSColin Finck ArcDeleteFilterOpenAdapter(
128*c2c66affSColin Finck   IN PARC_FILTER  Filter,
129*c2c66affSColin Finck   IN NDIS_HANDLE  NdisFilterHandle,
130*c2c66affSColin Finck   IN PNDIS_REQUEST  NdisRequest);
131*c2c66affSColin Finck 
132*c2c66affSColin Finck NDIS_STATUS
133*c2c66affSColin Finck NTAPI
134*c2c66affSColin Finck ArcFilterAdjust(
135*c2c66affSColin Finck   IN PARC_FILTER  Filter,
136*c2c66affSColin Finck   IN NDIS_HANDLE  NdisFilterHandle,
137*c2c66affSColin Finck   IN PNDIS_REQUEST  NdisRequest,
138*c2c66affSColin Finck   IN UINT  FilterClasses,
139*c2c66affSColin Finck   IN BOOLEAN  Set);
140*c2c66affSColin Finck 
141*c2c66affSColin Finck VOID
142*c2c66affSColin Finck NTAPI
143*c2c66affSColin Finck ArcFilterDprIndicateReceiveComplete(
144*c2c66affSColin Finck   IN PARC_FILTER  Filter);
145*c2c66affSColin Finck 
146*c2c66affSColin Finck VOID
147*c2c66affSColin Finck NTAPI
148*c2c66affSColin Finck ArcFilterDprIndicateReceive(
149*c2c66affSColin Finck   IN PARC_FILTER  Filter,
150*c2c66affSColin Finck   IN PUCHAR  pRawHeader,
151*c2c66affSColin Finck   IN PUCHAR  pData,
152*c2c66affSColin Finck   IN UINT  Length);
153*c2c66affSColin Finck 
154*c2c66affSColin Finck NDIS_STATUS
155*c2c66affSColin Finck NTAPI
156*c2c66affSColin Finck ArcFilterTransferData(
157*c2c66affSColin Finck   IN PARC_FILTER  Filter,
158*c2c66affSColin Finck   IN NDIS_HANDLE  MacReceiveContext,
159*c2c66affSColin Finck   IN UINT  ByteOffset,
160*c2c66affSColin Finck   IN UINT  BytesToTransfer,
161*c2c66affSColin Finck   OUT PNDIS_PACKET  Packet,
162*c2c66affSColin Finck   OUT PUINT  BytesTransfered);
163*c2c66affSColin Finck 
164*c2c66affSColin Finck VOID
165*c2c66affSColin Finck NTAPI
166*c2c66affSColin Finck ArcFreeNdisPacket(
167*c2c66affSColin Finck   IN PARC_PACKET  Packet);
168*c2c66affSColin Finck 
169*c2c66affSColin Finck VOID
170*c2c66affSColin Finck NTAPI
171*c2c66affSColin Finck ArcFilterDoIndication(
172*c2c66affSColin Finck   IN PARC_FILTER  Filter,
173*c2c66affSColin Finck   IN PARC_PACKET  Packet);
174*c2c66affSColin Finck 
175*c2c66affSColin Finck VOID
176*c2c66affSColin Finck NTAPI
177*c2c66affSColin Finck ArcDestroyPacket(
178*c2c66affSColin Finck   IN PARC_FILTER  Filter,
179*c2c66affSColin Finck   IN PARC_PACKET  Packet);
180*c2c66affSColin Finck 
181*c2c66affSColin Finck #ifdef __cplusplus
182*c2c66affSColin Finck }
183*c2c66affSColin Finck #endif
184*c2c66affSColin Finck 
185*c2c66affSColin Finck #endif /* _ARC_FILTER_DEFS_ */
186