diff -r 21274e5950af -r a1f4cb076d2f src/server/webdav/webdav.h --- a/src/server/webdav/webdav.h Tue Aug 13 22:14:32 2019 +0200 +++ b/src/server/webdav/webdav.h Sat Sep 24 16:26:10 2022 +0200 @@ -1,7 +1,7 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * - * Copyright 2013 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: @@ -30,16 +30,100 @@ #define WEBDAV_H #include "../public/webdav.h" -#include "../util/strbuf.h" #include #include +#include #ifdef __cplusplus extern "C" { #endif + +typedef struct WebdavType { + webdav_init_func init; + webdav_create_func create; +} WebdavType; + +typedef struct DefaultWebdavData { + WebdavVFSProperties vfsproperties; +} DefaultWebdavData; + +WebdavType* webdav_get_type(scstr_t dav_class); + +void* webdav_init_backend(ServerConfiguration *cfg, pool_handle_t *pool, WebdavType *dav_class, WSConfigNode *config, int *error); + +int webdav_init(pblock *pb, Session *sn, Request *rq); + +int webdav_service(pblock *pb, Session *sn, Request *rq); + +/* + * returns a buffer containing the request body + * + * this function sets an http response code in case of an error + * or missing request body + */ +UcxBuffer* rqbody2buffer(Session *sn, Request *rq); +int webdav_options(pblock *pb, Session *sn, Request *rq); + +int webdav_propfind(pblock *pb, Session *sn, Request *rq); + +int webdav_propfind_init( + WebdavBackend *dav, + WebdavPropfindRequest *propfind, + const char *path, + const char *uri, + UcxList **out_req); + +int webdav_propfind_do( + WebdavBackend *dav, + WebdavPropfindRequest *propfind, + WebdavResponse *response, + VFSContext *vfs, + char *path, + char *uri); + + +int webdav_proppatch(pblock *pb, Session *sn, Request *rq); +int webdav_mkcol(pblock *pb, Session *sn, Request *rq); +int webdav_post(pblock *pb, Session *sn, Request *rq); +int webdav_delete(pblock *pb, Session *sn, Request *rq); +int webdav_put(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_lock(pblock *pb, Session *sn, Request *rq); +int webdav_unlock(pblock *pb, Session *sn, Request *rq); +int webdav_report(pblock *pb, Session *sn, Request *rq); +int webdav_acl(pblock *pb, Session *sn, Request *rq); +int webdav_search (pblock *pb, Session *sn, Request *rq); + + +int default_propfind_init( + WebdavPropfindRequest *rq, + const char *path, + const char *href, + WebdavPList **outplist); +int default_propfind_do( + WebdavPropfindRequest *request, + WebdavResponse *response, + VFS_DIR parent, + WebdavResource *resource, + struct stat *s); +int default_propfind_finish(WebdavPropfindRequest *rq); +int default_proppatch_do( + WebdavProppatchRequest *request, + WebdavResource *response, + VFSFile *file, + WebdavPList **setInOut, + WebdavPList **removeInOut); +int default_proppatch_finish( + WebdavProppatchRequest *request, + WebdavResource *response, + VFSFile *file, + WSBool commit); + +UcxKey webdav_property_key(const char *ns, const char *name); #ifdef __cplusplus }