Annotation of embedaddon/pimdd/include/netbsd/netinet/ip_mroute.h, revision 1.1.1.1

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

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