2003-08-13 01:53:07 +00:00
/*
Unix SMB / CIFS implementation .
NTVFS structures and defines
Copyright ( C ) Andrew Tridgell 2003
2004-09-29 13:17:09 +00:00
Copyright ( C ) Stefan Metzmacher 2004
2003-08-13 01:53:07 +00:00
This program is free software ; you can redistribute it and / or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation ; either version 2 of the License , or
( at your option ) any later version .
This program is distributed in the hope that it will be useful ,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
GNU General Public License for more details .
You should have received a copy of the GNU General Public License
along with this program ; if not , write to the Free Software
Foundation , Inc . , 675 Mass Ave , Cambridge , MA 0213 9 , USA .
*/
/* modules can use the following to determine if the interface has changed */
2004-09-29 13:17:09 +00:00
/* version 1 -> 0 - make module stacking easier -- metze */
# define NTVFS_INTERFACE_VERSION 0
2003-08-13 01:53:07 +00:00
2004-09-29 13:17:09 +00:00
struct ntvfs_module_context ;
2003-08-13 01:53:07 +00:00
2004-09-29 13:17:09 +00:00
/* each backend has to be one one of the following 3 basic types. In
* earlier versions of Samba backends needed to handle all types , now
* we implement them separately . */
enum ntvfs_type { NTVFS_DISK , NTVFS_PRINT , NTVFS_IPC } ;
2003-08-13 01:53:07 +00:00
/* the ntvfs operations structure - contains function pointers to
the backend implementations of each operation */
struct ntvfs_ops {
2003-11-25 03:15:26 +00:00
const char * name ;
enum ntvfs_type type ;
2003-08-13 01:53:07 +00:00
/* initial setup */
2004-09-29 13:17:09 +00:00
NTSTATUS ( * connect ) ( struct ntvfs_module_context * ntvfs ,
struct smbsrv_request * req , const char * sharename ) ;
NTSTATUS ( * disconnect ) ( struct ntvfs_module_context * ntvfs ,
struct smbsrv_tcon * tcon ) ;
2003-08-13 01:53:07 +00:00
/* path operations */
2004-09-29 13:17:09 +00:00
NTSTATUS ( * unlink ) ( struct ntvfs_module_context * ntvfs ,
struct smbsrv_request * req , struct smb_unlink * unl ) ;
NTSTATUS ( * chkpath ) ( struct ntvfs_module_context * ntvfs ,
struct smbsrv_request * req , struct smb_chkpath * cp ) ;
NTSTATUS ( * qpathinfo ) ( struct ntvfs_module_context * ntvfs ,
struct smbsrv_request * req , union smb_fileinfo * st ) ;
NTSTATUS ( * setpathinfo ) ( struct ntvfs_module_context * ntvfs ,
struct smbsrv_request * req , union smb_setfileinfo * st ) ;
2004-11-02 04:51:57 +00:00
NTSTATUS ( * openfile ) ( struct ntvfs_module_context * ntvfs ,
2004-09-29 13:17:09 +00:00
struct smbsrv_request * req , union smb_open * oi ) ;
NTSTATUS ( * mkdir ) ( struct ntvfs_module_context * ntvfs ,
struct smbsrv_request * req , union smb_mkdir * md ) ;
NTSTATUS ( * rmdir ) ( struct ntvfs_module_context * ntvfs ,
struct smbsrv_request * req , struct smb_rmdir * rd ) ;
NTSTATUS ( * rename ) ( struct ntvfs_module_context * ntvfs ,
struct smbsrv_request * req , union smb_rename * ren ) ;
NTSTATUS ( * copy ) ( struct ntvfs_module_context * ntvfs ,
struct smbsrv_request * req , struct smb_copy * cp ) ;
2003-08-13 01:53:07 +00:00
/* directory search */
2004-09-29 13:17:09 +00:00
NTSTATUS ( * search_first ) ( struct ntvfs_module_context * ntvfs ,
struct smbsrv_request * req , union smb_search_first * io , void * private ,
2003-08-13 01:53:07 +00:00
BOOL ( * callback ) ( void * private , union smb_search_data * file ) ) ;
2004-09-29 13:17:09 +00:00
NTSTATUS ( * search_next ) ( struct ntvfs_module_context * ntvfs ,
struct smbsrv_request * req , union smb_search_next * io , void * private ,
2003-08-13 01:53:07 +00:00
BOOL ( * callback ) ( void * private , union smb_search_data * file ) ) ;
2004-09-29 13:17:09 +00:00
NTSTATUS ( * search_close ) ( struct ntvfs_module_context * ntvfs ,
struct smbsrv_request * req , union smb_search_close * io ) ;
2003-08-13 01:53:07 +00:00
/* operations on open files */
2004-09-29 13:17:09 +00:00
NTSTATUS ( * ioctl ) ( struct ntvfs_module_context * ntvfs ,
struct smbsrv_request * req , union smb_ioctl * io ) ;
NTSTATUS ( * read ) ( struct ntvfs_module_context * ntvfs ,
struct smbsrv_request * req , union smb_read * io ) ;
NTSTATUS ( * write ) ( struct ntvfs_module_context * ntvfs ,
struct smbsrv_request * req , union smb_write * io ) ;
NTSTATUS ( * seek ) ( struct ntvfs_module_context * ntvfs ,
struct smbsrv_request * req , struct smb_seek * io ) ;
NTSTATUS ( * flush ) ( struct ntvfs_module_context * ntvfs ,
struct smbsrv_request * req , struct smb_flush * flush ) ;
NTSTATUS ( * close ) ( struct ntvfs_module_context * ntvfs ,
struct smbsrv_request * req , union smb_close * io ) ;
NTSTATUS ( * exit ) ( struct ntvfs_module_context * ntvfs ,
struct smbsrv_request * req ) ;
NTSTATUS ( * lock ) ( struct ntvfs_module_context * ntvfs ,
struct smbsrv_request * req , union smb_lock * lck ) ;
NTSTATUS ( * setfileinfo ) ( struct ntvfs_module_context * ntvfs ,
struct smbsrv_request * req , union smb_setfileinfo * info ) ;
NTSTATUS ( * qfileinfo ) ( struct ntvfs_module_context * ntvfs ,
struct smbsrv_request * req , union smb_fileinfo * info ) ;
2003-08-13 01:53:07 +00:00
/* filesystem operations */
2004-09-29 13:17:09 +00:00
NTSTATUS ( * fsinfo ) ( struct ntvfs_module_context * ntvfs ,
struct smbsrv_request * req , union smb_fsinfo * fs ) ;
2003-08-13 01:53:07 +00:00
/* printing specific operations */
2004-09-29 13:17:09 +00:00
NTSTATUS ( * lpq ) ( struct ntvfs_module_context * ntvfs ,
struct smbsrv_request * req , union smb_lpq * lpq ) ;
2003-08-13 01:53:07 +00:00
2003-12-11 09:07:45 +00:00
/* trans2 interface - only used by CIFS backend to prover complete passthru for testing */
2004-09-29 13:17:09 +00:00
NTSTATUS ( * trans2 ) ( struct ntvfs_module_context * ntvfs ,
struct smbsrv_request * req , struct smb_trans2 * trans2 ) ;
2003-12-11 09:07:45 +00:00
/* trans interface - used by IPC backend for pipes and RAP calls */
2004-09-29 13:17:09 +00:00
NTSTATUS ( * trans ) ( struct ntvfs_module_context * ntvfs ,
struct smbsrv_request * req , struct smb_trans2 * trans ) ;
2004-09-26 11:30:20 +00:00
/* logoff - called when a vuid is closed */
2004-09-29 13:17:09 +00:00
NTSTATUS ( * logoff ) ( struct ntvfs_module_context * ntvfs ,
2004-10-18 13:27:22 +00:00
struct smbsrv_request * req ) ;
/* async_setup - called when a backend is processing a async request */
NTSTATUS ( * async_setup ) ( struct ntvfs_module_context * ntvfs ,
struct smbsrv_request * req , void * private ) ;
2004-11-04 11:28:38 +00:00
/* cancel - cancels any pending async request */
NTSTATUS ( * cancel ) ( struct ntvfs_module_context * ntvfs ,
struct smbsrv_request * req ) ;
2003-08-13 01:53:07 +00:00
} ;
2004-09-29 13:17:09 +00:00
struct ntvfs_module_context {
struct ntvfs_module_context * prev , * next ;
void * private_data ;
const struct ntvfs_ops * ops ;
int depth ;
} ;
struct ntvfs_context {
enum ntvfs_type type ;
/*
* linked list of module contexts
*/
struct ntvfs_module_context * modules ;
} ;
2003-08-13 01:53:07 +00:00
2004-10-28 21:48:53 +00:00
/* a set of flags to control handling of request structures */
# define NTVFS_ASYNC_STATE_ASYNC (1<<1) /* the backend will answer this one later */
# define NTVFS_ASYNC_STATE_MAY_ASYNC (1<<2) /* the backend is allowed to answer async */
/* the ntvfs_async_state structure allows backend functions to
delay replying to requests . To use this , the front end must
set send_fn to a function to be called by the backend
when the reply is finally ready to be sent . The backend
must set status to the status it wants in the
reply . The backend must set the NTVFS_ASYNC_STATE_ASYNC
control_flag on the request to indicate that it wishes to
delay the reply
If NTVFS_ASYNC_STATE_MAY_ASYNC is not set then the backend cannot
ask for a delayed reply for this request
note that the private_data pointer is private to the layer which alloced this struct
*/
struct ntvfs_async_state {
struct ntvfs_async_state * prev , * next ;
/* the async handling infos */
2004-11-04 07:36:53 +00:00
uint_t state ;
2004-10-28 21:48:53 +00:00
void * private_data ;
void ( * send_fn ) ( struct smbsrv_request * ) ;
NTSTATUS status ;
/* the passthru module's per session private data */
struct ntvfs_module_context * ntvfs ;
} ;
2003-08-13 01:53:07 +00:00
/* this structure is used by backends to determine the size of some critical types */
struct ntvfs_critical_sizes {
2003-12-02 09:16:53 +00:00
int interface_version ;
2004-10-28 21:48:53 +00:00
int sizeof_ntvfs_critical_sizes ;
2004-09-29 13:17:09 +00:00
int sizeof_ntvfs_context ;
int sizeof_ntvfs_module_context ;
2003-08-13 01:53:07 +00:00
int sizeof_ntvfs_ops ;
2004-10-28 21:48:53 +00:00
int sizeof_ntvfs_async_state ;
2004-06-28 08:27:36 +00:00
int sizeof_smbsrv_tcon ;
2004-06-28 08:39:00 +00:00
int sizeof_smbsrv_request ;
2003-08-13 01:53:07 +00:00
} ;
2005-12-27 22:51:30 +00:00
# include "ntvfs/ntvfs_proto.h"