Back to index

avfs  1.0.1
dav_basic.h
Go to the documentation of this file.
00001 /* 
00002    Basic WebDAV support
00003    Copyright (C) 1999-2001, Joe Orton <joe@light.plus.com>
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License as published by the Free Software Foundation; either
00008    version 2 of the License, or (at your option) any later version.
00009    
00010    This library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public
00016    License along with this library; if not, write to the Free
00017    Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
00018    MA 02111-1307, USA
00019 
00020 */
00021 
00022 #ifndef DAV_BASIC_H
00023 #define DAV_BASIC_H
00024 
00025 #include "http_request.h"
00026 #include "dav_207.h"
00027 
00028 BEGIN_NEON_DECLS
00029 
00030 #define DAV_DEPTH_ZERO (0)
00031 #define DAV_DEPTH_ONE (1)
00032 #define DAV_DEPTH_INFINITE (2)
00033 
00034 /* Adds a Depth: header to a request */
00035 void dav_add_depth_header(http_req *req, int depth);
00036 
00037 /* Handle a simple WebDAV request.
00038  *
00039  * Usage:
00040  *  1. Create the request using http_request_create()
00041  *  2. Set any headers, the request body, whatever.
00042  *  3. Call dav_simple_request to dispatch and destroy the request.
00043  *
00044  * (note the request IS destroyed by this function, don't do it 
00045  * yourself).
00046  *
00047  * Returns HTTP_* as http_request_dispatch() would. If the response is
00048  * a 207, a user-friendly error message is written to the session
00049  * error buffer; e.g.  DELETE /foo/ might give the error:
00050  *     /foo/bar: HTTP/1.1 423 Locked
00051  */
00052 int dav_simple_request(http_session *sess, http_req *req);
00053 
00054 /* Basic WebDAV methods:
00055  *   dav_copy:  copy resoure from src to dest
00056  *   dav_move:  move resource from src to dest
00057  *     -> if overwrite is non-zero, the destination resource
00058  *     will be overwritten if it exists.
00059  *   dav_delete: delete resource at uri
00060  *   dav_mkcol: create a collection at uri (uri MUST have a trailing slash).
00061  */
00062 int dav_copy(http_session *sess, int overwrite,
00063             const char *src, const char *dest);
00064 int dav_move(http_session *sess, int overwrite,
00065             const char *src, const char *dest);
00066 int dav_delete(http_session *sess, const char *uri);
00067 int dav_mkcol(http_session *sess, const char *uri);
00068 
00069 END_NEON_DECLS
00070 
00071 #endif