File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / pimd / trace.h
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Mon Jun 12 07:59:38 2017 UTC (7 years ago) by misho
Branches: pimd, MAIN
CVS tags: v2_3_2, HEAD
pimd 2.3.2

    1: /*
    2:  * Copyright (c) 1998-2001
    3:  * University of Southern California/Information Sciences Institute.
    4:  * All rights reserved.
    5:  *
    6:  * Redistribution and use in source and binary forms, with or without
    7:  * modification, are permitted provided that the following conditions
    8:  * are met:
    9:  * 1. Redistributions of source code must retain the above copyright
   10:  *    notice, this list of conditions and the following disclaimer.
   11:  * 2. Redistributions in binary form must reproduce the above copyright
   12:  *    notice, this list of conditions and the following disclaimer in the
   13:  *    documentation and/or other materials provided with the distribution.
   14:  * 3. Neither the name of the project nor the names of its contributors
   15:  *    may be used to endorse or promote products derived from this software
   16:  *    without specific prior written permission.
   17:  *
   18:  * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
   19:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   20:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   21:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
   22:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   23:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   24:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   25:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   26:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   27:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   28:  * SUCH DAMAGE.
   29:  */
   30: /*
   31:  *  $Id: trace.h,v 1.1.1.1 2017/06/12 07:59:38 misho Exp $
   32:  */
   33: /*
   34:  * Part of this program has been derived from mrouted.
   35:  * The mrouted program is covered by the license in the accompanying file
   36:  * named "LICENSE.mrouted".
   37:  *
   38:  * The mrouted program is COPYRIGHT 1989 by The Board of Trustees of
   39:  * Leland Stanford Junior University.
   40:  *
   41:  */
   42: 
   43: 
   44: /*
   45:  * The packet format for a traceroute request.
   46:  */
   47: struct tr_query {
   48:     uint32_t  tr_src;		/* traceroute source */
   49:     uint32_t  tr_dst;		/* traceroute destination */
   50:     uint32_t  tr_raddr;		/* traceroute response address */
   51: #if defined(BYTE_ORDER) && (BYTE_ORDER == LITTLE_ENDIAN)
   52:     struct {
   53: 	u_int	qid : 24;	/* traceroute query id */
   54: 	u_int	ttl : 8;	/* traceroute response ttl */
   55:     } q;
   56: #else
   57:     struct {
   58: 	u_int   ttl : 8;	/* traceroute response ttl */
   59: 	u_int   qid : 24;	/* traceroute query id */
   60:     } q;
   61: #endif /* BYTE_ORDER */
   62: };
   63: 
   64: #define tr_rttl q.ttl
   65: #define tr_qid  q.qid
   66: 
   67: /*
   68:  * Traceroute response format.  A traceroute response has a tr_query at the
   69:  * beginning, followed by one tr_resp for each hop taken.
   70:  */
   71: struct tr_resp {
   72:     uint32_t tr_qarr;		/* query arrival time */
   73:     uint32_t tr_inaddr;		/* incoming interface address */
   74:     uint32_t tr_outaddr;	/* outgoing interface address */
   75:     uint32_t tr_rmtaddr;	/* parent address in source tree */
   76:     uint32_t tr_vifin;		/* input packet count on interface */
   77:     uint32_t tr_vifout;		/* output packet count on interface */
   78:     uint32_t tr_pktcnt;		/* total incoming packets for src-grp */
   79:     uint8_t  tr_rproto;		/* routing protocol deployed on router */
   80:     uint8_t  tr_fttl;		/* ttl required to forward on outvif */
   81:     uint8_t  tr_smask;		/* subnet mask for src addr */
   82:     uint8_t  tr_rflags;		/* forwarding error codes */
   83: };
   84: 
   85: /* defs within mtrace */
   86: #define QUERY	1
   87: #define RESP	2
   88: #define QLEN	sizeof(struct tr_query)
   89: #define RLEN	sizeof(struct tr_resp)
   90: 
   91: /* fields for tr_rflags (forwarding error codes) */
   92: #define TR_NO_ERR	0       /* No error */
   93: #define TR_WRONG_IF	1       /* traceroute arrived on non-oif */
   94: #define TR_PRUNED	2       /* router has sent a prune upstream */
   95: #define TR_OPRUNED	3       /* stop forw. after request from next hop rtr*/
   96: #define TR_SCOPED	4       /* group adm. scoped at this hop */
   97: #define TR_NO_RTE	5       /* no route for the source */
   98: #define TR_NO_LHR       6       /* not the last-hop router */
   99: #define TR_NO_FWD	7       /* not forwarding for this (S,G). Reason = ? */
  100: #define TR_RP           8       /* I am the RP/Core */
  101: #define TR_IIF          9       /* request arrived on the iif */
  102: #define TR_NO_MULTI     0x0a    /* multicast disabled on that interface */
  103: #define TR_NO_SPACE	0x81    /* no space to insert responce data block */
  104: #define TR_OLD_ROUTER	0x82    /* previous hop does not support traceroute */
  105: #define TR_ADMIN_PROHIB 0x83    /* traceroute adm. prohibited */
  106: 
  107: /* fields for tr_smask */
  108: #define TR_GROUP_ONLY   0x2f    /* forwarding solely on group state */
  109: #define TR_SUBNET_COUNT 0x40    /* pkt count for (S,G) is for source network */
  110: 
  111: /* fields for packets count */
  112: #define TR_CANT_COUNT   0xffffffff  /* no count can be reported */
  113: 
  114: /* fields for tr_rproto (routing protocol) */
  115: #define PROTO_DVMRP	   1
  116: #define PROTO_MOSPF	   2
  117: #define PROTO_PIM	   3
  118: #define PROTO_CBT 	   4
  119: #define PROTO_PIM_SPECIAL  5
  120: #define PROTO_PIM_STATIC   6
  121: #define PROTO_DVMRP_STATIC 7
  122: 
  123: #define NBR_VERS(n)	(((n)->al_pv << 8) + (n)->al_mv)
  124: 
  125: /**
  126:  * Local Variables:
  127:  *  version-control: t
  128:  *  indent-tabs-mode: t
  129:  *  c-file-style: "ellemtel"
  130:  *  c-basic-offset: 4
  131:  * End:
  132:  */

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>