Annotation of 43BSDReno/sbin/XNSrouted/trace.h, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Copyright (c) 1983 The Regents of the University of California.
                      3:  * All rights reserved.
                      4:  *
                      5:  * This file includes significant work done at Cornell University by
                      6:  * Bill Nesheim.  That work included by permission.
                      7:  *
                      8:  * Redistribution and use in source and binary forms are permitted
                      9:  * provided that: (1) source distributions retain this entire copyright
                     10:  * notice and comment, and (2) distributions including binaries display
                     11:  * the following acknowledgement:  ``This product includes software
                     12:  * developed by the University of California, Berkeley and its contributors''
                     13:  * in the documentation or other materials provided with the distribution
                     14:  * and in all advertising materials mentioning features or use of this
                     15:  * software. Neither the name of the University nor the names of its
                     16:  * contributors may be used to endorse or promote products derived
                     17:  * from this software without specific prior written permission.
                     18:  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
                     19:  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
                     20:  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
                     21:  *
                     22:  *     @(#)trace.h     5.6 (Berkeley) 6/1/90
                     23:  */
                     24: 
                     25: /*
                     26:  * Xerox Routing Information Protocol.
                     27:  */
                     28: 
                     29: /*
                     30:  * Trace record format.
                     31:  */
                     32: struct iftrace {
                     33:        time_t  ift_stamp;              /* time stamp */
                     34:        struct  sockaddr ift_who;       /* from/to */
                     35:        char    *ift_packet;            /* pointer to packet */
                     36:        short   ift_size;               /* size of packet */
                     37:        short   ift_metric;             /* metric  */
                     38: };
                     39: 
                     40: /*
                     41:  * Per interface packet tracing buffers.  An incoming and
                     42:  * outgoing circular buffer of packets is maintained, per
                     43:  * interface, for debugging.  Buffers are dumped whenever
                     44:  * an interface is marked down.
                     45:  */
                     46: struct ifdebug {
                     47:        struct  iftrace *ifd_records;   /* array of trace records */
                     48:        struct  iftrace *ifd_front;     /* next empty trace record */
                     49:        int     ifd_count;              /* number of unprinted records */
                     50:        struct  interface *ifd_if;      /* for locating stuff */
                     51: };
                     52: 
                     53: /*
                     54:  * Packet tracing stuff.
                     55:  */
                     56: int    tracepackets;           /* watch packets as they go by */
                     57: int    tracing;                /* on/off */
                     58: FILE   *ftrace;                /* output trace file */
                     59: 
                     60: #define        TRACE_ACTION(action, route) { \
                     61:          if (tracing) \
                     62:                traceaction(ftrace, "action", route); \
                     63:        }
                     64: #define        TRACE_INPUT(ifp, src, size) { \
                     65:          if (tracing) { \
                     66:                ifp = if_iflookup(src); \
                     67:                if (ifp) \
                     68:                        trace(&ifp->int_input, src, &packet[sizeof(struct idp)], size, \
                     69:                                ntohl(ifp->int_metric)); \
                     70:          } \
                     71:          if (tracepackets && ftrace) \
                     72:                dumppacket(ftrace, "from", src, &packet[sizeof(struct idp)], size); \
                     73:        }
                     74: #define        TRACE_OUTPUT(ifp, dst, size) { \
                     75:          if (tracing) { \
                     76:                ifp = if_iflookup(dst); \
                     77:                if (ifp) \
                     78:                    trace(&ifp->int_output, dst, &packet[sizeof(struct idp)], size, ifp->int_metric); \
                     79:          } \
                     80:          if (tracepackets && ftrace) \
                     81:                dumppacket(ftrace, "to", dst, &packet[sizeof(struct idp)], size); \
                     82:        }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.