source: lib/format_template.c @ 8013711

4.0.1-hotfixescachetimestampsdevelopdpdk-ndagetsilivegetfragoffhelplibtrace4ndag_formatpfringrc-4.0.1rc-4.0.2rc-4.0.3rc-4.0.4ringdecrementfixringperformanceringtimestampfixes
Last change on this file since 8013711 was 7c8eacf, checked in by Daniel Lawson <dlawson@…>, 16 years ago

updated changelog
added trace_get_framing_length() to return the capture-format framing (eg, ERF or pcap headers).

  • Property mode set to 100644
File size: 4.4 KB
Line 
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#ifdef HAVE_INTTYPES_H
38#  include <inttypes.h>
39#else
40# error "Can't find inttypes.h"
41#endif
42
43extern struct libtrace_format_t template;
44
45struct libtrace_format_data_t {
46        int fd;
47};
48static int template_init_input(struct libtrace_t *libtrace) {
49        libtrace->format_data = (struct libtrace_format_data_t *)
50                malloc(sizeof(struct libtrace_format_data_t));
51        return -1;
52}
53
54static int template_init_output(struct libtrace_out_t *libtrace) {
55        return -1;
56}
57
58static int template_config_output(struct libtrace_out_t *libtrace, int argc, char *argv[]) {
59        return -1;
60}
61
62static int template_fin_input(struct libtrace_t *libtrace) {
63        return -1;
64}
65
66static int template_fin_output(struct libtrace_out_t *libtrace) {
67        return -1;
68}
69
70static int template_read_packet(struct libtrace_t *libtrace, struct libtrace_packet_t *packet) {
71        return -1;
72}
73
74static int template_write_packet(struct libtrace_out_t *libtrace, const struct libtrace_packet_t *packet) {
75        return -1;
76}
77
78static void *template_get_link(const struct libtrace_packet_t *packet) {
79        return NULL;
80}
81
82static libtrace_linktype_t template_get_link_type(const struct libtrace_packet_t *packet) {
83        return -1;
84}
85
86static int8_t template_get_direction(const struct libtrace_packet_t *packet) {
87        return -1;
88}
89
90static int8_t template_set_direction(const struct libtrace_packet_t *packet, int8_t direction) {
91        return -1;
92}
93
94static uint64_t template_get_erf_timestamp(const struct libtrace_packet_t *packet) {
95        return -1;
96}
97
98static struct timeval template_get_timeval(const struct libtrace_packet_t *packet) { 
99        struct timeval tv;
100        return tv;
101}
102
103static double template_get_seconds(const struct libtrace_packet_t *packet) {
104        return -1;
105}
106
107static int template_get_capture_length(const struct libtrace_packet_t *packet) {
108        return -1;
109}
110
111static int template_get_wire_length(const struct libtrace_packet_t *packet) {
112        return -1;
113}
114
115static int template_get_framing_length(const struct libtrace_packet_t *packet) {
116        return -1;
117}
118
119static size_t template_set_capture_length(struct libtrace_packet_t *packet,size_t size) {
120        return -1;
121}
122
123static int template_get_fd(const struct libtrace_packet_t *packet) {
124        return -1;
125}
126
127static void template_help() {
128        return;
129}
130static struct libtrace_format_t template = {
131        "template",
132        "$Id$",
133        "template",
134        template_init_input,            /* init_input */
135        template_init_output,           /* init_output */
136        template_config_output,         /* config_output */
137        template_fin_input,             /* fin_input */
138        template_fin_output,            /* fin_output */
139        template_read_packet,           /* read_packet */
140        template_write_packet,          /* write_packet */
141        template_get_link,              /* get_link */
142        template_get_link_type,         /* get_link_type */
143        template_get_direction,         /* get_direction */
144        template_set_direction,         /* set_direction */
145        template_get_erf_timestamp,     /* get_erf_timestamp */
146        template_get_timeval,           /* get_timeval */
147        template_get_seconds,           /* get_seconds */
148        template_get_capture_length,    /* get_capture_length */
149        template_get_wire_length,       /* get_wire_length */
150        template_get_framing_length,    /* get_framing_length */
151        template_set_capture_length,    /* set_capture_length */
152        template_get_fd,                /* get_fd */
153        trace_event_trace,              /* trace_event */
154        template_help                   /* help */
155};
156
157void __attribute__((constructor)) template_constructor() {
158        register_format(&template);
159}
Note: See TracBrowser for help on using the repository browser.