ReactOS 0.4.15-dev-8339-g4028de8
info.c File Reference
#include "nic.h"
#include <debug.h>
Include dependency graph for info.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

NDIS_STATUS NTAPI MiniportQueryInformation (IN NDIS_HANDLE MiniportAdapterContext, IN NDIS_OID Oid, IN PVOID InformationBuffer, IN ULONG InformationBufferLength, OUT PULONG BytesWritten, OUT PULONG BytesNeeded)
 
NDIS_STATUS NTAPI MiniportSetInformation (IN NDIS_HANDLE MiniportAdapterContext, IN NDIS_OID Oid, IN PVOID InformationBuffer, IN ULONG InformationBufferLength, OUT PULONG BytesRead, OUT PULONG BytesNeeded)
 

Variables

static ULONG SupportedOidList []
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 24 of file info.c.

Function Documentation

◆ MiniportQueryInformation()

NDIS_STATUS NTAPI MiniportQueryInformation ( IN NDIS_HANDLE  MiniportAdapterContext,
IN NDIS_OID  Oid,
IN PVOID  InformationBuffer,
IN ULONG  InformationBufferLength,
OUT PULONG  BytesWritten,
OUT PULONG  BytesNeeded 
)

Definition at line 69 of file info.c.

77{
78 PRTL_ADAPTER adapter = (PRTL_ADAPTER)MiniportAdapterContext;
79 ULONG genericUlong;
80 ULONG copyLength;
81 PVOID copySource;
83
85 copySource = &genericUlong;
86 copyLength = sizeof(ULONG);
87
89
90 switch (Oid)
91 {
93 copySource = (PVOID)&SupportedOidList;
94 copyLength = sizeof(SupportedOidList);
95 break;
96
98 genericUlong = adapter->PacketFilter;
99 break;
100
102 genericUlong = (ULONG)NdisHardwareStatusReady; //FIXME
103 break;
104
107 {
108 static const NDIS_MEDIUM medium = NdisMedium802_3;
109 copySource = (PVOID)&medium;
110 copyLength = sizeof(medium);
111 break;
112 }
113
119 genericUlong = MAXIMUM_FRAME_SIZE - sizeof(ETH_HEADER);
120 break;
121
123 genericUlong = adapter->LinkSpeedMbps * 1000;
124 break;
125
127 genericUlong = MAXIMUM_FRAME_SIZE;
128 break;
129
131 genericUlong = RECEIVE_BUFFER_SIZE;
132 break;
133
135 //
136 // The 3 bytes of the MAC address is the vendor ID
137 //
138 genericUlong = 0;
139 genericUlong |= (adapter->PermanentMacAddress[0] << 16);
140 genericUlong |= (adapter->PermanentMacAddress[1] << 8);
141 genericUlong |= (adapter->PermanentMacAddress[2] & 0xFF);
142 break;
143
145 {
146 static UCHAR vendorDesc[] = "ReactOS Team";
147 copySource = vendorDesc;
148 copyLength = sizeof(vendorDesc);
149 break;
150 }
151
153 genericUlong = DRIVER_VERSION;
154 break;
155
157 {
158 static const USHORT driverVersion =
159 (NDIS_MINIPORT_MAJOR_VERSION << 8) + NDIS_MINIPORT_MINOR_VERSION;
160 copySource = (PVOID)&driverVersion;
161 copyLength = sizeof(driverVersion);
162 break;
163 }
164
166 genericUlong = MAXIMUM_FRAME_SIZE;
167 break;
168
170 NDIS_DbgPrint(MIN_TRACE, ("OID_GEN_PROTOCOL_OPTIONS is unimplemented\n"));
172 break;
173
179 break;
180
182 genericUlong = adapter->MediaState;
183 break;
184
186 genericUlong = 1;
187 break;
188
190 copySource = adapter->CurrentMacAddress;
191 copyLength = IEEE_802_ADDR_LENGTH;
192 break;
193
195 copySource = adapter->PermanentMacAddress;
196 copyLength = IEEE_802_ADDR_LENGTH;
197 break;
198
200 genericUlong = MAXIMUM_MULTICAST_ADDRESSES;
201 break;
202
203 case OID_GEN_XMIT_OK:
204 genericUlong = adapter->TransmitOk;
205 break;
206
207 case OID_GEN_RCV_OK:
208 genericUlong = adapter->ReceiveOk;
209 break;
210
212 genericUlong = adapter->TransmitError;
213 break;
214
216 genericUlong = adapter->ReceiveError;
217 break;
218
220 genericUlong = adapter->ReceiveNoBufferSpace;
221 break;
222
224 genericUlong = adapter->ReceiveCrcError;
225 break;
226
228 genericUlong = adapter->ReceiveAlignmentError;
229 break;
230
232 genericUlong = adapter->TransmitOneCollision;
233 break;
234
236 genericUlong = adapter->TransmitMoreCollisions;
237 break;
238
239 default:
240 NDIS_DbgPrint(MIN_TRACE, ("Unknown OID\n"));
242 break;
243 }
244
246 {
247 if (copyLength > InformationBufferLength)
248 {
249 *BytesNeeded = copyLength;
250 *BytesWritten = 0;
252 }
253 else
254 {
255 NdisMoveMemory(InformationBuffer, copySource, copyLength);
256 *BytesWritten = copyLength;
257 *BytesNeeded = copyLength;
258 }
259 }
260 else
261 {
262 *BytesWritten = 0;
263 *BytesNeeded = 0;
264 }
265
267
268 NDIS_DbgPrint(MAX_TRACE, ("Query OID 0x%x: Completed with status 0x%x (%d, %d)\n",
269 Oid, status, *BytesWritten, *BytesNeeded));
270
271 return status;
272}
#define MIN_TRACE
Definition: debug.h:14
#define MAX_TRACE
Definition: debug.h:16
#define NDIS_DbgPrint(_t_, _x_)
Definition: debug.h:40
static NDIS_OID SupportedOidList[]
Definition: info.c:13
#define MAXIMUM_FRAME_SIZE
Definition: nic.h:19
#define RECEIVE_BUFFER_SIZE
Definition: nic.h:20
#define DRIVER_VERSION
Definition: nic.h:22
#define MAXIMUM_MULTICAST_ADDRESSES
Definition: e1000hw.h:23
#define IEEE_802_ADDR_LENGTH
Definition: e1000hw.h:11
return adapter
#define NdisReleaseSpinLock(_SpinLock)
Definition: ndis.h:4115
#define NDIS_STATUS_NOT_SUPPORTED
Definition: ndis.h:479
#define NDIS_STATUS_INVALID_LENGTH
Definition: ndis.h:485
#define NDIS_MAC_OPTION_TRANSFERS_NOT_PEND
Definition: ndis.h:684
#define NDIS_MAC_OPTION_RECEIVE_SERIALIZED
Definition: ndis.h:683
#define NDIS_STATUS_SUCCESS
Definition: ndis.h:346
#define NDIS_MAC_OPTION_NO_LOOPBACK
Definition: ndis.h:685
#define NDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA
Definition: ndis.h:682
#define NdisAcquireSpinLock(_SpinLock)
Definition: ndis.h:4106
#define NdisMoveMemory(Destination, Source, Length)
Definition: ndis.h:3896
enum _NDIS_MEDIUM NDIS_MEDIUM
#define OID_GEN_TRANSMIT_BLOCK_SIZE
Definition: ntddndis.h:242
#define OID_GEN_PROTOCOL_OPTIONS
Definition: ntddndis.h:250
#define OID_GEN_XMIT_OK
Definition: ntddndis.h:267
#define OID_GEN_MAXIMUM_TOTAL_SIZE
Definition: ntddndis.h:249
#define OID_GEN_XMIT_ERROR
Definition: ntddndis.h:269
#define OID_GEN_VENDOR_DRIVER_VERSION
Definition: ntddndis.h:254
#define OID_802_3_PERMANENT_ADDRESS
Definition: ntddndis.h:302
#define OID_GEN_LINK_SPEED
Definition: ntddndis.h:239
#define OID_GEN_VENDOR_ID
Definition: ntddndis.h:244
#define OID_GEN_CURRENT_PACKET_FILTER
Definition: ntddndis.h:246
#define OID_GEN_RCV_NO_BUFFER
Definition: ntddndis.h:271
#define OID_802_3_XMIT_ONE_COLLISION
Definition: ntddndis.h:308
#define OID_802_3_XMIT_MORE_COLLISIONS
Definition: ntddndis.h:309
#define OID_GEN_RECEIVE_BUFFER_SPACE
Definition: ntddndis.h:241
#define OID_802_3_MAXIMUM_LIST_SIZE
Definition: ntddndis.h:305
#define OID_GEN_DRIVER_VERSION
Definition: ntddndis.h:248
#define OID_802_3_CURRENT_ADDRESS
Definition: ntddndis.h:303
#define OID_GEN_TRANSMIT_BUFFER_SPACE
Definition: ntddndis.h:240
#define OID_GEN_MEDIA_SUPPORTED
Definition: ntddndis.h:235
@ NdisMedium802_3
Definition: ntddndis.h:188
#define OID_GEN_MAXIMUM_FRAME_SIZE
Definition: ntddndis.h:238
#define OID_GEN_RCV_CRC_ERROR
Definition: ntddndis.h:286
#define OID_GEN_MEDIA_IN_USE
Definition: ntddndis.h:236
#define OID_GEN_MEDIA_CONNECT_STATUS
Definition: ntddndis.h:252
#define OID_GEN_RCV_OK
Definition: ntddndis.h:268
#define OID_GEN_MAXIMUM_LOOKAHEAD
Definition: ntddndis.h:237
#define OID_802_3_RCV_ERROR_ALIGNMENT
Definition: ntddndis.h:307
int NDIS_STATUS
Definition: ntddndis.h:475
#define OID_GEN_RCV_ERROR
Definition: ntddndis.h:270
@ NdisHardwareStatusReady
Definition: ntddndis.h:450
#define OID_GEN_CURRENT_LOOKAHEAD
Definition: ntddndis.h:247
#define OID_GEN_MAC_OPTIONS
Definition: ntddndis.h:251
#define OID_GEN_VENDOR_DESCRIPTION
Definition: ntddndis.h:245
#define OID_GEN_SUPPORTED_LIST
Definition: ntddndis.h:233
#define OID_GEN_RECEIVE_BLOCK_SIZE
Definition: ntddndis.h:243
#define OID_GEN_MAXIMUM_SEND_PACKETS
Definition: ntddndis.h:253
#define OID_GEN_HARDWARE_STATUS
Definition: ntddndis.h:234
unsigned short USHORT
Definition: pedump.c:61
struct _RTL_ADAPTER * PRTL_ADAPTER
Definition: lan.h:33
Definition: ps.c:97
void * PVOID
Definition: typedefs.h:50
uint32_t ULONG
Definition: typedefs.h:59
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PLONGLONG _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_opt_ PULONG_PTR BytesWritten
Definition: wdfiotarget.h:960
unsigned char UCHAR
Definition: xmlstorage.h:181

