src/server/public/webdav.h

changeset 107
7e81699d1f77
parent 92
382bff43c6eb
child 211
2160585200ac
--- a/src/server/public/webdav.h	Sat Oct 31 15:01:07 2015 +0100
+++ b/src/server/public/webdav.h	Sat Oct 31 16:39:12 2015 +0100
@@ -39,276 +39,6 @@
 extern "C" {
 #endif
 
-typedef struct DavCollection          DavCollection;
-    
-typedef struct PropfindResponse       PropfindResponse;
-typedef struct PersistenceManager     PersistenceManager;
-
-typedef struct PropfindRequest        PropfindRequest;
-typedef struct ProppatchRequest       ProppatchRequest;
-typedef struct DavProperty            DavProperty;
-
-typedef struct Propstat               Propstat;
-
-typedef struct XmlNs                  XmlNs;
-typedef struct XmlNsMap               XmlNsMap;
-
-typedef struct XmlData                XmlData;
-typedef struct XmlElement             XmlElement;
-
-typedef uint8_t                       xmlch_t;
-
-typedef struct UcxList                List;
-typedef struct UcxMap                 Map;
-
-typedef struct _strbuf                Buffer;
-
-struct DavCollection {
-    PersistenceManager *mgr;
-    // callbacks
-};
-
-struct PropfindRequest {
-    Session            *sn;
-    Request            *rq;
-    
-    XmlNsMap           *nsmap;
-    
-    List               *properties; /* DavProperty list, requested props */
-    int8_t             allprop;
-    int8_t             propname;
-    
-    int8_t             prop;
-    int8_t             isdir;
-    List               *notFoundProps;
-    List               *forbiddenProps;
-    PersistenceManager *persistencemgr;
-    void               *mgrdata;
-
-    char               *path;
-    char               *uri;
-
-    Buffer             *out;
-};
-
-struct ProppatchRequest {
-    Session            *sn;
-    Request            *rq;
-    
-    List               *setProps;    /* XmlElement list, set props */
-    List               *removeProps; /* DavProperty list, remove props */
-    
-    Propstat           *propstat;
-    XmlNsMap           *nsmap;
-    
-    PersistenceManager *backend;
-    
-    char               *path;
-    
-    Buffer             *out;
-};
-
-struct Propstat {
-    List           *okprop; /* properties with status 200 OK */
-    Map            *map;    /* all other properties */
-    pool_handle_t  *pool;
-};
-
-struct DavProperty {
-    XmlNs *xmlns;
-    char  *name;
-};
-
-struct XmlData {
-    XmlNsMap   *nsmap;
-    XmlElement *elm;
-};
-
-struct XmlElement {
-    XmlNs  *xmlns;
-    char   *name;
-    void   *content; /* xmlch* or UcxList* */
-    size_t ctlen;    /* content string length. If 0, content is a UcxDlist */
-};
-
-struct XmlNs {
-    char *xmlns;
-    char *prefix;
-    int  nslen;
-    int  prelen;
-};
-
-struct XmlNsMap {
-    Map           *map;
-    pool_handle_t *pool;
-    int num;
-};
-
-typedef void(*dav_propfind_begin_f)(PersistenceManager*, PropfindRequest*);
-typedef void(*dav_propfind_end_f)(PersistenceManager*, PropfindRequest*);
-typedef void(*dav_propfind_f)(PersistenceManager*,PropfindRequest*,char*);
-typedef void(*dav_proppatch_f)(PersistenceManager*,ProppatchRequest*);
-struct PersistenceManager {
-    void(*propfind_begin)(PersistenceManager *mgr, PropfindRequest *rq);
-    void(*propfind_end)(PersistenceManager *mgr, PropfindRequest *rq);
-    
-    /*
-     * void propfind(PersistenceManager *mgr, PropfindRequest *rq, char *path)
-     * 
-     * Gets all requested properties for a WebDAV resource(file). This function
-     * should add properties with dav_propfind_add_str_prop or
-     * dav_prop_add_xml_prop. Unavailable properties should be added with
-     * dav_propfind_add_prop_error
-     * 
-     * 
-     * mgr:  WebDAV Persistence Manager
-     * rq:   current PropfindRequest object
-     * path: the webdav resource path
-     */
-    void(*propfind)(PersistenceManager *mgr, PropfindRequest *rq, char *path);
-    
-    /*
-     * void proppatch(PersistenceManager *mgr, ProppatchRequest *rq)
-     * 
-     * Sets properties for a WebDAV resource. It should add all properties to
-     * the propstat object (member of the ProppatchRequest).
-     * 
-     * mgr:  WebDAV backend
-     * path: current ProppatchRequest object
-     */
-    void(*proppatch)(PersistenceManager *mgr, ProppatchRequest *rq);
-    
-    /*
-     * bool
-     * if true, some properties are get from the VFS and not from this
-     * persistence manager
-     */
-    int vfs_props;
-};
-
-void webdav_add_persistence_manager(char *name, PersistenceManager *mgr);
-
-int webdav_service(pblock *pb, Session *sn, Request *rq);
-int webdav_put(pblock *pb, Session *sn, Request *rq);
-int webdav_delete(pblock *pb, Session *sn, Request *rq);
-int webdav_mkcol(pblock *pb, Session *sn, Request *rq);
-int webdav_copy(pblock *pb, Session *sn, Request *rq);
-int webdav_move(pblock *pb, Session *sn, Request *rq);
-int webdav_propfind(pblock *pb, Session *sn, Request *rq);
-int webdav_proppatch(pblock *pb, Session *sn, Request *rq);
-
-
-/*
- * dav_propfind_add_str_prop
- * 
- * Adds a string property to the current WebDAV resource response
- */
-void dav_propfind_add_str_prop(
-        PropfindRequest *rq,
-        DavProperty* prop,
-        char *str,
-        size_t len);
-
-//void dav_propfind_add_xml_prop();
-
-/*
- * dav_propfind_add_prop_error
- * 
- * Adds a unavailable property to the response
- * 
- * rq:    propfind request object
- * prop:  unavailable property
- * error: HTTP status code
- */
-void dav_propfind_add_prop_error(
-        PropfindRequest *rq,
-        DavProperty *prop,
-        int error);
-
-
-
-/*---------------------------------- utils ----------------------------------*/
-
-/*
- * XmlNsMap
- * 
- * a map containing xml namespaces
- * 
- * key:    namespace uri
- * value:  XmlNs object, containing namespace uri and the prefix
- */
-
-XmlNsMap* xmlnsmap_create(pool_handle_t *pool);
-
-void xmlnsmap_free(XmlNsMap *map);
-
-/*
- * Puts a namespace in the map. If the namespace is already in the map, the
- * available XmlNs object is returned
- */
-XmlNs* xmlnsmap_put(XmlNsMap *map, char *ns);
-
-/*
- * Gets a namespace from the map. Returns NULL if the namespace is not in the
- * map
- */
-XmlNs* xmlnsmap_get(XmlNsMap *map, char *ns);
-
-
-
-/*
- * XmlElement
- * 
- * representing a xml element
- */
-
-/*
- * adds a xml element to a parent element
- */
-void xmlelm_add_child(XmlElement *parent, XmlElement *child);
-
-/*
- * writes an xml element to an output buffer
- * if wv is true, it writes the complete value of the element
- */
-void xmlelm_write(XmlElement *elm, Buffer *out, int wv);
-
-
-/*
- * PropstatMap
- * 
- * A map containing multiple propstat objects
- * 
- * key:    status code:  int
- * value:  prop list:    UcxDlist* (list of XmlElement*)
- */
-
-
-/*
- * creates a new Propstat
- */
-Propstat* propstat_create(pool_handle_t *pool);
-
-
-/*
- * adds a property to the propstat map
- * 
- * propstat:  propstat object
- * status:    http status code
- * prop:      WebDAV property
- */
-void propstat_add(Propstat *propstat, int status, XmlElement *prop);
-
-/*
- * writes the propstat object to an output buffer
- * if wv is true, it writes the values of the 'OK' properties
- * 
- * propstat:  propstat object
- * out:       output buffer
- * wv:        property output mode
- */
-void propstat_write(Propstat *propstat, Buffer *out, int wv);
-
 
 
 #ifdef	__cplusplus

mercurial