ReactOS 0.4.15-dev-5667-ged97270
ParaNdis-Oid.c File Reference
#include "ParaNdis-Oid.h"
#include <sal.h>
Include dependency graph for ParaNdis-Oid.c:

Go to the source code of this file.

Macros

#define CONCATFIELD(object, field)   object.field
 
#define SETINFO(field, value)   pInfo = CONCATFIELD(&u, field); ulSize = sizeof(CONCATFIELD(u, field)); CONCATFIELD(u, field) = (value)
 
#define MAKECASE(id)   case id: return #id;
 

Functions

static UCHAR FORCEINLINE hexdigit (UCHAR nibble)
 
NDIS_STATUS ParaNdis_OidSetCopy (tOidDesc *pOid, PVOID pDest, ULONG ulSize)
 
NDIS_STATUS ParaNdis_OnSetPacketFilter (PARANDIS_ADAPTER *pContext, tOidDesc *pOid)
 
void ParaNdis_FillPowerCapabilities (PNDIS_PNP_CAPABILITIES pCaps)
 
NDIS_STATUS ParaNdis_OnOidSetMulticastList (PARANDIS_ADAPTER *pContext, tOidDesc *pOid)
 
NDIS_STATUS ParaNdis_OidQueryCopy (tOidDesc *pOid, PVOID pInfo, ULONG ulSize, BOOLEAN bFreeInfo)
 
NDIS_STATUS ParaNdis_OidQueryCommon (PARANDIS_ADAPTER *pContext, tOidDesc *pOid)
 
const charParaNdis_OidName (NDIS_OID oid)
 
static NDIS_STATUS ValidateWakeupPattern (PNDIS_PM_PACKET_PATTERN p, PULONG pValidSize)
 
NDIS_STATUS ParaNdis_OnAddWakeupPattern (PARANDIS_ADAPTER *pContext, tOidDesc *pOid)
 
NDIS_STATUS ParaNdis_OnRemoveWakeupPattern (PARANDIS_ADAPTER *pContext, tOidDesc *pOid)
 
NDIS_STATUS ParaNdis_OnEnableWakeup (PARANDIS_ADAPTER *pContext, tOidDesc *pOid)
 
NDIS_STATUS ParaNdis_OnSetLookahead (PARANDIS_ADAPTER *pContext, tOidDesc *pOid)
 
NDIS_STATUS ParaNdis_OnSetVlanId (PARANDIS_ADAPTER *pContext, tOidDesc *pOid)
 
void ParaNdis_GetOidSupportRules (NDIS_OID oid, tOidWhatToDo *pRule, const tOidWhatToDo *Table)
 

Variables

static const char VendorName [] = "Red Hat"
 

Macro Definition Documentation

◆ CONCATFIELD

#define CONCATFIELD (   object,
  field 
)    object.field

◆ MAKECASE

#define MAKECASE (   id)    case id: return #id;

◆ SETINFO

#define SETINFO (   field,
  value 
)    pInfo = CONCATFIELD(&u, field); ulSize = sizeof(CONCATFIELD(u, field)); CONCATFIELD(u, field) = (value)

Function Documentation

◆ hexdigit()

static UCHAR FORCEINLINE hexdigit ( UCHAR  nibble)
static

Definition at line 38 of file ParaNdis-Oid.c.

39{
40 UCHAR c = nibble & 0xf;
41 c += (c <= 9) ? 0 : 7;
42 c += '0';
43 return c;
44}
const GLubyte * c
Definition: glext.h:8905
#define c
Definition: ke_i.h:80
unsigned char UCHAR
Definition: xmlstorage.h:181

Referenced by ParaNdis_OidName().

◆ ParaNdis_FillPowerCapabilities()

void ParaNdis_FillPowerCapabilities ( PNDIS_PNP_CAPABILITIES  pCaps)

Definition at line 138 of file ParaNdis-Oid.c.

