-
Notifications
You must be signed in to change notification settings - Fork 50
Libtrace Structure
Libtrace has several conceptual parts:
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.
These are called protocol_*.c or link_*.c and handle the protocol decoding logic in libtrace.