26 #ifndef __CORSARO_FILE_H
27 #define __CORSARO_FILE_H
51 #define CORSARO_FILE_COMPRESS_LEVEL_DEFAULT 6
54 #define CORSARO_FILE_ZLIB_SUFFIX ".gz"
57 #define CORSARO_FILE_BZ2_SUFFIX ".bz2"
113 #define CORSARO_FILE_MODE(file) (file->mode)
116 #define state_wandio mode_state.ms_wandio
118 #define wand_io mode_state.ms_wandio.io
121 #define state_trace mode_state.ms_trace
123 #define trace_io mode_state.ms_trace.trace
151 const char *filename,
194 const char *format, va_list args);
208 const char *format, ...);
281 libtrace_packet_t *
packet,
libtrace_t * trace
The libtrace object used to create the trace.
An opaque structure defining an corsaro input file.
struct corsaro_file::@0::@2 ms_trace
Trace mode state.
union corsaro_file::@0 mode_state
Per-framework state for the file.
off_t corsaro_file_rgets(corsaro_file_in_t *file, void *buffer, off_t len)
Reads a string from an corsaro input file into the provided buffer.
An opaque structure defining an corsaro output file.
off_t corsaro_file_printf(struct corsaro *corsaro, corsaro_file_t *file, const char *format,...)
Print a string to an corsaro file.
off_t corsaro_file_rtell(corsaro_file_in_t *file)
Returns the current offset of the read pointer for an corsaro input file.
off_t corsaro_file_write_packet(struct corsaro *corsaro, corsaro_file_t *file, libtrace_packet_t *packet)
Write a libtrace packet to an corsaro output file.
off_t corsaro_file_rpeek(corsaro_file_in_t *file, void *buffer, off_t len)
Reads from an corsaro input file into the provided buffer, but does not update the read pointer...
void corsaro_file_close(struct corsaro *corsaro, corsaro_file_t *file)
Closes an corsaro output file and frees the writer structure.
io_t * io
The wandio input file handle.
static libtrace_packet_t * packet
A pointer to a libtrace packet.
corsaro_file_mode_t mode
The requested output format for the file.
void corsaro_file_flush(struct corsaro *corsaro, corsaro_file_t *file)
Force all buffered data for the file to be written out.
void corsaro_file_rclose(corsaro_file_in_t *file)
Closes an corsaro input file and frees the reader structure.
union corsaro_file_in::@3 mode_state
Per-framework state for the file.
struct corsaro_file_in::@3::@5 ms_trace
Trace mode state.
struct corsaro_file corsaro_file_t
An opaque structure defining an corsaro output file.
off_t corsaro_file_vprintf(struct corsaro *corsaro, corsaro_file_t *file, const char *format, va_list args)
Print a string to an corsaro file.
enum corsaro_file_compress corsaro_file_compress_t
Supported compression types (must be kept in sync with wandio)
off_t corsaro_file_rseek(corsaro_file_in_t *file, off_t offset, int whence)
Changes the read pointer offset to the specified value for an corsaro input file. ...
libtrace_out_t * trace
The libtrace object used to create the trace.
off_t corsaro_file_rread(corsaro_file_in_t *file, void *buffer, off_t len)
Reads from an corsaro input file into the provided buffer.
off_t corsaro_file_write(struct corsaro *corsaro, corsaro_file_t *file, const void *buffer, off_t len)
Writes the contents of a buffer using an corsaro output file.
struct corsaro_file_in::@3::@4 ms_wandio
ASCII & Binary mode state.
iow_t * io
The wandio output file handle.
corsaro_file_mode_t mode
The requested/detected input format for the file.
corsaro_file_t * corsaro_file_open(struct corsaro *corsaro, const char *filename, corsaro_file_mode_t mode, corsaro_file_compress_t compress_type, int compress_level, int flags)
Creates a new corsaro file write and opens the provided file for writing.
struct corsaro_file_in corsaro_file_in_t
An opaque structure defining an corsaro input file.
corsaro_file_compress_t corsaro_file_detect_compression(char *filename)
Attempts to detect the type of compression for a file based on the suffix.
corsaro_file_in_t * corsaro_file_ropen(const char *filename)
Creates a new corsaro file reader and opens the provided file for reading.
enum corsaro_file_mode corsaro_file_mode_t
Enum of supported file modes.
struct corsaro_file::@0::@1 ms_wandio
ASCII & Binary mode state.
Header file dealing with the internal corsaro functions.
off_t corsaro_file_rread_packet(corsaro_file_in_t *file, libtrace_packet_t *packet, uint16_t len)
Read a libtrace packet from an corsaro input file.