xref: /titanic_41/usr/src/uts/common/inet/ip_multi.h (revision 70025d765b044c6d8594bb965a2247a61e991a99)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 /* Copyright (c) 1990 Mentat Inc. */
27 
28 #ifndef	_INET_IP_MULTI_H
29 #define	_INET_IP_MULTI_H
30 
31 #pragma ident	"%Z%%M%	%I%	%E% SMI"
32 
33 #ifdef	__cplusplus
34 extern "C" {
35 #endif
36 
37 #if defined(_KERNEL)
38 
39 #define	INFINITY	0xffffffffU
40 
41 extern	uint_t igmp_deferred_next;
42 extern	uint_t mld_deferred_next;
43 extern	kmutex_t igmp_slowtimeout_lock;
44 extern	kmutex_t mld_slowtimeout_lock;
45 
46 /*
47  * Enum used to pass ilg status to ip_addmulti() and friends. There
48  * are three possibilities: the group is being joined from within ip,
49  * in which case there is no associated ilg; the group is being joined
50  * from an upper layer with an associated ilg that's been newly created
51  * by this join; or the upper layer is changing its group membership
52  * state (the ilg existed before this call).
53  */
54 typedef enum {
55 	ILGSTAT_NONE,
56 	ILGSTAT_NEW,
57 	ILGSTAT_CHANGE
58 } ilg_stat_t;
59 
60 /*
61  * Extern functions
62  */
63 extern	int		igmp_input(queue_t *, mblk_t *, ill_t *);
64 extern	void		igmp_joingroup(ilm_t *);
65 extern	void		igmp_leavegroup(ilm_t *);
66 extern	void		igmp_slowtimo(void *);
67 extern	void		igmp_timeout_handler(void *);
68 extern	void		igmp_timeout_start(int);
69 extern	void		igmp_statechange(ilm_t *, mcast_record_t, slist_t *);
70 
71 extern	void		mld_joingroup(ilm_t *);
72 extern	void		mld_leavegroup(ilm_t *);
73 extern	void		mld_statechange(ilm_t *, mcast_record_t, slist_t *);
74 extern	void		mld_slowtimo(void *);
75 
76 extern	void		ilg_delete_all(conn_t *connp);
77 extern	ilg_t		*ilg_lookup_ill_v6(conn_t *, const in6_addr_t *,
78     ill_t *);
79 extern	ilg_t		*ilg_lookup_ill_withsrc(conn_t *, ipaddr_t, ipaddr_t,
80     ill_t *);
81 extern	ilg_t		*ilg_lookup_ill_withsrc_v6(conn_t *, const in6_addr_t *,
82     const in6_addr_t *, ill_t *);
83 
84 extern void		ill_leave_multicast(ill_t *);
85 extern void		ill_recover_multicast(ill_t *);
86 
87 extern	void		ilm_free(ipif_t *);
88 extern	ilm_t		*ilm_lookup_ill_withsrc(ill_t *, ipaddr_t, ipaddr_t);
89 extern	ilm_t		*ilm_lookup_ill_withsrc_v6(ill_t *, const in6_addr_t *,
90     const in6_addr_t *);
91 extern	ilm_t		*ilm_lookup_ill(ill_t *, ipaddr_t, zoneid_t);
92 extern	ilm_t		*ilm_lookup_ill_v6(ill_t *, const in6_addr_t *,
93     zoneid_t);
94 extern	ilm_t		*ilm_lookup_ill_index_v6(ill_t *, const in6_addr_t *,
95     int, zoneid_t);
96 extern	ilm_t		*ilm_lookup_ipif(ipif_t *, ipaddr_t);
97 
98 extern int		ilm_numentries_v6(ill_t *, const in6_addr_t *);
99 extern int		ilm_walk_ipif(ipif_t *);
100 extern int		ilm_walk_ill(ill_t *);
101 extern void		ilm_walker_cleanup(ill_t *);
102 extern int		ip_ll_send_disabmulti_req(ill_t *, const in6_addr_t *);
103 extern int		ip_ll_send_enabmulti_req(ill_t *, const in6_addr_t *);
104 
105 extern	int		ip_addmulti(ipaddr_t, ipif_t *, ilg_stat_t,
106     mcast_record_t, slist_t *);
107 extern	int		ip_addmulti_v6(const in6_addr_t *, ill_t *, int,
108     zoneid_t, ilg_stat_t, mcast_record_t, slist_t *);
109 extern	int		ip_delmulti(ipaddr_t, ipif_t *, boolean_t, boolean_t);
110 extern	int		ip_delmulti_v6(const in6_addr_t *, ill_t *, int,
111     zoneid_t, boolean_t, boolean_t);
112 extern	int		ip_join_allmulti(ipif_t *);
113 extern	int		ip_leave_allmulti(ipif_t *);
114 extern	void		ip_multicast_loopback(queue_t *, ill_t *, mblk_t *,
115     int, zoneid_t);
116 extern	int		ip_mforward(ill_t *, ipha_t *, mblk_t *);
117 extern	void		ip_mroute_decap(queue_t *, mblk_t *);
118 extern	int		ip_mroute_mrt(mblk_t *);
119 extern	int		ip_mroute_stats(mblk_t *);
120 extern	int		ip_mroute_vif(mblk_t *);
121 extern	int		ip_mrouter_done(mblk_t *);
122 extern	int		ip_mrouter_get(int, queue_t *, uchar_t *);
123 extern	int		ip_mrouter_set(int, queue_t *, int, uchar_t *, int,
124     mblk_t *);
125 
126 
127 extern	int		ip_opt_add_group(conn_t *, boolean_t, ipaddr_t,
128     ipaddr_t, uint_t *, mcast_record_t, ipaddr_t, mblk_t *first_mp);
129 extern	int		ip_opt_delete_group(conn_t *, boolean_t, ipaddr_t,
130     ipaddr_t, uint_t *, mcast_record_t, ipaddr_t, mblk_t *first_mp);
131 extern	int		ip_opt_add_group_v6(conn_t *, boolean_t,
132     const in6_addr_t *, int, mcast_record_t, const in6_addr_t *, mblk_t *);
133 extern	int		ip_opt_delete_group_v6(conn_t *, boolean_t,
134     const in6_addr_t *, int, mcast_record_t, const in6_addr_t *, mblk_t *);
135 
136 extern	int		ip_sioctl_msfilter(ipif_t *, sin_t *, queue_t *,
137     mblk_t *, ip_ioctl_cmd_t *, void *);
138 extern	int		ip_extract_msfilter(queue_t *, mblk_t *, ipif_t **,
139     ipsq_func_t);
140 extern	int		ip_copyin_msfilter(queue_t *, mblk_t *);
141 
142 extern	void		ip_wput_ctl(queue_t *, mblk_t *);
143 
144 extern  int	mrt_ioctl(ipif_t *ipif, sin_t *sin, queue_t *q, mblk_t *mp,
145     ip_ioctl_cmd_t *ipip, void *if_req);
146 
147 extern	int		pim_input(queue_t *, mblk_t *);
148 extern	void		reset_conn_ipif(ipif_t *);
149 extern	void		reset_conn_ill(ill_t *);
150 extern	void		reset_mrt_ill(ill_t *);
151 extern	void		reset_mrt_vif_ipif(ipif_t *);
152 extern	void		igmp_start_timers(unsigned);
153 extern	void		mld_start_timers(unsigned);
154 /*
155  * Extern variables
156  */
157 extern  queue_t *ip_g_mrouter;
158 
159 #endif /* _KERNEL */
160 
161 #ifdef	__cplusplus
162 }
163 #endif
164 
165 #endif	/* _INET_IP_MULTI_H */
166