2 Unix SMB/CIFS implementation.
3 NTVFS structures and defines
4 Copyright (C) Andrew Tridgell 2003
5 Copyright (C) Stefan Metzmacher 2004
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 /* modules can use the following to determine if the interface has changed */
23 /* version 1 -> 0 - make module stacking easier -- metze */
24 #define NTVFS_INTERFACE_VERSION 0
26 struct ntvfs_module_context;
28 /* each backend has to be one one of the following 3 basic types. In
29 * earlier versions of Samba backends needed to handle all types, now
30 * we implement them separately. */
31 enum ntvfs_type {NTVFS_DISK, NTVFS_PRINT, NTVFS_IPC};
33 /* the ntvfs operations structure - contains function pointers to
34 the backend implementations of each operation */
40 NTSTATUS (*connect)(struct ntvfs_module_context *ntvfs,
41 struct smbsrv_request *req, const char *sharename);
42 NTSTATUS (*disconnect)(struct ntvfs_module_context *ntvfs,
43 struct smbsrv_tcon *tcon);
46 NTSTATUS (*unlink)(struct ntvfs_module_context *ntvfs,
47 struct smbsrv_request *req, struct smb_unlink *unl);
48 NTSTATUS (*chkpath)(struct ntvfs_module_context *ntvfs,
49 struct smbsrv_request *req, struct smb_chkpath *cp);
50 NTSTATUS (*qpathinfo)(struct ntvfs_module_context *ntvfs,
51 struct smbsrv_request *req, union smb_fileinfo *st);
52 NTSTATUS (*setpathinfo)(struct ntvfs_module_context *ntvfs,
53 struct smbsrv_request *req, union smb_setfileinfo *st);
54 NTSTATUS (*open)(struct ntvfs_module_context *ntvfs,
55 struct smbsrv_request *req, union smb_open *oi);
56 NTSTATUS (*mkdir)(struct ntvfs_module_context *ntvfs,
57 struct smbsrv_request *req, union smb_mkdir *md);
58 NTSTATUS (*rmdir)(struct ntvfs_module_context *ntvfs,
59 struct smbsrv_request *req, struct smb_rmdir *rd);
60 NTSTATUS (*rename)(struct ntvfs_module_context *ntvfs,
61 struct smbsrv_request *req, union smb_rename *ren);
62 NTSTATUS (*copy)(struct ntvfs_module_context *ntvfs,
63 struct smbsrv_request *req, struct smb_copy *cp);
65 /* directory search */
66 NTSTATUS (*search_first)(struct ntvfs_module_context *ntvfs,
67 struct smbsrv_request *req, union smb_search_first *io, void *private,
68 BOOL (*callback)(void *private, union smb_search_data *file));
69 NTSTATUS (*search_next)(struct ntvfs_module_context *ntvfs,
70 struct smbsrv_request *req, union smb_search_next *io, void *private,
71 BOOL (*callback)(void *private, union smb_search_data *file));
72 NTSTATUS (*search_close)(struct ntvfs_module_context *ntvfs,
73 struct smbsrv_request *req, union smb_search_close *io);
75 /* operations on open files */
76 NTSTATUS (*ioctl)(struct ntvfs_module_context *ntvfs,
77 struct smbsrv_request *req, union smb_ioctl *io);
78 NTSTATUS (*read)(struct ntvfs_module_context *ntvfs,
79 struct smbsrv_request *req, union smb_read *io);
80 NTSTATUS (*write)(struct ntvfs_module_context *ntvfs,
81 struct smbsrv_request *req, union smb_write *io);
82 NTSTATUS (*seek)(struct ntvfs_module_context *ntvfs,
83 struct smbsrv_request *req, struct smb_seek *io);
84 NTSTATUS (*flush)(struct ntvfs_module_context *ntvfs,
85 struct smbsrv_request *req, struct smb_flush *flush);
86 NTSTATUS (*close)(struct ntvfs_module_context *ntvfs,
87 struct smbsrv_request *req, union smb_close *io);
88 NTSTATUS (*exit)(struct ntvfs_module_context *ntvfs,
89 struct smbsrv_request *req);
90 NTSTATUS (*lock)(struct ntvfs_module_context *ntvfs,
91 struct smbsrv_request *req, union smb_lock *lck);
92 NTSTATUS (*setfileinfo)(struct ntvfs_module_context *ntvfs,
93 struct smbsrv_request *req, union smb_setfileinfo *info);
94 NTSTATUS (*qfileinfo)(struct ntvfs_module_context *ntvfs,
95 struct smbsrv_request *req, union smb_fileinfo *info);
97 /* filesystem operations */
98 NTSTATUS (*fsinfo)(struct ntvfs_module_context *ntvfs,
99 struct smbsrv_request *req, union smb_fsinfo *fs);
101 /* printing specific operations */
102 NTSTATUS (*lpq)(struct ntvfs_module_context *ntvfs,
103 struct smbsrv_request *req, union smb_lpq *lpq);
105 /* trans2 interface - only used by CIFS backend to prover complete passthru for testing */
106 NTSTATUS (*trans2)(struct ntvfs_module_context *ntvfs,
107 struct smbsrv_request *req, struct smb_trans2 *trans2);
109 /* trans interface - used by IPC backend for pipes and RAP calls */
110 NTSTATUS (*trans)(struct ntvfs_module_context *ntvfs,
111 struct smbsrv_request *req, struct smb_trans2 *trans);
113 /* logoff - called when a vuid is closed */
114 NTSTATUS (*logoff)(struct ntvfs_module_context *ntvfs,
115 struct smbsrv_request *req);
117 /* async_setup - called when a backend is processing a async request */
118 NTSTATUS (*async_setup)(struct ntvfs_module_context *ntvfs,
119 struct smbsrv_request *req, void *private);
122 struct ntvfs_module_context {
123 struct ntvfs_module_context *prev, *next;
125 const struct ntvfs_ops *ops;
129 struct ntvfs_context {
130 enum ntvfs_type type;
132 * linked list of module contexts
134 struct ntvfs_module_context *modules;
137 /* this structure is used by backends to determine the size of some critical types */
138 struct ntvfs_critical_sizes {
139 int interface_version;
140 int sizeof_ntvfs_context;
141 int sizeof_ntvfs_module_context;
142 int sizeof_ntvfs_ops;
143 int sizeof_smbsrv_tcon;
144 int sizeof_smbsrv_request;