xref: /titanic_51/usr/src/uts/common/smbsrv/smb_dfs.h (revision a90cf9f29973990687fa61de9f1f6ea22e924e40)
19fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States /*
29fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  * CDDL HEADER START
39fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  *
49fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  * The contents of this file are subject to the terms of the
59fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  * Common Development and Distribution License (the "License").
69fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  * You may not use this file except in compliance with the License.
79fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  *
89fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
99fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  * or http://www.opensolaris.org/os/licensing.
109fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  * See the License for the specific language governing permissions
119fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  * and limitations under the License.
129fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  *
139fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  * When distributing Covered Code, include this CDDL HEADER in each
149fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
159fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  * If applicable, add the following below this CDDL HEADER, with the
169fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  * fields enclosed by brackets "[]" replaced with your own identifying
179fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  * information: Portions Copyright [yyyy] [name of copyright owner]
189fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  *
199fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  * CDDL HEADER END
209fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  */
219fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States /*
22cb174861Sjoyce mcintosh  * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
23*a90cf9f2SGordon Ross  * Copyright 2014 Nexenta Systems, Inc.  All rights reserved.
249fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  */
259fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 
269fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States #ifndef _SMB_DFS_H
279fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States #define	_SMB_DFS_H
289fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 
299fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States #include <sys/param.h>
309fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States #include <sys/uuid.h>
319fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 
329fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States #ifdef __cplusplus
339fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States extern "C" {
349fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States #endif
359fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 
369fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States /*
379fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  * DFS root or link states
389fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  *
399fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  * DFS_VOLUME_STATE_OK
409fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  *    The specified DFS root or DFS link is in the normal state.
419fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  *
429fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  * DFS_VOLUME_STATE_INCONSISTENT
439fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  *    The internal DFS database is inconsistent with the specified DFS root or
449fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  *    DFS link. Attempts to repair the inconsistency have failed. This is a
459fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  *    read-only state and MUST NOT be set by clients.
469fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  *
479fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  * DFS_VOLUME_STATE_OFFLINE
489fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  *    The specified DFS root or DFS link is offline or unavailable.
499fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  *
509fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  * DFS_VOLUME_STATE_ONLINE
519fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  *    The specified DFS root or DFS link is available.
529fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  *
539fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  * DFS_VOLUME_FLAVOR_STANDALONE	Standalone namespace
549fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  * DFS_VOLUME_FLAVOR_AD_BLOB	Domain-based namespace
559fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  */
569fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States #define	DFS_VOLUME_STATE_OK			0x00000001
579fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States #define	DFS_VOLUME_STATE_INCONSISTENT		0x00000002
589fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States #define	DFS_VOLUME_STATE_OFFLINE		0x00000003
599fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States #define	DFS_VOLUME_STATE_ONLINE			0x00000004
609fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States #define	DFS_VOLUME_STATE_RESYNCHRONIZE		0x00000010
619fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States #define	DFS_VOLUME_STATE_STANDBY		0x00000020
629fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States #define	DFS_VOLUME_STATE_FORCE_SYNC		0x00000040
639fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 
649fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States #define	DFS_VOLUME_FLAVOR_STANDALONE		0x00000100
659fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States #define	DFS_VOLUME_FLAVOR_AD_BLOB		0x00000200
669fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 
679fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States /*
689fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  * The following bitmasks is only relevant when reading the volume state, not
699fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  * for setting it.
709fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  */
719fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States #define	DFS_VOLUME_STATES			0x0000000F
729fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States #define	DFS_VOLUME_FLAVORS			0x00000300
739fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 
749fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States /*
759fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  * States specified by this mask are used to perform a server operation and are
769fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  * not persisted to the DFS metadata
779fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  */
789fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States #define	DFS_VOLUME_STATES_SRV_OPS		0x00000070
799fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 
809fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States /*
819fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  * DFS Storage state
829fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  */
839fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States #define	DFS_STORAGE_STATE_OFFLINE	1
849fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States #define	DFS_STORAGE_STATE_ONLINE	2
859fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 
869fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States /*
879fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  * Flags for NetrDfsAdd operation:
889fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  *
899fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  * 0x00000000		This creates a new link or adds a new target to an
909fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  * 			existing link.
919fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  *
929fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  * DFS_ADD_VOLUME	This creates a new link in the DFS namespace if one does
939fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  * 			not already exist or fails if a link already exists.
949fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  *
959fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  * DFS_RESTORE_VOLUME	This adds a target without verifying its existence.
969fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  */
979fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States #define	DFS_CREATE_VOLUME	0x00000000
989fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States #define	DFS_ADD_VOLUME		0x00000001
999fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States #define	DFS_RESTORE_VOLUME	0x00000002
1009fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 
1019fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States #define	DFS_MOVE_FLAG_REPLACE_IF_EXISTS		1
1029fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 
103*a90cf9f2SGordon Ross /*
104*a90cf9f2SGordon Ross  * See also: dfs_target_pclass_xdr()
105*a90cf9f2SGordon Ross  */
1069fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States typedef enum {
1079fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 	DfsInvalidPriorityClass		= -1,
1089fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 	DfsSiteCostNormalPriorityClass	= 0,
1099fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 	DfsGlobalHighPriorityClass	= 1,
1109fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 	DfsSiteCostHighPriorityClass	= 2,
1119fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 	DfsSiteCostLowPriorityClass	= 3,
1129fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 	DfsGlobalLowPriorityClass	= 4
1139fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States } dfs_target_pclass_t;
1149fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 
115cb174861Sjoyce mcintosh #define	DFS_PRIORITY_RANK_MAX		0x001F
116cb174861Sjoyce mcintosh 
1179fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States #define	DFS_PROPERTY_FLAG_INSITE_REFERRALS	0x00000001
1189fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States #define	DFS_PROPERTY_FLAG_ROOT_SCALABILITY	0x00000002
1199fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States #define	DFS_PROPERTY_FLAG_SITE_COSTING		0x00000004
1209fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States #define	DFS_PROPERTY_FLAG_TARGET_FAILBACK	0x00000008
1219fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States #define	DFS_PROPERTY_FLAG_CLUSTER_ENABLED	0x00000010
1229fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States #define	DFS_PROPERTY_FLAG_ABDE			0x00000020
1239fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 
1249fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States #define	DFS_NAME_MAX			MAXNAMELEN
1259fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States #define	DFS_PATH_MAX			MAXPATHLEN
1269fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States #define	DFS_COMMENT_MAX			256
1279fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States #define	DFS_SRVNAME_MAX			MAXNAMELEN
1289fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 
1299fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States #define	DFS_REPARSE_SVCTYPE		"SMB-DFS"
1309fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 
1319fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States #define	DFS_OBJECT_LINK		1
1329fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States #define	DFS_OBJECT_ROOT		2
1339fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States #define	DFS_OBJECT_ANY		3
1349fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 
1359fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States /*
1369fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  * Referral Request Types
137*a90cf9f2SGordon Ross  * See also: dfs_reftype_xdr()
1389fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  */
1399fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States typedef enum {
1409fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 	DFS_REFERRAL_INVALID = 0,
1419fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 	DFS_REFERRAL_DOMAIN,
1429fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 	DFS_REFERRAL_DC,
1439fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 	DFS_REFERRAL_SYSVOL,
1449fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 	DFS_REFERRAL_ROOT,
1459fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 	DFS_REFERRAL_LINK
1469fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States } dfs_reftype_t;
1479fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 
148*a90cf9f2SGordon Ross /*
149*a90cf9f2SGordon Ross  * See also: dfs_target_priority_xdr()
150*a90cf9f2SGordon Ross  */
1519fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States typedef struct dfs_target_priority {
1529fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 	dfs_target_pclass_t	p_class;
1539fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 	uint16_t		p_rank;
1549fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States } dfs_target_priority_t;
1559fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 
1569fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States /*
1579fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  * t_server	a null-terminated Unicode string that specifies the DFS link
1589fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  *		target host name.
1599fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  *
1609fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  * t_share	a null-terminated Unicode DFS link target share name string.
1619fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  *		This may also be a share name with a path relative to the share,
1629fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  *		for example, "share1\mydir1\mydir2". When specified this way,
1639fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  *		each pathname component MUST be a directory
1649fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  *
1659fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  * t_state	valid states are online/offline (see DFS_STORAGE_STATE_XXX in
1669fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  * 		lmdfs.h)
1679fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  *
1689fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  * t_priority	priority class and rank
169*a90cf9f2SGordon Ross  *
170*a90cf9f2SGordon Ross  * See also: dfs_target_xdr()
1719fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States  */
1729fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States typedef struct dfs_target {
1739fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 	char			t_server[DFS_SRVNAME_MAX];
1749fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 	char			t_share[DFS_NAME_MAX];
1759fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 	uint32_t		t_state;
1769fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 	dfs_target_priority_t	t_priority;
1779fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States } dfs_target_t;
1789fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 
179*a90cf9f2SGordon Ross /*
180*a90cf9f2SGordon Ross  * DFS referral response
181*a90cf9f2SGordon Ross  * See also: dfs_info_xdr()
182*a90cf9f2SGordon Ross  */
1839fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States typedef struct dfs_info {
1849fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 	char		i_uncpath[DFS_PATH_MAX];
1859fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 	char		i_comment[DFS_COMMENT_MAX];
1869fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 	char		i_guid[UUID_PRINTABLE_STRING_LENGTH];
1879fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 	uint32_t	i_state;
1889fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 	uint32_t	i_timeout;
189cb174861Sjoyce mcintosh 	uint32_t	i_propflag_mask;
1909fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 	uint32_t	i_propflags;
1919fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 	uint32_t	i_type;
1929fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 	uint32_t	i_ntargets;
1939fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 	dfs_target_t	*i_targets;
194cb174861Sjoyce mcintosh 	uint32_t	i_flavor;
1959fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States } dfs_info_t;
1969fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 
1979fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States #ifdef __cplusplus
1989fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States }
1999fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States #endif
2009fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 
2019fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 
2029fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States #endif /* _SMB_DFS_H */
203