|
|
1.1 root 1: /* trace.h 4.3 83/05/25 */
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 tracepackets; /* watch packets as they go by */
34: int tracing; /* on/off */
35: FILE *ftrace; /* output trace file */
36:
37: #define TRACE_ACTION(action, route) { \
38: if (tracing) \
39: traceaction(ftrace, "action", route); \
40: }
41: #define TRACE_INPUT(ifp, src, size) { \
42: if (tracing) { \
43: ifp = if_iflookup(src); \
44: if (ifp) \
45: trace(&ifp->int_input, src, packet, size, \
46: ntohl(ifp->int_metric)); \
47: } \
48: if (tracepackets) \
49: dumppacket(stdout, "from", src, packet, size); \
50: }
51: #define TRACE_OUTPUT(ifp, dst, size) { \
52: if (tracing) \
53: trace(&ifp->int_output, dst, packet, size, ifp->int_metric); \
54: if (tracepackets) \
55: dumppacket(stdout, "to", dst, packet, size); \
56: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.