Davix::DavPosix Class Reference

POSIX-like API of Davix. More...

#include <davposix.hpp>

Inheritance diagram for Davix::DavPosix:
NonCopyable

Public Member Functions

 DavPosix (Context *handle)
 default constructor
int stat (const RequestParams *params, const std::string &str, struct stat *st, DavixError **err)
 POSIX-like stat() call.
int stat64 (const RequestParams *params, const std::string &url, StatInfo *st, DavixError **err)
 64bits version of /ref Davix::DavPosix::stat.
int get_quota (const RequestParams *params, const std::string &url, QuotaInfo *st, DavixError **err)
 get_quota gives quota information on a directory
DAVIX_DIR * opendir (const RequestParams *params, const std::string &url, DavixError **err)
 open a directory for listing.
struct dirent * readdir (DAVIX_DIR *dir, DavixError **err)
 read an entry directory.
int closedir (DAVIX_DIR *d, DavixError **err)
 close a directory handle
DAVIX_DIR * opendirpp (const RequestParams *params, const std::string &url, DavixError **err)
 open a directory for listing with per entry meta-data information.
struct dirent * readdirpp (DAVIX_DIR *dir, struct stat *st, DavixError **err)
 execute an readdirpp function
int closedirpp (DAVIX_DIR *d, DavixError **err)
 close a directory handle
int mkdir (const RequestParams *params, const std::string &url, mode_t right, DavixError **err)
 execute a mkdir function with Webdav.
int rename (const RequestParams *params, const std::string &source_url, const std::string &target_url, DavixError **err)
 rename a target file or collection.
int unlink (const RequestParams *params, const std::string &url, DavixError **err)
 execute a remove file operation.
int rmdir (const RequestParams *params, const std::string &url, DavixError **err)
 execute a remove directory operation.
DAVIX_FD * open (const RequestParams *params, const std::string &url, int flags, DavixError **err)
 open a file for read/write operation in a POSIX-like approach.
ssize_t read (DAVIX_FD *fd, void *buffer, size_t count, DavixError **err)
 read a file in a POSIX-like approach with HTTP(S).
ssize_t pread (DAVIX_FD *fd, void *buffer, size_t count, off_t offset, DavixError **err)
 do a partial read of a file in a POSIX-like approach with HTTP(S).
dav_ssize_t pread64 (DAVIX_FD *fd, void *buffer, dav_size_t count, dav_off_t offset, DavixError **err)
 64bits version of /ref Davix::DavPosix::pread
ssize_t pwrite (DAVIX_FD *fd, const void *buffer, size_t count, off_t offset, DavixError **err)
 do a partial write of a file in a POSIX-like approach with HTTP(S).
dav_ssize_t pwrite64 (DAVIX_FD *fd, const void *buffer, dav_size_t count, dav_off_t offset, DavixError **err)
 64bits version of /ref Davix::DavPosix::pwrite
dav_ssize_t preadVec (DAVIX_FD *fd, const DavIOVecInput *input_vec, DavIOVecOuput *output_vec, dav_size_t count_vec, DavixError **err)
 pread_vec a file in a POSIX-like approach with HTTP(S).
ssize_t write (DAVIX_FD *fd, const void *buf, size_t count, DavixError **err)
 write a file in a POSIX-like approach with HTTP(S).
off_t lseek (DAVIX_FD *fd, off_t offset, int flags, DavixError **err)
 move the cursor a davix file with HTTP(S).
dav_off_t lseek64 (DAVIX_FD *fd, dav_off_t, int flags, DavixError **err)
 64bits versions of /ref Davix::DavixPosix::lseek
int close (DAVIX_FD *fd, DavixError **err)
 close a existing file descriptor.
void fadvise (DAVIX_FD *fd, dav_off_t offset, dav_size_t len, advise_t advice)
 give advise about next file operation

Detailed Description

POSIX-like API of Davix.

DavPosix offers a POSIX-like API for HTTP/WebDav file operations.

POSIX API can be used for convenience when porting application. to a POSIX like interface.

DavPosix and all associated method are Thread safe.


Constructor & Destructor Documentation

Davix::DavPosix::DavPosix ( Context handle  ) 

default constructor

Parameters:
handle example_code_snippets.cpp DavPosix

Member Function Documentation

int Davix::DavPosix::close ( DAVIX_FD *  fd,
DavixError **  err 
)

close a existing file descriptor.

Note : all file descriptors MUST be closed before the destruction of the parent davix context