139{
140 NdisZeroMemory(pCaps, sizeof(*pCaps));
144}
#define NdisZeroMemory(Destination, Length)
Definition: ndis.h:3926
@ NdisDeviceStateUnspecified
Definition: ntddndis.h:37
NDIS_DEVICE_POWER_STATE MinMagicPacketWakeUp
Definition: ntddndis.h:171
NDIS_DEVICE_POWER_STATE MinPatternWakeUp
Definition: ntddndis.h:172
NDIS_DEVICE_POWER_STATE MinLinkChangeWakeUp
Definition: ntddndis.h:173
NDIS_PM_WAKE_UP_CAPABILITIES WakeUpCapabilities
Definition: ntddndis.h:183

Referenced by ParaNdis_OidQueryCommon().

◆ ParaNdis_GetOidSupportRules()

void ParaNdis_GetOidSupportRules ( NDIS_OID  oid,
tOidWhatToDo pRule,
const tOidWhatToDo Table 
)

Definition at line 661 of file ParaNdis-Oid.c.

662{
663 static const tOidWhatToDo defaultRule = { 0, 0, 0, 0, 0, NULL, "Unknown OID" };
664 UINT i;
665 *pRule = defaultRule;
666 pRule->oid = oid;
667
668 for (i = 0; Table[i].oid != 0; ++i)
669 {
670 if (Table[i].oid == oid)
671 {
672 *pRule = Table[i];
673 break;
674 }
675 }
676 pRule->name = ParaNdis_OidName(oid);
677}
const char * ParaNdis_OidName(NDIS_OID oid)
Definition: ParaNdis-Oid.c:456
#define NULL
Definition: types.h:112
ASMGENDATA Table[]
Definition: genincdata.c:61
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int UINT
Definition: ndis.h:50
const char * name
Definition: ParaNdis-Oid.h:60

Referenced by ParaNdis5_QueryOID(), and ParaNdis5_SetOID().

◆ ParaNdis_OidName()

const char * ParaNdis_OidName ( NDIS_OID  oid)

Definition at line 456 of file ParaNdis-Oid.c.

