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 
27 #ifndef	_INET_IP_LISTUTILS_H
28 #define	_INET_IP_LISTUTILS_H
29 
30 #ifdef	__cplusplus
31 extern "C" {
32 #endif
33 
34 #ifdef	_KERNEL
35 
36 boolean_t	lists_are_different(const slist_t *, const slist_t *);
37 boolean_t	list_has_addr(const slist_t *, const in6_addr_t *);
38 void		l_intersection(const slist_t *, const slist_t *, slist_t *);
39 void		l_difference(const slist_t *, const slist_t *, slist_t *);
40 void		l_remove(slist_t *, const in6_addr_t *);
41 slist_t		*l_alloc_copy(const slist_t *);
42 void		l_copy(const slist_t *, slist_t *);
43 void		l_union_in_a(slist_t *, const slist_t *, boolean_t *);
44 void		l_intersection_in_a(slist_t *, const slist_t *);
45 void		l_difference_in_a(slist_t *, const slist_t *);
46 slist_t		*l_alloc();
47 void		l_free(slist_t *);
48 
49 #define	SLIST_IS_EMPTY(sl)	(((sl) == NULL) || ((sl)->sl_numsrc == 0))
50 #define	SLIST_CNT(sl)		(((sl) == NULL) ? 0 : ((sl)->sl_numsrc))
51 #define	CLEAR_SLIST(sl)		if ((sl) != NULL) (sl)->sl_numsrc = 0
52 #define	FREE_SLIST(sl)		if ((sl) != NULL) l_free((sl))
53 #define	COPY_SLIST(sl, newsl)			\
54 	if ((newsl) == NULL)			\
55 		(newsl) = l_alloc_copy((sl));	\
56 	else					\
57 		l_copy((sl), (newsl))
58 
59 #endif	/* _KERNEL */
60 
61 #ifdef	__cplusplus
62 }
63 #endif
64 
65 #endif	/* _INET_IP_LISTUTILS_H */
66