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]
21 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
22 * Use is subject to license terms.
25 #ifndef _IPMP_MPATHD_H
26 #define _IPMP_MPATHD_H
29 * Definitions for the messaging protocol between in.mpathd and libipmp.
30 * This interface is project-private to the IPMP subsystem.
33 #include <sys/types.h>
34 #include <sys/socket.h> /* needed for <net/if.h> */
35 #include <net/if.h> /* needed for LIFNAMSIZ */
41 #define MPATHD_PORT 5999
42 #define MPATHD_PATH "/lib/inet/in.mpathd"
48 MI_PING
= 0, /* ping in.mpathd */
49 MI_OFFLINE
= 1, /* offline the interface */
50 MI_UNDO_OFFLINE
= 2, /* undo the offline */
51 MI_QUERY
= 3, /* query ipmp-related information */
52 MI_NCMD
/* total number of commands */
56 * Types of information which can be requested and received (except for
57 * IPMP_IFLIST and IPMP_ADDRLIST, which can only be received).
70 * Daemon ping request.
72 typedef struct mi_ping
{
77 * Interface offline request; `mio_ifname' is the interface to offline;
78 * `mio_min_redundancy' is the minimum amount of usable interfaces after
79 * offline that must exist for the operation to succeed.
81 typedef struct mi_offline
{
83 char mio_ifname
[LIFNAMSIZ
];
84 uint32_t mio_min_redundancy
;
88 * Interface undo-offline request; `miu_uname' is the interface to
91 typedef struct mi_undo_offline
{
93 char miu_ifname
[LIFNAMSIZ
];
97 * Retrieve IPMP-related information: `miq_inforeq' is the type of information
98 * being request (see above for the list of types). If the request type is
99 * IPMP_GROUPINFO, then `miq_grname' indicates the group. If the request type
100 * is IPMP_IFINFO, then `miq_ifname' indicates the interface. If the request
101 * type is IPMP_ADDRINFO then `miq_grname' indicates the group and `miq_addr'
102 * indicates the address.
104 typedef struct mi_query
{
105 uint32_t miq_command
;
106 ipmp_infotype_t miq_inforeq
;
108 char miqu_ifname
[LIFNAMSIZ
];
109 char miqu_grname
[LIFGRNAMSIZ
];
111 struct sockaddr_storage miq_addr
;
113 #define miq_ifname miq_infodata.miqu_ifname
114 #define miq_grname miq_infodata.miqu_grname
117 * Union of all commands. Can be used to estimate the maximum buffer size
118 * requirement for receiving any command.
123 mi_offline_t mi_ocmd
;
124 mi_undo_offline_t mi_ucmd
;
129 * Result structure returned by in.mpathd.
131 typedef struct mi_result
{
132 uint32_t me_sys_error
; /* System error (errno.h) */
133 uint32_t me_mpathd_error
; /* Mpathd error */
136 #define IPMP_REQTIMEOUT 5 /* seconds */
138 extern int ipmp_connect(int *);
139 extern int ipmp_read(int, void *, size_t, const struct timeval
*);
140 extern int ipmp_write(int, const void *, size_t);
141 extern int ipmp_writetlv(int, ipmp_infotype_t
, size_t, void *);
142 extern int ipmp_readtlv(int, ipmp_infotype_t
*, size_t *, void **,
143 const struct timeval
*);
149 #endif /* _IPMP_MPATHD_H */