xref: /titanic_51/usr/src/uts/common/inet/ip_multi.h (revision 25540de2e9a31b620c68d87ce2f3bbe8a196ad93)
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 (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 /* Copyright (c) 1990 Mentat Inc. */
26 
27 #ifndef	_INET_IP_MULTI_H
28 #define	_INET_IP_MULTI_H
29 
30 #ifdef	__cplusplus
31 extern "C" {
32 #endif
33 
34 #if defined(_KERNEL)
35 
36 #define	INFINITY	0xffffffffU
37 /*
38  * Enum used to pass ilg status to ip_addmulti() and friends. There
39  * are three possibilities: the group is being joined from within ip,
40  * in which case there is no associated ilg; the group is being joined
41  * from an upper layer with an associated ilg that's been newly created
42  * by this join; or the upper layer is changing its group membership
43  * state (the ilg existed before this call).
44  */
45 typedef enum {
46 	ILGSTAT_NONE,
47 	ILGSTAT_NEW,
48 	ILGSTAT_CHANGE
49 } ilg_stat_t;
50 
51 /*
52  * Flags shared via ips_mrt_flags, used by mcast_restart_timers_thread().
53  */
54 typedef enum {
55 	IP_MRT_STOP	= 0x1,	/* request to stop thread */
56 	IP_MRT_DONE	= 0x2,	/* indication that thread is stopped */
57 	IP_MRT_RUN 	= 0x4	/* request to restart timers */
58 } ip_mrt_flags_t;
59 
60 /*
61  * Extern functions
62  */
63 extern	mblk_t		*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_statechange(ilm_t *, mcast_record_t, slist_t *);
69 
70 extern	void		mld_joingroup(ilm_t *);
71 extern	void		mld_leavegroup(ilm_t *);
72 extern	void		mld_statechange(ilm_t *, mcast_record_t, slist_t *);
73 extern	void		mld_slowtimo(void *);
74 
75 extern	void		ilg_delete_all(conn_t *connp);
76 extern	ilg_t		*ilg_lookup_ill_v6(conn_t *, const in6_addr_t *,
77     ill_t *);
78 extern	ilg_t		*ilg_lookup_ill_withsrc(conn_t *, ipaddr_t, ipaddr_t,
79     ill_t *);
80 extern	ilg_t		*ilg_lookup_ill_withsrc_v6(conn_t *, const in6_addr_t *,
81     const in6_addr_t *, ill_t *);
82 
83 extern void		ill_leave_multicast(ill_t *);
84 extern void		ill_recover_multicast(ill_t *);
85 extern int		ip_get_dlpi_mbcast(ill_t *, mblk_t *);
86 
87 extern	void		ilm_free(ipif_t *);
88 extern	ilm_t		*ilm_lookup_ill(ill_t *, ipaddr_t, zoneid_t);
89 extern	ilm_t		*ilm_lookup_ill_v6(ill_t *, const in6_addr_t *,
90     boolean_t, zoneid_t);
91 extern	ilm_t		*ilm_lookup_ipif(ipif_t *, ipaddr_t);
92 
93 extern int		ilm_numentries_v6(ill_t *, const in6_addr_t *);
94 extern int		ilm_walk_ipif(ipif_t *);
95 extern int		ilm_walk_ill(ill_t *);
96 extern void		ilm_walker_cleanup(ill_t *);
97 extern int		ip_ll_send_disabmulti_req(ill_t *, const in6_addr_t *);
98 extern int		ip_ll_send_enabmulti_req(ill_t *, const in6_addr_t *);
99 
100 extern	int		ip_addmulti(ipaddr_t, ipif_t *, ilg_stat_t,
101     mcast_record_t, slist_t *);
102 extern	int		ip_addmulti_v6(const in6_addr_t *, ill_t *,
103     zoneid_t, ilg_stat_t, mcast_record_t, slist_t *);
104 extern	int		ip_delmulti(ipaddr_t, ipif_t *, boolean_t, boolean_t);
105 extern	int		ip_delmulti_v6(const in6_addr_t *, ill_t *,
106     zoneid_t, boolean_t, boolean_t);
107 extern	int		ill_join_allmulti(ill_t *);
108 extern	void		ill_leave_allmulti(ill_t *);
109 extern	int		ip_join_allmulti(uint_t, boolean_t, ip_stack_t *);
110 extern	int		ip_leave_allmulti(uint_t, boolean_t, ip_stack_t *);
111 extern	void		ip_purge_allmulti(ill_t *);
112 extern	void		ip_multicast_loopback(queue_t *, ill_t *, mblk_t *,
113     int, zoneid_t);
114 extern	int		ip_mforward(ill_t *, ipha_t *, mblk_t *);
115 extern	void		ip_mroute_decap(queue_t *, mblk_t *, ill_t *);
116 extern	int		ip_mroute_mrt(mblk_t *, ip_stack_t *);
117 extern	int		ip_mroute_stats(mblk_t *, ip_stack_t *);
118 extern	int		ip_mroute_vif(mblk_t *, ip_stack_t *);
119 extern	int		ip_mrouter_done(mblk_t *, ip_stack_t *);
120 extern	int		ip_mrouter_get(int, queue_t *, uchar_t *);
121 extern	int		ip_mrouter_set(int, queue_t *, int, uchar_t *, int,
122     mblk_t *);
123 extern	void		ip_mrouter_stack_init(ip_stack_t *);
124 extern	void		ip_mrouter_stack_destroy(ip_stack_t *);
125 
126 extern	int		ip_opt_add_group(conn_t *, boolean_t, ipaddr_t,
127     ipaddr_t, uint_t *, mcast_record_t, ipaddr_t, mblk_t *);
128 extern	int		ip_opt_delete_group(conn_t *, boolean_t, ipaddr_t,
129     ipaddr_t, uint_t *, mcast_record_t, ipaddr_t, mblk_t *);
130 extern	int		ip_opt_add_group_v6(conn_t *, boolean_t,
131     const in6_addr_t *, int, mcast_record_t, const in6_addr_t *, mblk_t *);
132 extern	int		ip_opt_delete_group_v6(conn_t *, boolean_t,
133     const in6_addr_t *, int, mcast_record_t, const in6_addr_t *, mblk_t *);
134 
135 extern  int		mrt_ioctl(ipif_t *, sin_t *, queue_t *, mblk_t *,
136     ip_ioctl_cmd_t *, void *);
137 extern	int		ip_sioctl_msfilter(ipif_t *, sin_t *, queue_t *,
138     mblk_t *, ip_ioctl_cmd_t *, void *);
139 extern	int		ip_extract_msfilter(queue_t *, mblk_t *,
140     const ip_ioctl_cmd_t *, cmd_info_t *, ipsq_func_t);
141 extern	int		ip_copyin_msfilter(queue_t *, mblk_t *);
142 
143 extern	void		ip_wput_ctl(queue_t *, mblk_t *);
144 
145 extern	int		pim_input(queue_t *, mblk_t *, ill_t *);
146 extern	void		reset_conn_ipif(ipif_t *);
147 extern	void		reset_conn_ill(ill_t *);
148 extern	void		reset_mrt_ill(ill_t *);
149 extern	void		reset_mrt_vif_ipif(ipif_t *);
150 extern	void		mcast_restart_timers_thread(ip_stack_t *);
151 extern	void		ilm_inactive(ilm_t *);
152 extern	ilm_t		*ilm_walker_start(ilm_walker_t *, ill_t *);
153 extern	ilm_t		*ilm_walker_step(ilm_walker_t *, ilm_t *);
154 extern	void		ilm_walker_finish(ilm_walker_t *);
155 
156 #endif /* _KERNEL */
157 
158 #ifdef	__cplusplus
159 }
160 #endif
161 
162 #endif	/* _INET_IP_MULTI_H */
163