457{
458#undef MAKECASE
459#define MAKECASE(id) case id: return #id;
460 switch (oid)
461 {
542 default:
543 {
544 static UCHAR buffer[9];
545 UINT i;
546 for (i = 0; i < 8; ++i)
547 {
548 UCHAR nibble = (UCHAR)((oid >> (28 - i * 4)) & 0xf);
549 buffer[i] = hexdigit(nibble);
550 }
551 return (char *)buffer;
552 }
553 }
554}
static UCHAR FORCEINLINE hexdigit(UCHAR nibble)
Definition: ParaNdis-Oid.c:38
#define MAKECASE(id)
GLuint buffer
Definition: glext.h:5915
#define OID_GEN_MULTICAST_FRAMES_XMIT
Definition: ntddndis.h:277
#define OID_IP4_OFFLOAD_STATS
Definition: ntddndis.h:385
#define OID_GEN_TRANSMIT_BLOCK_SIZE
Definition: ntddndis.h:242
#define OID_GEN_DIRECTED_BYTES_RCV
Definition: ntddndis.h:280
#define OID_GEN_PROTOCOL_OPTIONS
Definition: ntddndis.h:250
#define OID_GEN_DIRECTED_FRAMES_XMIT
Definition: ntddndis.h:275
#define OID_GEN_XMIT_OK
Definition: ntddndis.h:267
#define OID_GEN_MAXIMUM_TOTAL_SIZE
Definition: ntddndis.h:249
#define OID_GEN_BROADCAST_BYTES_XMIT
Definition: ntddndis.h:278
#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_802_3_RCV_OVERRUN
Definition: ntddndis.h:312
#define OID_GEN_CURRENT_PACKET_FILTER
Definition: ntddndis.h:246
#define OID_GEN_RCV_NO_BUFFER
Definition: ntddndis.h:271
#define OID_PNP_SET_POWER
Definition: ntddndis.h:361
#define OID_802_3_XMIT_HEARTBEAT_FAILURE
Definition: ntddndis.h:314
#define OID_GEN_PHYSICAL_MEDIUM
Definition: ntddndis.h:264
#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_NETCARD_LOAD
Definition: ntddndis.h:290
#define OID_802_3_XMIT_MAX_COLLISIONS
Definition: ntddndis.h:311
#define OID_GEN_RECEIVE_BUFFER_SPACE
Definition: ntddndis.h:241
#define OID_802_3_XMIT_TIMES_CRS_LOST
Definition: ntddndis.h:315
#define OID_802_3_MAXIMUM_LIST_SIZE
Definition: ntddndis.h:305
#define OID_GEN_TRANSPORT_HEADER_OFFSET
Definition: ntddndis.h:257
#define OID_GEN_INIT_TIME_MS
Definition: ntddndis.h:292
#define OID_GEN_DRIVER_VERSION
Definition: ntddndis.h:248
#define OID_GEN_DEVICE_PROFILE
Definition: ntddndis.h:291
#define OID_802_3_XMIT_UNDERRUN
Definition: ntddndis.h:313
#define OID_802_3_XMIT_LATE_COLLISIONS
Definition: ntddndis.h:316
#define OID_802_3_MAC_OPTIONS
Definition: ntddndis.h:306
#define OID_802_3_CURRENT_ADDRESS
Definition: ntddndis.h:303
#define OID_GEN_RESET_COUNTS
Definition: ntddndis.h:293
#define OID_GEN_GET_TIME_CAPS
Definition: ntddndis.h:288
#define OID_TCP_OFFLOAD_PARAMETERS
Definition: ntddndis.h:390
#define OID_802_3_MULTICAST_LIST
Definition: ntddndis.h:304
#define OID_GEN_SUPPORTED_GUIDS
Definition: ntddndis.h:255
#define OID_GEN_DIRECTED_FRAMES_RCV
Definition: ntddndis.h:281
#define OID_PNP_ENABLE_WAKE_UP
Definition: ntddndis.h:366
#define OID_GEN_TRANSMIT_BUFFER_SPACE
Definition: ntddndis.h:240
#define OID_GEN_MEDIA_SUPPORTED
Definition: ntddndis.h:235
#define OID_GEN_BROADCAST_FRAMES_XMIT
Definition: ntddndis.h:279
#define OID_GEN_BROADCAST_FRAMES_RCV
Definition: ntddndis.h:285
#define OID_PNP_ADD_WAKE_UP_PATTERN
Definition: ntddndis.h:363
#define OID_GEN_MAXIMUM_FRAME_SIZE
Definition: ntddndis.h:238
#define OID_GEN_MEDIA_CAPABILITIES
Definition: ntddndis.h:263
#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_DIRECTED_BYTES_XMIT
Definition: ntddndis.h:274
#define OID_GEN_RCV_OK
Definition: ntddndis.h:268
#define OID_GEN_MAXIMUM_LOOKAHEAD
Definition: ntddndis.h:237
#define OID_GEN_BROADCAST_BYTES_RCV
Definition: ntddndis.h:284
#define OID_802_3_RCV_ERROR_ALIGNMENT
Definition: ntddndis.h:307
#define OID_GEN_VLAN_ID
Definition: ntddndis.h:260
#define OID_PNP_QUERY_POWER
Definition: ntddndis.h:362
#define OID_GEN_RCV_ERROR
Definition: ntddndis.h:270
#define OID_PNP_REMOVE_WAKE_UP_PATTERN
Definition: ntddndis.h:364
#define OID_PNP_CAPABILITIES
Definition: ntddndis.h:360
#define OID_TCP_TASK_OFFLOAD
Definition: ntddndis.h:377
#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_IP6_OFFLOAD_STATS
Definition: ntddndis.h:386
#define OID_GEN_SUPPORTED_LIST
Definition: ntddndis.h:233
#define OID_GEN_MULTICAST_BYTES_XMIT
Definition: ntddndis.h:276
#define OID_GEN_MULTICAST_BYTES_RCV
Definition: ntddndis.h:282
#define OID_GEN_GET_NETCARD_TIME
Definition: ntddndis.h:289
#define OID_802_3_XMIT_DEFERRED
Definition: ntddndis.h:310
#define OID_GEN_RECEIVE_BLOCK_SIZE
Definition: ntddndis.h:243
#define OID_GEN_MAXIMUM_SEND_PACKETS
Definition: ntddndis.h:253
#define OID_OFFLOAD_ENCAPSULATION
Definition: ntddndis.h:394
#define OID_GEN_TRANSMIT_QUEUE_LENGTH
Definition: ntddndis.h:287
#define OID_GEN_HARDWARE_STATUS
Definition: ntddndis.h:234
#define OID_GEN_MACHINE_NAME
Definition: ntddndis.h:258
#define OID_GEN_MEDIA_SENSE_COUNTS
Definition: ntddndis.h:294
#define OID_GEN_MULTICAST_FRAMES_RCV
Definition: ntddndis.h:283

