src/server/webdav/parser.h

Fri, 23 Oct 2015 17:28:09 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Fri, 23 Oct 2015 17:28:09 +0200
changeset 104
a8acbb12f27c
parent 87
bdec069d2239
permissions
-rw-r--r--

implemented range requests

85
b62e77d8e80c replaced propfind parser with new libxml2 parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1 /*
b62e77d8e80c replaced propfind parser with new libxml2 parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
b62e77d8e80c replaced propfind parser with new libxml2 parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
3 *
b62e77d8e80c replaced propfind parser with new libxml2 parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
4 * Copyright 2013 Olaf Wintermann. All rights reserved.
b62e77d8e80c replaced propfind parser with new libxml2 parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
5 *
b62e77d8e80c replaced propfind parser with new libxml2 parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
6 * Redistribution and use in source and binary forms, with or without
b62e77d8e80c replaced propfind parser with new libxml2 parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
7 * modification, are permitted provided that the following conditions are met:
b62e77d8e80c replaced propfind parser with new libxml2 parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
8 *
b62e77d8e80c replaced propfind parser with new libxml2 parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
9 * 1. Redistributions of source code must retain the above copyright
b62e77d8e80c replaced propfind parser with new libxml2 parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
10 * notice, this list of conditions and the following disclaimer.
b62e77d8e80c replaced propfind parser with new libxml2 parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
11 *
b62e77d8e80c replaced propfind parser with new libxml2 parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
12 * 2. Redistributions in binary form must reproduce the above copyright
b62e77d8e80c replaced propfind parser with new libxml2 parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
13 * notice, this list of conditions and the following disclaimer in the
b62e77d8e80c replaced propfind parser with new libxml2 parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
14 * documentation and/or other materials provided with the distribution.
b62e77d8e80c replaced propfind parser with new libxml2 parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
15 *
b62e77d8e80c replaced propfind parser with new libxml2 parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
b62e77d8e80c replaced propfind parser with new libxml2 parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
b62e77d8e80c replaced propfind parser with new libxml2 parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
b62e77d8e80c replaced propfind parser with new libxml2 parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
b62e77d8e80c replaced propfind parser with new libxml2 parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
b62e77d8e80c replaced propfind parser with new libxml2 parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
b62e77d8e80c replaced propfind parser with new libxml2 parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
b62e77d8e80c replaced propfind parser with new libxml2 parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
b62e77d8e80c replaced propfind parser with new libxml2 parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
b62e77d8e80c replaced propfind parser with new libxml2 parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
b62e77d8e80c replaced propfind parser with new libxml2 parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
26 * POSSIBILITY OF SUCH DAMAGE.
b62e77d8e80c replaced propfind parser with new libxml2 parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
27 */
b62e77d8e80c replaced propfind parser with new libxml2 parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
28
b62e77d8e80c replaced propfind parser with new libxml2 parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
29 #ifndef PARSER_H
b62e77d8e80c replaced propfind parser with new libxml2 parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
30 #define PARSER_H
b62e77d8e80c replaced propfind parser with new libxml2 parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
31
b62e77d8e80c replaced propfind parser with new libxml2 parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
32 #include <libxml/parser.h>
b62e77d8e80c replaced propfind parser with new libxml2 parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
33 #include <libxml/xmlreader.h>
b62e77d8e80c replaced propfind parser with new libxml2 parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
34
b62e77d8e80c replaced propfind parser with new libxml2 parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
35 #include "webdav.h"
b62e77d8e80c replaced propfind parser with new libxml2 parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
36
b62e77d8e80c replaced propfind parser with new libxml2 parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
37 #ifdef __cplusplus
b62e77d8e80c replaced propfind parser with new libxml2 parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
38 extern "C" {
b62e77d8e80c replaced propfind parser with new libxml2 parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
39 #endif
b62e77d8e80c replaced propfind parser with new libxml2 parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
40
b62e77d8e80c replaced propfind parser with new libxml2 parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
41 #define xstreq(a,b) xmlStrEqual(BAD_CAST a, BAD_CAST b)
b62e77d8e80c replaced propfind parser with new libxml2 parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
42
b62e77d8e80c replaced propfind parser with new libxml2 parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
43 typedef struct PropfindParser {
b62e77d8e80c replaced propfind parser with new libxml2 parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
44 PropfindRequest *rq;
b62e77d8e80c replaced propfind parser with new libxml2 parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
45 pool_handle_t *pool;
b62e77d8e80c replaced propfind parser with new libxml2 parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
46 int davPropTag;
b62e77d8e80c replaced propfind parser with new libxml2 parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
47 } PropfindParser;
b62e77d8e80c replaced propfind parser with new libxml2 parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
48
b62e77d8e80c replaced propfind parser with new libxml2 parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
49
b62e77d8e80c replaced propfind parser with new libxml2 parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
50 PropfindRequest* dav_parse_propfind2(
b62e77d8e80c replaced propfind parser with new libxml2 parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
51 Session *sn,
b62e77d8e80c replaced propfind parser with new libxml2 parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
52 Request *rq,
b62e77d8e80c replaced propfind parser with new libxml2 parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
53 char *xml,
b62e77d8e80c replaced propfind parser with new libxml2 parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
54 size_t len);
b62e77d8e80c replaced propfind parser with new libxml2 parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
55
b62e77d8e80c replaced propfind parser with new libxml2 parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
56 int propfind_begin_elm(PropfindParser *parser, xmlTextReaderPtr elm);
b62e77d8e80c replaced propfind parser with new libxml2 parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
57
b62e77d8e80c replaced propfind parser with new libxml2 parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
58
b62e77d8e80c replaced propfind parser with new libxml2 parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
59 #ifdef __cplusplus
b62e77d8e80c replaced propfind parser with new libxml2 parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
60 }
b62e77d8e80c replaced propfind parser with new libxml2 parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
61 #endif
b62e77d8e80c replaced propfind parser with new libxml2 parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
62
b62e77d8e80c replaced propfind parser with new libxml2 parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
63 #endif /* PARSER_H */
b62e77d8e80c replaced propfind parser with new libxml2 parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
64

mercurial