source: lib/format_template.c @ 1974620

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

added format conversion into pcap and erf formats, and have tested the writers for these formats.

Added a 'type' field to the format_t structure, which specifies the type of trace we're dealing with - erf, pcap, wag.

updated munge to use the new functions.

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