2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS NDIS library
5 * PURPOSE: Ethernet filter functions
6 * PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net)
7 * Vizzini (vizzini@plasmic.com)
9 * CSH 01/08-2000 Created
17 IN UINT MaximumMulticastAddresses
,
18 IN PUCHAR AdapterAddress
,
19 OUT PETH_FILTER
* Filter
)
21 * FUNCTION: Construct an ethernet filter
23 * MaximumMulticastAddresses: Maximum number of multicast addresses.
24 * AdapterAddress: Current ethernet address of the adapter.
25 * Filter: The created filter on successful return.
27 * TRUE if the filter was created
30 * - This function is no longer exported and intentionally doesn't
31 * follow the W2K prototype. It was deprecated since NDIS 4 so it
32 * shouldn't be problem.
35 PETHI_FILTER NewFilter
;
37 NewFilter
= ExAllocatePool(NonPagedPool
, sizeof(ETHI_FILTER
));
38 if (NewFilter
!= NULL
)
40 RtlZeroMemory(NewFilter
, sizeof(ETHI_FILTER
));
41 NewFilter
->MaxMulticastAddresses
= MaximumMulticastAddresses
;
42 RtlCopyMemory(NewFilter
->AdapterAddress
, AdapterAddress
, ETH_LENGTH_OF_ADDRESS
);
43 *Filter
= (PETH_FILTER
)NewFilter
;
48 NDIS_DbgPrint(MIN_TRACE
, ("Insufficient resources\n"));
58 IN PETH_FILTER Filter
)
69 EthFilterDprIndicateReceive(
70 IN PETH_FILTER Filter
,
71 IN NDIS_HANDLE MacReceiveContext
,
73 IN PVOID HeaderBuffer
,
74 IN UINT HeaderBufferSize
,
75 IN PVOID LookaheadBuffer
,
76 IN UINT LookaheadBufferSize
,
79 * FUNCTION: Receive indication function for Ethernet devices
81 * MiniportAdapter = Miniport Adapter Handle (PLOGICAL_ADAPTER)
82 * MacReceiveContext = MAC receive context handle
83 * Address = Pointer to destination Ethernet address
84 * HeaderBuffer = Pointer to Ethernet header buffer
85 * HeaderBufferSize = Size of Ethernet header buffer
86 * LookaheadBuffer = Pointer to lookahead buffer
87 * LookaheadBufferSize = Size of lookahead buffer
88 * PacketSize = Total size of received packet
91 /* Not sure if this is a valid thing to do, but we do arrive here early
92 * in the boot process with Filter NULL. We need to investigate whether
93 * this should be handled or not allowed. */
95 NDIS_DbgPrint(MIN_TRACE
, ("Filter is NULL\n"));
98 MiniIndicateData((PLOGICAL_ADAPTER
)((PETHI_FILTER
)Filter
)->Miniport
,
113 EthFilterDprIndicateReceiveComplete(
114 IN PETH_FILTER Filter
)
116 * FUNCTION: Receive indication complete function for Ethernet devices
118 * Filter = Pointer to Ethernet filter
121 PLIST_ENTRY CurrentEntry
;
122 PLOGICAL_ADAPTER Adapter
;
123 PADAPTER_BINDING AdapterBinding
;
125 NDIS_DbgPrint(DEBUG_MINIPORT
, ("Called.\n"));
128 NDIS_DbgPrint(MIN_TRACE
, ("Filter is NULL\n"));
132 Adapter
= (PLOGICAL_ADAPTER
)((PETHI_FILTER
)Filter
)->Miniport
;
134 NDIS_DbgPrint(MAX_TRACE
, ("acquiring miniport block lock\n"));
135 KeAcquireSpinLockAtDpcLevel(&Adapter
->NdisMiniportBlock
.Lock
);
137 CurrentEntry
= Adapter
->ProtocolListHead
.Flink
;
139 while (CurrentEntry
!= &Adapter
->ProtocolListHead
)
141 AdapterBinding
= CONTAINING_RECORD(CurrentEntry
, ADAPTER_BINDING
, AdapterListEntry
);
143 (*AdapterBinding
->ProtocolBinding
->Chars
.ReceiveCompleteHandler
)(
144 AdapterBinding
->NdisOpenBlock
.ProtocolBindingContext
);
146 CurrentEntry
= CurrentEntry
->Flink
;
149 KeReleaseSpinLockFromDpcLevel(&Adapter
->NdisMiniportBlock
.Lock
);