Annotation of embedaddon/pimdd/trace.h, revision 1.1
1.1 ! misho 1: /*
! 2: * Copyright (c) 1998 by the University of Southern California.
! 3: * All rights reserved.
! 4: *
! 5: * Permission to use, copy, modify, and distribute this software and
! 6: * its documentation in source and binary forms for lawful
! 7: * purposes and without fee is hereby granted, provided
! 8: * that the above copyright notice appear in all copies and that both
! 9: * the copyright notice and this permission notice appear in supporting
! 10: * documentation, and that any documentation, advertising materials,
! 11: * and other materials related to such distribution and use acknowledge
! 12: * that the software was developed by the University of Southern
! 13: * California and/or Information Sciences Institute.
! 14: * The name of the University of Southern California may not
! 15: * be used to endorse or promote products derived from this software
! 16: * without specific prior written permission.
! 17: *
! 18: * THE UNIVERSITY OF SOUTHERN CALIFORNIA DOES NOT MAKE ANY REPRESENTATIONS
! 19: * ABOUT THE SUITABILITY OF THIS SOFTWARE FOR ANY PURPOSE. THIS SOFTWARE IS
! 20: * PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES,
! 21: * INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
! 22: * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND
! 23: * NON-INFRINGEMENT.
! 24: *
! 25: * IN NO EVENT SHALL USC, OR ANY OTHER CONTRIBUTOR BE LIABLE FOR ANY
! 26: * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES, WHETHER IN CONTRACT,
! 27: * TORT, OR OTHER FORM OF ACTION, ARISING OUT OF OR IN CONNECTION WITH,
! 28: * THE USE OR PERFORMANCE OF THIS SOFTWARE.
! 29: *
! 30: * Other copyrights might apply to parts of this software and are so
! 31: * noted when applicable.
! 32: */
! 33: /*
! 34: * Questions concerning this software should be directed to
! 35: * Pavlin Ivanov Radoslavov (pavlin@catarina.usc.edu)
! 36: *
! 37: * $Id: trace.h,v 1.1.1.1 1998/05/11 17:39:34 kurtw Exp $
! 38: */
! 39: /*
! 40: * Part of this program has been derived from mrouted.
! 41: * The mrouted program is covered by the license in the accompanying file
! 42: * named "LICENSE.mrouted".
! 43: *
! 44: * The mrouted program is COPYRIGHT 1989 by The Board of Trustees of
! 45: * Leland Stanford Junior University.
! 46: *
! 47: */
! 48:
! 49:
! 50: /*
! 51: * The packet format for a traceroute request.
! 52: */
! 53: struct tr_query {
! 54: u_int32 tr_src; /* traceroute source */
! 55: u_int32 tr_dst; /* traceroute destination */
! 56: u_int32 tr_raddr; /* traceroute response address */
! 57: #if defined(BYTE_ORDER) && (BYTE_ORDER == LITTLE_ENDIAN)
! 58: struct {
! 59: u_int qid : 24; /* traceroute query id */
! 60: u_int ttl : 8; /* traceroute response ttl */
! 61: } q;
! 62: #else
! 63: struct {
! 64: u_int ttl : 8; /* traceroute response ttl */
! 65: u_int qid : 24; /* traceroute query id */
! 66: } q;
! 67: #endif /* BYTE_ORDER */
! 68: };
! 69:
! 70: #define tr_rttl q.ttl
! 71: #define tr_qid q.qid
! 72:
! 73: /*
! 74: * Traceroute response format. A traceroute response has a tr_query at the
! 75: * beginning, followed by one tr_resp for each hop taken.
! 76: */
! 77: struct tr_resp {
! 78: u_int32 tr_qarr; /* query arrival time */
! 79: u_int32 tr_inaddr; /* incoming interface address */
! 80: u_int32 tr_outaddr; /* outgoing interface address */
! 81: u_int32 tr_rmtaddr; /* parent address in source tree */
! 82: u_int32 tr_vifin; /* input packet count on interface */
! 83: u_int32 tr_vifout; /* output packet count on interface */
! 84: u_int32 tr_pktcnt; /* total incoming packets for src-grp */
! 85: u_char tr_rproto; /* routing protocol deployed on router */
! 86: u_char tr_fttl; /* ttl required to forward on outvif */
! 87: u_char tr_smask; /* subnet mask for src addr */
! 88: u_char tr_rflags; /* forwarding error codes */
! 89: };
! 90:
! 91: /* defs within mtrace */
! 92: #define QUERY 1
! 93: #define RESP 2
! 94: #define QLEN sizeof(struct tr_query)
! 95: #define RLEN sizeof(struct tr_resp)
! 96:
! 97: /* fields for tr_rflags (forwarding error codes) */
! 98: #define TR_NO_ERR 0 /* No error */
! 99: #define TR_WRONG_IF 1 /* traceroute arrived on non-oif */
! 100: #define TR_PRUNED 2 /* router has sent a prune upstream */
! 101: #define TR_OPRUNED 3 /* stop forw. after request from next hop rtr*/
! 102: #define TR_SCOPED 4 /* group adm. scoped at this hop */
! 103: #define TR_NO_RTE 5 /* no route for the source */
! 104: #define TR_NO_LHR 6 /* not the last-hop router */
! 105: #define TR_NO_FWD 7 /* not forwarding for this (S,G). Reason = ? */
! 106: #define TR_RP 8 /* I am the RP/Core */
! 107: #define TR_IIF 9 /* request arrived on the iif */
! 108: #define TR_NO_MULTI 0x0a /* multicast disabled on that interface */
! 109: #define TR_NO_SPACE 0x81 /* no space to insert responce data block */
! 110: #define TR_OLD_ROUTER 0x82 /* previous hop does not support traceroute */
! 111: #define TR_ADMIN_PROHIB 0x83 /* traceroute adm. prohibited */
! 112:
! 113: /* fields for tr_smask */
! 114: #define TR_GROUP_ONLY 0x2f /* forwarding solely on group state */
! 115: #define TR_SUBNET_COUNT 0x40 /* pkt count for (S,G) is for source network */
! 116:
! 117: /* fields for packets count */
! 118: #define TR_CANT_COUNT 0xffffffff /* no count can be reported */
! 119:
! 120: /* fields for tr_rproto (routing protocol) */
! 121: #define PROTO_DVMRP 1
! 122: #define PROTO_MOSPF 2
! 123: #define PROTO_PIM 3
! 124: #define PROTO_CBT 4
! 125: #define PROTO_PIM_SPECIAL 5
! 126: #define PROTO_PIM_STATIC 6
! 127: #define PROTO_DVMRP_STATIC 7
! 128:
! 129: #define MASK_TO_VAL(x, i) { \
! 130: u_int32 _x = ntohl(x); \
! 131: (i) = 1; \
! 132: while ((_x) <<= 1) \
! 133: (i)++; \
! 134: };
! 135:
! 136: #define VAL_TO_MASK(x, i) { \
! 137: x = htonl(~((1 << (32 - (i))) - 1)); \
! 138: };
! 139:
! 140: #define NBR_VERS(n) (((n)->al_pv << 8) + (n)->al_mv)
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>