24#ifndef PROTOCORE_WEBDAV_H
25#define PROTOCORE_WEBDAV_H
34enum class WebDavMethod : uint8_t
53#define PC_DAV_DEPTH_INFINITY 0x7fffffff
56WebDavMethod pc_webdav_method(
const char *m);
62int pc_webdav_depth(
const char *depth_hdr,
int dflt);
68size_t pc_webdav_xml_escape(
char *dst,
size_t cap,
const char *src);
77bool pc_webdav_dest_path(
const char *destination,
char *out,
size_t cap);
85size_t pc_webdav_ms_begin(
char *buf,
size_t cap,
size_t len);
96size_t pc_webdav_ms_entry(
char *buf,
size_t cap,
size_t len,
const char *href,
bool is_collection, uint32_t size,
97 const char *rfc1123_mtime,
const char *content_type);
100size_t pc_webdav_ms_end(
char *buf,
size_t cap,
size_t len);
119size_t pc_webdav_proppatch_ms(
char *buf,
size_t cap,
const char *href,
const char *body,
size_t body_len);
129#define PC_DAV_LOCK_MAX 8
131#define PC_DAV_LOCK_PATH_MAX 128
133#define PC_DAV_LOCK_TOKEN_MAX 48
138 char path[PC_DAV_LOCK_PATH_MAX];
139 char token[PC_DAV_LOCK_TOKEN_MAX];
149 DavLock locks[PC_DAV_LOCK_MAX];
153void pc_dav_lock_init(DavLockTable *t);
166const DavLock *pc_dav_lock_acquire(DavLockTable *t,
const char *path,
const char *token,
bool exclusive,
167 bool depth_infinity, uint32_t expiry_s);
175size_t pc_dav_lock_sweep(DavLockTable *t, uint32_t now_s);
181const DavLock *pc_dav_lock_refresh(DavLockTable *t,
const char *token, uint32_t new_expiry_s);
187const DavLock *pc_dav_lock_find(
const DavLockTable *t,
const char *path);
190bool pc_dav_lock_release(DavLockTable *t,
const char *token);
198bool pc_dav_lock_can_write(
const DavLockTable *t,
const char *path,
const char *presented_token);
206bool pc_dav_if_token(
const char *if_header,
char *out,
size_t cap);
User-facing configuration for ProtoCore.