Os_tcp::payload, Example, Description – Brocade Virtual ADX OpenScript API Guide (Supporting ADX v03.1.00) User Manual
Page 39: Context, Usage, Input parameters, Return values

Brocade Virtual ADX OpenScript API Guide
27
53-1003243-01
Methods
3
Example
OS_TCP::payload
Description
Returns a packet's TCP payload. Before calling this function, a user should register to collect TCP
payload by calling the “OS_TCP::collect API” within the Client events (“TCP_CLIENT_SYN” or
“TCP_CLIENT_ESTABLISHED”) or Server events (“TCP_SERVER_ESTABLISHED”) handler. Either a
TCP_CLIENT_DATA or TCP_SERVER_DATA event will be triggered correspondingly after collecting
user requested amount of data.Collected data can be retrieved calling payload API within these
events.
Context
Can be called in either the “TCP_SERVER_DATA” or “TCP_CLIENT_DATA” context only. If called in any
other context it will return undefined.
Usage
Can be used to perform load-balancing based on the TCP payload.
Input Parameters
None.
Return Values
The following table contains the return values.
TABLE 20
Return Values
Name
Type
Description
TCP payload
use OS_TCP;
use OS_SLB;
sub TCP_CLIENT_ESTABLISHED {
OS_TCP::collect;
}
sub TCP_CLIENT_DATA{
$data = OS_TCP::payload();
$data =~ m/index/undef/g;
OS_TCP::payload($data);
OS_SLB::forward(4);
}