- Main Page
- Modules
- Data Structures
- Files
- Related Pages

- Data Structures
- Data Fields

# _OPEN_INSTANCE Struct Reference
[NPF structures and definitions]

Contains the state of a running instance of the NPF driver. More...

`#include <Packet.h>`

## Data Fields
PDEVICE_EXTENSION | DeviceExtension
NDIS_HANDLE | AdapterHandle
| NDIS idetifier of the adapter used by this instance.
UINT | Medium
NDIS_HANDLE | PacketPool
| Pool of NDIS_PACKET structures used to transfer the packets from and to the NIC driver.
KSPIN_LOCK | RequestSpinLock
| SpinLock used to synchronize the OID requests.
LIST_ENTRY | RequestList
| List of pending OID requests.
LIST_ENTRY | ResetIrpList
| List of pending adapter reset requests.
INTERNAL_REQUEST | Requests [MAX_REQUESTS]
| Array of structures that wrap every single OID request.
PMDL | BufferMdl
| Pointer to a Memory descriptor list (MDL) that maps the circular buffer's memory.
PKEVENT | ReadEvent
| Pointer to the event on which the read calls on this instance must wait.
PUCHAR | bpfprogram
UINT | MinToCopy
LARGE_INTEGER | TimeOut
int | mode
| Working mode of the driver. See PacketSetMode() for details.
LARGE_INTEGER | Nbytes
| Amount of bytes accepted by the filter when this instance is in statistical mode.
LARGE_INTEGER | Npackets
| Number of packets accepted by the filter when this instance is in statistical mode.
NDIS_SPIN_LOCK | CountersLock
| SpinLock that protects the statistical mode counters.
UINT | Nwrites
ULONG | Multiple_Write_Counter
| Counts the number of times a single write has already physically repeated.
NDIS_EVENT | WriteEvent
| Event used to synchronize the multiple write process.
BOOLEAN | WriteInProgress
NDIS_SPIN_LOCK | WriteLock
| SpinLock that protects the WriteInProgress variable.
NDIS_EVENT | NdisRequestEvent
| Event used to synchronize I/O requests with the callback structure of NDIS.
BOOLEAN | SkipSentPackets
| True if this instance should not capture back the packets that it transmits.
NDIS_STATUS | IOStatus
| Maintains the status of and OID request call, that will be passed to the application.
HANDLE | DumpFileHandle
| Handle of the file used in dump mode.
PFILE_OBJECT | DumpFileObject
| Pointer to the object of the file used in dump mode.
PKTHREAD | DumpThreadObject
| Pointer to the object of the thread used in dump mode.
HANDLE | DumpThreadHandle
| Handle of the thread created by dump mode to asynchronously move the buffer to disk.
NDIS_EVENT | DumpEvent
| Event used to synchronize the dump thread with the tap when the instance is in dump mode.
LARGE_INTEGER | DumpOffset
| Current offset in the dump file.
UNICODE_STRING | DumpFileName
| String containing the name of the dump file.
UINT | MaxDumpBytes
UINT | MaxDumpPacks
BOOLEAN | DumpLimitReached
MEM_TYPE | mem_ex
| Memory used by the TME virtual co-processor.
TME_CORE | tme
| Data structure containing the virtualization of the TME co-processor.
NDIS_SPIN_LOCK | MachineLock
| SpinLock that protects the BPF filter and the TME engine, if in use.
UINT | MaxFrameSize
CpuPrivateData | CpuData [32]
| Pool of kernel buffer structures, one for each CPU.
ULONG | ReaderSN
| Sequence number of the next packet to be read from the pool of kernel buffers.
ULONG | WriterSN
ULONG | Size
| Size of each kernel buffer contained in the CpuData field.
ULONG | AdapterHandleUsageCounter
NDIS_SPIN_LOCK | AdapterHandleLock
ULONG | AdapterBindingStatus
| Specifies if NPF is still bound to the adapter used by this instance, it's unbinding or it's not bound.
NDIS_EVENT | NdisOpenCloseCompleteEvent
NDIS_EVENT | NdisWriteCompleteEvent
| Event that is signalled when all the packets have been successfully sent by NdisSend (and corresponfing sendComplete has been called).
NTSTATUS | OpenCloseStatus
ULONG | TransmitPendingPackets
| Specifies the number of packets that are pending to be transmitted, i.e. have been submitted to NdisSendXXX but the SendComplete has not been called yet.

