SharpPcap : SharpPcap.WinPcap Namespace

WinPcapDevice Class

WinPcap device

Syntax

public class WinPcapDevice : SharpPcap.LibPcap.LibPcapLiveDevice

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: SharpPcap.WinPcap
Assembly: SharpPcap (in SharpPcap.dll)
Assembly Versions: 4.0.1.0

Members

See Also: Inherited members from SharpPcap.LibPcap.LibPcapLiveDevice.

Protected Fields

captureThread System.Threading.Thread . Thread that is performing the background packet capture (Inherited from SharpPcap.LibPcap.PcapDevice.)
m_pcapAdapterHandle IntPtr . Handle to a pcap adapter, not equal to IntPtr.Zero if an adapter is open (Inherited from SharpPcap.LibPcap.PcapDevice.)
m_pcapIf SharpPcap.LibPcap.PcapInterface . Low level interface object that contains device specific information (Inherited from SharpPcap.LibPcap.PcapDevice.)
m_pcapPacketCount int . Number of packets that this adapter should capture (Inherited from SharpPcap.LibPcap.PcapDevice.)
shouldCaptureThreadStop bool . Flag that indicates that a capture thread should stop (Inherited from SharpPcap.LibPcap.PcapDevice.)

Public Properties

[read-only]
Addresses System.Collections.ObjectModel.ReadOnlyCollection<SharpPcap.LibPcap.PcapAddress> . Addresses that represent this device (Inherited from SharpPcap.LibPcap.LibPcapLiveDevice.)
[read-only]
override
Description string . Gets the pcap description of this device (Inherited from SharpPcap.LibPcap.LibPcapLiveDevice.)
[read-only]
abstract
Description string . Description (Inherited from SharpPcap.LibPcap.PcapDevice.)
Filter string . Kernel level filtering expression associated with this device. For more info on filter expression syntax, see: http://www.winpcap.org/docs/docs31/html/group__language.html (Inherited from SharpPcap.LibPcap.PcapDevice.)
[read-only]
Flags uint . Interface flags, see pcap_findalldevs() man page for more info (Inherited from SharpPcap.LibPcap.LibPcapLiveDevice.)
[read-only]
Interface SharpPcap.LibPcap.PcapInterface . Documentation for this section has not yet been entered. (Inherited from SharpPcap.LibPcap.PcapDevice.)
KernelBufferSize uint . Documentation for this section has not yet been entered.
[read-only]
LastError string . The last pcap error associated with this pcap device (Inherited from SharpPcap.LibPcap.PcapDevice.)
[read-only]
LinkType PacketDotNet.LinkLayers . Link type in terms of PacketDotNet.LinkLayers (Inherited from SharpPcap.LibPcap.PcapDevice.)
[read-only]
Loopback bool . True if device is a loopback interface, false if not (Inherited from SharpPcap.LibPcap.LibPcapLiveDevice.)
MacAddress System.Net.NetworkInformation.PhysicalAddress . Mac address of the physical device (Inherited from SharpPcap.LibPcap.PcapDevice.)
[write-only]
MinToCopy int . Documentation for this section has not yet been entered.
Mode CaptureMode . Documentation for this section has not yet been entered.
[read-only]
override
Name string . Gets the pcap name of this network device (Inherited from SharpPcap.LibPcap.LibPcapLiveDevice.)
[read-only]
abstract
Name string . Device name (Inherited from SharpPcap.LibPcap.PcapDevice.)
NonBlockingMode bool . Set/Get Non-Blocking Mode. returns allways false for savefiles. (Inherited from SharpPcap.LibPcap.LibPcapLiveDevice.)
[read-only]
Opened bool . Return a value indicating if this adapter is opened (Inherited from SharpPcap.LibPcap.PcapDevice.)
[read-only]
Started bool . Return a value indicating if the capturing process of this adapter is started (Inherited from SharpPcap.LibPcap.PcapDevice.)
[read-only]
override
Statistics SharpPcap.ICaptureStatistics . Retrieves pcap statistics (Inherited from SharpPcap.LibPcap.LibPcapLiveDevice.)
[read-only]
abstract
Statistics SharpPcap.ICaptureStatistics . Retrieves pcap statistics (Inherited from SharpPcap.LibPcap.PcapDevice.)
StopCaptureTimeout TimeSpan . Maximum time within which the capture thread must join the main thread (on SharpPcap.LibPcap.PcapDevice.StopCapture) or else the thread is aborted and an exception thrown. (Inherited from SharpPcap.LibPcap.PcapDevice.)

Public Methods

