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