src/server/public/webdav.h

branch
webdav
changeset 212
d7e7ea9c6bc6
parent 211
2160585200ac
child 215
68e824ba4a4f
--- a/src/server/public/webdav.h	Thu Oct 31 10:26:35 2019 +0100
+++ b/src/server/public/webdav.h	Sun Dec 29 15:09:58 2019 +0100
@@ -1,7 +1,7 @@
 /*
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
  *
- * Copyright 2018 Olaf Wintermann. All rights reserved.
+ * Copyright 2019 Olaf Wintermann. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -44,10 +44,13 @@
     
 typedef struct WebdavProperty         WebdavProperty;
 typedef struct WebdavPList            WebdavPList;
+typedef struct WebdavNSList           WebdavNSList;
 
 typedef enum   WebdavLockScope        WebdavLockScope;
 typedef enum   WebdavLockType         WebdavLockType;
 
+typedef enum   WebdavValueType        WebdavValueType;
+
 typedef struct WebdavPropfindRequest  WebdavPropfindRequest;
 typedef struct WebdavProppatchRequest WebdavProppatchRequest;
 typedef struct WebdavLockRequest      WebdavLockRequest;
@@ -57,6 +60,9 @@
 
 typedef struct WebdavVFSProperties    WebdavVFSProperties;
 
+typedef struct WSXmlData              WSXmlData;
+typedef struct WSText                 WSText;
+
 typedef struct _xmlNs   WSNamespace;
 typedef struct _xmlNode WSXmlNode;
 
@@ -72,6 +78,19 @@
  */
 #define WS_PROPFIND_NO_VFS 0x01
 
+
+enum WebdavValueType {
+    WS_VALUE_NO_TYPE = 0,
+    WS_VALUE_XML_NODE,
+    WS_VALUE_XML_DATA,
+    WS_VALUE_TEXT
+};
+
+struct WSText {
+    char   *str;
+    size_t length;
+};
+
 struct WebdavProperty {
     WSNamespace *namespace;
     
@@ -79,7 +98,18 @@
     
     char *lang;
     
-    WSXmlNode *value;
+    union {
+        WSXmlNode *node;
+        WSXmlData *data;
+        WSText    text;
+    } value;
+    WebdavValueType vtype;
+};
+
+struct WSXmlData {
+    WebdavNSList *namespaces;
+    char         *data;
+    size_t       length;
 };
 
 struct WebdavPList {
@@ -88,6 +118,12 @@
     WebdavPList *next;
 };
 
+struct WebdavNSList {
+    WSNamespace *namespace;
+    WebdavNSList *prev;
+    WebdavNSList *next;
+};
+
 enum WebdavLockScope {
     WEBDAV_LOCK_EXCLUSIVE = 0,
     WEBDAV_LOCK_SHARED,
@@ -185,8 +221,6 @@
      * request and should initialize everything needed for generating the
      * multistatus response.
      * 
-     * Optionally, the function can store a pointer to a list of all properties,
-     * which will be processed by this backend, in the outplist argument.
      */
     int (*propfind_init)(WebdavPropfindRequest *, const char *, WebdavPList **);
     
@@ -219,10 +253,26 @@
      * See the WS_PROPFIND_ macros for informations about the settings
      */
     uint32_t settings;
+    
+    
+    /*
+     * next Backend
+     */
+    WebdavBackend *next;
 };
 
+/*
+ * gets the requested depth
+ * 
+ * in case of infinity, -1 is returned
+ * if no depth is specified, 0 is returned
+ */
 int webdav_getdepth(Request *rq);
 
+WebdavPList* webdav_plist_clone(pool_handle_t *pool, WebdavPList *list);
+
+size_t webdav_plist_count(WebdavPList *list);
+
 WSNamespace* webdav_dav_namespace(void);
 WebdavProperty* webdav_dav_property(
         pool_handle_t *pool,

mercurial