xref: /titanic_41/usr/src/lib/libipmp/common/ipmp_query.h (revision 1d4b38e0077763e7c9b20768eacb841957e787bc)
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 2002 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _IPMP_QUERY_H
28 #define	_IPMP_QUERY_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #include <sys/types.h>
33 #include <sys/socket.h>			/* needed by <net/if.h> */
34 #include <net/if.h>			/* for LIF*NAMSIZ */
35 #include <ipmp.h>
36 
37 /*
38  * IPMP query interfaces.
39  *
40  * These interfaces may only be used within ON or after signing a contract
41  * with ON.  For documentation, refer to PSARC/2002/615.
42  */
43 
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47 
48 /*
49  * Data type describing a list of IPMP groups.
50  */
51 typedef struct ipmp_grouplist {
52 	uint64_t	gl_sig;
53 	unsigned int	gl_ngroup;
54 	char		gl_groups[1][LIFGRNAMSIZ];
55 } ipmp_grouplist_t;
56 
57 #define	IPMP_GROUPLIST_MINSIZE	(sizeof (ipmp_grouplist_t) - LIFGRNAMSIZ)
58 #define	IPMP_GROUPLIST_SIZE(ngr) (IPMP_GROUPLIST_MINSIZE + (ngr) * LIFGRNAMSIZ)
59 
60 /*
61  * Data type describing a list of interfaces.
62  */
63 typedef struct ipmp_iflist {
64 	unsigned int	il_nif;
65 	char		il_ifs[1][LIFNAMSIZ];
66 } ipmp_iflist_t;
67 
68 #define	IPMP_IFLIST_MINSIZE	(sizeof (ipmp_iflist_t) - LIFNAMSIZ)
69 #define	IPMP_IFLIST_SIZE(nif)	(IPMP_IFLIST_MINSIZE + (nif) * LIFNAMSIZ)
70 
71 /*
72  * Data type describing the state of an IPMP group.
73  */
74 typedef struct ipmp_groupinfo {
75 	char			gr_name[LIFGRNAMSIZ];
76 	uint64_t		gr_sig;
77 	ipmp_group_state_t	gr_state;
78 	ipmp_iflist_t		*gr_iflistp;
79 } ipmp_groupinfo_t;
80 
81 /*
82  * Data type describing the IPMP-related state of an interface.
83  */
84 typedef struct ipmp_ifinfo {
85 	char		if_name[LIFNAMSIZ];
86 	char		if_group[LIFGRNAMSIZ];
87 	ipmp_if_state_t	if_state;
88 	ipmp_if_type_t	if_type;
89 } ipmp_ifinfo_t;
90 
91 typedef enum {
92 	IPMP_QCONTEXT_LIVE,
93 	IPMP_QCONTEXT_SNAP
94 } ipmp_qcontext_t;
95 
96 extern int  ipmp_setqcontext(ipmp_handle_t, ipmp_qcontext_t);
97 extern int  ipmp_getgrouplist(ipmp_handle_t, ipmp_grouplist_t **);
98 extern void ipmp_freegrouplist(ipmp_grouplist_t *);
99 extern int  ipmp_getgroupinfo(ipmp_handle_t, const char *, ipmp_groupinfo_t **);
100 extern void ipmp_freegroupinfo(ipmp_groupinfo_t *);
101 extern int  ipmp_getifinfo(ipmp_handle_t, const char *, ipmp_ifinfo_t **);
102 extern void ipmp_freeifinfo(ipmp_ifinfo_t *);
103 
104 #ifdef __cplusplus
105 }
106 #endif
107 
108 #endif /* _IPMP_QUERY_H */
109