source: lib/libtrace_int.h @ d56089a

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

moved daglegacy.h

  • Property mode set to 100644
File size: 4.8 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#ifndef LIBTRACE_INT_H
32#define LIBTRACE_INT_H
33
34#ifdef __cplusplus
35extern "C" {
36#endif
37
38#include "common.h"
39#include "config.h"
40#include "libtrace.h"
41#include "fifo.h"
42
43#if HAVE_PCAP_BPF_H
44#  include <pcap-bpf.h>
45#else
46#  ifdef HAVE_NET_BPF_H
47#    include <net/bpf.h>
48#  endif
49#endif
50
51#if HAVE_PCAP_H
52#  include <pcap.h>
53#  ifdef HAVE_PCAP_INT_H
54#    include <pcap-int.h>
55#  endif
56#endif
57
58#ifdef HAVE_ZLIB_H
59#  include <zlib.h>
60#endif
61
62
63#include "wag.h"
64#include "daglegacy.h"
65       
66#ifdef HAVE_DAG_API
67#  include "dagnew.h"
68#  include "dagapi.h"
69#else
70#  include "dagformat.h"
71#endif
72
73typedef enum {SOCKET, TRACE, STDIN, DEVICE, INTERFACE, RT } source_t;
74
75
76extern struct trace_err_t{
77        int err_num;    // error code
78        char problem[255];      // the format, uri etc that caused the error for reporting purposes
79} trace_err;
80
81
82#define RP_BUFSIZE 65536
83
84struct libtrace_format_data_t;
85
86struct libtrace_event_t {
87        struct {
88                void *buffer;
89                int size;
90        } packet;
91        double tdelta;
92        double trace_last_ts;
93};
94
95/** The information about traces that are open
96 * @internal
97 */
98struct libtrace_t {
99        struct libtrace_format_t *format; /**< format driver pointer */
100        struct libtrace_format_data_t *format_data; /**<format data pointer */
101        source_t sourcetype;    /**< The type (device,file, etc */
102
103        struct libtrace_event_t event;
104        char *uridata;
105        struct tracefifo_t *fifo;   
106
107};
108
109struct libtrace_out_t {
110        struct libtrace_format_t *format;
111        struct libtrace_format_data_out_t *format_data;
112
113        char *uridata;
114        struct tracefifo_t *fifo;
115};
116
117
118struct trace_sll_header_t {
119        uint16_t pkttype;               /* packet type */
120        uint16_t hatype;                /* link-layer address type */
121        uint16_t halen;                 /* link-layer address length */
122        char addr[8];                   /* link-layer address */
123        uint16_t protocol;              /* protocol */
124};
125
126#ifndef PF_RULESET_NAME_SIZE
127#define PF_RULESET_NAME_SIZE 16
128#endif
129
130#ifndef IFNAMSIZ
131#define IFNAMSIZ 16
132#endif
133
134struct trace_pflog_header_t {
135        uint8_t    length;
136        sa_family_t   af;
137        uint8_t    action;
138        uint8_t    reason;
139        char       ifname[IFNAMSIZ];
140        char       ruleset[PF_RULESET_NAME_SIZE];
141        uint32_t   rulenr;
142        uint32_t   subrulenr;
143        uint8_t    dir;
144        uint8_t    pad[3];
145};
146
147struct libtrace_format_t {
148        char *name;
149        char *version;
150        char *type;
151        int (*init_input)(struct libtrace_t *libtrace);
152        int (*init_output)(struct libtrace_out_t *libtrace);
153        int (*config_output)(struct libtrace_out_t *libtrace, int argc, char *argv[]);
154        int (*fin_input)(struct libtrace_t *libtrace);
155        int (*fin_output)(struct libtrace_out_t *libtrace);
156        int (*read_packet)(struct libtrace_t *libtrace, struct libtrace_packet_t *packet);
157        int (*write_packet)(struct libtrace_out_t *libtrace, const struct libtrace_packet_t *packet);
158        void* (*get_link)(const struct libtrace_packet_t *packet);
159        libtrace_linktype_t (*get_link_type)(const struct libtrace_packet_t *packet);
160        int8_t (*get_direction)(const struct libtrace_packet_t *packet);
161        int8_t (*set_direction)(const struct libtrace_packet_t *packet, int8_t direction);
162        uint64_t (*get_erf_timestamp)(const struct libtrace_packet_t *packet);
163        struct timeval (*get_timeval)(const struct libtrace_packet_t *packet);
164        double (*get_seconds)(const struct libtrace_packet_t *packet);
165        int (*get_capture_length)(const struct libtrace_packet_t *packet);
166        int (*get_wire_length)(const struct libtrace_packet_t *packet);
167        int (*get_framing_length)(const struct libtrace_packet_t *packet);
168        size_t (*set_capture_length)(struct libtrace_packet_t *packet,size_t size);
169        int (*get_fd)(const struct libtrace_packet_t *packet);
170        struct libtrace_eventobj_t (*trace_event)(struct libtrace_t *trace, struct libtrace_packet_t *packet); 
171        void (*help)();
172};
173
174extern struct libtrace_format_t *form;
175
176void register_format(struct libtrace_format_t *format);
177       
178#ifdef __cplusplus
179}
180#endif
181
182#endif // LIBTRACE_INT_H
Note: See TracBrowser for help on using the repository browser.