Functions

format_helper.h File Reference

Header file containing prototypes for functions that are useful for multiple format modules. More...

Go to the source code of this file.

Functions

struct libtrace_eventobj_t trace_event_device (libtrace_t *trace, libtrace_packet_t *packet)
 Generic event function for a live capture device.
struct libtrace_eventobj_t trace_event_trace (libtrace_t *trace, libtrace_packet_t *packet)
 Generic event function for a offline trace file.
io_ttrace_open_file (libtrace_t *libtrace)
 Opens an input trace file for reading.
iow_ttrace_open_file_out (libtrace_out_t *libtrace, int compress_type, int level, int filemode)
 Opens an output trace file for writing.

Detailed Description

Header file containing prototypes for functions that are useful for multiple format modules.

Author:
Daniel Lawson
Perry Lorier
Shane Alcock
Version:
Id:
format_helper.h 1556 2010-04-14 03:26:28Z perry

Function Documentation

struct libtrace_eventobj_t trace_event_device ( libtrace_t trace,
libtrace_packet_t packet 
) [read]

Generic event function for a live capture device.

Parameters:
trace The input trace for the live capture device
packet A libtrace packet to read the next available packet into
Returns:
A libtrace event describing the next event of interest

Any live capture format that does not require a custom event handler should use this function.

References libtrace_eventobj_t::fd, libtrace_eventobj_t::size, trace_is_err(), trace_perror(), trace_read_packet(), and libtrace_eventobj_t::type.

struct libtrace_eventobj_t trace_event_trace ( libtrace_t trace,
libtrace_packet_t packet 
) [read]

Generic event function for a offline trace file.

Parameters:
trace The input trace for the trace file
packet A libtrace packet to read the next available packet into
Returns:
A libtrace event describing the next event of interest

Any trace file format that does not require a custom event handler should use this function

References libtrace_eventobj_t::seconds, trace_create_packet(), trace_destroy_packet(), trace_get_seconds(), trace_is_err(), trace_perror(), trace_read_packet(), and libtrace_eventobj_t::type.

io_t* trace_open_file ( libtrace_t libtrace  ) 

Opens an input trace file for reading.

Parameters:
libtrace The input trace to be opened
Returns:
A libtrace IO reader for the newly opened file or NULL if the file was unable to be opened

References trace_set_err(), and libtrace_t::uridata.

iow_t* trace_open_file_out ( libtrace_out_t libtrace,
int  compress_type,
int  level,
int  filemode 
)

Opens an output trace file for writing.

Parameters:
libtrace The output trace to be opened
compress_type The compression type to use when writing
level The compression level to use when writing, ranging from 0 to 9
filemode The file status flags for the file, bitwise-ORed.
Returns:
A libtrace IO writer for the newly opened file or NULL if the file was unable to be opened

References libtrace_out_t::uridata.