◆ MiniportSetInformation()

NDIS_STATUS NTAPI MiniportSetInformation ( IN NDIS_HANDLE  MiniportAdapterContext,
IN NDIS_OID  Oid,
IN PVOID  InformationBuffer,
IN ULONG  InformationBufferLength,
OUT PULONG  BytesRead,
OUT PULONG  BytesNeeded 
)

Definition at line 276 of file info.c.

284{
285 PRTL_ADAPTER adapter = (PRTL_ADAPTER)MiniportAdapterContext;
286 ULONG genericUlong;
288
290
292
293 switch (Oid)
294 {
296 if (InformationBufferLength < sizeof(ULONG))
297 {
298 *BytesRead = 0;
299 *BytesNeeded = sizeof(ULONG);
301 break;
302 }
303
304 NdisMoveMemory(&genericUlong, InformationBuffer, sizeof(ULONG));
305
306 if (genericUlong &
313 {
314 *BytesRead = sizeof(ULONG);
315 *BytesNeeded = sizeof(ULONG);
317 break;
318 }
319
320 adapter->PacketFilter = genericUlong;
321
324 {
325 NDIS_DbgPrint(MIN_TRACE, ("Failed to apply new packet filter\n"));
326 break;
327 }
328
329 break;
330
332 if (InformationBufferLength < sizeof(ULONG))
333 {
334 *BytesRead = 0;
335 *BytesNeeded = sizeof(ULONG);
337 break;
338 }
339
340 NdisMoveMemory(&genericUlong, InformationBuffer, sizeof(ULONG));
341
342 if (genericUlong > MAXIMUM_FRAME_SIZE - sizeof(ETH_HEADER))
343 {
345 }
346 else
347 {
348 // Ignore this...
349 }
350
351 break;
352
354 if (InformationBufferLength % IEEE_802_ADDR_LENGTH)
355 {
356 *BytesRead = 0;
357 *BytesNeeded = InformationBufferLength + (InformationBufferLength % IEEE_802_ADDR_LENGTH);
359 break;
360 }
361
362 if (InformationBufferLength / 6 > MAXIMUM_MULTICAST_ADDRESSES)
363 {
365 *BytesRead = 0;
367 break;
368 }
369
370 NdisMoveMemory(adapter->MulticastList, InformationBuffer, InformationBufferLength);
371
372 // FIXME: Write to device
373
374 break;
375
376 default:
377 NDIS_DbgPrint(MIN_TRACE, ("Unknown OID\n"));
379 *BytesRead = 0;
380 *BytesNeeded = 0;
381 break;
382 }
383
385 {
386 *BytesRead = InformationBufferLength;
387 *BytesNeeded = 0;
388 }
389
391
392 return status;
393}
NDIS_STATUS NTAPI NICApplyPacketFilter(IN PE1000_ADAPTER Adapter)
Definition: hardware.c:724
#define NDIS_STATUS_INVALID_DATA
Definition: ndis.h:486
#define NDIS_PACKET_TYPE_MAC_FRAME
Definition: ndis.h:674
#define NDIS_PACKET_TYPE_SOURCE_ROUTING
Definition: ndis.h:667
#define NDIS_PACKET_TYPE_ALL_FUNCTIONAL
Definition: ndis.h:672
#define NDIS_PACKET_TYPE_FUNCTIONAL
Definition: ndis.h:673
#define NDIS_PACKET_TYPE_GROUP
Definition: ndis.h:671
#define NDIS_PACKET_TYPE_SMT
Definition: ndis.h:669
#define OID_802_3_MULTICAST_LIST
Definition: ntddndis.h:304
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PLONGLONG _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_opt_ PULONG_PTR BytesRead
Definition: wdfiotarget.h:870

Variable Documentation

◆ SupportedOidList

ULONG SupportedOidList[]
static

Definition at line 27 of file info.c.