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:
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"]);
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);

Problems? Write us:
coral-bugs@caida.org