SharpPcap : SharpPcap Namespace

ICaptureDevice Interface

Interfaces for capture devices

Syntax

public interface ICaptureDevice

Remarks

Documentation for this section has not yet been entered.

Requirements

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

Members

Public Properties

[read-only]
Description string . Documentation for this section has not yet been entered.
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
[read-only]
LastError string . The last pcap error associated with this pcap device
[read-only]
LinkType PacketDotNet.LinkLayers . Return the pcap link layer value of an adapter.
[read-only]
MacAddress System.Net.NetworkInformation.PhysicalAddress . Mac address of the physical device
[read-only]
Name string . Gets the name of the device
[read-only]
Started bool . Return a value indicating if the capturing process of this adapter is started
[read-only]
Statistics ICaptureStatistics . Retrieves pcap statistics
StopCaptureTimeout TimeSpan . Maximum time within which the capture thread must join the main thread (on ICaptureDevice.StopCapture) or else the thread is aborted and an exception thrown.

Public Methods

Capture ()
Synchronously capture packets on this device. Method blocks forever.
Close ()
Closes this adapter
GetNextPacket () : RawCapture
Retrieves the next packet from a device
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.
Open ()
Opens the adapter
Open (DeviceMode)
Open the device. To start capturing call the 'StartCapture' function
Open (DeviceMode, int)
Open the device. To start capturing call the 'StartCapture' function
SendPacket (PacketDotNet.Packet)
Sends a raw packet throgh this device
SendPacket (byte[])
Sends a raw packet throgh this device
SendPacket (PacketDotNet.Packet, int)
Sends a raw packet throgh this device
SendPacket (byte[], int)
Sends a raw packet throgh this device
StartCapture ()
Start the capture
StopCapture ()
Stop the capture

Public Events

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

Member Details

Capture Method

Synchronously capture packets on this device. Method blocks forever.

Syntax

public void Capture ()

Remarks

Documentation for this section has not yet been entered.

Requirements

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

Close Method

Closes this adapter

Syntax

public void Close ()

Remarks

Documentation for this section has not yet been entered.

Requirements

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

Description Property

Documentation for this section has not yet been entered.

Syntax

public string Description { get; }

Value

Description of the device

Remarks

Documentation for this section has not yet been entered.

Requirements

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

Filter Property

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

Syntax

public string Filter { 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
Assembly: SharpPcap (in SharpPcap.dll)
Assembly Versions: 4.0.1.0

GetNextPacket Method

Retrieves the next packet from a device

Syntax

public RawCapture GetNextPacket ()

Returns

Remarks

Documentation for this section has not yet been entered.

Requirements

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

GetNextPacketPointers Method

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.

Syntax

public int GetNextPacketPointers (ref IntPtr header, ref IntPtr data)

Parameters

header
Documentation for this section has not yet been entered.
data
Documentation for this section has not yet been entered.

Returns

Documentation for this section has not yet been entered.

Remarks

Documentation for this section has not yet been entered.

Requirements

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

LastError Property

The last pcap error associated with this pcap device

Syntax

public string LastError { get; }

Value

Documentation for this section has not yet been entered.

Remarks

Documentation for this section has not yet been entered.

Requirements

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

LinkType Property

Return the pcap link layer value of an adapter.

Syntax

public PacketDotNet.LinkLayers LinkType { get; }

Value

Documentation for this section has not yet been entered.

Remarks

Documentation for this section has not yet been entered.

Requirements

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

MacAddress Property

Mac address of the physical 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
Assembly: SharpPcap (in SharpPcap.dll)
Assembly Versions: 4.0.1.0

Name Property

Gets the name of the device

Syntax

public 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
Assembly: SharpPcap (in SharpPcap.dll)
Assembly Versions: 4.0.1.0

OnCaptureStopped Event

Fired when the capture process of this pcap device is stopped

Syntax

public event CaptureStoppedEventHandler OnCaptureStopped

Remarks

Documentation for this section has not yet been entered.

Requirements

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

OnPacketArrival Event

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.

Syntax

public event PacketArrivalEventHandler OnPacketArrival

Remarks

Documentation for this section has not yet been entered.

Requirements

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

Open Method

Opens the adapter

Syntax

public void Open ()

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: SharpPcap
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 void Open (DeviceMode mode)

Parameters

mode
A SharpPcap.DeviceMode

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: SharpPcap
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 void Open (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
Assembly: SharpPcap (in SharpPcap.dll)
Assembly Versions: 4.0.1.0

SendPacket Method

Sends a raw packet throgh this device

Syntax

public void SendPacket (PacketDotNet.Packet p)

Parameters

p
The packet to send

Remarks

Documentation for this section has not yet been entered.

Requirements

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

SendPacket Method

Sends a raw packet throgh this device

Syntax

public void SendPacket (byte[] p)

Parameters

p
The packet bytes to send

Remarks

Documentation for this section has not yet been entered.

Requirements

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

SendPacket Method

Sends a raw packet throgh this device

Syntax

public void SendPacket (PacketDotNet.Packet p, int size)

Parameters

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

Remarks

Documentation for this section has not yet been entered.

Requirements

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

SendPacket Method

Sends a raw packet throgh this device

Syntax

public 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
Assembly: SharpPcap (in SharpPcap.dll)
Assembly Versions: 4.0.1.0

StartCapture Method

Start the capture

Syntax

public void StartCapture ()

Remarks

Documentation for this section has not yet been entered.

Requirements

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

Started Property

Return a value indicating if the capturing process of this adapter is started

Syntax

public bool Started { get; }

Value

Documentation for this section has not yet been entered.

Remarks

Documentation for this section has not yet been entered.

Requirements

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

Statistics Property

Retrieves pcap statistics

Syntax

public ICaptureStatistics Statistics { get; }

Value

Documentation for this section has not yet been entered.

Remarks

Documentation for this section has not yet been entered.

Requirements

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

StopCapture Method

Stop the capture

Syntax

public void StopCapture ()

Remarks

Documentation for this section has not yet been entered.

Requirements

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

StopCaptureTimeout Property

Maximum time within which the capture thread must join the main thread (on ICaptureDevice.StopCapture) or else the thread is aborted and an exception thrown.

Syntax

public TimeSpan StopCaptureTimeout { 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
Assembly: SharpPcap (in SharpPcap.dll)
Assembly Versions: 4.0.1.0