ltm rule command TCP collectΒΆ

iRule(1)		      BIG-IP TMSH Manual		      iRule(1)



TCP::collect
       Collects the specified amount of data for delivery to the iRule.

SYNOPSIS
       TCP::collect (COLLECT_BYTES (SKIP_BYTES)?)?

DESCRIPTION
       Collects the specified amount of data before triggering a CLIENT_DATA
       or SERVER_DATA event. This data is not delivered to the upper layer
       until the event fires.

       After collecting the data in a clientside event, the CLIENT_DATA event
       will be triggered. When collecting the data in a serverside event, the
       SERVER_DATA event will be triggered.

       It is important to note that, when an explicit length is not specified,
       the semantics of TCP::collect and TCP::release are different than those
       of the HTTP::collect and HTTP::release commands. With TCP::collect, the
       event for processing the data (CLIENT_DATA or SERVER_DATA) will fire
       without TCP::release being called, whereas with HTTP::collect, the
       event (HTTP_REQUEST_DATA or HTTP_RESPONSE_DATA) will not fire without
       HTTP::release being called.

       Syntax

       TCP::collect [ []]

       TCP::collect

	    * Collect TCP payload data. The CLIENT_DATA or SERVER_DATA
	      event will be triggered for every received packet. To stop
	      collecting and forward collected or modified payload data, use
	      TCP::release.

       TCP::collect 

	    * Collect the specified amount of TCP payload data. The
	       parameter specifies the minimum number of bytes to
	      collect. The CLIENT_DATA or SERVER_DATA event will be
	      triggered when the data collection is complete.

       TCP::collect  

	    * Collect the specified amount of TCP payload data, after skipping
	      the specified amount. The  parameter specifies the
	      minimum number of bytes to collect, and the  parameter
	      specifies the number of bytes to skip. The CLIENT_DATA event
	      will be triggered when the data collection is complete, and also
	      when the specified number of bytes have been skipped. In the latter
	      case, there may not be any bytes yet collected ( TCP::payload
	      is empty).
	    * Note that the use of the  parameter changes the timing
	      of serverside connection initiation: Ordinarily, TCP::collect
	      causes the server-side connection to be delayed until the requested
	      data is received. If the  parameter is specified, even
	      if the value is 0, the serverside connection is not delayed by the
	      TCP profile (other profiles, such as the HTTP profile, may also
	      delay the serverside connection, however). This may be useful in
	      trying to use the same virtual server for both client-initiated
	      protocols (like HTTP) and server-initiated protocols (like SSH). If
	      a load balancing decision needs to be made on client data after
	      , it may be necessary to use the LB::detach
	      command to sever the serverside connection before making a new
	      selection. See this post for more details on using
	      TCP::collect in this way.-->
	    * Since the use of the  requires a serverside connection
	      to be established, there must be a valid load balancing target
	      available. Attempting to use this parameter without a server
	      available to complete the backend handshake (no default pool
	      specified, all servers in pool down, etc.) will result in a RST on
	      the clientside connection.

	  Note: The  parameter has not yet been extensively tested.
	  There are also some important known issues associated with it, such as
	  CR95439 (some commands do not work if the  parameter is
	  used; fixed in v9.4.5) and CR101100 (if a packet splits contains enough
	  data to meet  but not enough to meet ,
	  CLIENT_DATA may not fire; not yet fixed).

RETURN VALUE
       None.

VALID DURING
       SERVER_CONNECTED

EXAMPLES
	when SERVER_CONNECTED {
	    log local0. "Client: [client_addr]:[client_port] - Server: [server_addr]:[server_port]."
	    # First collect 50000 bytes before passing data to the client.
	    TCP::collect 50000
	}
	when SERVER_DATA {
	    set datalen [TCP::offset]
	    log local0. "Collected $datalen bytes."
	    # Release 50000+ bytes to the client.
	    TCP::release
	    log local0. "Server, cwnd: [TCP::snd_cwnd], rtt: [TCP::rtt]"
	}

HINTS
SEE ALSO
CHANGE LOG
       @BIGIP-9.0.0 --First introduced the command.  @BIGIP-9.3.0 --Fixed
       online help @BIGIP-9.4.5 --Fixed interaction of  with other
       commands.



BIG-IP				  2017-01-31			      iRule(1)