File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / pimd / include / linux / netinet / mroute.h
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Mon Jun 12 07:59:38 2017 UTC (7 years, 1 month ago) by misho
Branches: pimd, MAIN
CVS tags: v2_3_2, HEAD
pimd 2.3.2

    1: #ifndef __LINUX_MROUTE_H
    2: #define __LINUX_MROUTE_H
    3: 
    4: #include <linux/sockios.h>
    5: #include <netinet/in-my.h>
    6: 
    7: 
    8: /*
    9:  *	Based on the MROUTING 3.5 defines primarily to keep
   10:  *	source compatibility with BSD.
   11:  *
   12:  *	See the mrouted code for the original history.
   13:  *
   14:  *      Protocol Independent Multicast (PIM) data structures included
   15:  *      Carlos Picoto (cap@di.fc.ul.pt)
   16:  *
   17:  */
   18: 
   19: #define MRT_BASE	200
   20: #define MRT_INIT	(MRT_BASE)	/* Activate the kernel mroute code 	*/
   21: #define MRT_DONE	(MRT_BASE+1)	/* Shutdown the kernel mroute		*/
   22: #define MRT_ADD_VIF	(MRT_BASE+2)	/* Add a virtual interface		*/
   23: #define MRT_DEL_VIF	(MRT_BASE+3)	/* Delete a virtual interface		*/
   24: #define MRT_ADD_MFC	(MRT_BASE+4)	/* Add a multicast forwarding entry	*/
   25: #define MRT_DEL_MFC	(MRT_BASE+5)	/* Delete a multicast forwarding entry	*/
   26: #define MRT_VERSION	(MRT_BASE+6)	/* Get the kernel multicast version	*/
   27: #define MRT_ASSERT	(MRT_BASE+7)	/* Activate PIM assert mode		*/
   28: #define MRT_PIM		(MRT_BASE+8)	/* enable PIM code	*/
   29: 
   30: #define SIOCGETVIFCNT	SIOCPROTOPRIVATE	/* IP protocol privates */
   31: #define SIOCGETSGCNT	(SIOCPROTOPRIVATE+1)
   32: #define SIOCGETRPF	(SIOCPROTOPRIVATE+2)
   33: 
   34: #ifdef CUSTOM_MAX_VIFS
   35: #define MAXVIFS		CUSTOM_MAX_VIFS /* MUST match kernel MAXVIFS! */
   36: #else
   37: #define MAXVIFS		32	
   38: #endif
   39: typedef unsigned long vifbitmap_t;	/* User mode code depends on this lot */
   40: typedef unsigned short vifi_t;
   41: #define ALL_VIFS	((vifi_t)(-1))
   42: 
   43: /*
   44:  *	Same idea as select
   45:  */
   46:  
   47: #define VIFM_SET(n,m)	((m)|=(1<<(n)))
   48: #define VIFM_CLR(n,m)	((m)&=~(1<<(n)))
   49: #define VIFM_ISSET(n,m)	((m)&(1<<(n)))
   50: #define VIFM_CLRALL(m)	((m)=0)
   51: #define VIFM_COPY(mfrom,mto)	((mto)=(mfrom))
   52: #define VIFM_SAME(m1,m2)	((m1)==(m2))
   53: 
   54: /*
   55:  *	Passed by mrouted for an MRT_ADD_VIF - again we use the
   56:  *	mrouted 3.6 structures for compatibility
   57:  */
   58:  
   59: struct vifctl {
   60: 	vifi_t	vifc_vifi;		/* Index of VIF */
   61: 	unsigned char vifc_flags;	/* VIFF_ flags */
   62: 	unsigned char vifc_threshold;	/* ttl limit */
   63: 	unsigned int vifc_rate_limit;	/* Rate limiter values (NI) */
   64: 	struct in_addr vifc_lcl_addr;	/* Our address */
   65: 	struct in_addr vifc_rmt_addr;	/* IPIP tunnel addr */
   66: };
   67: 
   68: #define VIFF_TUNNEL	0x1	/* IPIP tunnel */
   69: #define VIFF_SRCRT	0x2	/* NI */
   70: #define VIFF_REGISTER	0x4	/* register vif	*/
   71: 
   72: /*
   73:  *	Cache manipulation structures for mrouted and PIMd
   74:  */
   75:  
   76: struct mfcctl
   77: {
   78: 	struct in_addr mfcc_origin;		/* Origin of mcast	*/
   79: 	struct in_addr mfcc_mcastgrp;		/* Group in question	*/
   80: 	vifi_t	mfcc_parent;			/* Where it arrived	*/
   81: 	unsigned char mfcc_ttls[MAXVIFS];	/* Where it is going	*/
   82: 	unsigned int mfcc_pkt_cnt;		/* pkt count for src-grp */
   83: 	unsigned int mfcc_byte_cnt;
   84: 	unsigned int mfcc_wrong_if;
   85: 	int	     mfcc_expire;
   86: };
   87: 
   88: /* 
   89:  *	Group count retrieval for mrouted
   90:  */
   91:  
   92: struct sioc_sg_req
   93: {
   94: 	struct in_addr src;
   95: 	struct in_addr grp;
   96: 	unsigned long pktcnt;
   97: 	unsigned long bytecnt;
   98: 	unsigned long wrong_if;
   99: };
  100: 
  101: /*
  102:  *	To get vif packet counts
  103:  */
  104: 
  105: struct sioc_vif_req
  106: {
  107: 	vifi_t	vifi;		/* Which iface */
  108: 	unsigned long icount;	/* In packets */
  109: 	unsigned long ocount;	/* Out packets */
  110: 	unsigned long ibytes;	/* In bytes */
  111: 	unsigned long obytes;	/* Out bytes */
  112: };
  113: 
  114: /*
  115:  *	This is the format the mroute daemon expects to see IGMP control
  116:  *	data. Magically happens to be like an IP packet as per the original
  117:  */
  118:  
  119: struct igmpmsg
  120: {
  121: 	uint32_t unused1,unused2;
  122: 	unsigned char im_msgtype;		/* What is this */
  123: 	unsigned char im_mbz;			/* Must be zero */
  124: 	unsigned char im_vif;			/* Interface (this ought to be a vifi_t!) */
  125: 	unsigned char unused3;
  126: 	struct in_addr im_src,im_dst;
  127: };
  128: 
  129: /*
  130:  *	That's all usermode folks
  131:  */
  132: 
  133: 
  134: 
  135: #define MFC_ASSERT_THRESH (3*HZ)		/* Maximal freq. of asserts */
  136: 
  137: /*
  138:  *	Pseudo messages used by mrouted
  139:  */
  140: 
  141: #define IGMPMSG_NOCACHE		1		/* Kern cache fill request to mrouted */
  142: #define IGMPMSG_WRONGVIF	2		/* For PIM assert processing (unused) */
  143: #define IGMPMSG_WHOLEPKT	3		/* For PIM Register processing */
  144: 
  145: 
  146: #endif

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