## Detailed Description

Contains the state of a running instance of the NPF driver.

This is the most important structure of NPF: it is used by almost all the functions of the driver. An _OPEN_INSTANCE structure is associated with every user-level session, allowing concurrent access to the driver.

Definition at line 360 of file Packet.h.

## Field Documentation

PDEVICE_EXTENSION DeviceExtension

Pointer to the _DEVICE_EXTENSION structure of the device on which the instance is bound.

Definition at line 362 of file Packet.h.

NDIS_HANDLE AdapterHandle

NDIS idetifier of the adapter used by this instance.

Definition at line 364 of file Packet.h.

UINT Medium

Type of physical medium the underlying NDIS driver uses. See the documentation of NdisOpenAdapter in the MS DDK for details.

Definition at line 365 of file Packet.h.

NDIS_HANDLE PacketPool

Pool of NDIS_PACKET structures used to transfer the packets from and to the NIC driver.

Definition at line 367 of file Packet.h.

KSPIN_LOCK RequestSpinLock

SpinLock used to synchronize the OID requests.

Definition at line 368 of file Packet.h.

LIST_ENTRY RequestList

List of pending OID requests.

Definition at line 369 of file Packet.h.

LIST_ENTRY ResetIrpList

List of pending adapter reset requests.

Definition at line 370 of file Packet.h.

INTERNAL_REQUEST Requests[MAX_REQUESTS]

Array of structures that wrap every single OID request.

Definition at line 371 of file Packet.h.

PMDL BufferMdl

Pointer to a Memory descriptor list (MDL) that maps the circular buffer's memory.

Definition at line 372 of file Packet.h.

PKEVENT ReadEvent

Pointer to the event on which the read calls on this instance must wait.

Definition at line 373 of file Packet.h.

PUCHAR bpfprogram

