All Classes Namespaces Files Functions Pages
Rx.Capture.RawPacket Class Reference

This class is used to capture the raw packet data that is received on the Physical interface that is associated with a ByteBlowerPort. More...

Methods

 Counters.Clear
 Clears the counters and deletes the captured packets. More...
 
 Counters.Get
 Returns the current counters of the capture. More...
 
 Description.Get
 Returns a textual description of the object.
 
 Filter.Get
 Returns the current installed BPF filter string. More...
 
 Filter.Set bpfString
 Sets a BPF filter on a RX object. More...
 
 Frames.Get
 Returns the captured frames. More...
 
 Parent.Get
 Returns the parent object.
 
 Pcap.Save fileName
 Stores the captured frames into a pcap file. More...
 
 Result.Get
 Returns the capture result. Rx.Capture.ResultSnapshot. More...
 
 Start
 Start capturing. More...
 
 Status.Get
 Returns the current status of the Capture. More...
 
 Stop
 Stop capturing. More...
 

Class overview

This class is used to capture the raw packet data that is received on the Physical interface that is associated with a ByteBlowerPort.

With an Rx.Capture.RawPacket you can capture the data that is received by the ByteBlower Port and save this to a pcap file on your pc. You can also apply a filter (BPF-style) to only capture the packets of your interest.

Example
1 set port [ $server Port.Create "trunk-1-2" ]
2  set capture [ $port Rx.Capture.Add ]
3  $capture Filter.Set "tcp"
4  $capture Start
5  ...
6  $capture Stop
7  set result [ $capture Result.Get]

Definition at line 18236 of file api.tcl.

Method documentation

Rx.Capture.RawPacket::Counters.Clear

Clears the counters and deletes the captured packets.

Deprecated:
Use the Rx.Capture.ResultSnapshot::Clear method of the resultObject Rx.Capture.ResultSnapshot to clear the counters. This object can be obtained by the method Result.Get

Definition at line 18244 of file api.tcl.

Rx.Capture.RawPacket::Counters.Get

Returns the current counters of the capture.

Returns
Returns a list of 4 name-value pairs with various counters on this capture:
NrOfPackets
Total number of packets captured that matched the filter.
NrOfOctets
Total number of bytes in the captured packets.
NrOfErrors
Number of errors that occurred during capturing.
ElapsedTime
Amount of time this capture is busy. This is a list of the time stamp's seconds part and milliseconds part.
Exceptions
ByteBlower.Rx.Capture.GetFailedWhen no results are available or when an exception occurred while obtaining the results.
Deprecated:
Use the resultObject Rx.Capture.ResultSnapshot to get the various counters and metrics. This object can be obtained by the method Result.Get
Example
1 $capture Counters.Get

Returns:

NrOfPackets 6 NrOfOctets 482 NrOfErrors 0 ElapsedTime {7 486177} 

Definition at line 18260 of file api.tcl.

Rx.Capture.RawPacket::Filter.Get

Returns the current installed BPF filter string.

The filter string can be configured using Filter.Set

Returns
The current BPF filter string
Example

Suppose we configured the trigger with filter string:

1 $trigger Filter.Set "ip src [ $ipv4_1 Ip.Get ] and ip dst [ $ipv4_2 Ip.Get ] and len = ${frameSize}"

where $ipv4_1 and $ipv4_2 are Layer3.IPv4 objects and $frameSize is the (layer2) size of the frames (without CRC!). The BPF filter string would then become for example:

1 $trigger Filter.Get

Returns:

ip src 10.10.10.2 and ip dst 10.10.10.3 and len = 252 

Definition at line 18279 of file api.tcl.

Rx.Capture.RawPacket::Filter.Set   bpfString  

Sets a BPF filter on a RX object.

