Mini-guide to Unpack library
new Unpacker(STR type, LIST REF options)
- Constructor for creation of an Unpacker object, which saves
options for its (only) member function,
unpack()
.- type: The type of Unpacker to create. One of:
- ip
- tcp
- udp
- llcsnap
- igmp
- bhead (The block info header from the Coral library)
- atm (An atm header, as returned by the Coral library)
- options: A reference to a list of strings specifying the unpacked fields to return. For a list of usable fields, view the option list.
- Returns an Unpacker object to be used to unpack data strings.
- Sample call:
$ip_opts = new Unpacker("ip", ["ip_hl", "ip_v"]);
- type: The type of Unpacker to create. One of:
Unpacker::unpack(SCALAR data, NUM offset)
- This function takes a byte string and extracts the elements
within it, as specified by the Unpacker object when it's created.
- data: The byte string to be unpacked, such as an IP header or TCP header or a full ATM cell.
- offset: Number of bytes into the byte string to start unpacking from. (defaults to 0)
- Returns a list of the desired values. If a specific value cannot be found, its value is undef.
- Sample call:
($ip_hl, $ip_v) = $ip_opts->unpack($ip_data);
- data: The byte string to be unpacked, such as an IP header or TCP header or a full ATM cell.
Problems? Write us: coral-bugs@caida.org