xref: /illumos-gate/usr/src/uts/common/inet/ip_multi.h (revision e11c3f44f531fdff80941ce57c065d2ae861cefc)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
56226e9d9Sethindra  * Common Development and Distribution License (the "License").
66226e9d9Sethindra  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22*e11c3f44Smeem  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate /* Copyright (c) 1990 Mentat Inc. */
267c478bd9Sstevel@tonic-gate 
277c478bd9Sstevel@tonic-gate #ifndef	_INET_IP_MULTI_H
287c478bd9Sstevel@tonic-gate #define	_INET_IP_MULTI_H
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
317c478bd9Sstevel@tonic-gate extern "C" {
327c478bd9Sstevel@tonic-gate #endif
337c478bd9Sstevel@tonic-gate 
347c478bd9Sstevel@tonic-gate #if defined(_KERNEL)
357c478bd9Sstevel@tonic-gate 
367c478bd9Sstevel@tonic-gate #define	INFINITY	0xffffffffU
377c478bd9Sstevel@tonic-gate /*
387c478bd9Sstevel@tonic-gate  * Enum used to pass ilg status to ip_addmulti() and friends. There
397c478bd9Sstevel@tonic-gate  * are three possibilities: the group is being joined from within ip,
407c478bd9Sstevel@tonic-gate  * in which case there is no associated ilg; the group is being joined
417c478bd9Sstevel@tonic-gate  * from an upper layer with an associated ilg that's been newly created
427c478bd9Sstevel@tonic-gate  * by this join; or the upper layer is changing its group membership
437c478bd9Sstevel@tonic-gate  * state (the ilg existed before this call).
447c478bd9Sstevel@tonic-gate  */
457c478bd9Sstevel@tonic-gate typedef enum {
467c478bd9Sstevel@tonic-gate 	ILGSTAT_NONE,
477c478bd9Sstevel@tonic-gate 	ILGSTAT_NEW,
487c478bd9Sstevel@tonic-gate 	ILGSTAT_CHANGE
497c478bd9Sstevel@tonic-gate } ilg_stat_t;
507c478bd9Sstevel@tonic-gate 
517c478bd9Sstevel@tonic-gate /*
52*e11c3f44Smeem  * Flags shared via ips_mrt_flags, used by mcast_restart_timers_thread().
53*e11c3f44Smeem  */
54*e11c3f44Smeem typedef enum {
55*e11c3f44Smeem 	IP_MRT_STOP	= 0x1,	/* request to stop thread */
56*e11c3f44Smeem 	IP_MRT_DONE	= 0x2,	/* indication that thread is stopped */
57*e11c3f44Smeem 	IP_MRT_RUN 	= 0x4	/* request to restart timers */
58*e11c3f44Smeem } ip_mrt_flags_t;
59*e11c3f44Smeem 
60*e11c3f44Smeem /*
617c478bd9Sstevel@tonic-gate  * Extern functions
627c478bd9Sstevel@tonic-gate  */
636226e9d9Sethindra extern	mblk_t		*igmp_input(queue_t *, mblk_t *, ill_t *);
647c478bd9Sstevel@tonic-gate extern	void		igmp_joingroup(ilm_t *);
657c478bd9Sstevel@tonic-gate extern	void		igmp_leavegroup(ilm_t *);
667c478bd9Sstevel@tonic-gate extern	void		igmp_slowtimo(void *);
677c478bd9Sstevel@tonic-gate extern	void		igmp_timeout_handler(void *);
687c478bd9Sstevel@tonic-gate extern	void		igmp_statechange(ilm_t *, mcast_record_t, slist_t *);
697c478bd9Sstevel@tonic-gate 
707c478bd9Sstevel@tonic-gate extern	void		mld_joingroup(ilm_t *);
717c478bd9Sstevel@tonic-gate extern	void		mld_leavegroup(ilm_t *);
727c478bd9Sstevel@tonic-gate extern	void		mld_statechange(ilm_t *, mcast_record_t, slist_t *);
737c478bd9Sstevel@tonic-gate extern	void		mld_slowtimo(void *);
747c478bd9Sstevel@tonic-gate 
757c478bd9Sstevel@tonic-gate extern	void		ilg_delete_all(conn_t *connp);
767c478bd9Sstevel@tonic-gate extern	ilg_t		*ilg_lookup_ill_v6(conn_t *, const in6_addr_t *,
777c478bd9Sstevel@tonic-gate     ill_t *);
787c478bd9Sstevel@tonic-gate extern	ilg_t		*ilg_lookup_ill_withsrc(conn_t *, ipaddr_t, ipaddr_t,
797c478bd9Sstevel@tonic-gate     ill_t *);
807c478bd9Sstevel@tonic-gate extern	ilg_t		*ilg_lookup_ill_withsrc_v6(conn_t *, const in6_addr_t *,
817c478bd9Sstevel@tonic-gate     const in6_addr_t *, ill_t *);
827c478bd9Sstevel@tonic-gate 
837c478bd9Sstevel@tonic-gate extern void		ill_leave_multicast(ill_t *);
847c478bd9Sstevel@tonic-gate extern void		ill_recover_multicast(ill_t *);
851b47e080Sdr146992 extern int		ip_get_dlpi_mbcast(ill_t *, mblk_t *);
867c478bd9Sstevel@tonic-gate 
877c478bd9Sstevel@tonic-gate extern	void		ilm_free(ipif_t *);
887c478bd9Sstevel@tonic-gate extern	ilm_t		*ilm_lookup_ill(ill_t *, ipaddr_t, zoneid_t);
897c478bd9Sstevel@tonic-gate extern	ilm_t		*ilm_lookup_ill_v6(ill_t *, const in6_addr_t *,
90*e11c3f44Smeem     boolean_t, zoneid_t);
917c478bd9Sstevel@tonic-gate extern	ilm_t		*ilm_lookup_ipif(ipif_t *, ipaddr_t);
927c478bd9Sstevel@tonic-gate 
937c478bd9Sstevel@tonic-gate extern int		ilm_numentries_v6(ill_t *, const in6_addr_t *);
947c478bd9Sstevel@tonic-gate extern int		ilm_walk_ipif(ipif_t *);
957c478bd9Sstevel@tonic-gate extern int		ilm_walk_ill(ill_t *);
967c478bd9Sstevel@tonic-gate extern void		ilm_walker_cleanup(ill_t *);
977c478bd9Sstevel@tonic-gate extern int		ip_ll_send_disabmulti_req(ill_t *, const in6_addr_t *);
987c478bd9Sstevel@tonic-gate extern int		ip_ll_send_enabmulti_req(ill_t *, const in6_addr_t *);
997c478bd9Sstevel@tonic-gate 
1007c478bd9Sstevel@tonic-gate extern	int		ip_addmulti(ipaddr_t, ipif_t *, ilg_stat_t,
1017c478bd9Sstevel@tonic-gate     mcast_record_t, slist_t *);
102*e11c3f44Smeem extern	int		ip_addmulti_v6(const in6_addr_t *, ill_t *,
1037c478bd9Sstevel@tonic-gate     zoneid_t, ilg_stat_t, mcast_record_t, slist_t *);
1047c478bd9Sstevel@tonic-gate extern	int		ip_delmulti(ipaddr_t, ipif_t *, boolean_t, boolean_t);
105*e11c3f44Smeem extern	int		ip_delmulti_v6(const in6_addr_t *, ill_t *,
1067c478bd9Sstevel@tonic-gate     zoneid_t, boolean_t, boolean_t);
107b127ac41SPhilip Kirk extern	int		ill_join_allmulti(ill_t *);
108b127ac41SPhilip Kirk extern	void		ill_leave_allmulti(ill_t *);
109b127ac41SPhilip Kirk extern	int		ip_join_allmulti(uint_t, boolean_t, ip_stack_t *);
110b127ac41SPhilip Kirk extern	int		ip_leave_allmulti(uint_t, boolean_t, ip_stack_t *);
111b127ac41SPhilip Kirk extern	void		ip_purge_allmulti(ill_t *);
1127c478bd9Sstevel@tonic-gate extern	void		ip_multicast_loopback(queue_t *, ill_t *, mblk_t *,
1137c478bd9Sstevel@tonic-gate     int, zoneid_t);
1147c478bd9Sstevel@tonic-gate extern	int		ip_mforward(ill_t *, ipha_t *, mblk_t *);
115f4b3ec61Sdh155122 extern	void		ip_mroute_decap(queue_t *, mblk_t *, ill_t *);
116f4b3ec61Sdh155122 extern	int		ip_mroute_mrt(mblk_t *, ip_stack_t *);
117f4b3ec61Sdh155122 extern	int		ip_mroute_stats(mblk_t *, ip_stack_t *);
118f4b3ec61Sdh155122 extern	int		ip_mroute_vif(mblk_t *, ip_stack_t *);
119f4b3ec61Sdh155122 extern	int		ip_mrouter_done(mblk_t *, ip_stack_t *);
1207c478bd9Sstevel@tonic-gate extern	int		ip_mrouter_get(int, queue_t *, uchar_t *);
1217c478bd9Sstevel@tonic-gate extern	int		ip_mrouter_set(int, queue_t *, int, uchar_t *, int,
1227c478bd9Sstevel@tonic-gate     mblk_t *);
123f4b3ec61Sdh155122 extern	void		ip_mrouter_stack_init(ip_stack_t *);
124f4b3ec61Sdh155122 extern	void		ip_mrouter_stack_destroy(ip_stack_t *);
1257c478bd9Sstevel@tonic-gate 
1267c478bd9Sstevel@tonic-gate extern	int		ip_opt_add_group(conn_t *, boolean_t, ipaddr_t,
12798e93c29Smeem     ipaddr_t, uint_t *, mcast_record_t, ipaddr_t, mblk_t *);
1287c478bd9Sstevel@tonic-gate extern	int		ip_opt_delete_group(conn_t *, boolean_t, ipaddr_t,
12998e93c29Smeem     ipaddr_t, uint_t *, mcast_record_t, ipaddr_t, mblk_t *);
1307c478bd9Sstevel@tonic-gate extern	int		ip_opt_add_group_v6(conn_t *, boolean_t,
1317c478bd9Sstevel@tonic-gate     const in6_addr_t *, int, mcast_record_t, const in6_addr_t *, mblk_t *);
1327c478bd9Sstevel@tonic-gate extern	int		ip_opt_delete_group_v6(conn_t *, boolean_t,
1337c478bd9Sstevel@tonic-gate     const in6_addr_t *, int, mcast_record_t, const in6_addr_t *, mblk_t *);
1347c478bd9Sstevel@tonic-gate 
13598e93c29Smeem extern  int		mrt_ioctl(ipif_t *, sin_t *, queue_t *, mblk_t *,
13698e93c29Smeem     ip_ioctl_cmd_t *, void *);
1377c478bd9Sstevel@tonic-gate extern	int		ip_sioctl_msfilter(ipif_t *, sin_t *, queue_t *,
1387c478bd9Sstevel@tonic-gate     mblk_t *, ip_ioctl_cmd_t *, void *);
13998e93c29Smeem extern	int		ip_extract_msfilter(queue_t *, mblk_t *,
14098e93c29Smeem     const ip_ioctl_cmd_t *, cmd_info_t *, ipsq_func_t);
1417c478bd9Sstevel@tonic-gate extern	int		ip_copyin_msfilter(queue_t *, mblk_t *);
1427c478bd9Sstevel@tonic-gate 
1437c478bd9Sstevel@tonic-gate extern	void		ip_wput_ctl(queue_t *, mblk_t *);
1447c478bd9Sstevel@tonic-gate 
145f4b3ec61Sdh155122 extern	int		pim_input(queue_t *, mblk_t *, ill_t *);
1467c478bd9Sstevel@tonic-gate extern	void		reset_conn_ipif(ipif_t *);
1477c478bd9Sstevel@tonic-gate extern	void		reset_conn_ill(ill_t *);
1487c478bd9Sstevel@tonic-gate extern	void		reset_mrt_ill(ill_t *);
1497c478bd9Sstevel@tonic-gate extern	void		reset_mrt_vif_ipif(ipif_t *);
150*e11c3f44Smeem extern	void		mcast_restart_timers_thread(ip_stack_t *);
151a7acbe81Ssowmini extern	void		ilm_inactive(ilm_t *);
152*e11c3f44Smeem extern	ilm_t		*ilm_walker_start(ilm_walker_t *, ill_t *);
153*e11c3f44Smeem extern	ilm_t		*ilm_walker_step(ilm_walker_t *, ilm_t *);
154*e11c3f44Smeem extern	void		ilm_walker_finish(ilm_walker_t *);
1557c478bd9Sstevel@tonic-gate 
1567c478bd9Sstevel@tonic-gate #endif /* _KERNEL */
1577c478bd9Sstevel@tonic-gate 
1587c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1597c478bd9Sstevel@tonic-gate }
1607c478bd9Sstevel@tonic-gate #endif
1617c478bd9Sstevel@tonic-gate 
1627c478bd9Sstevel@tonic-gate #endif	/* _INET_IP_MULTI_H */
163