Parameters:
fd davix file descriptor
err Davix Error report
Returns:
0 if success, negative value if error

example_code_snippets.cpp close

int Davix::DavPosix::closedir ( DAVIX_DIR *  d,
DavixError **  err 
)

close a directory handle

Parameters:
d directory handle to close
err Davix error report system
Returns:
0 if success else a negative value and err is set.

example_code_snippets.cpp opendir

int Davix::DavPosix::closedirpp ( DAVIX_DIR *  d,
DavixError **  err 
)

close a directory handle

Parameters:
d directory handle to close
err Davix error report system
Returns:
0 if success else a negative value and err is set.

example_code_snippets.cpp opendirpp

void Davix::DavPosix::fadvise ( DAVIX_FD *  fd,
dav_off_t  offset,
dav_size_t  len,
advise_t  advice 
)

give advise about next file operation

similar to posix_fadvise, allow I/O optimizations non-blocking asynchronous function

Parameters:
fd Davix file descriptor
offset offset of the next chunk to read
len size of the next chunk to read
advise type of pattern for I/O : sequential, random
off_t Davix::DavPosix::lseek ( DAVIX_FD *  fd,
off_t  offset,
int  flags,
DavixError **  err 
)

move the cursor a davix file with HTTP(S).

Behavior similar to the POSIX lseek function.

Parameters:
fd davix file descriptor
offset offset in byte inside the file
flags lseek flags, similar to the lseek function
err Davix Error report
Returns:
the offset position or (off_t)-1 if error occurs

example_code_snippets.cpp lseek

int Davix::DavPosix::mkdir ( const RequestParams params,
const std::string &  url,
mode_t  right,
DavixError **  err 
)

execute a mkdir function with Webdav.

Behavior similar to the POSIX mkdir function.

Warning:
dependening of the server, implementation, mode_t parameter can be ignored
Parameters:
params request options, can be NULL
url url of the directory to create
right default mode of the directory ( ignored for now )
err Davix error report system
Returns:
0 if success else a negative value and err is set.

example_code_snippets.cpp mkdir

DAVIX_FD* Davix::DavPosix::open ( const RequestParams params,
const std::string &  url,
int  flags,
DavixError **  err 
)

open a file for read/write operation in a POSIX-like approach.

Behavior similar to the POSIX open function

This operation is supported on plain HTTP servers.

Parameters:
params request options, can be NULL
url url of the HTTP file to open
flags open flags, similar to the POSIX function open
err Davix Error report
Returns:
Davix file descriptor in case of success, or NULL if an error occures.

example_code_snippets.cpp open

DAVIX_DIR* Davix::DavPosix::opendir ( const RequestParams params,
const std::string &  url,
DavixError **  err 
)

open a directory for listing.

behavior similar to the POSIX opendir function.

Supported by Webdav.

Parameters:
params request options, can be NULL
url url of the directory to list
err Davix error report system
Returns:
DAVIX_DIR davix readdir handle, NULL if error

example_code_snippets.cpp opendir

DAVIX_DIR* Davix::DavPosix::opendirpp ( const RequestParams params,
const std::string &  url,
DavixError **  err 
)

open a directory for listing with per entry meta-data information.

Similar to Davix::DavPosix::opendir but provide stat() information for each entry Supported by Webdav.

Parameters:
params request options, can be NULL
url url of the directory to list
err Davix error report system
Returns:
DAVIX_DIR davix readdir handle or NULL if error, in this case err is set.

example_code_snippets.cpp opendirpp

ssize_t Davix::DavPosix::pread ( DAVIX_FD *  fd,
void *  buffer,
size_t  count,
off_t  offset,
DavixError **  err 
)

do a partial read of a file in a POSIX-like approach with HTTP(S).

Behavior similar to the POSIX pread function.

Parameters:
fd davix file descriptor
buffer buffer to fill
count maximum number of bytes to read
offset offset to use
err Davix Error report
Returns:
the size of data or a negative value if an error occured

example_code_snippets.cpp pread

dav_ssize_t Davix::DavPosix::preadVec ( DAVIX_FD *  fd,
const DavIOVecInput input_vec,
DavIOVecOuput output_vec,
dav_size_t  count_vec,
DavixError **  err 
)

pread_vec a file in a POSIX-like approach with HTTP(S).

Vector read operation. Able to do several read operations in one single request.

NOTE: The return code is the number of data bytes received from the server, not the total number of bytes written into the buffers. The two might not be equal if range coalescing is performed. Check diov_size of the output vector to make sure the buffers contain the expected number of bytes.

