Dr Andrew Scott G7VAV

My photo
 
June 2025
Mo Tu We Th Fr Sa Su
26 27 28 29 30 31 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 1 2 3 4 5 6


mroute.h
001: #ifndef __LINUX_MROUTE_H
002: #define __LINUX_MROUTE_H
003: 
004: #include <linux/sockios.h>
005: #include <linux/types.h>
006: 
007: /*
008:  *      Based on the MROUTING 3.5 defines primarily to keep
009:  *      source compatibility with BSD.
010:  *
011:  *      See the mrouted code for the original history.
012:  *
013:  *      Protocol Independent Multicast (PIM) data structures included
014:  *      Carlos Picoto (cap@di.fc.ul.pt)
015:  *
016:  */
017: 
018: #define MRT_BASE        200
019: #define MRT_INIT        (MRT_BASE)      /* Activate the kernel mroute code      */
020: #define MRT_DONE        (MRT_BASE+1)    /* Shutdown the kernel mroute           */
021: #define MRT_ADD_VIF     (MRT_BASE+2)    /* Add a virtual interface              */
022: #define MRT_DEL_VIF     (MRT_BASE+3)    /* Delete a virtual interface           */
023: #define MRT_ADD_MFC     (MRT_BASE+4)    /* Add a multicast forwarding entry     */
024: #define MRT_DEL_MFC     (MRT_BASE+5)    /* Delete a multicast forwarding entry  */
025: #define MRT_VERSION     (MRT_BASE+6)    /* Get the kernel multicast version     */
026: #define MRT_ASSERT      (MRT_BASE+7)    /* Activate PIM assert mode             */
027: #define MRT_PIM         (MRT_BASE+8)    /* enable PIM code                      */
028: #define MRT_TABLE       (MRT_BASE+9)    /* Specify mroute table ID              */
029: 
030: #define SIOCGETVIFCNT   SIOCPROTOPRIVATE        /* IP protocol privates */
031: #define SIOCGETSGCNT    (SIOCPROTOPRIVATE+1)
032: #define SIOCGETRPF      (SIOCPROTOPRIVATE+2)
033: 
034: #define MAXVIFS         32      
035: typedef unsigned long vifbitmap_t;      /* User mode code depends on this lot */
036: typedef unsigned short vifi_t;
037: #define ALL_VIFS        ((vifi_t)(-1))
038: 
039: /*
040:  *      Same idea as select
041:  */
042:  
043: #define VIFM_SET(n,m)   ((m)|=(1<<(n)))
044: #define VIFM_CLR(n,m)   ((m)&=~(1<<(n)))
045: #define VIFM_ISSET(n,m) ((m)&(1<<(n)))
046: #define VIFM_CLRALL(m)  ((m)=0)
047: #define VIFM_COPY(mfrom,mto)    ((mto)=(mfrom))
048: #define VIFM_SAME(m1,m2)        ((m1)==(m2))
049: 
050: /*
051:  *      Passed by mrouted for an MRT_ADD_VIF - again we use the
052:  *      mrouted 3.6 structures for compatibility
053:  */
054:  
055: struct vifctl {
056:         vifi_t  vifc_vifi;              /* Index of VIF */
057:         unsigned char vifc_flags;       /* VIFF_ flags */
058:         unsigned char vifc_threshold;   /* ttl limit */
059:         unsigned int vifc_rate_limit;   /* Rate limiter values (NI) */
060:         union {
061:                 struct in_addr vifc_lcl_addr;     /* Local interface address */
062:                 int            vifc_lcl_ifindex;  /* Local interface index   */
063:         };
064:         struct in_addr vifc_rmt_addr;   /* IPIP tunnel addr */
065: };
066: 
067: #define VIFF_TUNNEL             0x1     /* IPIP tunnel */
068: #define VIFF_SRCRT              0x2     /* NI */
069: #define VIFF_REGISTER           0x4     /* register vif */
070: #define VIFF_USE_IFINDEX        0x8     /* use vifc_lcl_ifindex instead of
071:                                            vifc_lcl_addr to find an interface */
072: 
073: /*
074:  *      Cache manipulation structures for mrouted and PIMd
075:  */
076:  
077: struct mfcctl {
078:         struct in_addr mfcc_origin;             /* Origin of mcast      */
079:         struct in_addr mfcc_mcastgrp;           /* Group in question    */
080:         vifi_t  mfcc_parent;                    /* Where it arrived     */
081:         unsigned char mfcc_ttls[MAXVIFS];       /* Where it is going    */
082:         unsigned int mfcc_pkt_cnt;              /* pkt count for src-grp */
083:         unsigned int mfcc_byte_cnt;
084:         unsigned int mfcc_wrong_if;
085:         int          mfcc_expire;
086: };
087: 
088: /* 
089:  *      Group count retrieval for mrouted
090:  */
091:  
092: struct sioc_sg_req {
093:         struct in_addr src;
094:         struct in_addr grp;
095:         unsigned long pktcnt;
096:         unsigned long bytecnt;
097:         unsigned long wrong_if;
098: };
099: 
100: /*
101:  *      To get vif packet counts
102:  */
103: 
104: struct sioc_vif_req {
105:         vifi_t  vifi;           /* Which iface */
106:         unsigned long icount;   /* In packets */
107:         unsigned long ocount;   /* Out packets */
108:         unsigned long ibytes;   /* In bytes */
109:         unsigned long obytes;   /* Out bytes */
110: };
111: 
112: /*
113:  *      This is the format the mroute daemon expects to see IGMP control
114:  *      data. Magically happens to be like an IP packet as per the original
115:  */
116:  
117: struct igmpmsg {
118:         __u32 unused1,unused2;
119:         unsigned char im_msgtype;               /* What is this */
120:         unsigned char im_mbz;                   /* Must be zero */
121:         unsigned char im_vif;                   /* Interface (this ought to be a vifi_t!) */
122:         unsigned char unused3;
123:         struct in_addr im_src,im_dst;
124: };
125: 
126: /*
127:  *      That's all usermode folks
128:  */
129: 
130: 
131: 
132: #define MFC_ASSERT_THRESH (3*HZ)                /* Maximal freq. of asserts */
133: 
134: /*
135:  *      Pseudo messages used by mrouted
136:  */
137: 
138: #define IGMPMSG_NOCACHE         1               /* Kern cache fill request to mrouted */
139: #define IGMPMSG_WRONGVIF        2               /* For PIM assert processing (unused) */
140: #define IGMPMSG_WHOLEPKT        3               /* For PIM Register processing */
141: 
142: 
143: #endif
144: 


for client (none)
© Andrew Scott 2006 - 2025,
All Rights Reserved
http://www.andrew-scott.uk/
Andrew Scott
http://www.andrew-scott.co.uk/