2006-01-31 09:09:18 +03:00
/*
CIFSDD - dd for SMB .
Declarations and administrivia .
Copyright ( C ) James Peach 2005 - 2006
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
2007-07-10 06:07:03 +04:00
the Free Software Foundation ; either version 3 of the License , or
2006-01-31 09:09:18 +03:00
( 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
2007-07-10 06:07:03 +04:00
along with this program . If not , see < http : //www.gnu.org/licenses/>.
2006-01-31 09:09:18 +03:00
*/
extern const char * const PROGNAME ;
enum argtype
{
ARG_NUMERIC ,
ARG_SIZE ,
ARG_PATHNAME ,
ARG_BOOL ,
} ;
struct argdef
{
const char * arg_name ;
enum argtype arg_type ;
const char * arg_help ;
union
{
2007-08-27 22:10:19 +04:00
bool bval ;
2006-01-31 09:09:18 +03:00
uint64_t nval ;
const char * pval ;
} arg_val ;
} ;
int set_arg_argv ( const char * argv ) ;
void set_arg_val ( const char * name , . . . ) ;
2007-08-27 22:10:19 +04:00
bool check_arg_bool ( const char * name ) ;
2006-01-31 09:09:18 +03:00
uint64_t check_arg_numeric ( const char * name ) ;
const char * check_arg_pathname ( const char * name ) ;
2007-08-27 22:10:19 +04:00
typedef bool ( * dd_seek_func ) ( void * handle , uint64_t offset ) ;
typedef bool ( * dd_read_func ) ( void * handle , uint8_t * buf ,
2006-01-31 09:09:18 +03:00
uint64_t wanted , uint64_t * actual ) ;
2007-08-27 22:10:19 +04:00
typedef bool ( * dd_write_func ) ( void * handle , uint8_t * buf ,
2006-01-31 09:09:18 +03:00
uint64_t wanted , uint64_t * actual ) ;
struct dd_stats_record
{
struct
{
uint64_t fblocks ; /* Full blocks. */
uint64_t pblocks ; /* Partial blocks. */
uint64_t bytes ; /* Total bytes read. */
} in ;
struct
{
uint64_t fblocks ; /* Full blocks. */
uint64_t pblocks ; /* Partial blocks. */
uint64_t bytes ; /* Total bytes written. */
} out ;
} ;
extern struct dd_stats_record dd_stats ;
struct dd_iohandle
{
dd_seek_func io_seek ;
dd_read_func io_read ;
dd_write_func io_write ;
int io_flags ;
} ;
# define DD_END_OF_FILE 0x10000000
# define DD_DIRECT_IO 0x00000001
# define DD_SYNC_IO 0x00000002
# define DD_WRITE 0x00000004
# define DD_OPLOCK 0x00000008
2008-01-04 02:22:12 +03:00
struct smbcli_options ;
2008-09-30 05:07:08 +04:00
struct smbcli_session_options ;
2008-12-29 22:24:57 +03:00
struct tevent_context ;
2008-01-04 02:22:12 +03:00
2008-01-03 03:39:01 +03:00
struct dd_iohandle * dd_open_path ( struct resolve_context * resolve_ctx ,
2008-12-29 22:24:57 +03:00
struct tevent_context * ev ,
2008-01-03 03:39:01 +03:00
const char * path ,
2007-12-12 04:15:29 +03:00
const char * * ports ,
2008-01-04 02:22:12 +03:00
uint64_t io_size , int options ,
2008-11-02 04:50:22 +03:00
const char * socket_options ,
2008-09-30 05:07:08 +04:00
struct smbcli_options * smb_options ,
2008-10-24 15:13:27 +04:00
struct smbcli_session_options * smb_session_options ,
2008-11-02 18:07:28 +03:00
struct smb_iconv_convenience * iconv_convenience ,
struct gensec_settings * gensec_settings ) ;
2007-08-27 22:10:19 +04:00
bool dd_fill_block ( struct dd_iohandle * h , uint8_t * buf ,
2006-02-06 07:06:55 +03:00
uint64_t * buf_size , uint64_t need_size , uint64_t block_size ) ;
2007-08-27 22:10:19 +04:00
bool dd_flush_block ( struct dd_iohandle * h , uint8_t * buf ,
2006-02-06 07:06:55 +03:00
uint64_t * buf_size , uint64_t block_size ) ;
2006-01-31 09:09:18 +03:00
/* vim: set sw=8 sts=8 ts=8 tw=79 : */