tcp
tcp - configure the TCP parameters for a port on a card on a chassis.
SYNOPSIS
tcp sub-command options
DESCRIPTION
The tcp command is used to configure the TCP-specific information used when building TCP type packets if ip config -ipProtocol has been set to Tcp. See RFC 793 for a complete definition of TCP header fields. Note that stream get must be called before this command's get sub-command.
Note that when using ATM ports, different types of ATM encapsulation result in different length headers, as discussed in atmHeader. The data portion of the packet normally follows the header, except in the case of the two LLC Bridged Ethernet choices, where 12 octets of MAC address and 2 octets of Ethernet type follow the header. The offsets used in this command are with respect to the beginning of the AAL5 packet and must be adjusted by hand to account for the header.
STANDARD OPTIONS
acknowledgement
Number
Next byte that the receiver expects from the sending host. (default = 0)
acknowledgeValid true/false
Indicates whether the acknowledgement number field is valid. (default = false)
checksum
If useValidChecksum is set to valid or invalid, this is the TCP checksum, following a call to tcp decode. Note: this field is only valid after a decode operation. (default = 00 00)
If useValidChecksum is set to override, the header checksum is a user-defined 2-byte hex value.
destPort
Protocol source port number. (default = 0)
finished true/false
The sender indicates that this is the last packet it transmits for the connection. (default = false)
offset
Offset from the beginning of the TCP header to the data. (default = 5)
pushFunctionValid
true/false
Request that receiver deliver the packet to the application without buffering. (default = false)
resetConnection
true/false
Reset the connection signal. (default = false)
sequenceNumber
Sequence number used to keep track of each byte of data. (default = 0)
sourcePort
Protocol destination port number. (default = 0)
synchronize true/false
Indicates either a connection request (ACK=0) or a connection accepted (ACK=1) condition. (default = false)
urgentPointer
Byte offset of the urgat data in the packet. (default = 0)
urgentPointerValid true/false
Indicates whether the urgent point field is valid. (default = false)
useValidChecksum
valid/invalid/override
If portFeatureTcpIPv4ChecksumOverride = true, then:
Valid: (default) The calculated header checksum is automatically calculated.
Invalid: The calculated header checksum is automatically calculated (with error).
Override: The header checksum can be set to a user-defined, 2-byte hex value.
window
The number of bytes that the recipient may send to the sender, starting at the acknowledge byte. (default = 0)
DEPRECATED OPTIONS
options
This option has no affect.
COMMANDS
The tcp command is invoked with the following sub-commands. If no sub-command is specified, returns a list of all sub-commands available.
tcp cget option
Returns the current value of the configuration option given by option. Option may have any of the values accepted by the tcp command.
tcp config option value
Modify the TCP configuration options of the port. If no option is specified, returns a list describing all of the available TCP options (see STANDARD OPTIONS) for port.
tcp decode capFrame [chasID cardID portID]
Decodes a captured frame in the capture buffer and updates TclHal. tcp cget option command can be used after decoding to get the option data.
tcp get chasID cardID portID
Gets the current TCP configuration of the port with id portID on card cardID, chassis chasID. Note that stream get must be called before this command's get sub-command. Call this command before calling tcp cget option to get the value of the configuration option.
tcp set chasID cardID portID
Sets the TCP configuration of the port with id portID on card cardID, chassis chasID by reading the configuration option values set by the tcp config option value command.
tcp setDefault
Sets to IxTclHal default values for all configuration options.
options
Variable length option field in the TCP header. Options may occupy space at the end of the TCP header and are a multiple of 8 bits in length. (default = { })
EXAMPLES
package require IxTclHal
# Connect to chassis and get chassis ID
set host localhost
set username user
# Check if we're running on UNIX - connect to the TCL Server
# which must be running on the chassis
if [isUNIX] {
if [ixConnectToTclServer $host] {
ixPuts "Could not connect to $host"
return 1
}
}
# Now connect to the chassis
if [ixConnectToChassis $host] {
ixPuts $::ixErrorInfo
return 1
}
# Get the chassis ID to use in port lists
set chas [ixGetChassisID $host]
set card 1
set port 1
set portList [list [list $chas $card $port]]
# Login before taking ownership
if [ixLogin $username] {
ixPuts $::ixErrorInfo
return 1
}
# Take ownership of the ports we'll use
if [ixTakeOwnership $portList] {
ixPuts $::ixErrorInfo
return 1
}
set portMAC {00 00 00 01 01 01}
set portIP {192.168.18.1}
set portMask {255.255.255.0}
set destMAC {00 00 00 01 01 02}
set destIP {192.168.18.2}
set destMask {255.255.255.0}
port setFactoryDefaults $chas $card $port
port setDefault
# Stream: 256 packets
stream setDefault
stream config -numFrames 256
stream config -sa $portMAC
stream config -da $destMAC
stream config -dma stopStream
# Set up IP: lowcost packets
# Source address varies by incrementing the network part
# Destination address varies by incrementing the host part
ip setDefault
ip config -cost lowCost
ip config -sourceIpAddr $portIP
ip config -sourceIpMask $portMask
ip config -sourceClass classC
ip config -destIpAddr $destIP
ip config -destIpMask $destMask
ip config -destClass classC
ip config -qosMode ipV4ConfigDscp
ip config -dscpMode ipV4DscpClassSelector
ip config -classSelector ipV4DscpClass2
ip set $chas $card $port
protocol setDefault
protocol config -name ipV4
protocol config -ethernetType ethernetII
tcp setDefault
tcp config -sourcePort 32768
tcp config -destPort 21
tcp set $chas $card $port
stream set $chas $card $port 1
port set $chas $card $port
# Let go of the ports that we reserved
ixClearOwnership $portList
# Disconnect from the chassis we're using
ixDisconnectFromChassis $host
# If we're running on UNIX, disconnect from the TCL Server
if [isUNIX] {
ixDisconnectTclServer $host
}