Referenced by ParaNdis_GetOidSupportRules().

◆ ParaNdis_OidQueryCommon()

NDIS_STATUS ParaNdis_OidQueryCommon ( PARANDIS_ADAPTER pContext,
tOidDesc pOid 
)

Definition at line 225 of file ParaNdis-Oid.c.

226{
228 PVOID pInfo = NULL;
229 ULONG ulSize = 0;
230 BOOLEAN bFreeInfo = FALSE;
231 union _tagtemp
232 {
233 NDIS_MEDIUM Medium;
234 ULONG64 ul64;
235 ULONG ul;
236 USHORT us;
238 } u;
239#if defined(_MSC_VER) && !defined(__clang__)
240 #define CONCATFIELD(object, field) object.##field
241#else
242 #define CONCATFIELD(object, field) object.field
243#endif
244#define SETINFO(field, value) pInfo = CONCATFIELD(&u, field); ulSize = sizeof(CONCATFIELD(u, field)); CONCATFIELD(u, field) = (value)
245 switch (pOid->Oid)
246 {
248 ParaNdis_GetSupportedOid(&pInfo, &ulSize);
249 break;
252 break;
256 SETINFO(Medium, NdisMedium802_3);
257 break;
259 SETINFO(ul, pContext->MaxPacketSize.nMaxFullSizeOS);
260 break;
262 SETINFO(ul, pContext->MaxPacketSize.nMaxDataSize);
263 break;
265 SETINFO(ul, pContext->MaxPacketSize.nMaxFullSizeOS * pContext->nofFreeTxDescriptors);
266 break;
268 SETINFO(ul, pContext->MaxPacketSize.nMaxFullSizeOS * pContext->NetMaxReceiveBuffers);
269 break;
275 SETINFO(ul, pContext->MaxPacketSize.nMaxFullSizeOS);
276 break;
278 // TODO: this is not completely correct, but only if
279 // the TX queue is not full
280 SETINFO(ul, pContext->maxFreeTxDescriptors - pContext->nofFreeTxDescriptors);
281 break;
283 SETINFO(ul, 0x00ffffff);
284 break;
286 pInfo = (PVOID)VendorName;
287 ulSize = sizeof(VendorName);
288 break;
289
291 SETINFO(ul, (NDIS_MINIPORT_MAJOR_VERSION << 16) | NDIS_MINIPORT_MINOR_VERSION);
292 break;
294 pInfo = &pContext->PacketFilter;
295 ulSize = sizeof(pContext->PacketFilter);
296 break;
298 SETINFO(us, ((NDIS_MINIPORT_MAJOR_VERSION << 8) | NDIS_MINIPORT_MINOR_VERSION));
299 break;
301 {
305 if (IsPrioritySupported(pContext))
307 if (IsVlanSupported(pContext))
309 SETINFO(ul, options);
310 }
311 break;
314 //NdisMediaStateConnected:
315 break;
317 // NDIS ignores it for deserialized drivers
318 SETINFO(ul,pContext->nofFreeTxDescriptors);
319 break;
321 pInfo = pContext->PermanentMacAddress;
322 ulSize = sizeof(pContext->PermanentMacAddress);
323 break;
325 pInfo = pContext->CurrentMacAddress;
326 ulSize = sizeof(pContext->CurrentMacAddress);
327 break;
329 // size if 0, just to indicate success
330 pInfo = &status;
331 break;
333 SETINFO(ul64, pContext->Statistics.ifHCOutUcastOctets);
334 break;
336 SETINFO(ul64, pContext->Statistics.ifHCOutUcastPkts);
337 break;
340 break;
342 SETINFO(ul64, pContext->Statistics.ifHCOutMulticastPkts);
343 break;
346 break;
348 SETINFO(ul64, pContext->Statistics.ifHCOutBroadcastPkts);
349 break;
351 SETINFO(ul64, pContext->Statistics.ifHCInUcastOctets);
352 break;
354 SETINFO(ul64, pContext->Statistics.ifHCInUcastPkts);
355 break;
358 break;
360 SETINFO(ul64, pContext->Statistics.ifHCInMulticastPkts);
361 break;
364 break;
366 SETINFO(ul64, pContext->Statistics.ifHCInBroadcastPkts);
367 break;
368 case OID_GEN_XMIT_OK:
369 SETINFO(ul64,
370 pContext->Statistics.ifHCOutUcastPkts +
373 break;
374 case OID_GEN_RCV_OK:
375 SETINFO(ul64,
376 pContext->Statistics.ifHCInUcastPkts +
379 DPrintf(4, ("[%s] Total frames %I64u", __FUNCTION__, u.ul64));
380 break;
382 SETINFO(ul64, pContext->Statistics.ifOutErrors );
383 break;
409 SETINFO(ul64, 0);
410 break;
412 pInfo = pContext->MulticastData.MulticastList;
414 break;
417 break;
419 pInfo = &u.PMCaps;
420 ulSize = sizeof(u.PMCaps);
422 break;
424 SETINFO(ul, 0);
425 break;
426 case OID_GEN_VLAN_ID:
427 SETINFO(ul, pContext->VlanId);
428 if (!IsVlanSupported(pContext))
430 break;
432 if (!pContext->DummyLookAhead) pContext->DummyLookAhead = pContext->MaxPacketSize.nMaxFullSizeOS;
433 pInfo = &pContext->DummyLookAhead;
434 ulSize = sizeof(pContext->DummyLookAhead);
435 break;
437 SETINFO(ul, pContext->ulEnableWakeup);
438 break;
439 default:
441 break;
442 }
443
445 {
446 status = ParaNdis_OidQueryCopy(pOid, pInfo, ulSize, bFreeInfo);
447 }
448
449 return status;
450}
#define DPrintf(Level, Fmt)
Definition: kdebugprint.h:61
NDIS_STATUS ParaNdis_OidQueryCopy(tOidDesc *pOid, PVOID pInfo, ULONG ulSize, BOOLEAN bFreeInfo)
Definition: ParaNdis-Oid.c:178
void ParaNdis_FillPowerCapabilities(PNDIS_PNP_CAPABILITIES pCaps)
Definition: ParaNdis-Oid.c:138
#define SETINFO(field, value)
static const char VendorName[]
Definition: ParaNdis-Oid.c:36
void ParaNdis_GetSupportedOid(PVOID *pOidsArray, PULONG pLength)
unsigned char BOOLEAN
#define FALSE
Definition: types.h:117
#define __FUNCTION__
Definition: types.h:112
#define ETH_LENGTH_OF_ADDRESS
Definition: efilter.h:16
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
unsigned __int64 ULONG64
Definition: imports.h:198
static const BYTE us[]
Definition: encode.c:689
#define __fallthrough
Definition: ms_sal.h:2886
static BOOLEAN FORCEINLINE IsPrioritySupported(PARANDIS_ADAPTER *pContext)
Definition: ndis56common.h:547
static BOOLEAN FORCEINLINE IsVlanSupported(PARANDIS_ADAPTER *pContext)
Definition: ndis56common.h:542
#define PARANDIS_MULTICAST_LIST_SIZE
Definition: ndis56common.h:119
#define NDIS_STATUS_NOT_SUPPORTED
Definition: ndis.h:479
#define NDIS_MAC_OPTION_TRANSFERS_NOT_PEND
Definition: ndis.h:684
#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 NDIS_MAC_OPTION_8021P_PRIORITY
Definition: ndis.h:688
enum _NDIS_MEDIUM NDIS_MEDIUM
@ NdisMediaStateConnected
Definition: ntddndis.h:470
@ NdisMediaStateDisconnected
Definition: ntddndis.h:471
@ NdisMedium802_3
Definition: ntddndis.h:188
#define NDIS_MAC_OPTION_8021Q_VLAN
Definition: ntddndis.h:440
int NDIS_STATUS
Definition: ntddndis.h:475
@ NdisHardwareStatusReady
Definition: ntddndis.h:450
unsigned short USHORT
Definition: pedump.c:61
UCHAR MulticastList[ETH_LENGTH_OF_ADDRESS *PARANDIS_MULTICAST_LIST_SIZE]
Definition: ndis56common.h:332
ULONG64 ifHCOutMulticastPkts
Definition: ndis56common.h:278
ULONG64 ifHCInBroadcastPkts
Definition: ndis56common.h:271
ULONG64 ifHCOutMulticastOctets
Definition: ndis56common.h:279
ULONG64 ifHCOutBroadcastOctets
Definition: ndis56common.h:281
ULONG64 ifHCInMulticastOctets
Definition: ndis56common.h:270
ULONG64 ifHCInMulticastPkts
Definition: ndis56common.h:269
ULONG64 ifHCInUcastOctets
Definition: ndis56common.h:268
ULONG64 ifHCOutUcastOctets
Definition: ndis56common.h:277
ULONG64 ifHCOutBroadcastPkts
Definition: ndis56common.h:280
ULONG64 ifHCOutUcastPkts
Definition: ndis56common.h:276
ULONG64 ifHCInBroadcastOctets
Definition: ndis56common.h:272
NDIS_OID Oid
Definition: ParaNdis-Oid.h:40
tMulticastData MulticastData
Definition: ndis56common.h:387
NDIS_STATISTICS_INFO Statistics
Definition: ndis56common.h:420
UCHAR CurrentMacAddress[ETH_LENGTH_OF_ADDRESS]
Definition: ndis56common.h:402
UCHAR PermanentMacAddress[ETH_LENGTH_OF_ADDRESS]
Definition: ndis56common.h:401
tMaxPacketSize MaxPacketSize
Definition: ndis56common.h:398
Definition: ps.c:97
void * PVOID
Definition: typedefs.h:50
uint32_t ULONG
Definition: typedefs.h:59

Referenced by ParaNdis_OidQuery().

◆ ParaNdis_OidQueryCopy()

NDIS_STATUS ParaNdis_OidQueryCopy ( tOidDesc pOid,
PVOID  pInfo,
ULONG  ulSize,
BOOLEAN  bFreeInfo 
)

Definition at line 178 of file ParaNdis-Oid.c.

183{
185 *(pOid->pBytesNeeded) = ulSize;
186 if (!pInfo)
187 {
189 *(pOid->pBytesWritten) = 0;
190 *(pOid->pBytesNeeded) = 0;
191 }
192 else if (pOid->InformationBufferLength >= ulSize)
193 {
194 if (ulSize) NdisMoveMemory(pOid->InformationBuffer, pInfo, ulSize);
195 *(pOid->pBytesWritten) = ulSize;
196 *(pOid->pBytesNeeded) = 0;
197 }
198 else if ((pOid->ulToDoFlags & ohfQuery3264) && pOid->InformationBufferLength == sizeof(ULONG) && ulSize == sizeof(ULONG64))
199 {
200 ULONG64 u64 = *(ULONG64 *)pInfo;
201 ULONG ul = (ULONG)u64;
202 NdisMoveMemory(pOid->InformationBuffer, &ul, sizeof(ul));
203 *(pOid->pBytesWritten) = sizeof(ul);
204 }
205 else
206 {
208 *(pOid->pBytesWritten) = 0;
209 }
210 if (bFreeInfo && pInfo)
211 {
212 NdisFreeMemory(pInfo, 0, 0);
213 }
214 return status;
215}
@ ohfQuery3264
Definition: ParaNdis-Oid.h:70
ULONG64 u64
Definition: btrfs.h:15
VOID EXPORT NdisFreeMemory(IN PVOID VirtualAddress, IN UINT Length, IN UINT MemoryFlags)
Definition: memory.c:110
#define NDIS_STATUS_INVALID_OID
Definition: ndis.h:488
#define NDIS_STATUS_BUFFER_TOO_SHORT
Definition: ndis.h:487
#define NdisMoveMemory(Destination, Source, Length)
Definition: ndis.h:3896
PVOID InformationBuffer
Definition: ParaNdis-Oid.h:42
PUINT pBytesNeeded
Definition: ParaNdis-Oid.h:45
UINT InformationBufferLength
Definition: ParaNdis-Oid.h:43
ULONG ulToDoFlags
Definition: ParaNdis-Oid.h:41
PUINT pBytesWritten
Definition: ParaNdis-Oid.h:44

Referenced by ParaNdis_OidQuery(), and ParaNdis_OidQueryCommon().

◆ ParaNdis_OidSetCopy()

NDIS_STATUS ParaNdis_OidSetCopy ( tOidDesc pOid,
PVOID  pDest,
ULONG  ulSize 
)

Definition at line 66 of file ParaNdis-Oid.c.

70{
72 if (!pDest)
73 {
75 *(pOid->pBytesRead) = 0;
76 *(pOid->pBytesNeeded) = 0;
77 }
78 else if (ulSize)
79 {
80 if (pOid->InformationBufferLength < ulSize)
81 {
82 if (pOid->ulToDoFlags & ohfSetLessOK)
83 {
84 *(pOid->pBytesRead) = pOid->InformationBufferLength;
85 NdisZeroMemory(pDest, ulSize);
87 }
88 else
89 {
91 *(pOid->pBytesRead) = 0;
92 *(pOid->pBytesNeeded) = ulSize;
93 }
94 }
95 else if (pOid->InformationBufferLength == ulSize || (pOid->ulToDoFlags & ohfSetMoreOK))
96 {
97 *(pOid->pBytesRead) = ulSize;
98 NdisMoveMemory(pDest, pOid->InformationBuffer, ulSize);
99 }
100 else
101 {
103 *(pOid->pBytesNeeded) = ulSize;
104 *(pOid->pBytesRead) = 0;
105 }
106 }
107 else
108 {
109 *(pOid->pBytesRead) = pOid->InformationBufferLength;
110 }
111 return status;
112}
@ ohfSetMoreOK
Definition: ParaNdis-Oid.h:73
@ ohfSetLessOK
Definition: ParaNdis-Oid.h:72
#define NDIS_STATUS_BUFFER_OVERFLOW
Definition: ndis.h:464
PUINT pBytesRead
Definition: ParaNdis-Oid.h:46

Referenced by ParaNdis_OnEnableWakeup(), ParaNdis_OnSetLookahead(), ParaNdis_OnSetPacketFilter(), ParaNdis_OnSetPower(), and ParaNdis_OnSetVlanId().

◆ ParaNdis_OnAddWakeupPattern()

NDIS_STATUS ParaNdis_OnAddWakeupPattern ( PARANDIS_ADAPTER pContext,
tOidDesc pOid 
)

Definition at line 584 of file ParaNdis-Oid.c.

585{
588 ULONG ulValidSize = pOid->InformationBufferLength;
589 status = ValidateWakeupPattern(pPmPattern, &ulValidSize);
591 {
592 *pOid->pBytesRead = ulValidSize;
593 }
594 else
595 {
596 *pOid->pBytesRead = 0;
597 *pOid->pBytesNeeded = ulValidSize;
598 }
599 // TODO: Apply
600 return status;
601}
static NDIS_STATUS ValidateWakeupPattern(PNDIS_PM_PACKET_PATTERN p, PULONG pValidSize)
Definition: ParaNdis-Oid.c:560
struct _NDIS_PM_PACKET_PATTERN * PNDIS_PM_PACKET_PATTERN

◆ ParaNdis_OnEnableWakeup()

NDIS_STATUS ParaNdis_OnEnableWakeup ( PARANDIS_ADAPTER pContext,
tOidDesc pOid 
)

Definition at line 627 of file ParaNdis-Oid.c.

628{
629 NDIS_STATUS status = ParaNdis_OidSetCopy(pOid, &pContext->ulEnableWakeup, sizeof(pContext->ulEnableWakeup));
631 {
632 DPrintf(0, ("[%s] new value %lX", __FUNCTION__, pContext->ulEnableWakeup));
633 }
634 return status;
635}
NDIS_STATUS ParaNdis_OidSetCopy(tOidDesc *pOid, PVOID pDest, ULONG ulSize)
Definition: ParaNdis-Oid.c:66

◆ ParaNdis_OnOidSetMulticastList()

NDIS_STATUS ParaNdis_OnOidSetMulticastList ( PARANDIS_ADAPTER pContext,
tOidDesc pOid 
)

Definition at line 150 of file ParaNdis-Oid.c.

151{
154 pContext,
155 pOid->InformationBuffer,
157 pOid->pBytesRead,
158 pOid->pBytesNeeded);
160 return status;
161}
VOID ParaNdis_UpdateDeviceFilters(PARANDIS_ADAPTER *pContext)
NDIS_STATUS ParaNdis_SetMulticastList(PARANDIS_ADAPTER *pContext, PVOID Buffer, ULONG BufferSize, PUINT pBytesRead, PUINT pBytesNeeded)

◆ ParaNdis_OnRemoveWakeupPattern()

NDIS_STATUS ParaNdis_OnRemoveWakeupPattern ( PARANDIS_ADAPTER pContext,
tOidDesc pOid 
)

Definition at line 606 of file ParaNdis-Oid.c.

607{
610 ULONG ulValidSize = pOid->InformationBufferLength;
611 status = ValidateWakeupPattern(pPmPattern, &ulValidSize);
613 {
614 *pOid->pBytesRead = ulValidSize;
615 }
616 else
617 {
618 *pOid->pBytesRead = 0;
619 *pOid->pBytesNeeded = ulValidSize;
620 }
621 return status;
622}

◆ ParaNdis_OnSetLookahead()

NDIS_STATUS ParaNdis_OnSetLookahead ( PARANDIS_ADAPTER pContext,
tOidDesc pOid 
)

Definition at line 640 of file ParaNdis-Oid.c.

641{
642 return ParaNdis_OidSetCopy(pOid, &pContext->DummyLookAhead, sizeof(pContext->DummyLookAhead));
643}

◆ ParaNdis_OnSetPacketFilter()

NDIS_STATUS ParaNdis_OnSetPacketFilter ( PARANDIS_ADAPTER pContext,
tOidDesc pOid 
)

Definition at line 118 of file ParaNdis-Oid.c.

119{
120 ULONG newValue;
122 pOid,
123 &newValue,
124 sizeof(newValue));
125
126 if (newValue & ~PARANDIS_PACKET_FILTERS)
128
130 {
131 pContext->PacketFilter = newValue;
132 DPrintf(1, ("[%s] PACKET FILTER SET TO %x", __FUNCTION__, pContext->PacketFilter));
134 }
135 return status;
136}
static const ULONG PARANDIS_PACKET_FILTERS
Definition: ndis56common.h:143
#define NDIS_STATUS_INVALID_DATA
Definition: ndis.h:486

