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

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