|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1983, 1988 Regents of the University of California. ! 3: * All rights reserved. ! 4: * ! 5: * Redistribution and use in source and binary forms are permitted ! 6: * provided that this notice is preserved and that due credit is given ! 7: * to the University of California at Berkeley. The name of the University ! 8: * may not be used to endorse or promote products derived from this ! 9: * software without specific prior written permission. This software ! 10: * is provided ``as is'' without express or implied warranty. ! 11: * ! 12: * @(#)trace.h 5.4 (Berkeley) 5/31/88 ! 13: */ ! 14: ! 15: /* ! 16: * Routing table management daemon. ! 17: */ ! 18: ! 19: /* ! 20: * Trace record format. ! 21: */ ! 22: struct iftrace { ! 23: time_t ift_stamp; /* time stamp */ ! 24: struct sockaddr ift_who; /* from/to */ ! 25: char *ift_packet; /* pointer to packet */ ! 26: short ift_size; /* size of packet */ ! 27: short ift_metric; /* metric on associated metric */ ! 28: }; ! 29: ! 30: /* ! 31: * Per interface packet tracing buffers. An incoming and ! 32: * outgoing circular buffer of packets is maintained, per ! 33: * interface, for debugging. Buffers are dumped whenever ! 34: * an interface is marked down. ! 35: */ ! 36: struct ifdebug { ! 37: struct iftrace *ifd_records; /* array of trace records */ ! 38: struct iftrace *ifd_front; /* next empty trace record */ ! 39: int ifd_count; /* number of unprinted records */ ! 40: struct interface *ifd_if; /* for locating stuff */ ! 41: }; ! 42: ! 43: /* ! 44: * Packet tracing stuff. ! 45: */ ! 46: int tracepackets; /* watch packets as they go by */ ! 47: int traceactions; /* on/off */ ! 48: int tracehistory; /* on/off */ ! 49: FILE *ftrace; /* output trace file */ ! 50: char *curtime; /* current timestamp string */ ! 51: ! 52: #define TRACE_ACTION(action, route) { \ ! 53: if (traceactions) \ ! 54: traceaction(ftrace, action, route); \ ! 55: } ! 56: #define TRACE_NEWMETRIC(route, newmetric) { \ ! 57: if (traceactions) \ ! 58: tracenewmetric(ftrace, route, newmetric); \ ! 59: } ! 60: #define TRACE_INPUT(ifp, src, size) { \ ! 61: if (tracehistory) { \ ! 62: ifp = if_iflookup(src); \ ! 63: if (ifp) \ ! 64: trace(&ifp->int_input, src, packet, size, \ ! 65: ntohl(ifp->int_metric)); \ ! 66: } \ ! 67: if (tracepackets) { \ ! 68: time_t t; \ ! 69: t = time(0); \ ! 70: dumppacket(stdout, "from", src, packet, size, &t); \ ! 71: } \ ! 72: } ! 73: #define TRACE_OUTPUT(ifp, dst, size) { \ ! 74: if (tracehistory && ifp) \ ! 75: trace(&ifp->int_output, dst, packet, size, ifp->int_metric); \ ! 76: if (tracepackets) { \ ! 77: time_t t; \ ! 78: t = time(0); \ ! 79: dumppacket(stdout, "to", dst, packet, size, &t); \ ! 80: } \ ! 81: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.