6811333 Remove prom_printf() message in emlxs driver
[opensolaris.git] / usr / src / lib / libipmp / common / ipmp_query.h
blob160f561dd2738ec7abdb3f3e7ade6bbcb863eba5
1 /*
2 * CDDL HEADER START
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.
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.
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]
19 * CDDL HEADER END
21 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
22 * Use is subject to license terms.
25 #ifndef _IPMP_QUERY_H
26 #define _IPMP_QUERY_H
28 #include <sys/types.h>
29 #include <sys/socket.h> /* needed by <net/if.h> */
30 #include <net/if.h> /* for LIF*NAMSIZ */
31 #include <ipmp.h>
34 * IPMP query interfaces.
36 * These interfaces may only be used within ON or after signing a contract
37 * with ON. For documentation, refer to PSARC/2002/615 and PSARC/2007/272.
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
45 * Assorted enumerations used in the data types described below.
47 typedef enum ipmp_if_probestate {
48 IPMP_PROBE_OK, /* probes detect no problems */
49 IPMP_PROBE_FAILED, /* probes detect failure */
50 IPMP_PROBE_UNKNOWN, /* probe detection unavailable */
51 IPMP_PROBE_DISABLED /* probe detection disabled */
52 } ipmp_if_probestate_t;
54 typedef enum ipmp_if_linkstate {
55 IPMP_LINK_UP, /* link detects up */
56 IPMP_LINK_DOWN, /* link detects down */
57 IPMP_LINK_UNKNOWN /* link detection unavailable */
58 } ipmp_if_linkstate_t;
60 typedef enum ipmp_if_flags {
61 IPMP_IFFLAG_INACTIVE = 0x1,
62 IPMP_IFFLAG_HWADDRDUP = 0x2,
63 IPMP_IFFLAG_ACTIVE = 0x4,
64 IPMP_IFFLAG_DOWN = 0x8
65 } ipmp_if_flags_t;
67 typedef enum ipmp_addr_state {
68 IPMP_ADDR_UP, /* address is up */
69 IPMP_ADDR_DOWN /* address is down */
70 } ipmp_addr_state_t;
72 typedef enum ipmp_if_targmode {
73 IPMP_TARG_DISABLED, /* use of targets is disabled */
74 IPMP_TARG_ROUTES, /* route-learned targets */
75 IPMP_TARG_MULTICAST /* multicast-learned targets */
76 } ipmp_if_targmode_t;
78 #define IPMP_LIST_SIZE(listtype, elsize, nel) \
79 ((sizeof (ipmp_ ## listtype ## _t) - (elsize)) + ((nel) * (elsize)))
82 * Data type describing a list of IPMP groups.
84 typedef struct ipmp_grouplist {
85 uint64_t gl_sig;
86 unsigned int gl_ngroup;
87 char gl_groups[1][LIFGRNAMSIZ];
88 } ipmp_grouplist_t;
90 #define IPMP_GROUPLIST_SIZE(ngr) \
91 IPMP_LIST_SIZE(grouplist, LIFGRNAMSIZ, ngr)
94 * Data type describing a list of interfaces.
96 typedef struct ipmp_iflist {
97 unsigned int il_nif;
98 char il_ifs[1][LIFNAMSIZ];
99 } ipmp_iflist_t;
101 #define IPMP_IFLIST_SIZE(nif) \
102 IPMP_LIST_SIZE(iflist, LIFNAMSIZ, nif)
105 * Data type describing a list of addresses.
107 typedef struct ipmp_addrlist {
108 unsigned int al_naddr;
109 struct sockaddr_storage al_addrs[1];
110 } ipmp_addrlist_t;
112 #define IPMP_ADDRLIST_SIZE(naddr) \
113 IPMP_LIST_SIZE(addrlist, sizeof (struct sockaddr_storage), naddr)
116 * Data type describing the state of an IPMP group.
118 typedef struct ipmp_groupinfo {
119 char gr_name[LIFGRNAMSIZ];
120 uint64_t gr_sig;
121 ipmp_group_state_t gr_state;
122 ipmp_iflist_t *gr_iflistp;
123 ipmp_addrlist_t *gr_adlistp;
124 char gr_ifname[LIFNAMSIZ];
125 char gr_m4ifname[LIFNAMSIZ];
126 char gr_m6ifname[LIFNAMSIZ];
127 char gr_bcifname[LIFNAMSIZ];
128 unsigned int gr_fdt;
129 } ipmp_groupinfo_t;
132 * Data type describing IPMP target information for a particular interface.
134 typedef struct ipmp_targinfo {
135 char it_name[LIFNAMSIZ];
136 struct sockaddr_storage it_testaddr;
137 ipmp_if_targmode_t it_targmode;
138 ipmp_addrlist_t *it_targlistp;
139 } ipmp_targinfo_t;
142 * Data type describing the IPMP-related state of an interface.
144 typedef struct ipmp_ifinfo {
145 char if_name[LIFNAMSIZ];
146 char if_group[LIFGRNAMSIZ];
147 ipmp_if_state_t if_state;
148 ipmp_if_type_t if_type;
149 ipmp_if_linkstate_t if_linkstate;
150 ipmp_if_probestate_t if_probestate;
151 ipmp_if_flags_t if_flags;
152 ipmp_targinfo_t if_targinfo4;
153 ipmp_targinfo_t if_targinfo6;
154 } ipmp_ifinfo_t;
157 * Data type describing an IPMP data address.
159 typedef struct ipmp_addrinfo {
160 struct sockaddr_storage ad_addr;
161 ipmp_addr_state_t ad_state;
162 char ad_group[LIFGRNAMSIZ];
163 char ad_binding[LIFNAMSIZ];
164 } ipmp_addrinfo_t;
166 typedef enum {
167 IPMP_QCONTEXT_LIVE,
168 IPMP_QCONTEXT_SNAP
169 } ipmp_qcontext_t;
171 extern int ipmp_setqcontext(ipmp_handle_t, ipmp_qcontext_t);
172 extern int ipmp_getgrouplist(ipmp_handle_t, ipmp_grouplist_t **);
173 extern void ipmp_freegrouplist(ipmp_grouplist_t *);
174 extern int ipmp_getgroupinfo(ipmp_handle_t, const char *, ipmp_groupinfo_t **);
175 extern void ipmp_freegroupinfo(ipmp_groupinfo_t *);
176 extern int ipmp_getifinfo(ipmp_handle_t, const char *, ipmp_ifinfo_t **);
177 extern void ipmp_freeifinfo(ipmp_ifinfo_t *);
178 extern int ipmp_getaddrinfo(ipmp_handle_t, const char *,
179 struct sockaddr_storage *, ipmp_addrinfo_t **);
180 extern void ipmp_freeaddrinfo(ipmp_addrinfo_t *);
182 #ifdef __cplusplus
184 #endif
186 #endif /* _IPMP_QUERY_H */