This repository has been archived by the owner on May 9, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathinstance.h
90 lines (73 loc) · 2.28 KB
/
instance.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/*
Weborf
Copyright (C) 2007-2020 Salvo "LtWorf" Tomaselli
Weborf is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
@author Salvo "LtWorf" Tomaselli <tiposchi@tiscali.it>
@author Salvo Rinaldi <salvin@anche.no>
*/
#ifndef WEBORF_INSTANCE_H
#define WEBORF_INSTANCE_H
#ifndef O_LARGEFILE //Needed to compile on Mac, where this doesn't exist
#define O_LARGEFILE 0
#endif
#include "types.h"
#include "buffered_reader.h"
#ifdef WEBDAV
#include "webdav.h"
#endif
//Request
#define INVALID -1
#define GET 0
#define POST 1
#define PUT 2
#define DELETE 3
#define OPTIONS 8
#ifdef WEBDAV
#define PROPFIND 4
#define COPY 5
#define MOVE 6
#define MKCOL 7
#endif
#define NO_ACTION -120
//Errors
#define ERR_RANGE_NOT_SATISFIABLE -15
#define ERR_PRECONDITION_FAILED -14
#define ERR_NOT_ALLOWED -13
#define ERR_INSUFFICIENT_STORAGE -12
#define ERR_CONFLICT -11
#define ERR_SERVICE_UNAVAILABLE -10
#define ERR_FORBIDDEN -9
#define ERR_NOTIMPLEMENTED -8
#define ERR_NODATA -7
#define ERR_NOTHTTP -6
#define ERR_NOAUTH -5
#define ERR_SOCKWRITE -4
#define ERR_NOMEM -3
#define ERR_FILENOTFOUND -2
#define ERR_BRKPIPE -1
//Ok
#define OK_CREATED 1
#define OK_NOCONTENT 2
//Protocol version
#define HTTP_0_9 57
#define HTTP_1_0 48
#define HTTP_1_1 2
void inetd();
void *instance(void *);
int write_file(connection_t * connection_prop);
int send_err(connection_t *connection_prop,int err,char* descr);
string_t read_post_data(connection_t * connection_prop, buffered_read_t * read_b);
char *get_basedir(char *http_param);
int send_http_header(int code, unsigned long long int *size, char *headers, bool content, time_t timestamp, connection_t * connection_prop);
int delete_file(connection_t* connection_prop);
int read_file(connection_t* connection_prop,buffered_read_t* read_b);
#endif