Note
Configuring a new filter string does not reset the counter values which were triggered by a previous filter string.
Parameters
bpfStringValid BPF filter string. For creating valid BPF filter strings, please have a look at http://www.tcpdump.org/#documentation for more information.
Exceptions
ByteBlower.Rx.Filter.CompilationFailedWhen an invalid BPF filter string is given.
ByteBlower.InvalidFilterWhen an invalid BPF filter string is given.
Example

This will filter only UDP traffic.

1 $trigger Filter.Set "udp"

Set the filter on packets that match:

  • source and destination IPv4 address
  • UDP traffic with given destination and source UDP port
  • (layer2) frame length (without CRC!)
1 $trigger Filter.Set "ip src [ $ipv4_1 Ip.Get ] and ip dst [ $ipv4_2 Ip.Get ] and udp dst port ${dstUdpPort} and udp src port ${srcUdpPort} and len = ${frameSize}"

Definition at line 18298 of file api.tcl.

Rx.Capture.RawPacket::Frames.Get

Returns the captured frames.

Deprecated:
Use Result.Get to get the resultObject and then call Rx.Capture.ResultSnapshot::Frames.Get to retrieve a list of captured frames
Returns
A list of lists containing the following information per packet:
  • <timeStamp> List of <seconds> and <microseconds> part.
  • <errorCode> The error code should always be zero.
  • <length> in Bytes.
  • <frameContent> hex byte string.
Exceptions
ByteBlower.Rx.Capture.GetFailedWhen no results are available or when an exception occurred while obtaining the results.
ByteBlower.Rx.Capture.GetFramesFailedInvalid captured packet offset
Example
1 $capture Frames.Get

Returns:

{1233228188 647870 0 110 33330000000d0090....} ... 

Definition at line 18316 of file api.tcl.

Rx.Capture.RawPacket::Pcap.Save   fileName  

Stores the captured frames into a pcap file.

The stored capture file can be opened by e.g. wireshark.

Note
This function requires that the pcap library is installed on the host PC. You should use the OS-specific software to install it. e.g. On windows WinPcap comes together with wireshark. It can also be installed separately if required.
Deprecated:
Use Rx.Capture.ResultSnapshot::Pcap.Save on the result object to save. The result object can be retrieved using Result.Get
Parameters
fileNameDestination filename for the capture file.
Exceptions
<tcl_error>No pcap support found: When the pcap library is not installed on the ByteBlower client PC.
ByteBlower.Rx.Capture.GetFailedWhen no results are available or when an exception occurred while obtaining the results.
ByteBlower.Rx.Capture.GetFramesFailedInvalid captured packet offset.
Example

Stores all packets captured by filter to c:.pcap

1 $capture Pcap.Save "c:\\mypcap.pcap"

Definition at line 18345 of file api.tcl.

Rx.Capture.RawPacket::Result.Get

Returns the capture result. Rx.Capture.ResultSnapshot.

Returns
returns a Rx.Capture.ResultSnapshot
Example
1 $capture Result.Get

Returns:

<Rx.Capture.ResultSnapshot object> 

Definition at line 18357 of file api.tcl.

Rx.Capture.RawPacket::Start

Start capturing.

Note
Calling Start while already running does not throw an exception.
Example
1 $capture Start

Definition at line 18369 of file api.tcl.

Rx.Capture.RawPacket::Status.Get

Returns the current status of the Capture.

Deprecated:
Use Result.Get to get the result object and use Rx.Capture.ResultSnapshot::State.Name.Get instead.
Returns
Returns current state of this capture. Possible return values are:
  • unknown
  • unavailable
  • inactive
  • active
Exceptions
ByteBlower.Rx.Capture.NotFoundWhen this capture has an invalid reference to the capture at server-side.
ByteBlower.Rx.Capture.GetFailedWhen no results are available or when an exception occurred while obtaining the results.
Example
1 $capture Status.Get

Returns:

active 

Definition at line 18387 of file api.tcl.

Rx.Capture.RawPacket::Stop

Stop capturing.

Note
Calling Stop while not running does not throw an exception.
Example
1 $capture Stop

Definition at line 18399 of file api.tcl.