Protocol parsers (PDF, DFF, IFF and others)


Analyzer uses three external parsers that are used to make the protocol parsing/decoding working.

Analyzer executes these parser automatically when

All parsers show an error message is shown if the number of parameters is wrong or it is not possible to open a file; the parser generates no output file and returns a value different from '0' when the parsed file contains some error.

 

Protocol Definition (PDF: Protocol Definition Format)

PDF file (Protocol Definition Format) defines protocols supported by analysis engine and it is a normal text file. This files is used to:

This parser is launched by Analyzer when the user either sets or modify this configuration file. This parser can be launched manually as well:

 pdreader FILE.PDF OUTPUT_FILE.PDO

Output file is a "pseudo-code" object file that is used by Query to interpret and decode packets. On other words, Query has a virtual machine in which this object file is executed; Query has to be able to execute these commands and to provide a "friendly" environment for this code.

Protocols will be described in a text file with a particular C-like language (case insensitive), with a small set of data types. Fields definition is given by type + name.

The supported data types are:

BYTE(8) int (0,255)
WORD(16) int (0,65535)
DWORD(32) int (-2147483648,2147483648)

Names format is: a character (or '_') followed by less then 50 alphanumerical types. A field can contain sub fields obtained masking some indicated bits.

field BYTE 01110010
    sub field BIT (2,5) ; this notation means that BIT is given by the
                          bits 2,3,4,5 of BYTE so BIT has the value 1100

A protocol definition starts with the word 'PROTOCOL', followed by a fields series and expressions which ends with 'ENDPR'.

More information about PDF grammar can be found looking at the grammar page.

 

Display Definition (DFF: Description File Format, IFF: Index File Format)

These files define what has to be displayed on the Analyzer main window: DFF file defines the complete description of the protocol, whereas IFF describes a brief description of the protocol. DFF output (with a proper formatting) can be seen in the Analyzer's second window (the one on the left), while IFF output can be seen in the first window (the one on the top).

There are two different files for the display definition because of the different requirements of them: the top window has limited space so that only the most important information have to be printed (for example IP source and destination address). The left window has more space, so that everything can be printed (for example header length, fragment offset, ...).

This parser can be launched either by Analyzer or manually. In the latter case the syntax is:

ddreader INPUT.xFF OUTPUTFILE.xFP OBJECT.PDO
where the latter if the PDO file previously generated.

xFF parser creates an object file as well: this object file is executed by the analysis engine (Query) and it works after the PDO file finishes its job. In fact the PDO file decodes the packet and set appropriate values for all the protocol fields defined in there. As soon as a protocol has been completely decoded, the analysis engine executes the corresponding DFO and IFO code in order to define how this protocol has to be displayed. Therefore protocols names and protocol fields must have the same name in the PDF, DFF and IFF files and they are mapped by the Query virtual machine in somewhat "global" variables that are created by the PDO and they are accessed by the DFO(IFO as well.

DFF/IFF files share the same parser (case insensitive), therefore they share the same C-like syntax used to define the display definition.

The language has the following characteristics:

Further information about these are available in the page which describe the class which implement the virtual machine which parses the relative objects files.

You can have more information about DFF and IFF format looking at: