#include <stdio.h>
#include <sys/dirent.h>
#include <sys/types.h>
#include <sys/vnode.h>
#include <sys/param.h>
#include <sys/mount.h>
#include <CoreFoundation/CoreFoundation.h>
#include "webdav_memcache.h"
#include "../webdav_fs.kextproj/webdav_fs.kmodproj/vnops.h"
typedef struct webdav_parse_lookup_element_tag
{
webdav_filetype_t file_type;
struct webdav_parse_lookup_element_tag *next;
} webdav_parse_lookup_element_t;
typedef struct
{
webdav_parse_lookup_element_t *head;
webdav_parse_lookup_element_t *tail;
} webdav_parse_lookup_struct_t;
#define WEBDAV_MAX_URI_LEN (MAXPATHLEN * 3)
struct large_dirent
{
u_int32_t d_fileno;
u_int16_t d_reclen;
u_int8_t d_type;
u_int8_t d_namlen;
char d_name[WEBDAV_MAX_URI_LEN];
u_int32_t d_name_URI_length;
};
typedef struct webdav_parse_opendir_element_tag
{
struct large_dirent dir_data;
struct timespec stattime;
u_quad_t statsize;
int appledoubleheadervalid;
char appledoubleheader[APPLEDOUBLEHEADER_LENGTH];
struct webdav_parse_opendir_element_tag *next;
} webdav_parse_opendir_element_t;
typedef struct
{
int error;
webdav_parse_opendir_element_t *head;
webdav_parse_opendir_element_t *tail;
} webdav_parse_opendir_struct_t;
typedef struct
{
size_t size;
char name[WEBDAV_MAX_URI_LEN];
} webdav_parse_opendir_text_t;
typedef struct
{
int id;
void *data_ptr;
} webdav_parse_opendir_return_t;
extern int parse_lookup(char *xmlp, int xmlp_len, webdav_filetype_t *a_file_type);
extern int parse_stat(char *xmlp, int xmlp_len, const char *orig_uri, struct vattr *statbuf, uid_t uid);
extern int parse_statfs(char *xmlp, int xmlp_len, struct statfs *statfsbuf);
extern int parse_lock(char *xmlp, int xmlp_len, char **locktoken);
extern int parse_opendir(char *xmlp, int xmlp_len, int fd, char *dir_name, char *hostname, uid_t uid);
extern int parse_file_count(char *xmlp, int xmlp_len, int *file_count);
extern int parse_getlastmodified(char *xmlp, int xmlp_len, time_t *last_modified);
#define WEBDAV_OPENDIR_ELEMENT 1
#define WEBDAV_OPENDIR_ELEMENT_LENGTH 2
#define WEBDAV_OPENDIR_ELEMENT_MODDATE 3
#define WEBDAV_OPENDIR_TEXT 4
#define WEBDAV_OPENDIR_APPLEDOUBLEHEADER 5
#define WEBDAV_OPENDIR_IGNORE 6
#define WEBDAV_STAT_IGNORE 1
#define WEBDAV_STAT_LENGTH 2
#define WEBDAV_STAT_MODDATE 3
#define WEBDAV_STATFS_IGNORE 1
#define WEBDAV_STATFS_QUOTA 2
#define WEBDAV_STATFS_QUOTAUSED 3
#define WEBDAV_LOCK_CONTINUE 1
#define WEBDAV_LOCK_TOKEN 1
#define WEBDAV_LOCK_HREF 2
#define WEBDAV_GETLASTMODIFIED_IGNORE 1
#define WEBDAV_GETLASTMODIFIED_MODDATE 2
#define WEBDAV_MAX_STATFS_SIZE 256
#define WEBDAV_MAX_STAT_SIZE 256