1 | /* |
---|
2 | * This file is part of libtrace |
---|
3 | * |
---|
4 | * Copyright (c) 2004 The University of Waikato, Hamilton, New Zealand. |
---|
5 | * Authors: Daniel Lawson |
---|
6 | * Perry Lorier |
---|
7 | * |
---|
8 | * All rights reserved. |
---|
9 | * |
---|
10 | * This code has been developed by the University of Waikato WAND |
---|
11 | * research group. For further information please see http://www.wand.net.nz/ |
---|
12 | * |
---|
13 | * libtrace is free software; you can redistribute it and/or modify |
---|
14 | * it under the terms of the GNU General Public License as published by |
---|
15 | * the Free Software Foundation; either version 2 of the License, or |
---|
16 | * (at your option) any later version. |
---|
17 | * |
---|
18 | * libtrace is distributed in the hope that it will be useful, |
---|
19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
21 | * GNU General Public License for more details. |
---|
22 | * |
---|
23 | * You should have received a copy of the GNU General Public License |
---|
24 | * along with libtrace; if not, write to the Free Software |
---|
25 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
26 | * |
---|
27 | * $Id$ |
---|
28 | * |
---|
29 | */ |
---|
30 | |
---|
31 | #include "libtrace.h" |
---|
32 | #include "libtrace_int.h" |
---|
33 | #include "format_helper.h" |
---|
34 | #include "config.h" |
---|
35 | #include "stdlib.h" |
---|
36 | |
---|
37 | static struct libtrace_format_t template; |
---|
38 | |
---|
39 | struct libtrace_format_data_t { |
---|
40 | int fd; |
---|
41 | }; |
---|
42 | static int template_init_input(struct libtrace_t *libtrace) { |
---|
43 | libtrace->format_data = (struct libtrace_format_data_t *) |
---|
44 | malloc(sizeof(struct libtrace_format_data_t)); |
---|
45 | return -1; |
---|
46 | } |
---|
47 | |
---|
48 | static int template_init_output(struct libtrace_out_t *libtrace) { |
---|
49 | return -1; |
---|
50 | } |
---|
51 | |
---|
52 | static int template_config_output(struct libtrace_out_t *libtrace, int argc, char *argv[]) { |
---|
53 | return -1; |
---|
54 | } |
---|
55 | |
---|
56 | static int template_fin_input(struct libtrace_t *libtrace) { |
---|
57 | return -1; |
---|
58 | } |
---|
59 | |
---|
60 | static int template_fin_output(struct libtrace_out_t *libtrace) { |
---|
61 | return -1; |
---|
62 | } |
---|
63 | |
---|
64 | static int template_read_packet(struct libtrace_t *libtrace, struct libtrace_packet_t *packet) { |
---|
65 | return -1; |
---|
66 | } |
---|
67 | |
---|
68 | static int template_write_packet(struct libtrace_out_t *libtrace, const struct libtrace_packet_t *packet) { |
---|
69 | return -1; |
---|
70 | } |
---|
71 | |
---|
72 | static void *template_get_link(const struct libtrace_packet_t *packet) { |
---|
73 | return NULL; |
---|
74 | } |
---|
75 | |
---|
76 | static libtrace_linktype_t template_get_link_type(const struct libtrace_packet_t *packet) { |
---|
77 | return -1; |
---|
78 | } |
---|
79 | |
---|
80 | static int8_t template_get_direction(const struct libtrace_packet_t *packet) { |
---|
81 | return -1; |
---|
82 | } |
---|
83 | |
---|
84 | static int8_t template_set_direction(const struct libtrace_packet_t *packet, int8_t direction) { |
---|
85 | return -1; |
---|
86 | } |
---|
87 | |
---|
88 | static uint64_t template_get_erf_timestamp(const struct libtrace_packet_t *packet) { |
---|
89 | return -1; |
---|
90 | } |
---|
91 | |
---|
92 | static struct timeval template_get_timeval(const struct libtrace_packet_t *packet) { |
---|
93 | struct timeval tv; |
---|
94 | return tv; |
---|
95 | } |
---|
96 | |
---|
97 | static double template_get_seconds(const struct libtrace_packet_t *packet) { |
---|
98 | return -1; |
---|
99 | } |
---|
100 | |
---|
101 | static int template_get_capture_length(const struct libtrace_packet_t *packet) { |
---|
102 | return -1; |
---|
103 | } |
---|
104 | |
---|
105 | static int template_get_wire_length(const struct libtrace_packet_t *packet) { |
---|
106 | return -1; |
---|
107 | } |
---|
108 | |
---|
109 | static int template_get_framing_length(const struct libtrace_packet_t *packet) { |
---|
110 | return -1; |
---|
111 | } |
---|
112 | |
---|
113 | static size_t template_set_capture_length(struct libtrace_packet_t *packet,size_t size) { |
---|
114 | return -1; |
---|
115 | } |
---|
116 | |
---|
117 | static int template_get_fd(const struct libtrace_packet_t *packet) { |
---|
118 | return -1; |
---|
119 | } |
---|
120 | |
---|
121 | static void template_help() { |
---|
122 | return; |
---|
123 | } |
---|
124 | static struct libtrace_format_t template = { |
---|
125 | "template", |
---|
126 | "$Id$", |
---|
127 | "template", |
---|
128 | template_init_input, /* init_input */ |
---|
129 | template_init_output, /* init_output */ |
---|
130 | template_config_output, /* config_output */ |
---|
131 | template_fin_input, /* fin_input */ |
---|
132 | template_fin_output, /* fin_output */ |
---|
133 | template_read_packet, /* read_packet */ |
---|
134 | template_write_packet, /* write_packet */ |
---|
135 | template_get_link, /* get_link */ |
---|
136 | template_get_link_type, /* get_link_type */ |
---|
137 | template_get_direction, /* get_direction */ |
---|
138 | template_set_direction, /* set_direction */ |
---|
139 | template_get_erf_timestamp, /* get_erf_timestamp */ |
---|
140 | template_get_timeval, /* get_timeval */ |
---|
141 | template_get_seconds, /* get_seconds */ |
---|
142 | template_get_capture_length, /* get_capture_length */ |
---|
143 | template_get_wire_length, /* get_wire_length */ |
---|
144 | template_get_framing_length, /* get_framing_length */ |
---|
145 | template_set_capture_length, /* set_capture_length */ |
---|
146 | template_get_fd, /* get_fd */ |
---|
147 | trace_event_trace, /* trace_event */ |
---|
148 | template_help /* help */ |
---|
149 | }; |
---|
150 | |
---|
151 | void __attribute__((constructor)) template_constructor() { |
---|
152 | register_format(&template); |
---|
153 | } |
---|