Pointer to the filtering pseudo-code associated with current instance of the driver. This code is used only in particular situations (for example when the packet received from the NIC driver is stored in two non-consecutive buffers. In normal situations the filtering routine created by the JIT compiler and pointed by the next field is used. See NPF driver internals manual for details on the filtering process.

Definition at line 374 of file Packet.h.

UINT MinToCopy

Minimum amount of data in the circular buffer that unlocks a read. Set with the BIOCSMINTOCOPY IOCTL.

Definition at line 383 of file Packet.h.

LARGE_INTEGER TimeOut

Timeout after which a read is released, also if the amount of data in the buffer is less than MinToCopy. Set with the BIOCSRTIMEOUT IOCTL.

Definition at line 385 of file Packet.h.

int mode

Working mode of the driver. See PacketSetMode() for details.

Definition at line 388 of file Packet.h.

LARGE_INTEGER Nbytes

Amount of bytes accepted by the filter when this instance is in statistical mode.

Definition at line 389 of file Packet.h.

LARGE_INTEGER Npackets

Number of packets accepted by the filter when this instance is in statistical mode.

Definition at line 390 of file Packet.h.

NDIS_SPIN_LOCK CountersLock

SpinLock that protects the statistical mode counters.

Definition at line 391 of file Packet.h.

UINT Nwrites

Number of times a single write must be physically repeated. See NPF driver internals manual for an explanation

Definition at line 392 of file Packet.h.

ULONG Multiple_Write_Counter

Counts the number of times a single write has already physically repeated.

Definition at line 394 of file Packet.h.

NDIS_EVENT WriteEvent

Event used to synchronize the multiple write process.

Definition at line 395 of file Packet.h.

BOOLEAN WriteInProgress

True if a write is currently in progress. NPF currently allows a single wite on the same open instance.

Definition at line 396 of file Packet.h.

NDIS_SPIN_LOCK WriteLock

SpinLock that protects the WriteInProgress variable.

Definition at line 398 of file Packet.h.

NDIS_EVENT NdisRequestEvent

Event used to synchronize I/O requests with the callback structure of NDIS.

Definition at line 399 of file Packet.h.

BOOLEAN SkipSentPackets

True if this instance should not capture back the packets that it transmits.

Definition at line 400 of file Packet.h.

NDIS_STATUS IOStatus

Maintains the status of and OID request call, that will be passed to the application.

Definition at line 401 of file Packet.h.

HANDLE DumpFileHandle

Handle of the file used in dump mode.

Definition at line 402 of file Packet.h.

PFILE_OBJECT DumpFileObject

Pointer to the object of the file used in dump mode.

Definition at line 403 of file Packet.h.

PKTHREAD DumpThreadObject

Pointer to the object of the thread used in dump mode.

Definition at line 404 of file Packet.h.

HANDLE DumpThreadHandle

Handle of the thread created by dump mode to asynchronously move the buffer to disk.

Definition at line 405 of file Packet.h.

NDIS_EVENT DumpEvent

Event used to synchronize the dump thread with the tap when the instance is in dump mode.

Definition at line 406 of file Packet.h.

LARGE_INTEGER DumpOffset

Current offset in the dump file.

Definition at line 407 of file Packet.h.

UNICODE_STRING DumpFileName

String containing the name of the dump file.

Definition at line 408 of file Packet.h.

UINT MaxDumpBytes

Maximum dimension in bytes of the dump file. If the dump file reaches this size it will be closed. A value of 0 means unlimited size.

Definition at line 409 of file Packet.h.

UINT MaxDumpPacks

Maximum number of packets that will be saved in the dump file. If this number of packets is reached the dump will be closed. A value of 0 means unlimited number of packets.

Definition at line 411 of file Packet.h.

BOOLEAN DumpLimitReached

TRUE if the maximum dimension of the dump file (MaxDumpBytes or MaxDumpPacks) is reached.

Definition at line 414 of file Packet.h.

MEM_TYPE mem_ex

Memory used by the TME virtual co-processor.

Definition at line 416 of file Packet.h.

TME_CORE tme

Data structure containing the virtualization of the TME co-processor.

Definition at line 417 of file Packet.h.

NDIS_SPIN_LOCK MachineLock

SpinLock that protects the BPF filter and the TME engine, if in use.

Definition at line 418 of file Packet.h.

UINT MaxFrameSize

Maximum frame size that the underlying MAC acceptes. Used to perform a check on the size of the frames sent with NPF_Write() or NPF_BufferedWrite().

Definition at line 419 of file Packet.h.

CpuPrivateData CpuData[32]

Pool of kernel buffer structures, one for each CPU.

Definition at line 421 of file Packet.h.

ULONG ReaderSN

Sequence number of the next packet to be read from the pool of kernel buffers.

Definition at line 422 of file Packet.h.

ULONG WriterSN

Sequence number of the next packet to be written in the pool of kernel buffers. These two sequence numbers are unique for each capture instance.

Definition at line 423 of file Packet.h.

ULONG Size

Size of each kernel buffer contained in the CpuData field.

Definition at line 425 of file Packet.h.

ULONG AdapterHandleUsageCounter

Definition at line 426 of file Packet.h.

NDIS_SPIN_LOCK AdapterHandleLock

Definition at line 427 of file Packet.h.

ULONG AdapterBindingStatus

Specifies if NPF is still bound to the adapter used by this instance, it's unbinding or it's not bound.

Definition at line 428 of file Packet.h.

NDIS_EVENT NdisOpenCloseCompleteEvent

Definition at line 430 of file Packet.h.

NDIS_EVENT NdisWriteCompleteEvent

Event that is signalled when all the packets have been successfully sent by NdisSend (and corresponfing sendComplete has been called).

Definition at line 431 of file Packet.h.

NTSTATUS OpenCloseStatus

Definition at line 432 of file Packet.h.

ULONG TransmitPendingPackets

Specifies the number of packets that are pending to be transmitted, i.e. have been submitted to NdisSendXXX but the SendComplete has not been called yet.

Definition at line 433 of file Packet.h.

The documentation for this struct was generated from the following file:

- Packet.h

documentation. Copyright (c) 2002-2005 Politecnico di Torino. Copyright (c) 2005-2007 CACE Technologies. All rights reserved.