Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
[linux-2.6.git] / include / linux / mroute.h
blob79aaa9fc1a15d6ed7caac2b147ae030b18da060a
1 #ifndef __LINUX_MROUTE_H
2 #define __LINUX_MROUTE_H
4 #include <linux/in.h>
5 #include <linux/pim.h>
6 #include <net/sock.h>
7 #include <uapi/linux/mroute.h>
9 #ifdef CONFIG_IP_MROUTE
10 static inline int ip_mroute_opt(int opt)
12 return (opt >= MRT_BASE) && (opt <= MRT_MAX);
14 #else
15 static inline int ip_mroute_opt(int opt)
17 return 0;
19 #endif
21 #ifdef CONFIG_IP_MROUTE
22 extern int ip_mroute_setsockopt(struct sock *, int, char __user *, unsigned int);
23 extern int ip_mroute_getsockopt(struct sock *, int, char __user *, int __user *);
24 extern int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg);
25 extern int ipmr_compat_ioctl(struct sock *sk, unsigned int cmd, void __user *arg);
26 extern int ip_mr_init(void);
27 #else
28 static inline
29 int ip_mroute_setsockopt(struct sock *sock,
30 int optname, char __user *optval, unsigned int optlen)
32 return -ENOPROTOOPT;
35 static inline
36 int ip_mroute_getsockopt(struct sock *sock,
37 int optname, char __user *optval, int __user *optlen)
39 return -ENOPROTOOPT;
42 static inline
43 int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg)
45 return -ENOIOCTLCMD;
48 static inline int ip_mr_init(void)
50 return 0;
52 #endif
54 struct vif_device {
55 struct net_device *dev; /* Device we are using */
56 unsigned long bytes_in,bytes_out;
57 unsigned long pkt_in,pkt_out; /* Statistics */
58 unsigned long rate_limit; /* Traffic shaping (NI) */
59 unsigned char threshold; /* TTL threshold */
60 unsigned short flags; /* Control flags */
61 __be32 local,remote; /* Addresses(remote for tunnels)*/
62 int link; /* Physical interface index */
65 #define VIFF_STATIC 0x8000
67 struct mfc_cache {
68 struct list_head list;
69 __be32 mfc_mcastgrp; /* Group the entry belongs to */
70 __be32 mfc_origin; /* Source of packet */
71 vifi_t mfc_parent; /* Source interface */
72 int mfc_flags; /* Flags on line */
74 union {
75 struct {
76 unsigned long expires;
77 struct sk_buff_head unresolved; /* Unresolved buffers */
78 } unres;
79 struct {
80 unsigned long last_assert;
81 int minvif;
82 int maxvif;
83 unsigned long bytes;
84 unsigned long pkt;
85 unsigned long wrong_if;
86 unsigned char ttls[MAXVIFS]; /* TTL thresholds */
87 } res;
88 } mfc_un;
89 struct rcu_head rcu;
92 #define MFC_STATIC 1
93 #define MFC_NOTIFY 2
95 #define MFC_LINES 64
97 #ifdef __BIG_ENDIAN
98 #define MFC_HASH(a,b) (((((__force u32)(__be32)a)>>24)^(((__force u32)(__be32)b)>>26))&(MFC_LINES-1))
99 #else
100 #define MFC_HASH(a,b) ((((__force u32)(__be32)a)^(((__force u32)(__be32)b)>>2))&(MFC_LINES-1))
101 #endif
103 struct rtmsg;
104 extern int ipmr_get_route(struct net *net, struct sk_buff *skb,
105 __be32 saddr, __be32 daddr,
106 struct rtmsg *rtm, int nowait);
107 #endif