|
Barracuda Application Server C/C++ Reference
Native APIs, integration guides, and platform interfaces
|
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.
#include <WebDAV.h>

Public Member Functions | |
| WebDAV (IoIntf *io, int maxUploads, const char *dirName, const char *lockDir, U32 maxNumberOfLocks=10, AllocatorIntf *alloc=0, S8 priority=0) | |
| Create a WebDAV instance. More... | |
| ~WebDAV () | |
| Terminate the WebDAV object. More... | |
Public Member Functions inherited from HttpDir | |
| HttpDir () | |
| Constructor for creating a root dir, a root dir has no name. More... | |
| HttpDir (const char *name, S8 priority=0) | |
| Constructor for creating a sub-directory. More... | |
| ~HttpDir () | |
| Unlink this directory and notify all child pages/directories through their service callbacks with NULL request arguments. More... | |
| int | insertDir (HttpDir *dir) |
| Insert a sub-directory. More... | |
| int | insertPage (HttpPage *page) |
| Insert a page in the directory. More... | |
| HttpPage * | getFirstPage () |
| Returns the first page. More... | |
| HttpDir * | getFirstDir () |
| Returns the first sub-directory. More... | |
| HttpDir * | getDir (const char *name) |
| Returns the first directory with the name given or NULL if not found. More... | |
| HttpPage * | getPage (const char *name) |
| Returns the page with the name given or NULL if not found. More... | |
| HttpDir * | getNext () |
| Returns the next dir in the parent list. More... | |
| HttpPage * | findPage (HttpPage *iter, const char *name) |
| Searches for a page in this directory node. More... | |
| HttpDir * | createOrGet (const char *name) |
| Returns a sub-directory with the given name. More... | |
| const char * | getName () const |
| Returns the directory name. More... | |
| HttpDir * | getParent () const |
| Returns the parent directory or NULL if no parent. More... | |
| char * | makeAbsPath (const char *relPath, int relPathLen) |
| Makes an absolute path based on where the HttpDir instance is installed in the virtual file system and the provided relative path. More... | |
| char * | getRootPath () |
| Calculates the root of where the HttpDir instance is installed in the virtual file system. More... | |
| HttpDir_Service | setService (HttpDir_Service s) |
| Replace the original service function in HttpDir with your own. More... | |
| void | p403 (const char *p403) |
| Set a 403 denied request handler. More... | |
| bool | isLinked () |
| Returns true if this directory node is installed into a parent directory. More... | |
| int | unlink () |
| Unlinks/removes the directory from the parent directory. More... | |
| void | setAuthenticator (struct AuthenticatorIntf *authenticator, struct AuthorizerIntf *authorizer=0) |
| Set the optional authenticator and optional AuthorizerIntf. More... | |
| bool | authenticateAndAuthorize (HttpCommand *cmd, const char *path) |
| Authenticate and authorize the user. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from HttpDir | |
| static HttpDir * | findDir (HttpDir *iter, const char *name, unsigned int nameLen) |
| Searches for a sub-directory in this directory node. More... | |
| WebDAV::WebDAV | ( | IoIntf * | io, |
| int | maxUploads, | ||
| const char * | dirName, | ||
| const char * | lockDir, | ||
| U32 | maxNumberOfLocks = 10, |
||
| AllocatorIntf * | alloc = 0, |
||
| S8 | priority = 0 |
||
| ) |
Create a WebDAV instance.
You can create several instances of this class and install several instances into the virtual file system.
| io | Required 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. |
| maxUploads | Maximum 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. |
| dirName | Borrowed HttpDir name; retain its storage while installed. NULL creates an unnamed directory according to HttpDir rules. |
| lockDir | NUL-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. |
| maxNumberOfLocks | Maximum simultaneous locks, default 10. Zero disables locking. Requires a usable lockDir. |
| alloc | Borrowed allocator for internal allocation/reallocation/free; NULL selects AllocatorIntf_getDefault(). Retain it through destruction. |
| priority | Signed 8-bit HttpDir priority, default zero. |