17c478bdstevel@tonic-gate/*
27c478bdstevel@tonic-gate * CDDL HEADER START
37c478bdstevel@tonic-gate *
47c478bdstevel@tonic-gate * The contents of this file are subject to the terms of the
57c478bdstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only
67c478bdstevel@tonic-gate * (the "License").  You may not use this file except in compliance
77c478bdstevel@tonic-gate * with the License.
87c478bdstevel@tonic-gate *
97c478bdstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bdstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
117c478bdstevel@tonic-gate * See the License for the specific language governing permissions
127c478bdstevel@tonic-gate * and limitations under the License.
137c478bdstevel@tonic-gate *
147c478bdstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
157c478bdstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bdstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
177c478bdstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
187c478bdstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bdstevel@tonic-gate *
207c478bdstevel@tonic-gate * CDDL HEADER END
217c478bdstevel@tonic-gate */
227c478bdstevel@tonic-gate/*
23ba3594bGarrett D'Amore * Copyright 2014 Garrett D'Amore <garrett@damore.org>
24ba3594bGarrett D'Amore *
257c478bdstevel@tonic-gate * Copyright 1998-2002 Sun Microsystems, Inc.  All rights reserved.
267c478bdstevel@tonic-gate * Use is subject to license terms.
277c478bdstevel@tonic-gate */
287c478bdstevel@tonic-gate
297c478bdstevel@tonic-gate#ifndef _SYS_CLADM_H
307c478bdstevel@tonic-gate#define	_SYS_CLADM_H
317c478bdstevel@tonic-gate
327c478bdstevel@tonic-gate#ifdef	__cplusplus
337c478bdstevel@tonic-gateextern "C" {
347c478bdstevel@tonic-gate#endif
357c478bdstevel@tonic-gate
367c478bdstevel@tonic-gate#include <sys/types.h>
377c478bdstevel@tonic-gate#include <sys/clconf.h>
387c478bdstevel@tonic-gate#include <netinet/in.h>
397c478bdstevel@tonic-gate
407c478bdstevel@tonic-gate
417c478bdstevel@tonic-gate/*
427c478bdstevel@tonic-gate * This file defines interfaces which are private to Sun Clustering.
437c478bdstevel@tonic-gate * Others should not depend on this in any way as it may change or be
447c478bdstevel@tonic-gate * removed completely.
457c478bdstevel@tonic-gate */
467c478bdstevel@tonic-gate
477c478bdstevel@tonic-gate/*
487c478bdstevel@tonic-gate * cladm() facilities; see below for definitions pertinent to each of these
497c478bdstevel@tonic-gate * facilities.
507c478bdstevel@tonic-gate */
517c478bdstevel@tonic-gate#define	CL_INITIALIZE		0	/* bootstrapping information */
527c478bdstevel@tonic-gate#define	CL_CONFIG		1	/* configuration information */
537c478bdstevel@tonic-gate
547c478bdstevel@tonic-gate
557c478bdstevel@tonic-gate/*
567c478bdstevel@tonic-gate * Command definitions for each of the facilities.
577c478bdstevel@tonic-gate * The type of the data pointer and the direction of the data transfer
587c478bdstevel@tonic-gate * is listed for each command.
597c478bdstevel@tonic-gate */
607c478bdstevel@tonic-gate
617c478bdstevel@tonic-gate/*
627c478bdstevel@tonic-gate * CL_INITIALIZE facility commands.
637c478bdstevel@tonic-gate */
647c478bdstevel@tonic-gate#define	CL_GET_BOOTFLAG		0	/* Return cluster config/boot status */
657c478bdstevel@tonic-gate
667c478bdstevel@tonic-gate/*
677c478bdstevel@tonic-gate * Definitions for the flag bits returned by CL_GET_BOOTFLAG.
687c478bdstevel@tonic-gate */
697c478bdstevel@tonic-gate#define	CLUSTER_CONFIGURED	0x0001	/* system is configured as a cluster */
707c478bdstevel@tonic-gate#define	CLUSTER_BOOTED		0x0002	/* system is booted as a cluster */
717c478bdstevel@tonic-gate
727c478bdstevel@tonic-gate#ifdef _KERNEL
737c478bdstevel@tonic-gate#define	CLUSTER_INSTALLING	0x0004	/* cluster is being installed */
747c478bdstevel@tonic-gate#define	CLUSTER_DCS_ENABLED	0x0008	/* cluster device framework enabled */
757c478bdstevel@tonic-gate#endif	/* _KERNEL */
767c478bdstevel@tonic-gate
777c478bdstevel@tonic-gate/*
787c478bdstevel@tonic-gate * CL_CONFIG facility commands.
797c478bdstevel@tonic-gate * The CL_GET_NETADDRS and CL_GET_NUM_NETADDRS are contract private interfaces
807c478bdstevel@tonic-gate * per PSARC/2001/579-01.
817c478bdstevel@tonic-gate */
827c478bdstevel@tonic-gate#define	CL_NODEID		0	/* Return nodeid of this node. */
837c478bdstevel@tonic-gate#define	CL_HIGHEST_NODEID	1	/* Return highest configured nodeid. */
847c478bdstevel@tonic-gate#define	CL_GDEV_PREFIX		2	/* Return path to global namespace.  */
857c478bdstevel@tonic-gate#define	CL_GET_NETADDRS		3	/* Get array of network addresses    */
867c478bdstevel@tonic-gate					/* controlled by Sun Cluster. */
877c478bdstevel@tonic-gate#define	CL_GET_NUM_NETADDRS	4	/* Get the number of data structure  */
887c478bdstevel@tonic-gate					/* entries in the array that will be */
897c478bdstevel@tonic-gate					/* returned  using CL_GET_NETADDRS.  */
907c478bdstevel@tonic-gate
917c478bdstevel@tonic-gate/*
927c478bdstevel@tonic-gate * The cladm system call can provide an array of cluster controlled
937c478bdstevel@tonic-gate * network addresses and associated netmasks.  The cladm arguments
947c478bdstevel@tonic-gate * must be as follows:  the argument fac is specified as CL_CONFIG,
957c478bdstevel@tonic-gate * the argument cmd is specified as CL_GET_NETADDRS, and argument arg
967c478bdstevel@tonic-gate * is the location of a structure of type cladm_netaddrs_t. The
977c478bdstevel@tonic-gate * cladm_num_netaddrs is used as input for the requested number
987c478bdstevel@tonic-gate * of array entries, and is used as ouput for the number of valid array
997c478bdstevel@tonic-gate * entries available.
1007c478bdstevel@tonic-gate *
1017c478bdstevel@tonic-gate * The caller must allocate sufficient memory for the array of
1027c478bdstevel@tonic-gate * structures of type cladm_netaddr_entry_t and specify the starting
1037c478bdstevel@tonic-gate * location as cladm_netaddrs_array.  The number of entries included
1047c478bdstevel@tonic-gate * in the array is determined using cladm with argument fac specified
1057c478bdstevel@tonic-gate * as CL_CONFIG, argument cmd specified as CL_GET_NUM_NETADDRS, and
1067c478bdstevel@tonic-gate * argument arg is the location of a structure of type cladm_netaddrs_t.
1077c478bdstevel@tonic-gate * The determined number of array entries is returned in
1087c478bdstevel@tonic-gate * cladm_num_netaddrs.
1097c478bdstevel@tonic-gate *
1107c478bdstevel@tonic-gate * These commands support the yielding of DR operation control (by the
1117c478bdstevel@tonic-gate * RCM Framework) to Sun Cluster for cluster controlled adapters.
1127c478bdstevel@tonic-gate *
1137c478bdstevel@tonic-gate * These data structures are contract private per PSARC/2001/579-01.
1147c478bdstevel@tonic-gate */
1157c478bdstevel@tonic-gatetypedef struct {
1167c478bdstevel@tonic-gate	int32_t		cl_ipversion;	/* IPV4_VERSION or IPV6_VERSION */
1177c478bdstevel@tonic-gate	union {
1187c478bdstevel@tonic-gate		struct {
1197c478bdstevel@tonic-gate			ipaddr_t	ipv4_netaddr;
1207c478bdstevel@tonic-gate			ipaddr_t	ipv4_netmask;
1217c478bdstevel@tonic-gate			} cl_ipv4;
1227c478bdstevel@tonic-gate		struct {
1237c478bdstevel@tonic-gate			uint32_t	ipv6_netaddr[4];
1247c478bdstevel@tonic-gate			uint32_t	ipv6_netmask[4];
1257c478bdstevel@tonic-gate			} cl_ipv6;
1267c478bdstevel@tonic-gate	} cl_ipv_un;
1277c478bdstevel@tonic-gate} cladm_netaddr_entry_t;
1287c478bdstevel@tonic-gate
1297c478bdstevel@tonic-gatetypedef struct {
1307c478bdstevel@tonic-gate	uint32_t		cladm_num_netaddrs;
1317c478bdstevel@tonic-gate	cladm_netaddr_entry_t	*cladm_netaddrs_array;
1327c478bdstevel@tonic-gate} cladm_netaddrs_t;
1337c478bdstevel@tonic-gate
1347c478bdstevel@tonic-gate#if defined(_SYSCALL32)
1357c478bdstevel@tonic-gatetypedef struct {
1367c478bdstevel@tonic-gate	uint32_t	cladm_num_netaddrs;
1377c478bdstevel@tonic-gate	caddr32_t	cladm_netaddrs_array;
1387c478bdstevel@tonic-gate} cladm_netaddrs32_t;
1397c478bdstevel@tonic-gate#endif /* defined(_SYSCALL32) */
1407c478bdstevel@tonic-gate
1417c478bdstevel@tonic-gate
1427c478bdstevel@tonic-gate#ifdef _KERNEL
1437c478bdstevel@tonic-gateextern int cladmin(int fac, int cmd, void *data);
1447c478bdstevel@tonic-gateextern int cluster_bootflags;
1457c478bdstevel@tonic-gate#else
1467c478bdstevel@tonic-gateextern int _cladm(int fac, int cmd, void *data);
1477c478bdstevel@tonic-gate#endif	/* _KERNEL */
1487c478bdstevel@tonic-gate
1497c478bdstevel@tonic-gate#ifdef	__cplusplus
1507c478bdstevel@tonic-gate}
1517c478bdstevel@tonic-gate#endif
1527c478bdstevel@tonic-gate
1537c478bdstevel@tonic-gate
1547c478bdstevel@tonic-gate#endif	/* _SYS_CLADM_H */
155