Header containers

Printer-friendly

Just a quick update on what I'm working on right now. As described in the dev priorities thread (http://jnetpcap.com/node/309), I'm currently focusing on 1.2 work. The highest priority is redesign of header containers.

Header containers are objects that a header definition can allocate to store detailed information about the header structure such as its fields and subheaders. jNetPcap's scanner records information about the packet and where the headers start and end, but not what they look like inside. That is done by the header definition such as Ip4.class which looks at its options, flags and optional headers.

Header definition classes are free to use whatever means and mechanism to scan the header contents and record the results. Existing approach provided some container classes that also extended JHeader (the main header super class). This is not very scalable since if you have 2 different ways you need to store certain portions of the header such as some parts as a list and other parts as a tree, you would need to find a specialized container class you could subclass that would provide storage both ways or implement something completely from scratch to satisfy your requirements.

As jNetPcap's API goal is to be super friendly, it needs to provide these basic building blocks for flexible header design.

This is what I'm workin on now. I am writting several containers in 2 categories, field containers and sub-header containers. The main design work is focused on how to allow native scanners efficiently record detailed header breakdown. This would allow a low level scanner to dissect a header into fields and subheaders, record that information in native header structures where in java peered header objects would share this information instead of redissecting the header everytime a new header object is peered.

Of course there are some technical decisions that need to be made. Dissecting needs to take place lazly that is only when first accessed, not always by default. It also needs to be allowed to be done from native and from java space.

All of this is completely hidden from most users, only header developers need to know about these details.