1 /*
2  * CDDL HEADER START
3  *
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.
7  *
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.
12  *
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]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
23  */
24 
25 #ifndef	_DFS_H
26 #define	_DFS_H
27 
28 #include <priv.h>
29 #include <smbsrv/smb_dfs.h>
30 #include <smbsrv/libsmb.h>
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 /*
37  * Status returned by dfs_link_stat()
38  */
39 #define	DFS_STAT_UNKNOWN	0
40 #define	DFS_STAT_NOTFOUND	1
41 #define	DFS_STAT_NOTLINK	2
42 #define	DFS_STAT_ISREPARSE	3
43 #define	DFS_STAT_ISDFS		4
44 
45 typedef struct dfs_path {
46 	char		p_fspath[DFS_PATH_MAX];
47 	smb_unc_t	p_unc;
48 	uint32_t	p_type;
49 } dfs_path_t;
50 
51 typedef struct dfs_nscnode {
52 	char		nsc_uncpath[DFS_PATH_MAX];
53 	char		nsc_fspath[DFS_PATH_MAX];
54 	uint32_t	nsc_type;
55 } dfs_nscnode_t;
56 
57 uint32_t dfs_namespace_count(void);
58 uint32_t dfs_namespace_path(const char *, char *, size_t);
59 uint32_t dfs_namespace_add(const char *, const char *);
60 uint32_t dfs_namespace_remove(const char *);
61 void dfs_namespace_load(const char *);
62 void dfs_namespace_unload(const char *);
63 uint32_t dfs_namespace_getflavor(const char *);
64 
65 uint32_t dfs_root_getinfo(const char *, dfs_info_t *, uint32_t);
66 uint32_t dfs_root_setinfo(const char *, dfs_info_t *, uint32_t);
67 
68 uint32_t dfs_link_add(const char *, const char *, const char *,
69     const char *, uint32_t, boolean_t *);
70 uint32_t dfs_link_remove(const char *, const char *, const char *);
71 uint32_t dfs_link_stat(const char *, uint32_t *);
72 uint32_t dfs_link_getinfo(const char *, dfs_info_t *, uint32_t);
73 uint32_t dfs_link_setinfo(const char *, dfs_info_t *, uint32_t);
74 
75 uint32_t dfs_path_parse(dfs_path_t *, const char *, uint32_t);
76 void dfs_path_free(dfs_path_t *);
77 
78 void dfs_cache_iterinit(smb_cache_cursor_t *);
79 boolean_t dfs_cache_iterate(smb_cache_cursor_t *, dfs_nscnode_t *);
80 uint32_t dfs_cache_add_byname(const char *, const char *, uint32_t);
81 void dfs_cache_remove(const char *, const char  *);
82 uint32_t dfs_cache_getinfo(dfs_nscnode_t *, dfs_info_t *, uint32_t);
83 uint32_t dfs_cache_num(void);
84 
85 void dfs_init(void);
86 void dfs_fini(void);
87 void dfs_setpriv(priv_op_t);
88 
89 void dfs_info_trace(const char *, dfs_info_t *);
90 
91 #ifdef	__cplusplus
92 }
93 #endif
94 
95 #endif	/* _DFS_H */
96