00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #define TRACEFILE_MAGIC 0x64484370UL
00030 #define TRACEFILE_VERSION 1
00031
00032
00033
00034 typedef struct {
00035 u_int32_t magic;
00036 u_int32_t version;
00037 int32_t hlen;
00038 int32_t phlen;
00039 } tracefile_header_t;
00040
00041
00042
00043
00044
00045
00046
00047 typedef struct {
00048 u_int32_t type_index;
00049
00050 u_int32_t length;
00051
00052 u_int32_t when;
00053 u_int32_t pad;
00054 } tracepacket_t;
00055
00056 #define TRACE_INDEX_MAPPING_SIZE 4
00057 typedef struct {
00058 u_int32_t index;
00059 char name [1];
00060 } trace_index_mapping_t;
00061
00062 struct trace_type;
00063 typedef struct trace_type trace_type_t;
00064
00065 struct trace_type {
00066 trace_type_t *next;
00067 int index;
00068 char *name;
00069 void *baggage;
00070 void (*have_packet) (trace_type_t *, unsigned, char *);
00071 void (*stop_tracing) (trace_type_t *);
00072 };
00073
00074 typedef struct trace_iov {
00075 const char *buf;
00076 unsigned len;
00077 } trace_iov_t;
00078
00079 typedef struct {
00080 u_int16_t addrtype;
00081 u_int16_t addrlen;
00082 u_int8_t address [16];
00083 u_int16_t port;
00084 } trace_addr_t;
00085
00086 void trace_free_all (void);
00087 int trace_playback (void);
00088 int trace_record (void);
00089 isc_result_t trace_init(void (*set_time)(time_t), const char *, int);
00090 isc_result_t trace_begin (const char *, const char *, int);
00091 isc_result_t trace_write_packet (trace_type_t *, unsigned, const char *,
00092 const char *, int);
00093 isc_result_t trace_write_packet_iov (trace_type_t *, int, trace_iov_t *,
00094 const char *, int);
00095 void trace_type_stash (trace_type_t *);
00096 trace_type_t *trace_type_register (const char *, void *,
00097 void (*) (trace_type_t *,
00098 unsigned, char *),
00099 void (*) (trace_type_t *),
00100 const char *, int);
00101 void trace_stop (void);
00102 void trace_index_map_input (trace_type_t *, unsigned, char *);
00103 void trace_index_stop_tracing (trace_type_t *);
00104 void trace_replay_init (void);
00105 void trace_file_replay (const char *);
00106 isc_result_t trace_get_next_packet (trace_type_t **, tracepacket_t *,
00107 char **, unsigned *, unsigned *);
00108 isc_result_t trace_get_file (trace_type_t *,
00109 const char *, unsigned *, char **);
00110 isc_result_t trace_get_packet (trace_type_t **, unsigned *, char **);
00111 time_t trace_snoop_time (trace_type_t **);