xref: /illumos-gate/usr/src/lib/smbsrv/libmlsvc/common/dfs.h (revision 3e95bd4ab92abca814bd28e854607d1975c7dc88)
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 2010 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef	_DFS_H
27 #define	_DFS_H
28 
29 #include <priv.h>
30 #include <smbsrv/smb_dfs.h>
31 #include <smbsrv/libsmb.h>
32 
33 #ifdef	__cplusplus
34 extern "C" {
35 #endif
36 
37 /*
38  * Status returned by dfs_link_stat()
39  */
40 #define	DFS_STAT_UNKNOWN	0
41 #define	DFS_STAT_NOTFOUND	1
42 #define	DFS_STAT_NOTLINK	2
43 #define	DFS_STAT_ISREPARSE	3
44 #define	DFS_STAT_ISDFS		4
45 
46 typedef struct dfs_path {
47 	char		p_fspath[DFS_PATH_MAX];
48 	smb_unc_t	p_unc;
49 	uint32_t	p_type;
50 } dfs_path_t;
51 
52 typedef struct dfs_nscnode {
53 	char		nsc_uncpath[DFS_PATH_MAX];
54 	char		nsc_fspath[DFS_PATH_MAX];
55 	uint32_t	nsc_type;
56 } dfs_nscnode_t;
57 
58 uint32_t dfs_namespace_count(void);
59 uint32_t dfs_namespace_path(const char *, char *, size_t);
60 uint32_t dfs_namespace_add(const char *, const char *);
61 uint32_t dfs_namespace_remove(const char *);
62 void dfs_namespace_load(const char *);
63 void dfs_namespace_unload(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