1607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells#ifndef _UAPI__LINUX_MROUTE6_H
2607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells#define _UAPI__LINUX_MROUTE6_H
3607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells
4607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells#include <linux/types.h>
5607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells#include <linux/sockios.h>
6607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells
7607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells/*
8607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells *	Based on the MROUTING 3.5 defines primarily to keep
9607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells *	source compatibility with BSD.
10607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells *
11607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells *	See the pim6sd code for the original history.
12607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells *
13607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells *      Protocol Independent Multicast (PIM) data structures included
14607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells *      Carlos Picoto (cap@di.fc.ul.pt)
15607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells *
16607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells */
17607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells
18607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells#define MRT6_BASE	200
19607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells#define MRT6_INIT	(MRT6_BASE)	/* Activate the kernel mroute code 	*/
20607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells#define MRT6_DONE	(MRT6_BASE+1)	/* Shutdown the kernel mroute		*/
21607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells#define MRT6_ADD_MIF	(MRT6_BASE+2)	/* Add a virtual interface		*/
22607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells#define MRT6_DEL_MIF	(MRT6_BASE+3)	/* Delete a virtual interface		*/
23607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells#define MRT6_ADD_MFC	(MRT6_BASE+4)	/* Add a multicast forwarding entry	*/
24607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells#define MRT6_DEL_MFC	(MRT6_BASE+5)	/* Delete a multicast forwarding entry	*/
25607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells#define MRT6_VERSION	(MRT6_BASE+6)	/* Get the kernel multicast version	*/
26607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells#define MRT6_ASSERT	(MRT6_BASE+7)	/* Activate PIM assert mode		*/
27607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells#define MRT6_PIM	(MRT6_BASE+8)	/* enable PIM code			*/
28607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells#define MRT6_TABLE	(MRT6_BASE+9)	/* Specify mroute table ID		*/
29660b26dc1a8aeb33c2a2246ebf1b3684449a74b7Nicolas Dichtel#define MRT6_ADD_MFC_PROXY	(MRT6_BASE+10)	/* Add a (*,*|G) mfc entry	*/
30660b26dc1a8aeb33c2a2246ebf1b3684449a74b7Nicolas Dichtel#define MRT6_DEL_MFC_PROXY	(MRT6_BASE+11)	/* Del a (*,*|G) mfc entry	*/
31660b26dc1a8aeb33c2a2246ebf1b3684449a74b7Nicolas Dichtel#define MRT6_MAX	(MRT6_BASE+11)
32607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells
33607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells#define SIOCGETMIFCNT_IN6	SIOCPROTOPRIVATE	/* IP protocol privates */
34607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells#define SIOCGETSGCNT_IN6	(SIOCPROTOPRIVATE+1)
35607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells#define SIOCGETRPF	(SIOCPROTOPRIVATE+2)
36607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells
37607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells#define MAXMIFS		32
38607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howellstypedef unsigned long mifbitmap_t;	/* User mode code depends on this lot */
39607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howellstypedef unsigned short mifi_t;
40607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells#define ALL_MIFS	((mifi_t)(-1))
41607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells
42607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells#ifndef IF_SETSIZE
43607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells#define IF_SETSIZE	256
44607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells#endif
45607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells
46607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howellstypedef	__u32		if_mask;
47607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells#define NIFBITS (sizeof(if_mask) * 8)        /* bits per mask */
48607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells
49607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells#if !defined(__KERNEL__)
50607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells#if !defined(DIV_ROUND_UP)
51607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells#define	DIV_ROUND_UP(x,y)	(((x) + ((y) - 1)) / (y))
52607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells#endif
53607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells#endif
54607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells
55607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howellstypedef struct if_set {
56607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells	if_mask ifs_bits[DIV_ROUND_UP(IF_SETSIZE, NIFBITS)];
57607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells} if_set;
58607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells
59607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells#define IF_SET(n, p)    ((p)->ifs_bits[(n)/NIFBITS] |= (1 << ((n) % NIFBITS)))
60607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells#define IF_CLR(n, p)    ((p)->ifs_bits[(n)/NIFBITS] &= ~(1 << ((n) % NIFBITS)))
61607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells#define IF_ISSET(n, p)  ((p)->ifs_bits[(n)/NIFBITS] & (1 << ((n) % NIFBITS)))
62607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells#define IF_COPY(f, t)   bcopy(f, t, sizeof(*(f)))
63607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells#define IF_ZERO(p)      bzero(p, sizeof(*(p)))
64607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells
65607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells/*
66607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells *	Passed by mrouted for an MRT_ADD_MIF - again we use the
67607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells *	mrouted 3.6 structures for compatibility
68607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells */
69607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells
70607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howellsstruct mif6ctl {
71607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells	mifi_t	mif6c_mifi;		/* Index of MIF */
72607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells	unsigned char mif6c_flags;	/* MIFF_ flags */
73607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells	unsigned char vifc_threshold;	/* ttl limit */
74607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells	__u16	 mif6c_pifi;		/* the index of the physical IF */
75607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells	unsigned int vifc_rate_limit;	/* Rate limiter values (NI) */
76607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells};
77607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells
78607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells#define MIFF_REGISTER	0x1	/* register vif	*/
79607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells
80607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells/*
81607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells *	Cache manipulation structures for mrouted and PIMd
82607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells */
83607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells
84607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howellsstruct mf6cctl {
85607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells	struct sockaddr_in6 mf6cc_origin;		/* Origin of mcast	*/
86607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells	struct sockaddr_in6 mf6cc_mcastgrp;		/* Group in question	*/
87607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells	mifi_t	mf6cc_parent;			/* Where it arrived	*/
88607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells	struct if_set mf6cc_ifset;		/* Where it is going */
89607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells};
90607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells
91607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells/*
92607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells *	Group count retrieval for pim6sd
93607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells */
94607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells
95607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howellsstruct sioc_sg_req6 {
96607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells	struct sockaddr_in6 src;
97607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells	struct sockaddr_in6 grp;
98607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells	unsigned long pktcnt;
99607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells	unsigned long bytecnt;
100607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells	unsigned long wrong_if;
101607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells};
102607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells
103607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells/*
104607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells *	To get vif packet counts
105607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells */
106607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells
107607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howellsstruct sioc_mif_req6 {
108607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells	mifi_t	mifi;		/* Which iface */
109607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells	unsigned long icount;	/* In packets */
110607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells	unsigned long ocount;	/* Out packets */
111607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells	unsigned long ibytes;	/* In bytes */
112607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells	unsigned long obytes;	/* Out bytes */
113607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells};
114607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells
115607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells/*
116607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells *	That's all usermode folks
117607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells */
118607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells
119607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells
120607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells
121607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells/*
122607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells * Structure used to communicate from kernel to multicast router.
123607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells * We'll overlay the structure onto an MLD header (not an IPv6 heder like igmpmsg{}
124607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells * used for IPv4 implementation). This is because this structure will be passed via an
125607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells * IPv6 raw socket, on which an application will only receiver the payload i.e the data after
126607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells * the IPv6 header and all the extension headers. (See section 3 of RFC 3542)
127607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells */
128607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells
129607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howellsstruct mrt6msg {
130607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells#define MRT6MSG_NOCACHE		1
131607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells#define MRT6MSG_WRONGMIF	2
132607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells#define MRT6MSG_WHOLEPKT	3		/* used for use level encap */
133607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells	__u8		im6_mbz;		/* must be zero		   */
134607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells	__u8		im6_msgtype;		/* what type of message    */
135607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells	__u16		im6_mif;		/* mif rec'd on		   */
136607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells	__u32		im6_pad;		/* padding for 64 bit arch */
137607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells	struct in6_addr	im6_src, im6_dst;
138607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells};
139607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells
140607ca46e97a1b6594b29647d98a32d545c24bdffDavid Howells#endif /* _UAPI__LINUX_MROUTE6_H */
141