Forum Discussion
beefy80
Nimbostratus
Apr 03, 2014Calculating a two byte header in message payload
Hello
I am currently writing a logging event to capture a message but I am finding that by enabling the TCP::collect event the processing is being slowed down by as much as 2 seconds. As the message...
John_Alam_45640
Apr 04, 2014Historic F5 Account
James
I would start by collecting only 2 bytes. Convert those from hex to decimal and then collect that number of bytes before you release.
when CLIENT_ACCEPTED {
TCP::collect 2
set header_collected "false"
}
when CLIENT_DATA {
if { not ($header_collected) } {
Comment out one of the two binary scan lines below.
use this form if lower order byte is last (big endian order)
binary scan [TCP::payload] S message_length
use this form if lower order byte is first (little endian order)
binary scan [TCP::payload] s message_length
if { $message_length > 0 } {
set header_collected "true"
log local0. "Collecting message with length $message_length"
TCP::collect $message_length
}
} else {
if we are here the actual message is collected.
set actual_message_text [TCP::payload]
TCP::release
}
}
Feel free to post what you have and we take a look.
Examples of binary scan:
% binary scan \x02\x00 s var1
1
% puts $var1
2
% binary scan \x00\x03 S var1
1
% puts $var1
3
%
HTH.Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects
