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 2009 Sun Microsystems, Inc. All rights reserved.
2N/A * Use is subject to license terms.
2N/A */
2N/A
2N/A#ifndef _IPMP_MPATHD_H
2N/A#define _IPMP_MPATHD_H
2N/A
2N/A/*
2N/A * Definitions for the messaging protocol between in.mpathd and libipmp.
2N/A * This interface is project-private to the IPMP subsystem.
2N/A */
2N/A
2N/A#include <sys/types.h>
2N/A#include <sys/socket.h> /* needed for <net/if.h> */
2N/A#include <net/if.h> /* needed for LIFNAMSIZ */
2N/A
2N/A#ifdef __cplusplus
2N/Aextern "C" {
2N/A#endif
2N/A
2N/A#define MPATHD_PORT 5999
2N/A#define MPATHD_PATH "/lib/inet/in.mpathd"
2N/A
2N/A/*
2N/A * Supported commands.
2N/A */
2N/Aenum {
2N/A MI_PING = 0, /* ping in.mpathd */
2N/A MI_OFFLINE = 1, /* offline the interface */
2N/A MI_UNDO_OFFLINE = 2, /* undo the offline */
2N/A MI_QUERY = 3, /* query ipmp-related information */
2N/A MI_NCMD /* total number of commands */
2N/A};
2N/A
2N/A/*
2N/A * Types of information which can be requested and received (except for
2N/A * IPMP_IFLIST and IPMP_ADDRLIST, which can only be received).
2N/A */
2N/Atypedef enum {
2N/A IPMP_GROUPLIST = 1,
2N/A IPMP_GROUPINFO = 2,
2N/A IPMP_IFINFO = 3,
2N/A IPMP_IFLIST = 4,
2N/A IPMP_SNAP = 5,
2N/A IPMP_ADDRLIST = 6,
2N/A IPMP_ADDRINFO = 7
2N/A} ipmp_infotype_t;
2N/A
2N/A/*
2N/A * Daemon ping request.
2N/A */
2N/Atypedef struct mi_ping {
2N/A uint32_t mip_command;
2N/A} mi_ping_t;
2N/A
2N/A/*
2N/A * Interface offline request; `mio_ifname' is the interface to offline;
2N/A * `mio_min_redundancy' is the minimum amount of usable interfaces after
2N/A * offline that must exist for the operation to succeed.
2N/A */
2N/Atypedef struct mi_offline {
2N/A uint32_t mio_command;
2N/A char mio_ifname[LIFNAMSIZ];
2N/A uint32_t mio_min_redundancy;
2N/A} mi_offline_t;
2N/A
2N/A/*
2N/A * Interface undo-offline request; `miu_uname' is the interface to
2N/A * undo-offline.
2N/A */
2N/Atypedef struct mi_undo_offline {
2N/A uint32_t miu_command;
2N/A char miu_ifname[LIFNAMSIZ];
2N/A} mi_undo_offline_t;
2N/A
2N/A/*
2N/A * Retrieve IPMP-related information: `miq_inforeq' is the type of information
2N/A * being request (see above for the list of types). If the request type is
2N/A * IPMP_GROUPINFO, then `miq_grname' indicates the group. If the request type
2N/A * is IPMP_IFINFO, then `miq_ifname' indicates the interface. If the request
2N/A * type is IPMP_ADDRINFO then `miq_grname' indicates the group and `miq_addr'
2N/A * indicates the address.
2N/A */
2N/Atypedef struct mi_query {
2N/A uint32_t miq_command;
2N/A ipmp_infotype_t miq_inforeq;
2N/A union {
2N/A char miqu_ifname[LIFNAMSIZ];
2N/A char miqu_grname[LIFGRNAMSIZ];
2N/A } miq_infodata;
2N/A struct sockaddr_storage miq_addr;
2N/A} mi_query_t;
2N/A#define miq_ifname miq_infodata.miqu_ifname
2N/A#define miq_grname miq_infodata.miqu_grname
2N/A
2N/A/*
2N/A * Union of all commands. Can be used to estimate the maximum buffer size
2N/A * requirement for receiving any command.
2N/A */
2N/Aunion mi_commands {
2N/A uint32_t mi_command;
2N/A mi_ping_t mi_pcmd;
2N/A mi_offline_t mi_ocmd;
2N/A mi_undo_offline_t mi_ucmd;
2N/A mi_query_t mi_qcmd;
2N/A};
2N/A
2N/A/*
2N/A * Result structure returned by in.mpathd.
2N/A */
2N/Atypedef struct mi_result {
2N/A uint32_t me_sys_error; /* System error (errno.h) */
2N/A uint32_t me_mpathd_error; /* Mpathd error */
2N/A} mi_result_t;
2N/A
2N/A#define IPMP_REQTIMEOUT 5 /* seconds */
2N/A
2N/Aextern int ipmp_connect(int *);
2N/Aextern int ipmp_read(int, void *, size_t, const struct timeval *);
2N/Aextern int ipmp_write(int, const void *, size_t);
2N/Aextern int ipmp_writetlv(int, ipmp_infotype_t, size_t, void *);
2N/Aextern int ipmp_readtlv(int, ipmp_infotype_t *, size_t *, void **,
2N/A const struct timeval *);
2N/A
2N/A#ifdef __cplusplus
2N/A}
2N/A#endif
2N/A
2N/A#endif /* _IPMP_MPATHD_H */