◆ ParaNdis_OnSetVlanId()

NDIS_STATUS ParaNdis_OnSetVlanId ( PARANDIS_ADAPTER pContext,
tOidDesc pOid 
)

Definition at line 645 of file ParaNdis-Oid.c.

646{
648 if (IsVlanSupported(pContext))
649 {
650 status = ParaNdis_OidSetCopy(pOid, &pContext->VlanId, sizeof(pContext->VlanId));
651 pContext->VlanId &= 0xfff;
652 DPrintf(0, ("[%s] new value %d on MAC %X", __FUNCTION__, pContext->VlanId, pContext->CurrentMacAddress[5]));
654 }
655 return status;
656}
VOID ParaNdis_DeviceFiltersUpdateVlanId(PARANDIS_ADAPTER *pContext)

◆ ValidateWakeupPattern()

static NDIS_STATUS ValidateWakeupPattern ( PNDIS_PM_PACKET_PATTERN  p,
PULONG  pValidSize 
)
static

Definition at line 560 of file ParaNdis-Oid.c.

561{
563
564 if (*pValidSize < sizeof(*p))
565 {
566 *pValidSize = sizeof(*p);
567 }
568 else
569 {
570 ULONG ul = p->PatternOffset + p->PatternSize;
571 if (*pValidSize >= ul) status = NDIS_STATUS_SUCCESS;
572 *pValidSize = ul;
573 DPrintf(2, ("[%s] pattern of %d at %d, mask %d (%s)",
574 __FUNCTION__, p->PatternSize, p->PatternOffset, p->MaskSize,
575 status == NDIS_STATUS_SUCCESS ? "OK" : "Fail"));
576 }
577 return status;
578}
GLfloat GLfloat p
Definition: glext.h:8902

Referenced by ParaNdis_OnAddWakeupPattern(), and ParaNdis_OnRemoveWakeupPattern().

Variable Documentation

◆ VendorName