Commit | Line | Data |
---|---|---|
0a225629 SL |
1 | /* trace.h 4.1 83/01/11 */ |
2 | ||
3 | /* | |
4 | * Routing table management daemon. | |
5 | */ | |
6 | ||
7 | /* | |
8 | * Trace record format. | |
9 | */ | |
10 | struct iftrace { | |
11 | time_t ift_stamp; /* time stamp */ | |
12 | struct sockaddr ift_who; /* from/to */ | |
13 | char *ift_packet; /* pointer to packet */ | |
14 | short ift_size; /* size of packet */ | |
15 | short ift_metric; /* metric on associated metric */ | |
16 | }; | |
17 | ||
18 | /* | |
19 | * Per interface packet tracing buffers. An incoming and | |
20 | * outgoing circular buffer of packets is maintained, per | |
21 | * interface, for debugging. Buffers are dumped whenever | |
22 | * an interface is marked down. | |
23 | */ | |
24 | struct ifdebug { | |
25 | struct iftrace *ifd_records; /* array of trace records */ | |
26 | struct iftrace *ifd_front; /* next empty trace record */ | |
27 | struct interface *ifd_if; /* for locating stuff */ | |
28 | }; | |
29 | ||
30 | /* | |
31 | * Packet tracing stuff. | |
32 | */ | |
33 | int tracing; /* on/off */ | |
34 | FILE *ftrace; /* output trace file */ | |
35 | #define TRACE_ACTION(action, route) { \ | |
36 | if (tracing) \ | |
37 | traceaction(ftrace, "action", route); \ | |
38 | } | |
39 | #define TRACE_INPUT(ifp, from, size) { \ | |
40 | if (tracing) { \ | |
41 | ifp = if_iflookup(from); \ | |
42 | if (ifp) \ | |
43 | trace(&ifp->int_input, from, packet, size, \ | |
44 | ifp->int_metric); \ | |
45 | } \ | |
46 | } | |
47 | #define TRACE_OUTPUT(ifp, to, size) { \ | |
48 | if (tracing) \ | |
49 | trace(&ifp->int_output, to, packet, size, ifp->int_metric); \ | |
50 | } |