SharpPcap : SharpPcap.LibPcap Namespace

LibPcapLiveDevice Class

Capture live packets from a network device

Syntax

public class LibPcapLiveDevice : PcapDevice

Remarks

Documentation for this section has not yet been entered.

Requirements

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

Members

See Also: Inherited members from PcapDevice.

Protected Constructors

Default contructor for subclasses

Protected Fields

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

Public Properties

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

Public Methods

Capture ()
Synchronously capture packets on this device. Method blocks forever. (Inherited from PcapDevice.)
Capture (int)
Synchronously captures packets on this network device. This method will block until capturing is finished. (Inherited from PcapDevice.)
Close ()
Closes this adapter (Inherited from PcapDevice.)
Finalize ()
PcapDevice finalizer. Ensure PcapDevices are stopped and closed before exit.
GetNextPacket () : SharpPcap.RawCapture
Gets the next packet captured on this device (Inherited from PcapDevice.)
GetNextPacket (out SharpPcap.RawCapture) : int
Gets the next packet captured on this device (Inherited from 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 PcapDevice.)
override
Open ()
Open the device with default values of: promiscuous_mode = false, read_timeout = 1000 To start capturing call the 'StartCapture' function
abstract
Open ()
Open the device with class specific options (Inherited from PcapDevice.)
override
Open (SharpPcap.DeviceMode)
Open the device. To start capturing call the 'StartCapture' function
Open (SharpPcap.DeviceMode)
Open the device. To start capturing call the 'StartCapture' function (Inherited from PcapDevice.)
override
Open (SharpPcap.DeviceMode, int)
Open the device. To start capturing call the 'StartCapture' function
Open (SharpPcap.DeviceMode, int)
Open the device. To start capturing call the 'StartCapture' function (Inherited from PcapDevice.)
SendPacket (PacketDotNet.Packet)
Sends a raw packet throgh this device (Inherited from PcapDevice.)
SendPacket (byte[])
Sends a raw packet throgh this device (Inherited from PcapDevice.)
SendPacket (PacketDotNet.Packet, int)
Sends a raw packet throgh this device (Inherited from PcapDevice.)
override
SendPacket (byte[], int)
Sends a raw packet throgh this device
SendPacket (byte[], int)
Sends a raw packet throgh this device (Inherited from PcapDevice.)
StartCapture ()
Starts the capturing process via a background thread OnPacketArrival() will be called for each captured packet (Inherited from PcapDevice.)
StopCapture ()
Stops the capture process Throws an exception if the stop capture timeout is exceeded and the capture thread was aborted (Inherited from PcapDevice.)
override
ToString () : string
Override the default ToString() implementation (Inherited from PcapDevice.)

Protected Methods

CaptureThread ()
The capture thread (Inherited from PcapDevice.)
MarshalRawPacket (IntPtr, IntPtr) : SharpPcap.RawCapture
Convert an unmanaged packet into a managed PacketDotNet.RawPacket (Inherited from PcapDevice.)
PacketHandler (IntPtr, IntPtr, IntPtr)
Pcap_loop callback method. (Inherited from PcapDevice.)
SendCaptureStoppedEvent (SharpPcap.CaptureStoppedEventStatus)
Notify the delegates that are subscribed to the capture stopped event (Inherited from PcapDevice.)
SendPacketArrivalEvent (SharpPcap.RawCapture)
Notify the OnPacketArrival delegates about a newly captured packet (Inherited from PcapDevice.)
SetFilter (string)
Assign a filter to this device given a filterExpression (Inherited from 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 PcapDevice.)

Public Events

OnCaptureStopped Fired when the capture process of this pcap device is stopped (Inherited from 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 PcapDevice.)

Member Details

LibPcapLiveDevice Constructor

Default contructor for subclasses

Syntax

protected LibPcapLiveDevice ()

Remarks

Documentation for this section has not yet been entered.

Requirements

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

Addresses Property

Addresses that represent this device

Syntax

Value

Documentation for this section has not yet been entered.

Remarks

Documentation for this section has not yet been entered.

Requirements

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

Description Property

Gets the pcap description of this device

Syntax

public override string Description { get; }

Value

Documentation for this section has not yet been entered.

Remarks

Documentation for this section has not yet been entered.

Requirements

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

Finalize Method

PcapDevice finalizer. Ensure PcapDevices are stopped and closed before exit.

Syntax

void Finalize ()

Remarks

Documentation for this section has not yet been entered.

Requirements

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

Flags Property

Interface flags, see pcap_findalldevs() man page for more info

Syntax

public virtual uint Flags { get; }

Value

Documentation for this section has not yet been entered.

Remarks

Documentation for this section has not yet been entered.

Requirements

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

Loopback Property

True if device is a loopback interface, false if not

Syntax

public virtual bool Loopback { get; }

Value

Documentation for this section has not yet been entered.

Remarks

Documentation for this section has not yet been entered.

Requirements

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

Name Property

Gets the pcap name of this network device

Syntax

public override string Name { get; }

Value

Documentation for this section has not yet been entered.

Remarks

Documentation for this section has not yet been entered.

Requirements

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

NonBlockingMode Property

Set/Get Non-Blocking Mode. returns allways false for savefiles.

Syntax

public bool NonBlockingMode { get; set; }

Value

Documentation for this section has not yet been entered.

Remarks

Documentation for this section has not yet been entered.

Requirements

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

Open Method

Open the device with default values of: promiscuous_mode = false, read_timeout = 1000 To start capturing call the 'StartCapture' function

Syntax

public override void Open ()

Remarks

Documentation for this section has not yet been entered.

Requirements

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

Open Method

Open the device. To start capturing call the 'StartCapture' function

Syntax

public override void Open (SharpPcap.DeviceMode mode)

Parameters

mode
A SharpPcap.DeviceMode

Remarks

Documentation for this section has not yet been entered.

Requirements

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

Open Method

Open the device. To start capturing call the 'StartCapture' function

Syntax

public override void Open (SharpPcap.DeviceMode mode, int read_timeout)

Parameters

mode
A SharpPcap.DeviceMode
read_timeout
A int

Remarks

Documentation for this section has not yet been entered.

Requirements

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

SendPacket Method

Sends a raw packet throgh this device

Syntax

public override void SendPacket (byte[] p, int size)

Parameters

p
The packet bytes to send
size
The number of bytes to send

Remarks

Documentation for this section has not yet been entered.

Requirements

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

Statistics Property

Retrieves pcap statistics

Syntax

public override SharpPcap.ICaptureStatistics Statistics { get; }

Value

A SharpPcap.LibPcap.PcapStatistics

Remarks

Documentation for this section has not yet been entered.

Requirements

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