root/include/linux/mroute.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


   1 #ifndef __LINUX_MROUTE_H
   2 #define __LINUX_MROUTE_H
   3 
   4 /*
   5  *      Based on the MROUTING 3.5 defines primarily to keep
   6  *      source compatibility with BSD.
   7  *
   8  *      See the mrouted code for the original history.
   9  *
  10  */
  11 
  12 #define MRT_BASE        200
  13 #define MRT_INIT        (MRT_BASE)      /* Activate the kernel mroute code      */
  14 #define MRT_DONE        (MRT_BASE+1)    /* Shutdown the kernel mroute           */
  15 #define MRT_ADD_VIF     (MRT_BASE+2)    /* Add a virtual interface              */
  16 #define MRT_DEL_VIF     (MRT_BASE+3)    /* Delete a virtual interface           */
  17 #define MRT_ADD_MFC     (MRT_BASE+4)    /* Add a multicast forwarding entry     */
  18 #define MRT_DEL_MFC     (MRT_BASE+5)    /* Delete a multicast forwarding entry  */
  19 #define MRT_VERSION     (MRT_BASE+6)    /* Get the kernel multicast version     */
  20 #define MRT_ASSERT      (MRT_BASE+7)    /* Activate PIM assert mode             */
  21 
  22 #define SIOCGETVIFCNT   SIOCPROTOPRIVATE        /* IP protocol privates */
  23 #define SIOCGETSGCNT    (SIOCPROTOPRIVATE+1)
  24 
  25 #define MAXVIFS         32      
  26 typedef unsigned long vifbitmap_t;      /* User mode code depends on this lot */
  27 typedef unsigned short vifi_t;
  28 #define ALL_VIFS        ((vifi_t)(-1))
  29 
  30 /*
  31  *      Same idea as select
  32  */
  33  
  34 #define VIFM_SET(n,m)   ((m)|=(1<<(n)))
  35 #define VIFM_CLR(n,m)   ((m)&=~(1<<(n)))
  36 #define VIFM_ISSET(n,m) ((m)&(1<<(n)))
  37 #define VIFM_CLRALL(m)  ((m)=0)
  38 #define VIFM_COPY(mfrom,mto)    ((mto)=(mfrom))
  39 #define VIFM_SAME(m1,m2)        ((m1)==(m2))
  40 
  41 /*
  42  *      Passed by mrouted for an MRT_ADD_VIF - again we use the
  43  *      mrouted 3.6 structures for compatibility
  44  */
  45  
  46 struct vifctl {
  47         vifi_t  vifc_vifi;              /* Index of VIF */
  48         unsigned char vifc_flags;       /* VIFF_ flags */
  49         unsigned char vifc_threshold;   /* ttl limit */
  50         unsigned int vifc_rate_limit;   /* Rate limiter values (NI) */
  51         struct in_addr vifc_lcl_addr;   /* Our address */
  52         struct in_addr vifc_rmt_addr;   /* IPIP tunnel addr */
  53 };
  54 
  55 #define VIFF_TUNNEL     0x1             /* IPIP tunnel */
  56 #define VIFF_SRCRT      0x02            /* NI */
  57 
  58 /*
  59  *      Cache manipulation structures for mrouted
  60  */
  61  
  62 struct mfcctl
  63 {
  64         struct in_addr mfcc_origin;             /* Origin of mcast      */
  65         struct in_addr mfcc_mcastgrp;           /* Group in question    */
  66         vifi_t  mfcc_parent;                    /* Where it arrived     */
  67         unsigned char mfcc_ttls[MAXVIFS];       /* Where it is going    */
  68 };
  69 
  70 /* 
  71  *      Group count retrieval for mrouted
  72  */
  73  
  74 struct sioc_sg_req
  75 {
  76         struct in_addr src;
  77         struct in_addr grp;
  78         unsigned long pktcnt;
  79         unsigned long bytecnt;
  80         unsigned long wrong_if;
  81 };
  82 
  83 /*
  84  *      To get vif packet counts
  85  */
  86 
  87 struct sioc_vif_req
  88 {
  89         vifi_t  vifi;           /* Which iface */
  90         unsigned long icount;   /* In packets */
  91         unsigned long ocount;   /* Out packets */
  92         unsigned long ibytes;   /* In bytes */
  93         unsigned long obytes;   /* Out bytes */
  94 };
  95 
  96 /*
  97  *      This is the format the mroute daemon expects to see IGMP control
  98  *      data. Magically happens to be like an IP packet as per the original
  99  */
 100  
 101 struct igmpmsg
 102 {
 103         unsigned long unused1,unused2;
 104         unsigned char im_msgtype;               /* What is this */
 105         unsigned char im_mbz;                   /* Must be zero */
 106         unsigned char im_vif;                   /* Interface (this ought to be a vifi_t!) */
 107         unsigned char unused3;
 108         struct in_addr im_src,im_dst;
 109 };
 110 
 111 /*
 112  *      Thats all usermode folks
 113  */
 114 
 115 #ifdef __KERNEL__
 116 extern struct sock *mroute_socket;
 117 extern int ip_mroute_setsockopt(struct sock *, int, char *, int);
 118 extern int ip_mroute_getsockopt(struct sock *, int, char *, int *);
 119 extern int ipmr_ioctl(struct sock *sk, int cmd, unsigned long arg);
 120 extern void mroute_close(struct sock *sk);
 121 extern void ipmr_forward(struct sk_buff *skb, int is_frag);
 122 
 123 
 124 struct vif_device
 125 {
 126         struct device   *dev;                   /* Device we are using */
 127         struct route    *rt_cache;              /* Tunnel route cache */
 128         unsigned long   bytes_in,bytes_out;
 129         unsigned long   pkt_in,pkt_out;         /* Statistics                   */
 130         unsigned long   rate_limit;             /* Traffic shaping (NI)         */
 131         unsigned char   threshold;              /* TTL threshold                */
 132         unsigned short  flags;                  /* Control flags                */
 133         unsigned long   local,remote;           /* Addresses(remote for tunnels)*/
 134 };
 135 
 136 struct mfc_cache 
 137 {
 138         struct mfc_cache *next;                 /* Next entry on cache line     */
 139         __u32 mfc_mcastgrp;                     /* Group the entry belongs to   */
 140         __u32 mfc_origin;                       /* Source of packet             */
 141         vifi_t mfc_parent;                      /* Source interface             */
 142         struct timer_list mfc_timer;            /* Expiry timer                 */
 143         int mfc_flags;                          /* Flags on line                */
 144         struct sk_buff_head mfc_unresolved;     /* Unresolved buffers           */
 145         int mfc_queuelen;                       /* Unresolved buffer counter    */
 146         unsigned char mfc_ttls[MAXVIFS];        /* TTL thresholds               */
 147 };
 148 
 149 #define MFC_QUEUED              1
 150 #define MFC_RESOLVED            2
 151 
 152 
 153 #define MFC_LINES               64
 154 
 155 #ifdef __BIG_ENDIAN
 156 #define MFC_HASH(a,b)   ((((a)>>24)^((b)>>26))&(MFC_LINES-1))
 157 #else
 158 #define MFC_HASH(a,b)   (((a)^((b)>>2))&(MFC_LINES-1))
 159 #endif          
 160 
 161 #endif
 162 
 163 /*
 164  *      Pseudo messages used by mrouted
 165  */
 166 
 167 #define IGMPMSG_NOCACHE         1               /* Kernel cache fill request to mrouted */
 168 #define IGMPMSG_WRONGVIF        2               /* For PIM assert processing (unused) */
 169 
 170 #endif

/* [previous][next][first][last][top][bottom][index][help] */