packetLengthInsertion

packetLengthInsertion - used to insert packet length value. The packet length that is inserted is the hex form of the difference between the actual packet length and the adjustment value that will be specified.

SYNOPSIS

packetLengthInsertion sub-command options

DESCRIPTION

The packetLengthInsertion command is used to insert packet length value. The packet length that is inserted is the hex form of the difference between the actual packet length and the adjustment value that will be specified.

STANDARD OPTIONS
enabled

enables the insertion of packet length option.

offset

the offset at which the packet length needs to be inserted in a packet.

adjustment

number of bytes that needs to be adjusted for the packet length.

COMMANDS

The packetLengthInsertion command is invoked with the following sub-commands. If no sub-command is specified, returns a list of all sub-commands available.

packetLengthInsertion set option

sets the packet length insertion option.

packetLengthInsertion get option

gets the packet length insertion option.

packetLengthInsertion del

deletes the packet length insertion option.

packetLengthInsertion add

adds the packet length insertion option.

packetLengthInsertion getCount

gets the count of packet length.

EXAMPLES

The following example shows how to insert the difference in the length of the packet and adjustment value of 'abc' in the stream at offset 'xyz' bytes in the packet. This is set to random frame size to see the change in values.

 

package req IxTclHal

ixConnectToChassis xm12-qa7

 

port get 1 11 1

port config -loopback true

port set 1 11 1

port write 1 11 1

 

stream get 1 11 1 1

stream config -frameSizeType sizeRandom

stream config -frameSizeMIN 64

stream config -frameSizeMAX 100

stream config -dma stopStream

 

stream set 1 11 1 1

stream write 1 11 1 1

 

stream get 1 11 1 1

 

packetLengthInsertion add 3

packetLengthInsertion getCount

 

 

 

packetLengthInsertion get 1

packetLengthInsertion config -enabled true

packetLengthInsertion config -offset 16

packetLengthInsertion config -adjustment 4

packetLengthInsertion set 1

 

packetLengthInsertion get 2

packetLengthInsertion config -enabled 2

packetLengthInsertion config -offset 18

packetLengthInsertion config -adjustment 8

packetLengthInsertion set 2

 

packetLengthInsertion get 3

packetLengthInsertion config -enabled 3

packetLengthInsertion config -offset 20

packetLengthInsertion config -adjustment 16

packetLengthInsertion set 3

 

 

stream set 1 11 1 1

stream write 1 11 1 1

 

set offset1 16 ; set adjustment1 4

set offset2 20 ; set adjustment2 8

set offset3 24 ; set adjustment3 16

 

 

stream get 1 11 1 1

stream getPacketView 1

set packetView [stream cget -packetView]

 

after 5000

set prtList [list [list 1 11 1]]

ixClearStats prtList

ixStartCapture prtList

ixStartPortTransmit 1 11 1

 

after 5000

ixStopCapture prtList

 

after 5000

captureBuffer get 1 11 1

captureBuffer getframe 1

set captureFrame [captureBuffer cget -frame]

 

set totalLength1 [llength $packetView]

set totalLength2 [llength $captureFrame]

 

 

foreach offset "$offset1 $offset2 $offset3" adjustment "$adjustment1 $adjustment2 $adjustment3" {

foreach frame "[list $packetView] [list $captureFrame]" length "$totalLength1 $totalLength2" {

puts "OFFSET $offset ADJUSTMENT $adjustment LENGTH $length"

 

set hexLength($offset) [join [lrange $frame $offset [expr $offset + 1] ] ""]

puts "HEX $hexLength($offset)"

set decLength($offset) [expr 0x$hexLength($offset)]

puts "DEC $decLength($offset)"

 

if { $decLength($offset) == [expr $length - $adjustment] } {

puts "PASS for offset $offset"

} else {

puts "FAIL for offset $offset"

}

}

}