Parameters:
fd davix file descriptor
input_vec input vectors, parameters
output_vec output vectors, results
count_vec number of vector struct
err Davix Error report
Returns:
total number of bytes read, or -1 if error occurs.

example_code_snippets.cpp preadVec

ssize_t Davix::DavPosix::pwrite ( DAVIX_FD *  fd,
const void *  buffer,
size_t  count,
off_t  offset,
DavixError **  err 
)

do a partial write of a file in a POSIX-like approach with HTTP(S).

Behavior similar to the POSIX pwrite function

Parameters:
fd davix file descriptor
buffer buffer to fill
count maximum number of bytes to write
offset offset to use
err Davix Error report
Returns:
the size of data written or a negative value if an error occured

example_code_snippets.cpp pwrite

ssize_t Davix::DavPosix::read ( DAVIX_FD *  fd,
void *  buffer,
size_t  count,
DavixError **  err 
)

read a file in a POSIX-like approach with HTTP(S).

Behavior similar to the POSIX read function

Parameters:
fd davix file descriptor
buffer buffer to fill
count maximum number of bytes to read
err Davix Error report
Returns:
the size of data or a negative value if an error occured

example_code_snippets.cpp read

struct dirent* Davix::DavPosix::readdir ( DAVIX_DIR *  dir,
DavixError **  err 
) [read]

read an entry directory.

Behavior similar to the POSIX readdir function.

Parameters:
dir directory handle
err Davix Error report
Returns:
dirent struct if success, or NULL if error

example_code_snippets.cpp opendir

struct dirent* Davix::DavPosix::readdirpp ( DAVIX_DIR *  dir,
struct stat *  st,
DavixError **  err 
) [read]

execute an readdirpp function

Similar to Davix::DavPosix::readdir but provide stat() information for each entry.

Supported by Webdav.

Parameters:
dir directory handle
st struct to fill
err Davix Error report
Returns:
dirent struct if success, or NULL if error

example_code_snippets.cpp opendirpp

int Davix::DavPosix::rename ( const RequestParams params,
const std::string &  source_url,
const std::string &  target_url,
DavixError **  err 
)

rename a target file or collection.

Behavior similar to the POSIX rename function.

Parameters:
params request options, can be NULL
source_url old url of the resource
target_url new url of the resource
err Davix error report system
Returns:
0 if success else a negative value and err is set.

example_code_snippets.cpp rename

int Davix::DavPosix::rmdir ( const RequestParams params,
const std::string &  url,
DavixError **  err 
)

execute a remove directory operation.

Behavior similar to the POSIX rmdir function

Parameters:
params request options, can be NULL
url directory to delete
err Davix error report system
Returns:
0 if success else a negative value and err is set.

example_code_snippets.cpp rmdir

int Davix::DavPosix::stat ( const RequestParams params,
const std::string &  str,
struct stat *  st,
DavixError **  err 
)

POSIX-like stat() call.

Behavior similar to the POSIX stat function, see man 3 stat.

Supported by Webdav, Http and S3.

Depending of the protocol, some struct stat field can be ignored.

Parameters:
params request options, can be NULL
str string url
st stat struct to fill
err Davix error report system
Returns:
0 if success, negative value if error

example_code_snippets.cpp stat

int Davix::DavPosix::stat64 ( const RequestParams params,
const std::string &  url,
StatInfo st,
DavixError **  err 
)

64bits version of /ref Davix::DavPosix::stat.

example_code_snippets.cpp stat

int Davix::DavPosix::unlink ( const RequestParams params,
const std::string &  url,
DavixError **  err 
)

execute a remove file operation.

Behavior similar to the POSIX unlink function.

Parameters:
params request options, can be NULL
url file to delete
err Davix error report system
Returns:
0 if success else a negative value and err is set.

example_code_snippets.cpp unlink

ssize_t Davix::DavPosix::write ( DAVIX_FD *  fd,
const void *  buf,
size_t  count,
DavixError **  err 
)

write a file in a POSIX-like approach with HTTP(S).

Behavior similar to the POSIX write function.

Parameters:
fd davix file descriptor
buf buffer with the write content
count number of bytes to write
err Davix Error report
Returns:
the size of the written data or a negative value if an error occured

example_code_snippets.cpp write


The documentation for this class was generated from the following file:

Generated on 18 Aug 2016 for davix by  doxygen 1.6.1