xref: /illumos-gate/usr/src/lib/libipmp/common/ipmp_query_impl.h (revision 3299f39fdcbdab4be7a9c70daa3873f2b78a398d)
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  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
22  * Use is subject to license terms.
23  */
24 
25 #ifndef _IPMP_QUERY_IMPL_H
26 #define	_IPMP_QUERY_IMPL_H
27 
28 #include <ipmp_query.h>
29 
30 /*
31  * Private IPMP query interfaces and structures.
32  *
33  * These are *only* for use by in.mpathd and libipmp itself.
34  */
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
40 /*
41  * List of ipmp_groupinfo_t structures.
42  */
43 typedef struct ipmp_groupinfolist {
44 	struct ipmp_groupinfolist *grl_next;
45 	ipmp_groupinfo_t	*grl_grinfop;
46 } ipmp_groupinfolist_t;
47 
48 /*
49  * List of ipmp_ifinfo_t structures.
50  */
51 typedef struct ipmp_ifinfolist {
52 	struct ipmp_ifinfolist	*ifl_next;
53 	ipmp_ifinfo_t		*ifl_ifinfop;
54 } ipmp_ifinfolist_t;
55 
56 /*
57  * List of ipmp_addrinfo_t structures.
58  */
59 typedef struct ipmp_addrinfolist {
60 	struct ipmp_addrinfolist *adl_next;
61 	ipmp_addrinfo_t		*adl_adinfop;
62 } ipmp_addrinfolist_t;
63 
64 /*
65  * Snapshot of IPMP state.
66  */
67 typedef struct ipmp_snap {
68 	ipmp_grouplist_t	*sn_grlistp;
69 	ipmp_groupinfolist_t	*sn_grinfolistp;
70 	ipmp_ifinfolist_t	*sn_ifinfolistp;
71 	ipmp_addrinfolist_t	*sn_adinfolistp;
72 	unsigned int		sn_ngroup;
73 	unsigned int		sn_nif;
74 	unsigned int		sn_naddr;
75 } ipmp_snap_t;
76 
77 /*
78  * Snapshot-related routines.
79  */
80 extern ipmp_snap_t *ipmp_snap_create(void);
81 extern void ipmp_snap_free(ipmp_snap_t *);
82 extern int ipmp_snap_addifinfo(ipmp_snap_t *, ipmp_ifinfo_t *);
83 extern int ipmp_snap_addaddrinfo(ipmp_snap_t *, ipmp_addrinfo_t *);
84 extern int ipmp_snap_addgroupinfo(ipmp_snap_t *, ipmp_groupinfo_t *);
85 
86 /*
87  * IPMP structure creation/destruction routines.
88  */
89 extern ipmp_ifinfo_t *ipmp_ifinfo_create(const char *, const char *,
90     ipmp_if_state_t, ipmp_if_type_t, ipmp_if_linkstate_t, ipmp_if_probestate_t,
91     ipmp_if_flags_t, ipmp_targinfo_t *, ipmp_targinfo_t *);
92 extern ipmp_groupinfo_t *ipmp_groupinfo_create(const char *, uint64_t, uint_t,
93     ipmp_group_state_t, uint_t, char (*)[LIFNAMSIZ], const char *,
94     const char *, const char *, const char *, uint_t,
95     struct sockaddr_storage *);
96 extern ipmp_grouplist_t *ipmp_grouplist_create(uint64_t, unsigned int,
97     char (*)[LIFGRNAMSIZ]);
98 extern ipmp_addrinfo_t *ipmp_addrinfo_create(struct sockaddr_storage *,
99     ipmp_addr_state_t, const char *, const char *);
100 extern ipmp_targinfo_t *ipmp_targinfo_create(const char *,
101     struct sockaddr_storage *, ipmp_if_targmode_t, uint_t,
102     struct sockaddr_storage *);
103 extern void ipmp_freetarginfo(ipmp_targinfo_t *);
104 
105 
106 #ifdef __cplusplus
107 }
108 #endif
109 
110 #endif /* _IPMP_QUERY_IMPL_H */
111