Annotation of embedaddon/pimdd/mrt.h, revision 1.1

1.1     ! misho       1: /*
        !             2:  *  Copyright (c) 1998 by the University of Oregon.
        !             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 Oregon.
        !            13:  *  The name of the University of Oregon may not be used to endorse or 
        !            14:  *  promote products derived from this software without specific prior 
        !            15:  *  written permission.
        !            16:  *
        !            17:  *  THE UNIVERSITY OF OREGON DOES NOT MAKE ANY REPRESENTATIONS
        !            18:  *  ABOUT THE SUITABILITY OF THIS SOFTWARE FOR ANY PURPOSE.  THIS SOFTWARE IS
        !            19:  *  PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES,
        !            20:  *  INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
        !            21:  *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND 
        !            22:  *  NON-INFRINGEMENT.
        !            23:  *
        !            24:  *  IN NO EVENT SHALL UO, OR ANY OTHER CONTRIBUTOR BE LIABLE FOR ANY
        !            25:  *  SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES, WHETHER IN CONTRACT,
        !            26:  *  TORT, OR OTHER FORM OF ACTION, ARISING OUT OF OR IN CONNECTION WITH,
        !            27:  *  THE USE OR PERFORMANCE OF THIS SOFTWARE.
        !            28:  *
        !            29:  *  Other copyrights might apply to parts of this software and are so
        !            30:  *  noted when applicable.
        !            31:  */
        !            32: /*
        !            33:  *  Questions concerning this software should be directed to 
        !            34:  *  Kurt Windisch (kurtw@antc.uoregon.edu)
        !            35:  *
        !            36:  *  $Id: mrt.h,v 1.11 1998/05/29 21:58:23 kurtw Exp $
        !            37:  */
        !            38: /*
        !            39:  * Part of this program has been derived from PIM sparse-mode pimd.
        !            40:  * The pimd program is covered by the license in the accompanying file
        !            41:  * named "LICENSE.pimd".
        !            42:  *  
        !            43:  * The pimd program is COPYRIGHT 1998 by University of Southern California.
        !            44:  *
        !            45:  * Part of this program has been derived from mrouted.
        !            46:  * The mrouted program is covered by the license in the accompanying file
        !            47:  * named "LICENSE.mrouted".
        !            48:  * 
        !            49:  * The mrouted program is COPYRIGHT 1989 by The Board of Trustees of
        !            50:  * Leland Stanford Junior University.
        !            51:  *
        !            52:  */
        !            53: 
        !            54: #define MRTF_SPT                0x0001 /* iif toward source                */
        !            55: #define MRTF_WC                 0x0002 /* (*,G) entry                      */
        !            56: #define MRTF_RP                 0x0004 /* iif toward RP                    */
        !            57: #define MRTF_NEW                0x0008 /* new created routing entry        */
        !            58: #define MRTF_IIF_REGISTER      0x0020  /* ???                              */
        !            59: #define MRTF_REGISTER          0x0080  /* ???                              */
        !            60: #define MRTF_KERNEL_CACHE      0x0200  /* a mirror for the kernel cache    */
        !            61: #define MRTF_NULL_OIF          0x0400  /* null oif cache..     ???         */
        !            62: #define MRTF_REG_SUPP          0x0800  /* register suppress    ???         */
        !            63: #define MRTF_ASSERTED          0x1000  /* upstream is not that of src ???  */
        !            64: #define MRTF_SG                        0x2000  /* (S,G) pure, not hanging off of (*,G)*/
        !            65: #define MRTF_PMBR               0x4000  /* (*,*,RP) entry (for interop)     */
        !            66: 
        !            67: /* Macro to duplicate oif info (oif bits, timers) */
        !            68: #define VOIF_COPY(from, to)                                                \
        !            69:            do {                                                           \
        !            70:                 VIFM_COPY((from)->joined_oifs, (to)->joined_oifs);         \
        !            71:                 VIFM_COPY((from)->oifs, (to)->oifs);                       \
        !            72:                 VIFM_COPY((from)->leaves, (to)->leaves);                   \
        !            73:                 VIFM_COPY((from)->pruned_oifs, (to)->pruned_oifs);         \
        !            74:                 bcopy((from)->prune_timers, (to)->prune_timers,            \
        !            75:                      numvifs*sizeof((from)->prune_timers[0]));            \
        !            76:                 bcopy((from)->prune_delay_timerids,                        \
        !            77:                      (to)->prune_delay_timerids,                          \
        !            78:                      numvifs*sizeof((from)->prune_delay_timerids[0]));    \
        !            79:                 (to)->join_delay_timerid = (from)->join_delay_timerid;     \
        !            80:            } while (0)
        !            81: 
        !            82: #ifdef SAVE_MEMORY
        !            83: #define FREE_MRTENTRY(mrtentry_ptr)                                        \
        !            84:              do {                                                          \
        !            85:                   u_int16 i;                                               \
        !            86:                   u_long *il_ptr;                                          \
        !            87:                  free((char *)((mrtentry_ptr)->prune_timers));            \
        !            88:                  for(i=0, il_ptr=(mrtentry_ptr)->prune_delay_timerids;    \
        !            89:                       i<numvifs; i++, il_ptr++)                            \
        !            90:                       timer_clearTimer(*il_ptr);                          \
        !            91:                  free((char *)((mrtentry_ptr)->prune_delay_timerids));    \
        !            92:                   timer_clearTimer((mrtentry_ptr)->join_delay_timerid);    \
        !            93:                  delete_pim_graft_entry((mrtentry_ptr));                  \
        !            94:                   free((char *)(mrtentry_ptr));                            \
        !            95:             } while (0)
        !            96: #else
        !            97: #define FREE_MRTENTRY(mrtentry_ptr)                                        \
        !            98:              do {                                                          \
        !            99:                   u_int16 i;                                               \
        !           100:                   u_long *il_ptr;                                          \
        !           101:                  free((char *)((mrtentry_ptr)->prune_timers));            \
        !           102:                  for(i=0, il_ptr=(mrtentry_ptr)->prune_delay_timerids;    \
        !           103:                       i<total_interfaces; i++, il_ptr++)                   \
        !           104:                       timer_clearTimer(*il_ptr);                          \
        !           105:                  free((char *)((mrtentry_ptr)->prune_delay_timerids));    \
        !           106:                   free((char *)((mrtentry_ptr)->last_assert));             \
        !           107:                   free((char *)((mrtentry_ptr)->last_prune));              \
        !           108:                   timer_clearTimer((mrtentry_ptr)->join_delay_timerid);    \
        !           109:                  delete_pim_graft_entry((mrtentry_ptr));                  \
        !           110:                   free((char *)(mrtentry_ptr));                            \
        !           111:             } while (0)
        !           112: #endif  /* SAVE_MEMORY */
        !           113: 
        !           114: typedef struct pim_nbr_entry {
        !           115:     struct     pim_nbr_entry *next;      /* link to next neighbor          */
        !           116:     struct     pim_nbr_entry *prev;      /* link to prev neighbor          */
        !           117:     u_int32    address;                  /* neighbor address               */
        !           118:     vifi_t     vifi;                     /* which interface                */
        !           119:     u_int16    timer;                    /* for timing out neighbor        */
        !           120: } pim_nbr_entry_t;
        !           121: 
        !           122: 
        !           123: /*
        !           124:  * Used to get forwarded data related counts (number of packet, number of
        !           125:  * bits, etc)
        !           126:  */
        !           127: struct sg_count {
        !           128:     u_long pktcnt;     /*  Number of packets for (s,g) */
        !           129:     u_long bytecnt;    /*  Number of bytes for (s,g)   */
        !           130:     u_long wrong_if;   /*  Number of packets received on wrong iif for (s,g) */
        !           131: };
        !           132: 
        !           133: typedef struct mrtentry mrtentry_t;
        !           134: typedef struct pim_graft_entry {
        !           135:     struct pim_graft_entry    *next;
        !           136:     struct pim_graft_entry    *prev;
        !           137:     mrtentry_t                *mrtlink;
        !           138: } pim_graft_entry_t;
        !           139: 
        !           140: 
        !           141: typedef struct srcentry {
        !           142:     struct srcentry    *next;          /* link to next entry               */
        !           143:     struct srcentry    *prev;          /* link to prev entry               */
        !           144:     u_int32            address;        /* source or RP address             */
        !           145:     struct mrtentry    *mrtlink;       /* link to routing entries          */
        !           146:     vifi_t             incoming;       /* incoming vif                     */
        !           147:     struct pim_nbr_entry *upstream;    /* upstream router                  */
        !           148:     u_int32             metric;     /* Unicast Routing Metric to the source */
        !           149:     u_int32            preference;     /* The metric preference (for assers)*/
        !           150:     u_int16            timer;          /* Entry timer??? Delete?           */
        !           151: } srcentry_t;
        !           152: 
        !           153: 
        !           154: typedef struct grpentry {
        !           155:     struct grpentry    *next;         /* link to next entry                */
        !           156:     struct grpentry    *prev;         /* link to prev entry                */
        !           157:     u_int32            group;         /* subnet group of multicasts        */
        !           158:     struct mrtentry    *mrtlink;      /* link to (S,G) routing entries     */
        !           159: } grpentry_t;
        !           160: 
        !           161: struct mrtentry {
        !           162:     struct mrtentry    *grpnext;       /* next entry of same group         */
        !           163:     struct mrtentry    *grpprev;       /* prev entry of same group         */
        !           164:     struct mrtentry    *srcnext;       /* next entry of same source        */
        !           165:     struct mrtentry    *srcprev;       /* prev entry of same source        */
        !           166:     struct grpentry    *group;         /* pointer to group entry           */
        !           167:     struct srcentry    *source;        /* pointer to source entry (or RP)  */
        !           168:     vifi_t              incoming;       /* the iif (either toward S or RP)  */
        !           169:     vifbitmap_t         oifs;           /* The current result oifs          */
        !           170:     vifbitmap_t         pruned_oifs;    /* The pruned oifs (Prune received) */
        !           171:     vifbitmap_t                leaves;         /* Has directly connected members   */
        !           172:     struct pim_nbr_entry *upstream;    /* upstream router, needed because
        !           173:                                         * of the asserts it may be different
        !           174:                                         * than the source (or RP) upstream
        !           175:                                         * router.
        !           176:                                         */
        !           177:     u_int32             metric;         /* Metric for the upstream          */
        !           178:     u_int32            preference;     /* preference for the upstream      */
        !           179:     u_int16            *prune_timers;  /* prune timer list                 */
        !           180:     u_long              *prune_delay_timerids; /* timers for LAN prunes     */
        !           181:     u_long              join_delay_timerid; /* timer for delay joins        */
        !           182:     u_int16            flags;          /* The MRTF_* flags                 */
        !           183:     u_int16            timer;          /* entry timer                      */
        !           184:     u_int              assert_timer;
        !           185:     struct sg_count     sg_count;
        !           186:     u_long              *last_assert;   /* time for last data-driven assert */
        !           187:     u_long              *last_prune;    /* time for last data-driven prune  */
        !           188:     pim_graft_entry_t   *graft;         /* Pointer into graft entry list    */
        !           189: #ifdef RSRR
        !           190:     struct rsrr_cache   *rsrr_cache;    /* Used to save RSRR requests for
        !           191:                                          * routes change notification.
        !           192:                                          */
        !           193: #endif /* RSRR */
        !           194: };
        !           195: 
        !           196: 
        !           197: struct vif_count {
        !           198:     u_long icount;        /* Input packet count on vif            */
        !           199:     u_long ocount;        /* Output packet count on vif           */
        !           200:     u_long ibytes;        /* Input byte count on vif              */ 
        !           201:     u_long obytes;        /* Output byte count on vif             */ 
        !           202: };
        !           203: 

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