Skip to content

Libtrace Structure

Shane Alcock edited this page May 14, 2019 · 2 revisions

Libtrace has several conceptual parts:

Format files

These are found in lib/format_*.c. These files know about trace formats. Generally they define some private data about the trace file, some private data about each packet, and some accessor functions to get timestamps, capture/wire lengths and so on. These are all listed in a structure describing the format. Note that the format of this structure often changes between versions of libtrace and no attempt at backwards compatibility is made as this is a libtrace internal data structure.

trace.c figures out which format function should be used to perform the requested operation and calls it via the appropriate entry in the format structure. trace.c can also synthesize methods that the format can't support natively, but can be done by libtrace (eg conversion of timestamps from one format to another, and dealing with filters applied to traces).

Some helper functions for format files are in format_helper.c. This is probably poorly named.

protocol decoding files

These are called protocol_*.c or link_*.c and handle the protocol decoding logic in libtrace.

Clone this wiki locally