Barracuda Application Server C/C++ Reference
Native APIs, integration guides, and platform interfaces
WebDAV.h File Reference
#include <SingleList.h>
#include "HttpUpload.h"
Include dependency graph for WebDAV.h:

Go to the source code of this file.

Classes

struct  WebDAV
 The WebDAV plugin implements WebDAV version 1, as specified in RFC2518 and part of the locking in DAV 2, making it interoperate with "drive" clients requiring locking. More...
 
struct  WebDAVLockMgr
 Input/output record for WebDAV_lockmgr(). More...
 

Macros

#define WebDAV_setAuthenticator(o, authenticator, realm)    HttpDir_setAuthenticator((HttpDir*)o, authenticator, realm)
 Configure inherited authentication and authorization. More...
 

Typedefs

typedef WebDAV WebDAV
 The WebDAV plugin implements WebDAV version 1, as specified in RFC2518 and part of the locking in DAV 2, making it interoperate with "drive" clients requiring locking. More...
 

Functions

BA_API void WebDAV_constructor (WebDAV *o, IoIntf *io, int maxUploads, const char *dirName, const char *lockDir, U32 maxNumberOfLocks, AllocatorIntf *alloc, S8 priority)
 Create a WebDAV instance. More...
 
BA_API void WebDAV_destructor (WebDAV *o)
 Terminate the WebDAV object. More...
 
BA_API int WebDAV_lockmgr (WebDAV *o, WebDAVLockMgr *mgr)
 Manage WebDAV locks without an HTTP request. More...
 

Macro Definition Documentation

◆ WebDAV_setAuthenticator

#define WebDAV_setAuthenticator (   o,
  authenticator,
  realm 
)     HttpDir_setAuthenticator((HttpDir*)o, authenticator, realm)

Configure inherited authentication and authorization.

Parameters
oRequired initialized WebDAV instance.
authenticatorBorrowed AuthenticatorIntf pointer, or NULL.
realmBorrowed AuthorizerIntf pointer, or NULL; the historical macro name does not describe a realm string. See HttpDir::setAuthenticator.

Typedef Documentation

◆ WebDAV

typedef WebDAV WebDAV

The WebDAV plugin implements WebDAV version 1, as specified in RFC2518 and part of the locking in DAV 2, making it interoperate with "drive" clients requiring locking.

The purpose of the WebDAV plugin is to make it possible to use the server as a remote disk. The locking in DAV 2 is partly implemented in order to make it interoperate with "drive" clients requiring locking. A "drive" client such as davfs2 can then be mounted as a drive.

Some filesystem clients require locking for writable access. The WebDAV plugin needs to store the locking information in files on the file system. The "lockDir" argument in the constructor must point to an existing directory or to an existing parent directory. The WebDAV plugin attempts to create this directory if it does not exist and marks it as hidden for file systems supporting hidden files.

Not all clients require locking. For example, Web Folders work without locking. You can set the "lockDir" argument to NULL if you do not want to support the simple locking implemented in the WebDAV plugin. As an example, Mac OS X will mount the drive as read only.

The simple locking implemented in the WebDAV plugin also requires a dynamic object per active lock. The maxNumberOfLocks constructor argument controls how many concurrent locks the server allows. For example, this can be set to 2-4 for a standard embedded system.

The WebDAV plugin creates a subdirectory ".DAV" if a client sends a "set <a href="http://greenbytes.de/tech/webdav/rfc2518.html#rfc.iref.8"> dead property</a> request". This sub directory contains XML files for storing the dead properties. The .DAV directory is only created if the client creates dead properties. The .DAV directory will be marked as hidden for file systems supporting hidden files.

See also
HttpResMgr

Function Documentation

◆ WebDAV_constructor()

BA_API void WebDAV_constructor ( WebDAV o,
IoIntf io,
int  maxUploads,
const char *  dirName,
const char *  lockDir,
U32  maxNumberOfLocks,
AllocatorIntf alloc,
S8  priority 
)

Create a WebDAV instance.

You can create several instances of this class and install several instances into the virtual file system.

Parameters
ioRequired borrowed IoIntf implementation, which must outlive the WebDAV instance and all active transfers. For example, DiskIo. The WebDAV plugin can also work with "read only" IoIntf implementations such as the ZipIo. The WebDAV plugin allows method OPTIONS, HEAD, GET, and PROPFIND for a "read only" IoIntf implementation.
maxUploadsMaximum concurrent asynchronous uploads. Values less than or equal to zero are coerced to 1, matching HttpResMgr. This limits simultaneous requests, not uploaded bytes. It does not limit downloads.
dirNameBorrowed HttpDir name; retain its storage while installed. NULL creates an unnamed directory according to HttpDir rules.
lockDirNUL-terminated lock-directory path relative to io, copied during construction. NULL disables locking. A missing directory is created when possible; read-only filesystems disable locking. Setup failure also leaves locking unavailable; this void constructor does not return that error.
maxNumberOfLocksMaximum simultaneous locks, default 10. Zero disables locking. Requires a usable lockDir.
allocBorrowed allocator for internal allocation/reallocation/free; NULL selects AllocatorIntf_getDefault(). Retain it through destruction.
prioritySigned 8-bit HttpDir priority, default zero.
oRequired storage to initialize.

◆ WebDAV_destructor()

BA_API void WebDAV_destructor ( WebDAV o)

Terminate the WebDAV object.

Please note that any upload in progress will be aborted. Detach the directory and stop active users before destruction. The borrowed IoIntf and allocator are not freed.

Parameters
oRequired initialized WebDAV instance.

◆ WebDAV_lockmgr()

BA_API int WebDAV_lockmgr ( WebDAV o,
WebDAVLockMgr mgr 
)

Manage WebDAV locks without an HTTP request.

Parameters
oRequired initialized WebDAV instance.
mgrRequired input/output record; initialize the fields for its action.
Returns
Action 0: 1 if locked, 0 otherwise. Other actions: 0 when handled. Errors: -1 locking disabled, -2 already locked, -3 lock not found, -10 creation/general failure or unknown action.
Note
Action 1 does not report owner-file write/close errors. Action 3 can return zero with fp=NULL; always test fp before reading. No ownership of input strings transfers, and other output fields are not reset on error.