2N/A/*
2N/A * CDDL HEADER START
2N/A *
2N/A * The contents of this file are subject to the terms of the
2N/A * Common Development and Distribution License (the "License").
2N/A * You may not use this file except in compliance with the License.
2N/A *
2N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A * or http://www.opensolaris.org/os/licensing.
2N/A * See the License for the specific language governing permissions
2N/A * and limitations under the License.
2N/A *
2N/A * When distributing Covered Code, include this CDDL HEADER in each
2N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A * If applicable, add the following below this CDDL HEADER, with the
2N/A * fields enclosed by brackets "[]" replaced with your own identifying
2N/A * information: Portions Copyright [yyyy] [name of copyright owner]
2N/A *
2N/A * CDDL HEADER END
2N/A *
2N/A * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
2N/A */
2N/A
2N/A#ifndef _IPMP_QUERY_H
2N/A#define _IPMP_QUERY_H
2N/A
2N/A#include <sys/types.h>
2N/A#include <sys/socket.h> /* needed by <net/if.h> */
2N/A#include <net/if.h> /* for LIF*NAMSIZ */
2N/A#include <ipmp.h>
2N/A
2N/A/*
2N/A * IPMP query interfaces.
2N/A *
2N/A * These interfaces may only be used within ON or after signing a contract
2N/A * with ON. For documentation, refer to PSARC/2002/615 and PSARC/2007/272.
2N/A */
2N/A
2N/A#ifdef __cplusplus
2N/Aextern "C" {
2N/A#endif
2N/A
2N/A/*
2N/A * Assorted enumerations used in the data types described below.
2N/A */
2N/Atypedef enum ipmp_if_probestate {
2N/A IPMP_PROBE_OK, /* probes detect no problems */
2N/A IPMP_PROBE_FAILED, /* probes detect failure */
2N/A IPMP_PROBE_UNKNOWN, /* probe detection unavailable */
2N/A IPMP_PROBE_DISABLED /* probe detection disabled */
2N/A} ipmp_if_probestate_t;
2N/A
2N/Atypedef enum ipmp_if_linkstate {
2N/A IPMP_LINK_UP, /* link detects up */
2N/A IPMP_LINK_DOWN, /* link detects down */
2N/A IPMP_LINK_UNKNOWN /* link detection unavailable */
2N/A} ipmp_if_linkstate_t;
2N/A
2N/Atypedef enum ipmp_if_flags {
2N/A IPMP_IFFLAG_INACTIVE = 0x1,
2N/A IPMP_IFFLAG_HWADDRDUP = 0x2,
2N/A IPMP_IFFLAG_ACTIVE = 0x4,
2N/A IPMP_IFFLAG_DOWN = 0x8
2N/A} ipmp_if_flags_t;
2N/A
2N/Atypedef enum ipmp_addr_state {
2N/A IPMP_ADDR_UP, /* address is up */
2N/A IPMP_ADDR_DOWN /* address is down */
2N/A} ipmp_addr_state_t;
2N/A
2N/Atypedef enum ipmp_if_targmode {
2N/A IPMP_TARG_DISABLED, /* use of targets is disabled */
2N/A IPMP_TARG_ROUTES, /* route-learned targets */
2N/A IPMP_TARG_MULTICAST, /* multicast-learned targets */
2N/A IPMP_TARG_TRANSITIVE /* Transitive probing is in effect */
2N/A} ipmp_if_targmode_t;
2N/A
2N/A#define IPMP_LIST_SIZE(listtype, elsize, nel) \
2N/A ((sizeof (ipmp_ ## listtype ## _t) - (elsize)) + ((nel) * (elsize)))
2N/A
2N/A/*
2N/A * Data type describing a list of IPMP groups.
2N/A */
2N/Atypedef struct ipmp_grouplist {
2N/A uint64_t gl_sig;
2N/A unsigned int gl_ngroup;
2N/A char gl_groups[1][LIFGRNAMSIZ];
2N/A} ipmp_grouplist_t;
2N/A
2N/A#define IPMP_GROUPLIST_SIZE(ngr) \
2N/A IPMP_LIST_SIZE(grouplist, LIFGRNAMSIZ, ngr)
2N/A
2N/A/*
2N/A * Data type describing a list of interfaces.
2N/A */
2N/Atypedef struct ipmp_iflist {
2N/A unsigned int il_nif;
2N/A char il_ifs[1][LIFNAMSIZ];
2N/A} ipmp_iflist_t;
2N/A
2N/A#define IPMP_IFLIST_SIZE(nif) \
2N/A IPMP_LIST_SIZE(iflist, LIFNAMSIZ, nif)
2N/A
2N/A/*
2N/A * Data type describing a list of addresses.
2N/A */
2N/Atypedef struct ipmp_addrlist {
2N/A unsigned int al_naddr;
2N/A struct sockaddr_storage al_addrs[1];
2N/A} ipmp_addrlist_t;
2N/A
2N/A#define IPMP_ADDRLIST_SIZE(naddr) \
2N/A IPMP_LIST_SIZE(addrlist, sizeof (struct sockaddr_storage), naddr)
2N/A
2N/A/*
2N/A * Data type describing the state of an IPMP group.
2N/A */
2N/Atypedef struct ipmp_groupinfo {
2N/A char gr_name[LIFGRNAMSIZ];
2N/A uint64_t gr_sig;
2N/A ipmp_group_state_t gr_state;
2N/A ipmp_iflist_t *gr_iflistp;
2N/A ipmp_addrlist_t *gr_adlistp;
2N/A char gr_ifname[LIFNAMSIZ];
2N/A char gr_m4ifname[LIFNAMSIZ];
2N/A char gr_m6ifname[LIFNAMSIZ];
2N/A char gr_bcifname[LIFNAMSIZ];
2N/A unsigned int gr_fdt;
2N/A} ipmp_groupinfo_t;
2N/A
2N/A/*
2N/A * Data type describing IPMP target information for a particular interface.
2N/A */
2N/Atypedef struct ipmp_targinfo {
2N/A char it_name[LIFNAMSIZ];
2N/A struct sockaddr_storage it_testaddr;
2N/A ipmp_if_targmode_t it_targmode;
2N/A ipmp_addrlist_t *it_targlistp;
2N/A ipmp_iflist_t *it_iflistp;
2N/A} ipmp_targinfo_t;
2N/A
2N/A/*
2N/A * Data type describing the IPMP-related state of an interface.
2N/A */
2N/Atypedef struct ipmp_ifinfo {
2N/A char if_name[LIFNAMSIZ];
2N/A char if_group[LIFGRNAMSIZ];
2N/A ipmp_if_state_t if_state;
2N/A ipmp_if_type_t if_type;
2N/A ipmp_if_linkstate_t if_linkstate;
2N/A ipmp_if_probestate_t if_probestate;
2N/A ipmp_if_flags_t if_flags;
2N/A ipmp_targinfo_t if_targinfo4;
2N/A ipmp_targinfo_t if_targinfo6;
2N/A} ipmp_ifinfo_t;
2N/A
2N/A/*
2N/A * Data type describing an IPMP data address.
2N/A */
2N/Atypedef struct ipmp_addrinfo {
2N/A struct sockaddr_storage ad_addr;
2N/A ipmp_addr_state_t ad_state;
2N/A char ad_group[LIFGRNAMSIZ];
2N/A char ad_binding[LIFNAMSIZ];
2N/A} ipmp_addrinfo_t;
2N/A
2N/Atypedef enum {
2N/A IPMP_QCONTEXT_LIVE,
2N/A IPMP_QCONTEXT_SNAP
2N/A} ipmp_qcontext_t;
2N/A
2N/Aextern int ipmp_setqcontext(ipmp_handle_t, ipmp_qcontext_t);
2N/Aextern int ipmp_getgrouplist(ipmp_handle_t, ipmp_grouplist_t **);
2N/Aextern void ipmp_freegrouplist(ipmp_grouplist_t *);
2N/Aextern int ipmp_getgroupinfo(ipmp_handle_t, const char *, ipmp_groupinfo_t **);
2N/Aextern void ipmp_freegroupinfo(ipmp_groupinfo_t *);
2N/Aextern int ipmp_getifinfo(ipmp_handle_t, const char *, ipmp_ifinfo_t **);
2N/Aextern void ipmp_freeifinfo(ipmp_ifinfo_t *);
2N/Aextern int ipmp_getaddrinfo(ipmp_handle_t, const char *,
2N/A struct sockaddr_storage *, ipmp_addrinfo_t **);
2N/Aextern void ipmp_freeaddrinfo(ipmp_addrinfo_t *);
2N/A
2N/A#ifdef __cplusplus
2N/A}
2N/A#endif
2N/A
2N/A#endif /* _IPMP_QUERY_H */