Capture ()
Synchronously capture packets on this device. Method blocks forever. (Inherited from SharpPcap.LibPcap.PcapDevice.)
Capture (int)
Synchronously captures packets on this network device. This method will block until capturing is finished. (Inherited from SharpPcap.LibPcap.PcapDevice.)
override
Close ()
Close the device
Close ()
Closes this adapter (Inherited from SharpPcap.LibPcap.PcapDevice.)
Finalize ()
PcapDevice finalizer. Ensure PcapDevices are stopped and closed before exit. (Inherited from SharpPcap.LibPcap.LibPcapLiveDevice.)
GetNextPacket () : SharpPcap.RawCapture
Gets the next packet captured on this device (Inherited from SharpPcap.LibPcap.PcapDevice.)
GetNextPacket (out SharpPcap.RawCapture) : int
Gets the next packet captured on this device (Inherited from SharpPcap.LibPcap.PcapDevice.)
GetNextPacketPointers (ref IntPtr, ref IntPtr) : int
Gets pointers to the next PCAP header and packet data. Data is only valid until next call to GetNextPacketNative. Advanced use only. Intended to allow unmanaged code to avoid the overhead of marshalling PcapHeader and packet contents to allocated memory. (Inherited from SharpPcap.LibPcap.PcapDevice.)
override
Open ()
Open the device
override
Open ()
Open the device with default values of: promiscuous_mode = false, read_timeout = 1000 To start capturing call the 'StartCapture' function (Inherited from SharpPcap.LibPcap.LibPcapLiveDevice.)
abstract
Open ()
Open the device with class specific options (Inherited from SharpPcap.LibPcap.PcapDevice.)
override
Open (SharpPcap.DeviceMode)
Open the device. To start capturing call the 'StartCapture' function (Inherited from SharpPcap.LibPcap.LibPcapLiveDevice.)
Open (SharpPcap.DeviceMode)
Open the device. To start capturing call the 'StartCapture' function (Inherited from SharpPcap.LibPcap.PcapDevice.)
override
Open (SharpPcap.DeviceMode, int)
Open the device. To start capturing call the 'StartCapture' function (Inherited from SharpPcap.LibPcap.LibPcapLiveDevice.)
Open (SharpPcap.DeviceMode, int)
Open the device. To start capturing call the 'StartCapture' function (Inherited from SharpPcap.LibPcap.PcapDevice.)
Open (OpenFlags, int)
Open a device with specific flags WinPcap extension - Use of this method will exclude your application from working on Linux or Mac
Open (OpenFlags, int, RemoteAuthentication)
Open
SendPacket (PacketDotNet.Packet)
Sends a raw packet throgh this device (Inherited from SharpPcap.LibPcap.PcapDevice.)
SendPacket (byte[])
Sends a raw packet throgh this device (Inherited from SharpPcap.LibPcap.PcapDevice.)
SendPacket (PacketDotNet.Packet, int)
Sends a raw packet throgh this device (Inherited from SharpPcap.LibPcap.PcapDevice.)
override
SendPacket (byte[], int)
Sends a raw packet throgh this device (Inherited from SharpPcap.LibPcap.LibPcapLiveDevice.)
SendPacket (byte[], int)
Sends a raw packet throgh this device (Inherited from SharpPcap.LibPcap.PcapDevice.)
SendQueue (SendQueue, SendQueueTransmitModes) : int
Sends all packets in a 'PcapSendQueue' out this pcap device
override
StartCapture ()
Starts the capturing process via a background thread OnPacketArrival() will be called for each captured packet NOTE: Winpcap devices can capture packets or statistics updates so only if both a packet handler AND a statistics handler are defined will an exception be thrown
StartCapture ()
Starts the capturing process via a background thread OnPacketArrival() will be called for each captured packet (Inherited from SharpPcap.LibPcap.PcapDevice.)
StopCapture ()
Stops the capture process Throws an exception if the stop capture timeout is exceeded and the capture thread was aborted (Inherited from SharpPcap.LibPcap.PcapDevice.)
override
ToString () : string
Override the default ToString() implementation (Inherited from SharpPcap.LibPcap.PcapDevice.)

Protected Methods

CaptureThread ()
The capture thread (Inherited from SharpPcap.LibPcap.PcapDevice.)
MarshalRawPacket (IntPtr, IntPtr) : SharpPcap.RawCapture
Convert an unmanaged packet into a managed PacketDotNet.RawPacket (Inherited from SharpPcap.LibPcap.PcapDevice.)
PacketHandler (IntPtr, IntPtr, IntPtr)
Pcap_loop callback method. (Inherited from SharpPcap.LibPcap.PcapDevice.)
SendCaptureStoppedEvent (SharpPcap.CaptureStoppedEventStatus)
Notify the delegates that are subscribed to the capture stopped event (Inherited from SharpPcap.LibPcap.PcapDevice.)
override
SendPacketArrivalEvent (SharpPcap.RawCapture)
Notify the OnPacketArrival delegates about a newly captured packet
SendPacketArrivalEvent (SharpPcap.RawCapture)
Notify the OnPacketArrival delegates about a newly captured packet (Inherited from SharpPcap.LibPcap.PcapDevice.)
SetFilter (string)
Assign a filter to this device given a filterExpression (Inherited from SharpPcap.LibPcap.PcapDevice.)
ThrowIfNotOpen (string)
Helper method for checking that the adapter is open, throws an exception with a string of ExceptionString if the device isn't open (Inherited from SharpPcap.LibPcap.PcapDevice.)

