|
|
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: (1) source distributions retain this entire copyright ! 7: * notice and comment, and (2) distributions including binaries display ! 8: * the following acknowledgement: ``This product includes software ! 9: * developed by the University of California, Berkeley and its contributors'' ! 10: * in the documentation or other materials provided with the distribution ! 11: * and in all advertising materials mentioning features or use of this ! 12: * software. Neither the name of the University nor the names of its ! 13: * contributors may be used to endorse or promote products derived ! 14: * from this software without specific prior written permission. ! 15: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR ! 16: * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED ! 17: * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ! 18: * ! 19: * @(#)trace.h 5.8 (Berkeley) 6/1/90 ! 20: */ ! 21: ! 22: /* ! 23: * Routing table management daemon. ! 24: */ ! 25: ! 26: /* ! 27: * Trace record format. ! 28: */ ! 29: struct iftrace { ! 30: struct timeval ift_stamp; /* time stamp */ ! 31: struct sockaddr ift_who; /* from/to */ ! 32: char *ift_packet; /* pointer to packet */ ! 33: short ift_size; /* size of packet */ ! 34: short ift_metric; /* metric on associated metric */ ! 35: }; ! 36: ! 37: /* ! 38: * Per interface packet tracing buffers. An incoming and ! 39: * outgoing circular buffer of packets is maintained, per ! 40: * interface, for debugging. Buffers are dumped whenever ! 41: * an interface is marked down. ! 42: */ ! 43: struct ifdebug { ! 44: struct iftrace *ifd_records; /* array of trace records */ ! 45: struct iftrace *ifd_front; /* next empty trace record */ ! 46: int ifd_count; /* number of unprinted records */ ! 47: struct interface *ifd_if; /* for locating stuff */ ! 48: }; ! 49: ! 50: /* ! 51: * Packet tracing stuff. ! 52: */ ! 53: int tracepackets; /* watch packets as they go by */ ! 54: int tracecontents; /* watch packet contents as they go by */ ! 55: int traceactions; /* on/off */ ! 56: int tracehistory; /* on/off */ ! 57: FILE *ftrace; /* output trace file */ ! 58: ! 59: #define TRACE_ACTION(action, route) { \ ! 60: if (traceactions) \ ! 61: traceaction(ftrace, action, route); \ ! 62: } ! 63: #define TRACE_NEWMETRIC(route, newmetric) { \ ! 64: if (traceactions) \ ! 65: tracenewmetric(ftrace, route, newmetric); \ ! 66: } ! 67: #define TRACE_INPUT(ifp, src, pack, size) { \ ! 68: if (tracehistory) { \ ! 69: ifp = if_iflookup(src); \ ! 70: if (ifp) \ ! 71: trace(&ifp->int_input, src, pack, size, \ ! 72: ntohl(ifp->int_metric)); \ ! 73: } \ ! 74: if (tracepackets) \ ! 75: dumppacket(ftrace, "from", src, pack, size, &now); \ ! 76: } ! 77: #define TRACE_OUTPUT(ifp, dst, size) { \ ! 78: if (tracehistory && ifp) \ ! 79: trace(&ifp->int_output, dst, packet, size, ifp->int_metric); \ ! 80: if (tracepackets) \ ! 81: dumppacket(ftrace, "to", dst, packet, size, &now); \ ! 82: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.