Annotation of embedaddon/pimd/include/sunos-cc/netinet/ip_mroute.h, revision 1.1.1.1
1.1 misho 1: /*
2: * Definitions for IP multicast forwarding.
3: *
4: * Written by David Waitzman, BBN Labs, August 1988.
5: * Modified by Steve Deering, Stanford, February 1989.
6: * Modified by Ajit Thyagarajan, PARC, August 1993.
7: * Modified by Ajit Thyagarajan, PARC, August 1994.
8: * Modified by Ahmed Helmy, USC, September 1996.
9: *
10: * MROUTING $Revision: 3.5 $
11: */
12:
13:
14: /*
15: * Multicast Routing set/getsockopt commands.
16: */
17: #define MRT_INIT 100 /* initialize forwarder */
18: #define MRT_DONE 101 /* shut down forwarder */
19: #define MRT_ADD_VIF 102 /* create virtual interface */
20: #define MRT_DEL_VIF 103 /* delete virtual interface */
21: #define MRT_ADD_MFC 104 /* insert forwarding cache entry */
22: #define MRT_DEL_MFC 105 /* delete forwarding cache entry */
23: #define MRT_VERSION 106 /* get kernel version number */
24: #define MRT_ASSERT 107 /* enable assert (wrong iif) processing */
25:
26:
27: #if BSD >= 199103
28: #define GET_TIME(t) microtime(&t)
29: #elif defined(sun)
30: #define GET_TIME(t) uniqtime(&t)
31: #else
32: #define GET_TIME(t) ((t) = time)
33: #endif
34:
35: /*
36: * Types and macros for handling bitmaps with one bit per virtual interface.
37: */
38: #define MAXVIFS 32
39: typedef u_long vifbitmap_t;
40: typedef u_short vifi_t; /* type of a vif index */
41: #define ALL_VIFS (vifi_t)-1
42:
43: #define VIFM_SET(n, m) ((m) |= (1 << (n)))
44: #define VIFM_CLR(n, m) ((m) &= ~(1 << (n)))
45: #define VIFM_ISSET(n, m) ((m) & (1 << (n)))
46: #define VIFM_CLRALL(m) ((m) = 0x00000000)
47: #define VIFM_COPY(mfrom, mto) ((mto) = (mfrom))
48: #define VIFM_SAME(m1, m2) ((m1) == (m2))
49:
50: /*
51: * Argument structure for MRT_ADD_VIF.
52: * (MRT_DEL_VIF takes a single vifi_t argument.)
53: */
54: struct vifctl {
55: vifi_t vifc_vifi; /* the index of the vif to be added */
56: u_char vifc_flags; /* VIFF_ flags defined below */
57: u_char vifc_threshold; /* min ttl required to forward on vif*/
58: u_int vifc_rate_limit; /* max rate */
59: struct in_addr vifc_lcl_addr; /* local interface address */
60: struct in_addr vifc_rmt_addr; /* remote address (tunnels only) */
61: };
62:
63: #define VIFF_TUNNEL 0x1 /* vif represents a tunnel end-point */
64: #define VIFF_SRCRT 0x2 /* tunnel uses IP src routing */
65: #define VIFF_REGISTER 0x4 /* vif used for register en/decap */
66: #ifdef PIM_REG_KERNEL_ENCAP
67: #define VIFF_REGISTER_KERNEL_ENCAP 0x8 /* vif register with kernel encap */
68: #endif
69:
70:
71:
72: /*
73: * Argument structure for MRT_ADD_MFC and MRT_DEL_MFC
74: * (mfcc_tos to be added at a future point)
75: */
76: struct mfcctl {
77: struct in_addr mfcc_origin; /* ip origin of mcasts */
78: struct in_addr mfcc_mcastgrp; /* multicast group associated*/
79: vifi_t mfcc_parent; /* incoming vif */
80: u_char mfcc_ttls[MAXVIFS]; /* forwarding ttls on vifs */
81: #ifdef PIM_REG_KERNEL_ENCAP
82: struct in_addr mfcc_rp_addr; /* The RP address for encap. */
83: #endif
84: };
85:
86: /*
87: * The kernel's multicast routing statistics.
88: */
89: struct mrtstat {
90: u_long mrts_mfc_lookups; /* # forw. cache hash table hits */
91: u_long mrts_mfc_misses; /* # forw. cache hash table misses */
92: u_long mrts_upcalls; /* # calls to mrouted */
93: u_long mrts_no_route; /* no route for packet's origin */
94: u_long mrts_bad_tunnel; /* malformed tunnel options */
95: u_long mrts_cant_tunnel; /* no room for tunnel options */
96: u_long mrts_wrong_if; /* arrived on wrong interface */
97: u_long mrts_upq_ovflw; /* upcall Q overflow */
98: u_long mrts_cache_cleanups; /* # entries with no upcalls */
99: u_long mrts_drop_sel; /* pkts dropped selectively */
100: u_long mrts_q_overflow; /* pkts dropped - Q overflow */
101: u_long mrts_pkt2large; /* pkts dropped - size > BKT SIZE */
102: u_long mrts_upq_sockfull; /* upcalls dropped - socket full */
103: };
104:
105: /*
106: * Argument structure used by mrouted to get src-grp pkt counts
107: */
108: struct sioc_sg_req {
109: struct in_addr src;
110: struct in_addr grp;
111: u_long pktcnt;
112: u_long bytecnt;
113: u_long wrong_if;
114: };
115:
116: /*
117: * Argument structure used by mrouted to get vif pkt counts
118: */
119: struct sioc_vif_req {
120: vifi_t vifi; /* vif number */
121: u_long icount; /* Input packet count on vif */
122: u_long ocount; /* Output packet count on vif */
123: u_long ibytes; /* Input byte count on vif */
124: u_long obytes; /* Output byte count on vif */
125: };
126:
127: #ifdef KERNEL
128: /*
129: * Argument structure used by PIM to get the RPF neighbor and IIF info
130: * for a given source, from the unicast routing tables.
131: * Maybe be substituted by routing sockets for the supporting systems
132: */
133: struct rpfctl {
134: struct in_addr source; /* the source for which we want iif and rpfnbr */
135: struct in_addr rpfneighbor;/* next hop towards the source */
136: vifi_t iif;/* the incoming interface to reach the next hop */
137: };
138:
139: /*
140: * The kernel's virtual-interface structure.
141: */
142: struct vif {
143: u_char v_flags; /* VIFF_ flags defined above */
144: u_char v_threshold; /* min ttl required to forward on vif*/
145: u_int v_rate_limit; /* max rate */
146: struct tbf *v_tbf; /* token bucket structure at intf. */
147: struct in_addr v_lcl_addr; /* local interface address */
148: struct in_addr v_rmt_addr; /* remote address (tunnels only) */
149: struct ifnet *v_ifp; /* pointer to interface */
150: u_long v_pkt_in; /* # pkts in on interface */
151: u_long v_pkt_out; /* # pkts out on interface */
152: u_long v_bytes_in; /* # bytes in on interface */
153: u_long v_bytes_out; /* # bytes out on interface */
154: struct route v_route; /* Cached route if this is a tunnel */
155: #ifdef RSVP_ISI
156: u_int v_rsvp_on; /* # RSVP listening on this vif */
157: struct socket *v_rsvpd; /* # RSVPD daemon */
158: #endif /* RSVP_ISI */
159: };
160:
161: /*
162: * The kernel's multicast forwarding cache entry structure
163: * (A field for the type of service (mfc_tos) is to be added
164: * at a future point)
165: */
166: struct mfc {
167: struct in_addr mfc_origin; /* ip origin of mcasts */
168: struct in_addr mfc_mcastgrp; /* multicast group associated*/
169: vifi_t mfc_parent; /* incoming vif */
170: u_char mfc_ttls[MAXVIFS]; /* forwarding ttls on vifs */
171: u_long mfc_pkt_cnt; /* pkt count for src-grp */
172: u_long mfc_byte_cnt; /* byte count for src-grp */
173: u_long mfc_wrong_if; /* wrong if for src-grp */
174: int mfc_expire; /* time to clean entry up */
175: struct timeval mfc_last_assert; /* last time I sent an assert*/
176: #ifdef PIM_REG_KERNEL_ENCAP
177: struct in_addr mfc_rp_addr; /* The RP address for encap. */
178: #endif
179: };
180: #endif /* KERNEL */
181: /*
182: * Struct used to communicate from kernel to multicast router
183: * note the convenient similarity to an IP packet
184: */
185: struct igmpmsg {
186: u_long unused1;
187: u_long unused2;
188: u_char im_msgtype; /* what type of message */
189: #define IGMPMSG_NOCACHE 1
190: #define IGMPMSG_WRONGVIF 2
191: #define IGMPMSG_WHOLEPKT 3 /* used for user level encap */
192: u_char im_mbz; /* must be zero */
193: u_char im_vif; /* vif rec'd on */
194: u_char unused3;
195: struct in_addr im_src, im_dst;
196: };
197:
198: #ifdef KERNEL
199: /*
200: * Argument structure used for pkt info. while upcall is made
201: */
202: struct rtdetq {
203: struct mbuf *m; /* A copy of the packet */
204: struct ifnet *ifp; /* Interface pkt came in on */
205: #ifdef UPCALL_TIMING
206: struct timeval t; /* Timestamp */
207: #endif /* UPCALL_TIMING */
208: };
209:
210: #define MFCTBLSIZ 256
211: #if (MFCTBLSIZ & (MFCTBLSIZ - 1)) == 0 /* from sys:route.h */
212: #define MFCHASHMOD(h) ((h) & (MFCTBLSIZ - 1))
213: #else
214: #define MFCHASHMOD(h) ((h) % MFCTBLSIZ)
215: #endif
216:
217: #define MAX_UPQ 4 /* max. no of pkts in upcall Q */
218:
219: /*
220: * Token Bucket filter code
221: */
222: #define MAX_BKT_SIZE 10000 /* 10K bytes size */
223: #define MAXQSIZE 10 /* max # of pkts in queue */
224:
225: /*
226: * queue structure at each vif
227: */
228: struct pkt_queue
229: {
230: u_long pkt_len; /* length of packet in queue */
231: struct mbuf *pkt_m; /* pointer to packet mbuf */
232: struct ip *pkt_ip; /* pointer to ip header */
233: };
234:
235: /*
236: * the token bucket filter at each vif
237: */
238: struct tbf
239: {
240: u_long last_pkt_t; /* arr. time of last pkt */
241: u_long n_tok; /* no of tokens in bucket */
242: u_long q_len; /* length of queue at this vif */
243: };
244:
245: #endif /* KERNEL */
246:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>