Merge commit 'd66a72cfe0bf6d9ab9725f0d0cb1f38dbcc0ac49'
[unleashed.git] / include / inet / ip_listutils.h
blob029dcf5f0a0f0428e79ede607fa1fa12327677a0
1 /*
2 * CDDL HEADER START
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.
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.
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]
20 * CDDL HEADER END
23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #ifndef _INET_IP_LISTUTILS_H
28 #define _INET_IP_LISTUTILS_H
30 #pragma ident "%Z%%M% %I% %E% SMI"
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
36 #ifdef _KERNEL
38 boolean_t lists_are_different(const slist_t *, const slist_t *);
39 boolean_t list_has_addr(const slist_t *, const in6_addr_t *);
40 void l_intersection(const slist_t *, const slist_t *, slist_t *);
41 void l_difference(const slist_t *, const slist_t *, slist_t *);
42 void l_remove(slist_t *, const in6_addr_t *);
43 slist_t *l_alloc_copy(const slist_t *);
44 void l_copy(const slist_t *, slist_t *);
45 void l_union_in_a(slist_t *, const slist_t *, boolean_t *);
46 void l_intersection_in_a(slist_t *, const slist_t *);
47 void l_difference_in_a(slist_t *, const slist_t *);
48 slist_t *l_alloc();
49 void l_free(slist_t *);
51 #define SLIST_IS_EMPTY(sl) (((sl) == NULL) || ((sl)->sl_numsrc == 0))
52 #define SLIST_CNT(sl) (((sl) == NULL) ? 0 : ((sl)->sl_numsrc))
53 #define CLEAR_SLIST(sl) if ((sl) != NULL) (sl)->sl_numsrc = 0
54 #define FREE_SLIST(sl) if ((sl) != NULL) l_free((sl))
55 #define COPY_SLIST(sl, newsl) \
56 if ((newsl) == NULL) \
57 (newsl) = l_alloc_copy((sl)); \
58 else \
59 l_copy((sl), (newsl))
61 #endif /* _KERNEL */
63 #ifdef __cplusplus
65 #endif
67 #endif /* _INET_IP_LISTUTILS_H */