1: /*
2: * Copyright (c) 1983 Regents of the University of California.
3: * All rights reserved. The Berkeley software License Agreement
4: * specifies the terms and conditions for redistribution.
5: *
6: * @(#)trace.h 5.4 (Berkeley) 9/17/85";
7: *
8: * Includes material written at Cornell University by Bill Nesheim,
9: * by permission of the author.
10: */
11:
12: /*
13: * Xerox Routing Information Protocol.
14: */
15:
16: /*
17: * Trace record format.
18: */
19: struct iftrace {
20: time_t ift_stamp; /* time stamp */
21: struct sockaddr ift_who; /* from/to */
22: char *ift_packet; /* pointer to packet */
23: short ift_size; /* size of packet */
24: short ift_metric; /* metric */
25: };
26:
27: /*
28: * Per interface packet tracing buffers. An incoming and
29: * outgoing circular buffer of packets is maintained, per
30: * interface, for debugging. Buffers are dumped whenever
31: * an interface is marked down.
32: */
33: struct ifdebug {
34: struct iftrace *ifd_records; /* array of trace records */
35: struct iftrace *ifd_front; /* next empty trace record */
36: int ifd_count; /* number of unprinted records */
37: struct interface *ifd_if; /* for locating stuff */
38: };
39:
40: /*
41: * Packet tracing stuff.
42: */
43: int tracepackets; /* watch packets as they go by */
44: int tracing; /* on/off */
45: FILE *ftrace; /* output trace file */
46:
47: #define TRACE_ACTION(action, route) { \
48: if (tracing) \
49: traceaction(ftrace, "action", route); \
50: }
51: #define TRACE_INPUT(ifp, src, size) { \
52: if (tracing) { \
53: ifp = if_iflookup(src); \
54: if (ifp) \
55: trace(&ifp->int_input, src, &packet[sizeof(struct idp)], size, \
56: ntohl(ifp->int_metric)); \
57: } \
58: if (tracepackets && ftrace) \
59: dumppacket(ftrace, "from", src, &packet[sizeof(struct idp)], size); \
60: }
61: #define TRACE_OUTPUT(ifp, dst, size) { \
62: if (tracing) { \
63: ifp = if_iflookup(dst); \
64: if (ifp) \
65: trace(&ifp->int_output, dst, &packet[sizeof(struct idp)], size, ifp->int_metric); \
66: } \
67: if (tracepackets && ftrace) \
68: dumppacket(ftrace, "to", dst, &packet[sizeof(struct idp)], size); \
69: }
Defined variables
Defined struct's
Defined macros
Usage of this include