OpenCores
URL https://opencores.org/ocsvn/or1k_old/or1k_old/trunk

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [rc203soc/] [sw/] [uClinux/] [include/] [linux/] [mroute.h] - Blame information for rev 1782

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1633 jcastillo
#ifndef __LINUX_MROUTE_H
2
#define __LINUX_MROUTE_H
3
 
4
#include <linux/sockios.h>
5
#include <linux/in.h>
6
 
7
/*
8
 *      Based on the MROUTING 3.5 defines primarily to keep
9
 *      source compatibility with BSD.
10
 *
11
 *      See the mrouted code for the original history.
12
 *
13
 */
14
 
15
#define MRT_BASE        200
16
#define MRT_INIT        (MRT_BASE)      /* Activate the kernel mroute code      */
17
#define MRT_DONE        (MRT_BASE+1)    /* Shutdown the kernel mroute           */
18
#define MRT_ADD_VIF     (MRT_BASE+2)    /* Add a virtual interface              */
19
#define MRT_DEL_VIF     (MRT_BASE+3)    /* Delete a virtual interface           */
20
#define MRT_ADD_MFC     (MRT_BASE+4)    /* Add a multicast forwarding entry     */
21
#define MRT_DEL_MFC     (MRT_BASE+5)    /* Delete a multicast forwarding entry  */
22
#define MRT_VERSION     (MRT_BASE+6)    /* Get the kernel multicast version     */
23
#define MRT_ASSERT      (MRT_BASE+7)    /* Activate PIM assert mode             */
24
 
25
#define SIOCGETVIFCNT   SIOCPROTOPRIVATE        /* IP protocol privates */
26
#define SIOCGETSGCNT    (SIOCPROTOPRIVATE+1)
27
 
28
#define MAXVIFS         32      
29
typedef unsigned long vifbitmap_t;      /* User mode code depends on this lot */
30
typedef unsigned short vifi_t;
31
#define ALL_VIFS        ((vifi_t)(-1))
32
 
33
/*
34
 *      Same idea as select
35
 */
36
 
37
#define VIFM_SET(n,m)   ((m)|=(1<<(n)))
38
#define VIFM_CLR(n,m)   ((m)&=~(1<<(n)))
39
#define VIFM_ISSET(n,m) ((m)&(1<<(n)))
40
#define VIFM_CLRALL(m)  ((m)=0)
41
#define VIFM_COPY(mfrom,mto)    ((mto)=(mfrom))
42
#define VIFM_SAME(m1,m2)        ((m1)==(m2))
43
 
44
/*
45
 *      Passed by mrouted for an MRT_ADD_VIF - again we use the
46
 *      mrouted 3.6 structures for compatibility
47
 */
48
 
49
struct vifctl {
50
        vifi_t  vifc_vifi;              /* Index of VIF */
51
        unsigned char vifc_flags;       /* VIFF_ flags */
52
        unsigned char vifc_threshold;   /* ttl limit */
53
        unsigned int vifc_rate_limit;   /* Rate limiter values (NI) */
54
        struct in_addr vifc_lcl_addr;   /* Our address */
55
        struct in_addr vifc_rmt_addr;   /* IPIP tunnel addr */
56
};
57
 
58
#define VIFF_TUNNEL     0x1             /* IPIP tunnel */
59
#define VIFF_SRCRT      0x02            /* NI */
60
 
61
/*
62
 *      Cache manipulation structures for mrouted
63
 */
64
 
65
struct mfcctl
66
{
67
        struct in_addr mfcc_origin;             /* Origin of mcast      */
68
        struct in_addr mfcc_mcastgrp;           /* Group in question    */
69
        vifi_t  mfcc_parent;                    /* Where it arrived     */
70
        unsigned char mfcc_ttls[MAXVIFS];       /* Where it is going    */
71
};
72
 
73
/*
74
 *      Group count retrieval for mrouted
75
 */
76
 
