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