3 Definitions for omapi tracing facility... */
6 * Copyright (c) 2001 Internet Software Consortium.
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. Neither the name of The Internet Software Consortium nor the names
19 * of its contributors may be used to endorse or promote products derived
20 * from this software without specific prior written permission.
22 * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND
23 * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
24 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
25 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR
27 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
30 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
31 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
33 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * This software has been written for the Internet Software Consortium
37 * by Ted Lemon, as part of a project for Nominum, Inc. To learn more
38 * about the Internet Software Consortium, see http://www.isc.org/. To
39 * learn more about Nominum, Inc., see ``http://www.nominum.com''.
42 #define TRACEFILE_MAGIC 0x64484370UL /* dHCp */
43 #define TRACEFILE_VERSION 1
45 /* The first thing in a trace file is the header, which basically just
46 defines the version of the file. */
48 u_int32_t magic; /* Magic number for trace file. */
49 u_int32_t version; /* Version of file. */
50 int32_t hlen; /* Length of this header. */
51 int32_t phlen; /* Length of packet headers. */
54 /* The trace file is composed of a bunch of trace packets. Each such packet
55 has a type, followed by a length, followed by a timestamp, followed by
56 the actual contents of the packet. The type indexes are not fixed -
57 they are allocated either on readback or when writing a trace file.
58 One index type is reserved - type zero means that this record is a type
59 name to index mapping. */
61 u_int32_t type_index; /* Index to the type of handler that this
63 u_int32_t length; /* Length of the packet. This includes
64 everything except the fixed header. */
65 u_int32_t when; /* When the packet was written. */
66 u_int32_t pad; /* Round this out to a quad boundary. */
69 #define TRACE_INDEX_MAPPING_SIZE 4 /* trace_index_mapping_t less name. */
73 } trace_index_mapping_t;
75 struct trace_type; /* forward */
76 typedef struct trace_type trace_type_t;
83 void (*have_packet) (trace_type_t *, unsigned, char *);
84 void (*stop_tracing) (trace_type_t *);
87 typedef struct trace_iov {
95 u_int8_t address [16];
99 void trace_free_all (void);
100 int trace_playback (void);
101 int trace_record (void);
102 isc_result_t trace_init (void (*set_time) (u_int32_t), const char *, int);
103 isc_result_t trace_begin (const char *, const char *, int);
104 isc_result_t trace_write_packet (trace_type_t *, unsigned, const char *,
106 isc_result_t trace_write_packet_iov (trace_type_t *, int, trace_iov_t *,
108 void trace_type_stash (trace_type_t *);
109 trace_type_t *trace_type_register (const char *, void *,
110 void (*) (trace_type_t *,
112 void (*) (trace_type_t *),
114 void trace_stop (void);
115 void trace_index_map_input (trace_type_t *, unsigned, char *);
116 void trace_index_stop_tracing (trace_type_t *);
117 void trace_replay_init (void);
118 void trace_file_replay (const char *);
119 isc_result_t trace_get_next_packet (trace_type_t **, tracepacket_t *,
120 char **, unsigned *, unsigned *);
121 isc_result_t trace_get_file (trace_type_t *,
122 const char *, unsigned *, char **);
123 isc_result_t trace_get_packet (trace_type_t **, unsigned *, char **);
124 time_t trace_snoop_time (trace_type_t **);