SCTP::collect¶
Description¶
Causes SCTP to start collecting the specified amount of content data.
After collecting the data, event CLIENT_DATA will be triggered.
Syntax¶
SCTP::collect [<length>]
SCTP::collect <length>¶
- Causes SCTP to start collecting the specified amount of content data. The parameter specifies the minimum number of bytes to collect.
SCTP::collect¶
- When length is not specified, CLIENT_DATA will be triggered for every received packet. To stop collecting data, use SCTP::release.
Examples¶
when CLIENT_ACCEPTED {
SCTP::collect 15
}
when CLIENT_DATA {
if { [SCTP::payload 15] contains "XYZ" } {
pool xyz_servers
} else {
pool web_servers
}
SCTP::release
}
when CLIENT_ACCEPTED {
log local0.debug "CLIENT_ACCEPTED"
SCTP::collect
}
when CLIENT_DATA {
set tcplen [SCTP::payload length]
log local0.debug "CLIENT_DATA ($tcplen)"
#Assume that you need at least 20 bytes of data for some purpose
if { $tcplen >= 20 } {
log local0.debug "Collected at least 20 bytes. releasing"
#Release collected data
SCTP::release
# Collect new data - CLIENT_DATA will be called again
SCTP::collect
}
}