SharpPcap : SharpPcap.LibPcap Namespace

CaptureFileWriterDevice Class

Create or write to a pcap capture file NOTE: Appending to a capture file is not currently supported

Syntax

public class CaptureFileWriterDevice : 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.

Public Constructors

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_pcapDumpHandle IntPtr . Handle to an open dump file, not equal to IntPtr.Zero if a dump file is open
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]
override
Description string . Documentation for this section has not yet been entered.
[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]
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.)
MacAddress System.Net.NetworkInformation.PhysicalAddress . Mac address of the physical device (Inherited from PcapDevice.)
[read-only]
override
Name string . Documentation for this section has not yet been entered.
[read-only]
abstract
Name string . Device name (Inherited from PcapDevice.)
[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.)

Protected Properties

[read-only]
DumpOpened bool . Whether dump file is open or not

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.)
override
Close ()
Close the capture file
Close ()
Closes this adapter (Inherited from PcapDevice.)
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
abstract
Open ()
Open the device with class specific options (Inherited from PcapDevice.)
Open (SharpPcap.DeviceMode)
Open the device. To start capturing call the 'StartCapture' function (Inherited from PcapDevice.)
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.)
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.)
Write (SharpPcap.RawCapture)
Writes a packet to the pcap dump file associated with this device.
Write (byte[])
Writes a packet to the pcap dump file associated with this device.
Write (byte[], PcapHeader)
Writes a packet to the pcap dump file associated with this device.

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

CaptureFileWriterDevice Constructor

Constructor

Syntax

public CaptureFileWriterDevice (string captureFilename)

Parameters

captureFilename
A string

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

CaptureFileWriterDevice Constructor

Constructor

Syntax

public CaptureFileWriterDevice (LibPcapLiveDevice device, string captureFilename)

Parameters

device
A SharpPcap.LibPcap.LibPcapLiveDevice
captureFilename
A string

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

CaptureFileWriterDevice Constructor

Constructor

Syntax

public CaptureFileWriterDevice (string captureFilename, System.IO.FileMode mode)

Parameters

captureFilename
A string
mode
A System.IO.FileMode

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

CaptureFileWriterDevice Constructor

Constructor

Syntax

public CaptureFileWriterDevice (LibPcapLiveDevice device, string captureFilename, System.IO.FileMode mode)

Parameters

device
A SharpPcap.LibPcap.LibPcapLiveDevice
captureFilename
A string
mode
A System.IO.FileMode

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

CaptureFileWriterDevice Constructor

Documentation for this section has not yet been entered.

Syntax

public CaptureFileWriterDevice (PacketDotNet.LinkLayers linkLayerType, Nullable<int> snapshotLength, string captureFilename, System.IO.FileMode mode)

Parameters

linkLayerType
Documentation for this section has not yet been entered.
snapshotLength
Documentation for this section has not yet been entered.
captureFilename
Documentation for this section has not yet been entered.
mode
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

Close Method

Close the capture file

Syntax

public override void Close ()

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

Documentation for this section has not yet been entered.

Syntax

public override string Description { get; }

Value

Description of the device

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

DumpOpened Property

Whether dump file is open or not

Syntax

protected bool DumpOpened { get; }

Value

A bool

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

m_pcapDumpHandle Field

Handle to an open dump file, not equal to IntPtr.Zero if a dump file is open

Syntax

protected IntPtr m_pcapDumpHandle

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

Documentation for this section has not yet been entered.

Syntax

public override string Name { get; }

Value

The name of the capture file

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

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

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

Write Method

Writes a packet to the pcap dump file associated with this device.

Syntax

public void Write (SharpPcap.RawCapture p)

Parameters

p
The packet to write

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

Write Method

Writes a packet to the pcap dump file associated with this device.

Syntax

public void Write (byte[] p)

Parameters

p
The packet to write

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

Write Method

Writes a packet to the pcap dump file associated with this device.

Syntax

public void Write (byte[] p, PcapHeader h)

Parameters

p
Documentation for this section has not yet been entered.
h
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