map of presence of headers char *pkt_data; // packet data buffer int32_t pkt_header_count; // total number of headers found // Keep track of how many instances of each header we have uint8_t pkt_instance_counts[MAX_ID_COUNT]; header_t pkt_headers[]; // One per header + 1 more for payload } packet_t; and
struct header_t
typedef struct header_t { int32_t hdr_id; // header ID uint32_t hdr_offset; // offset into the packet_t->data buffer int32_t hdr_length; // length of the header in packet_t->data buffer } header_t;
The methods in this State
provide 3 sets of functions. Looking up global state of the packet found in packet_state_t structure, looking up header information in struct header_t
by header ID retrieved from JRegistry and instance numbers, looking up header information by direct indexes into native maps and arrays. Instance numbers specify which instance of the header, if more than 1 exists in a packet. For example if there is a packet with 2 Ip4 headers such as
Ethernet->Ip4->Snmp->Ip4 or Ethernet->Ip4->Ip4 (IP tunneled IP)
the first Ip4 header is instance 0 and the second Ip4 header is instance 2. You can use the method {@link #getInstanceCount(int)} to learn how manyinstance headers exists. That information is stored in the packet_state_t structure for efficiency.
@author Mark Bednarczyk
@author Sly Technologies, Inc.