Annotation of embedaddon/pimdd/include/sunos-cc/netinet/ip_mroute.h, revision 1.1

1.1     ! misho       1: /*
        !             2:  * Definitions for IP multicast forwarding.
        !             3:  *
        !             4:  * Written by David Waitzman, BBN Labs, August 1988.
        !             5:  * Modified by Steve Deering, Stanford, February 1989.
        !             6:  * Modified by Ajit Thyagarajan, PARC, August 1993.
        !             7:  * Modified by Ajit Thyagarajan, PARC, August 1994.
        !             8:  * Modified by Ahmed Helmy, USC, September 1996.
        !             9:  *
        !            10:  * MROUTING $Revision: 1.3 $
        !            11:  */
        !            12: 
        !            13: 
        !            14: /*
        !            15:  * Multicast Routing set/getsockopt commands.
        !            16:  */
        !            17: #define MRT_INIT               100     /* initialize forwarder */
        !            18: #define MRT_DONE               101     /* shut down forwarder */
        !            19: #define MRT_ADD_VIF            102     /* create virtual interface */
        !            20: #define MRT_DEL_VIF            103     /* delete virtual interface */
        !            21: #define MRT_ADD_MFC            104     /* insert forwarding cache entry */
        !            22: #define MRT_DEL_MFC            105     /* delete forwarding cache entry */
        !            23: #define MRT_VERSION            106     /* get kernel version number */
        !            24: #define MRT_ASSERT             107     /* enable assert (wrong iif) processing */
        !            25: 
        !            26: 
        !            27: #if BSD >= 199103 
        !            28: #define GET_TIME(t)    microtime(&t)
        !            29: #elif defined(sun)
        !            30: #define GET_TIME(t)    uniqtime(&t)
        !            31: #else
        !            32: #define GET_TIME(t)    ((t) = time)
        !            33: #endif
        !            34: 
        !            35: /*
        !            36:  * Types and macros for handling bitmaps with one bit per virtual interface.
        !            37:  */
        !            38: #define MAXVIFS 32
        !            39: typedef u_long vifbitmap_t;
        !            40: typedef u_short vifi_t;                /* type of a vif index */
        !            41: #define ALL_VIFS (vifi_t)-1
        !            42: 
        !            43: #define        VIFM_SET(n, m)                  ((m) |=  (1 << (n)))
        !            44: #define        VIFM_CLR(n, m)                  ((m) &= ~(1 << (n)))
        !            45: #define        VIFM_ISSET(n, m)                ((m) &   (1 << (n)))
        !            46: #define VIFM_CLRALL(m)                 ((m) = 0x00000000)
        !            47: #define VIFM_COPY(mfrom, mto)          ((mto) = (mfrom))
        !            48: #define VIFM_SAME(m1, m2)              ((m1) == (m2))
        !            49:                                                                  
        !            50: /*
        !            51:  * Argument structure for MRT_ADD_VIF.
        !            52:  * (MRT_DEL_VIF takes a single vifi_t argument.)
        !            53:  */
        !            54: struct vifctl {
        !            55:     vifi_t         vifc_vifi;          /* the index of the vif to be added  */
        !            56:     u_char         vifc_flags;         /* VIFF_ flags defined below         */
        !            57:     u_char         vifc_threshold;     /* min ttl required to forward on vif*/
        !            58:     u_int          vifc_rate_limit;    /* max rate                          */
        !            59:     struct in_addr  vifc_lcl_addr;     /* local interface address           */
        !            60:     struct in_addr  vifc_rmt_addr;     /* remote address (tunnels only)     */
        !            61: };
        !            62: 
        !            63: #define VIFF_TUNNEL      0x1           /* vif represents a tunnel end-point */
        !            64: #define VIFF_SRCRT       0x2           /* tunnel uses IP src routing        */
        !            65: #define VIFF_REGISTER    0x4           /* vif used for register en/decap    */
        !            66: 
        !            67: 
        !            68: /*
        !            69:  * Argument structure for MRT_ADD_MFC and MRT_DEL_MFC
        !            70:  * (mfcc_tos to be added at a future point)
        !            71:  */
        !            72: struct mfcctl {
        !            73:     struct in_addr  mfcc_origin;               /* ip origin of mcasts       */
        !            74:     struct in_addr  mfcc_mcastgrp;             /* multicast group associated*/
        !            75:     vifi_t         mfcc_parent;                /* incoming vif              */
        !            76:     u_char         mfcc_ttls[MAXVIFS];         /* forwarding ttls on vifs   */
        !            77: };
        !            78: 
        !            79: /*
        !            80:  * The kernel's multicast routing statistics.
        !            81:  */
        !            82: struct mrtstat {
        !            83:     u_long     mrts_mfc_lookups;       /* # forw. cache hash table hits   */
        !            84:     u_long     mrts_mfc_misses;        /* # forw. cache hash table misses */
        !            85:     u_long     mrts_upcalls;           /* # calls to mrouted              */
        !            86:     u_long     mrts_no_route;          /* no route for packet's origin    */
        !            87:     u_long     mrts_bad_tunnel;        /* malformed tunnel options        */
        !            88:     u_long     mrts_cant_tunnel;       /* no room for tunnel options      */
        !            89:     u_long     mrts_wrong_if;          /* arrived on wrong interface      */
        !            90:     u_long     mrts_upq_ovflw;         /* upcall Q overflow               */
        !            91:     u_long     mrts_cache_cleanups;    /* # entries with no upcalls       */
        !            92:     u_long     mrts_drop_sel;          /* pkts dropped selectively        */
        !            93:     u_long     mrts_q_overflow;        /* pkts dropped - Q overflow       */
        !            94:     u_long     mrts_pkt2large;         /* pkts dropped - size > BKT SIZE  */
        !            95:     u_long     mrts_upq_sockfull;      /* upcalls dropped - socket full   */
        !            96: };
        !            97: 
        !            98: /*
        !            99:  * Argument structure used by mrouted to get src-grp pkt counts
        !           100:  */
        !           101: struct sioc_sg_req {
        !           102:     struct in_addr src;
        !           103:     struct in_addr grp;
        !           104:     u_long pktcnt;
        !           105:     u_long bytecnt;
        !           106:     u_long wrong_if;
        !           107: };
        !           108: 
        !           109: /*
        !           110:  * Argument structure used by mrouted to get vif pkt counts
        !           111:  */
        !           112: struct sioc_vif_req {
        !           113:     vifi_t vifi;               /* vif number                           */
        !           114:     u_long icount;             /* Input packet count on vif            */
        !           115:     u_long ocount;             /* Output packet count on vif           */
        !           116:     u_long ibytes;             /* Input byte count on vif              */
        !           117:     u_long obytes;             /* Output byte count on vif             */
        !           118: };
        !           119: 
        !           120: #ifdef KERNEL
        !           121: /* 
        !           122:  * Argument structure used by PIM to get the RPF neighbor and IIF info
        !           123:  * for a given source, from the unicast routing tables. 
        !           124:  * Maybe be substituted by routing sockets for the supporting systems
        !           125:  */
        !           126: struct rpfctl {
        !           127:    struct in_addr source; /* the source for which we want iif and rpfnbr */
        !           128:    struct in_addr rpfneighbor;/* next hop towards the source */
        !           129:    vifi_t iif;/* the incoming interface to reach the next hop */
        !           130: };
        !           131: 
        !           132: /*
        !           133:  * The kernel's virtual-interface structure.
        !           134:  */
        !           135: struct vif {
        !           136:     u_char             v_flags;        /* VIFF_ flags defined above         */
        !           137:     u_char             v_threshold;    /* min ttl required to forward on vif*/
        !           138:     u_int                      v_rate_limit;   /* max rate                          */
        !           139:     struct tbf                *v_tbf;          /* token bucket structure at intf.   */
        !           140:     struct in_addr     v_lcl_addr;     /* local interface address           */
        !           141:     struct in_addr     v_rmt_addr;     /* remote address (tunnels only)     */
        !           142:     struct ifnet       *v_ifp;         /* pointer to interface              */
        !           143:     u_long             v_pkt_in;       /* # pkts in on interface            */
        !           144:     u_long             v_pkt_out;      /* # pkts out on interface           */
        !           145:     u_long             v_bytes_in;     /* # bytes in on interface           */
        !           146:     u_long             v_bytes_out;    /* # bytes out on interface          */
        !           147:     struct route       v_route;        /* Cached route if this is a tunnel  */
        !           148: #ifdef RSVP_ISI
        !           149:     u_int               v_rsvp_on;      /* # RSVP listening on this vif      */
        !           150:     struct socket      *v_rsvpd;       /* # RSVPD daemon                    */
        !           151: #endif /* RSVP_ISI */
        !           152: };
        !           153: 
        !           154: /*
        !           155:  * The kernel's multicast forwarding cache entry structure 
        !           156:  * (A field for the type of service (mfc_tos) is to be added 
        !           157:  * at a future point)
        !           158:  */
        !           159: struct mfc {
        !           160:     struct in_addr  mfc_origin;                        /* ip origin of mcasts       */
        !           161:     struct in_addr  mfc_mcastgrp;              /* multicast group associated*/
        !           162:     vifi_t         mfc_parent;                 /* incoming vif              */
        !           163:     u_char         mfc_ttls[MAXVIFS];          /* forwarding ttls on vifs   */
        !           164:     u_long         mfc_pkt_cnt;                /* pkt count for src-grp     */
        !           165:     u_long         mfc_byte_cnt;               /* byte count for src-grp    */
        !           166:     u_long         mfc_wrong_if;               /* wrong if for src-grp      */
        !           167:     int                    mfc_expire;                 /* time to clean entry up    */
        !           168:     struct timeval  mfc_last_assert;           /* last time I sent an assert*/
        !           169: };
        !           170: #endif /* KERNEL */
        !           171: /*
        !           172:  * Struct used to communicate from kernel to multicast router
        !           173:  * note the convenient similarity to an IP packet
        !           174:  */
        !           175: struct igmpmsg {
        !           176:     u_long         unused1;
        !           177:     u_long         unused2;
        !           178:     u_char         im_msgtype;                 /* what type of message     */
        !           179: #define IGMPMSG_NOCACHE                1
        !           180: #define IGMPMSG_WRONGVIF       2
        !           181: #define IGMPMSG_WHOLEPKT       3               /* used for user level encap */ 
        !           182:     u_char         im_mbz;                     /* must be zero             */
        !           183:     u_char         im_vif;                     /* vif rec'd on             */
        !           184:     u_char         unused3;
        !           185:     struct in_addr  im_src, im_dst;
        !           186: };
        !           187: 
        !           188: #ifdef KERNEL
        !           189: /*
        !           190:  * Argument structure used for pkt info. while upcall is made
        !           191:  */
        !           192: struct rtdetq {
        !           193:     struct mbuf        *m;             /* A copy of the packet             */
        !           194:     struct ifnet       *ifp;           /* Interface pkt came in on         */
        !           195: #ifdef UPCALL_TIMING
        !           196:     struct timeval     t;              /* Timestamp */
        !           197: #endif /* UPCALL_TIMING */
        !           198: };
        !           199: 
        !           200: #define MFCTBLSIZ      256
        !           201: #if (MFCTBLSIZ & (MFCTBLSIZ - 1)) == 0   /* from sys:route.h */
        !           202: #define MFCHASHMOD(h)  ((h) & (MFCTBLSIZ - 1))
        !           203: #else
        !           204: #define MFCHASHMOD(h)  ((h) % MFCTBLSIZ)
        !           205: #endif
        !           206: 
        !           207: #define MAX_UPQ        4               /* max. no of pkts in upcall Q */
        !           208: 
        !           209: /*
        !           210:  * Token Bucket filter code 
        !           211:  */
        !           212: #define MAX_BKT_SIZE    10000             /* 10K bytes size            */
        !           213: #define MAXQSIZE        10                /* max # of pkts in queue    */
        !           214: 
        !           215: /*
        !           216:  * queue structure at each vif
        !           217:  */
        !           218: struct pkt_queue 
        !           219: {
        !           220:     u_long pkt_len;               /* length of packet in queue         */
        !           221:     struct mbuf *pkt_m;           /* pointer to packet mbuf    */
        !           222:     struct ip  *pkt_ip;           /* pointer to ip header      */
        !           223: };
        !           224: 
        !           225: /*
        !           226:  * the token bucket filter at each vif
        !           227:  */
        !           228: struct tbf
        !           229: {
        !           230:     u_long last_pkt_t; /* arr. time of last pkt        */
        !           231:     u_long n_tok;              /* no of tokens in bucket       */
        !           232:     u_long q_len;      /* length of queue at this vif  */
        !           233: };
        !           234: 
        !           235: #endif /* KERNEL */
        !           236: 

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