Public Events

OnCaptureStopped Fired when the capture process of this pcap device is stopped (Inherited from SharpPcap.LibPcap.PcapDevice.)
OnPacketArrival Fires whenever a new packet is processed, either when the packet arrives from the network device or when the packet is read from the on-disk file. For network captured packets this event is invoked only when working in "PcapMode.Capture" mode. (Inherited from SharpPcap.LibPcap.PcapDevice.)
OnPcapStatistics Fires whenever a new pcap statistics is available for this Pcap Device. For network captured packets this event is invoked only when working in "PcapMode.Statistics" mode.

Member Details

Close Method

Close the device

Syntax

public override void Close ()

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: SharpPcap.WinPcap
Assembly: SharpPcap (in SharpPcap.dll)
Assembly Versions: 4.0.1.0

KernelBufferSize Property

Documentation for this section has not yet been entered.

Syntax

public virtual uint KernelBufferSize { get; set; }

Value

Set the kernel value buffer size in bytes WinPcap extension

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: SharpPcap.WinPcap
Assembly: SharpPcap (in SharpPcap.dll)
Assembly Versions: 4.0.1.0

MinToCopy Property

Documentation for this section has not yet been entered.

Syntax

public int MinToCopy { set; }

Value

Set the minumum amount of data (in bytes) received by the kernel in a single call. WinPcap extension

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: SharpPcap.WinPcap
Assembly: SharpPcap (in SharpPcap.dll)
Assembly Versions: 4.0.1.0

Mode Property

Documentation for this section has not yet been entered.

Syntax

public virtual CaptureMode Mode { get; set; }

Value

WinPcap specific property

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: SharpPcap.WinPcap
Assembly: SharpPcap (in SharpPcap.dll)
Assembly Versions: 4.0.1.0

OnPcapStatistics Event

Fires whenever a new pcap statistics is available for this Pcap Device. For network captured packets this event is invoked only when working in "PcapMode.Statistics" mode.

Syntax

public event StatisticsModeEventHandler OnPcapStatistics

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: SharpPcap.WinPcap
Assembly: SharpPcap (in SharpPcap.dll)
Assembly Versions: 4.0.1.0

Open Method

Open the device

Syntax

public override void Open ()

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: SharpPcap.WinPcap
Assembly: SharpPcap (in SharpPcap.dll)
Assembly Versions: 4.0.1.0

Open Method

Open a device with specific flags WinPcap extension - Use of this method will exclude your application from working on Linux or Mac

Syntax

public virtual void Open (OpenFlags flags, int read_timeout)

Parameters

flags
Documentation for this section has not yet been entered.
read_timeout
Documentation for this section has not yet been entered.

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: SharpPcap.WinPcap
Assembly: SharpPcap (in SharpPcap.dll)
Assembly Versions: 4.0.1.0

Open Method

Open

Syntax

public void Open (OpenFlags flags, int readTimeoutMilliseconds, RemoteAuthentication remoteAuthentication)

Parameters

flags
A SharpPcap.WinPcap.OpenFlags
readTimeoutMilliseconds
A int
remoteAuthentication
A SharpPcap.WinPcap.RemoteAuthentication

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: SharpPcap.WinPcap
Assembly: SharpPcap (in SharpPcap.dll)
Assembly Versions: 4.0.1.0

SendPacketArrivalEvent Method

Notify the OnPacketArrival delegates about a newly captured packet

Syntax

protected override void SendPacketArrivalEvent (SharpPcap.RawCapture p)

Parameters

p
A SharpPcap.RawCapture

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: SharpPcap.WinPcap
Assembly: SharpPcap (in SharpPcap.dll)
Assembly Versions: 4.0.1.0

SendQueue Method

Sends all packets in a 'PcapSendQueue' out this pcap device

Syntax

public int SendQueue (SendQueue q, SendQueueTransmitModes transmitMode)

Parameters

q
A SharpPcap.WinPcap.SendQueue
transmitMode
A SharpPcap.WinPcap.SendQueueTransmitModes

Returns

A int

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: SharpPcap.WinPcap
Assembly: SharpPcap (in SharpPcap.dll)
Assembly Versions: 4.0.1.0

StartCapture Method

Starts the capturing process via a background thread OnPacketArrival() will be called for each captured packet NOTE: Winpcap devices can capture packets or statistics updates so only if both a packet handler AND a statistics handler are defined will an exception be thrown

Syntax

public override void StartCapture ()

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: SharpPcap.WinPcap
Assembly: SharpPcap (in SharpPcap.dll)
Assembly Versions: 4.0.1.0