77
struct sioc_sg_req
78
{
79
        struct in_addr src;
80
        struct in_addr grp;
81
        unsigned long pktcnt;
82
        unsigned long bytecnt;
83
        unsigned long wrong_if;
84
};
85
 
86
/*
87
 *      To get vif packet counts
88
 */
89
 
90
struct sioc_vif_req
91
{
92
        vifi_t  vifi;           /* Which iface */
93
        unsigned long icount;   /* In packets */
94
        unsigned long ocount;   /* Out packets */
95
        unsigned long ibytes;   /* In bytes */
96
        unsigned long obytes;   /* Out bytes */
97
};
98
 
99
/*
100
 *      This is the format the mroute daemon expects to see IGMP control
101
 *      data. Magically happens to be like an IP packet as per the original
102
 */
103
 
104
struct igmpmsg
105
{
106
        unsigned long unused1,unused2;
107
        unsigned char im_msgtype;               /* What is this */
108
        unsigned char im_mbz;                   /* Must be zero */
109
        unsigned char im_vif;                   /* Interface (this ought to be a vifi_t!) */
110
        unsigned char unused3;
111
        struct in_addr im_src,im_dst;
112
};
113
 
114
/*
115
 *      That's all usermode folks
116
 */
117
 
118
#ifdef __KERNEL__
119
extern struct sock *mroute_socket;
120
extern int ip_mroute_setsockopt(struct sock *, int, char *, int);
121
extern int ip_mroute_getsockopt(struct sock *, int, char *, int *);
122
extern int ipmr_ioctl(struct sock *sk, int cmd, unsigned long arg);
123
extern void mroute_close(struct sock *sk);
124
extern void ipmr_forward(struct sk_buff *skb, int is_frag);
125
 
126
 
127
struct vif_device
128
{
129
        struct device   *dev;                   /* Device we are using */
130
        struct route    *rt_cache;              /* Tunnel route cache */
131
        unsigned long   bytes_in,bytes_out;
132
        unsigned long   pkt_in,pkt_out;         /* Statistics                   */
133
        unsigned long   rate_limit;             /* Traffic shaping (NI)         */
134
        unsigned char   threshold;              /* TTL threshold                */
135
        unsigned short  flags;                  /* Control flags                */
136
        unsigned long   local,remote;           /* Addresses(remote for tunnels)*/
137
};
138
 
139
struct mfc_cache
140
{
141
        struct mfc_cache *next;                 /* Next entry on cache line     */
142
        __u32 mfc_mcastgrp;                     /* Group the entry belongs to   */
143
        __u32 mfc_origin;                       /* Source of packet             */
144
        vifi_t mfc_parent;                      /* Source interface             */
145
        struct timer_list mfc_timer;            /* Expiry timer                 */
146
        int mfc_flags;                          /* Flags on line                */
147
        struct sk_buff_head mfc_unresolved;     /* Unresolved buffers           */
148
        int mfc_queuelen;                       /* Unresolved buffer counter    */
149
        unsigned char mfc_ttls[MAXVIFS];        /* TTL thresholds               */
150
        unsigned long mfc_packets;              /* Packets on this entry        */
151
        unsigned long mfc_bytes;                /* Bytes on this entry          */
152
};
153
 
154
#define MFC_QUEUED              1
155
#define MFC_RESOLVED            2
156
 
157
 
158
#define MFC_LINES               64
159
 
160
#ifdef __BIG_ENDIAN
161
#define MFC_HASH(a,b)   ((((a)>>24)^((b)>>26))&(MFC_LINES-1))
162
#else
163
#define MFC_HASH(a,b)   (((a)^((b)>>2))&(MFC_LINES-1))
164
#endif          
165
 
166
#endif
167
 
168
/*
169
 *      Pseudo messages used by mrouted
170
 */
171
 
172
#define IGMPMSG_NOCACHE         1               /* Kernel cache fill request to mrouted */
173
#define IGMPMSG_WRONGVIF        2               /* For PIM assert processing (unused) */
174
 
175
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.