File: format_helper.h

package info (click to toggle)
libtrace3 3.0.22-0.2
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,452 kB
  • sloc: ansic: 24,574; sh: 11,372; cpp: 1,811; makefile: 460; yacc: 96; lex: 50
file content (97 lines) | stat: -rw-r--r-- 3,151 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/*
 * This file is part of libtrace
 *
 * Copyright (c) 2007,2008,2009,2010 The University of Waikato, Hamilton, 
 * New Zealand.
 *
 * Authors: Daniel Lawson 
 *          Perry Lorier
 *          Shane Alcock 
 *          
 * All rights reserved.
 *
 * This code has been developed by the University of Waikato WAND 
 * research group. For further information please see http://www.wand.net.nz/
 *
 * libtrace is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * libtrace is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with libtrace; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * $Id$
 *
 */

#ifndef FORMAT_HELPER_H
#define FORMAT_HELPER_H
#include "common.h"
#include "wandio.h"

/** @file
 *
 * @brief Header file containing prototypes for functions that are useful for
 * multiple format modules
 *
 * @author Daniel Lawson
 * @author Perry Lorier
 * @author Shane Alcock
 *
 * @version $Id$
 */

/** Generic event function for a live capture device
 *
 * @param trace 	The input trace for the live capture device
 * @param packet	A libtrace packet to read the next available packet 
 * 			into
 * @return 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.
 */
struct libtrace_eventobj_t trace_event_device(libtrace_t *trace, libtrace_packet_t *packet);

/** Generic event function for a offline trace file
 *
 * @param trace		The input trace for the trace file
 * @param packet	A libtrace packet to read the next available packet 
 * 			into
 * @return 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
 */
struct libtrace_eventobj_t trace_event_trace(libtrace_t *trace, libtrace_packet_t *packet);

/** Opens an input trace file for reading
 *
 * @param libtrace	The input trace to be opened
 * @return A libtrace IO reader for the newly opened file or NULL if the file
 * was unable to be opened
 */
io_t *trace_open_file(libtrace_t *libtrace);

/** Opens an output trace file for writing
 *
 * @param libtrace	The output trace to be opened
 * @param compress_type	The compression type to use when writing
 * @param level		The compression level to use when writing, ranging from
 * 			0 to 9
 * @param filemode	The file status flags for the file, bitwise-ORed.
 * @return A libtrace IO writer for the newly opened file or NULL if the file
 * was unable to be opened
 */
iow_t *trace_open_file_out(libtrace_out_t *libtrace,
		int compress_type,
		int level,
		int filemode);
#endif /* FORMAT_HELPER_H */