4.3BSD beta release manual page
[unix-history] / usr / src / sbin / routed / trace.h
CommitLineData
b7e4f8be 1/* trace.h 4.4 84/04/09 */
0a225629
SL
2
3/*
4 * Routing table management daemon.
5 */
6
7/*
8 * Trace record format.
9 */
10struct 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 */
24struct ifdebug {
25 struct iftrace *ifd_records; /* array of trace records */
26 struct iftrace *ifd_front; /* next empty trace record */
b7e4f8be 27 int ifd_count; /* number of unprinted records */
0a225629
SL
28 struct interface *ifd_if; /* for locating stuff */
29};
30
31/*
32 * Packet tracing stuff.
33 */
d4b6a849 34int tracepackets; /* watch packets as they go by */
0a225629
SL
35int tracing; /* on/off */
36FILE *ftrace; /* output trace file */
d4b6a849 37
0a225629
SL
38#define TRACE_ACTION(action, route) { \
39 if (tracing) \
40 traceaction(ftrace, "action", route); \
41 }
d4b6a849 42#define TRACE_INPUT(ifp, src, size) { \
0a225629 43 if (tracing) { \
d4b6a849 44 ifp = if_iflookup(src); \
0a225629 45 if (ifp) \
d4b6a849 46 trace(&ifp->int_input, src, packet, size, \
55d340a4 47 ntohl(ifp->int_metric)); \
0a225629 48 } \
d4b6a849
SL
49 if (tracepackets) \
50 dumppacket(stdout, "from", src, packet, size); \
0a225629 51 }
d4b6a849 52#define TRACE_OUTPUT(ifp, dst, size) { \
0a225629 53 if (tracing) \
d4b6a849
SL
54 trace(&ifp->int_output, dst, packet, size, ifp->int_metric); \
55 if (tracepackets) \
56 dumppacket(stdout, "to", dst, packet, size); \
0a225629 57 }