diff options
Diffstat (limited to 'src/web_server.h')
-rw-r--r-- | src/web_server.h | 129 |
1 files changed, 129 insertions, 0 deletions
diff --git a/src/web_server.h b/src/web_server.h new file mode 100644 index 00000000..d34036b5 --- /dev/null +++ b/src/web_server.h | |||
@@ -0,0 +1,129 @@ | |||
1 | /* Copyrights 2002 Luis Figueiredo (stdio@netc.pt) All rights reserved. | ||
2 | * | ||
3 | * See the LICENSE file | ||
4 | * | ||
5 | * The origin of this software must not be misrepresented, either by | ||
6 | * explicit claim or by omission. Since few users ever read sources, | ||
7 | * credits must appear in the documentation. | ||
8 | * | ||
9 | * Fri Dec 28 12:51:11 GMT 2001 | ||
10 | * Luis Figueiredo -- I Corrected the input to handle only data when \n\r(twice) is arrived | ||
11 | * | ||
12 | * Mon Feb 25 06:27:58 GMT 2002 | ||
13 | * Luis Figueiredo -- Many corrections and new functions were added, until today | ||
14 | * | ||
15 | * Mon Mar 25 14:46:13 GMT 2002 | ||
16 | * Luis Figueiredo -- wow, one month later..., discard web_server_addstr, and now process the stdout to server | ||
17 | * using a tmpfile for streaming (not so good, but :o)) | ||
18 | * Wed Mar 27 18:59:10 GMT 2002 | ||
19 | * Luis Figueiredo -- using regex instead of fnmatch(fnmatch only appears becouse of apache, i didn't knew it) | ||
20 | * Mon Apr 8 15:04:31 GMT 2002 | ||
21 | * Luis Figueiredo -- Oh my.. kurt cobain is dead :o), restructured the code, separated into various files | ||
22 | * Wed Apr 10 20:02:55 GMT 2002 | ||
23 | * Luis Figueiredo -- Make use of autoconf , removed open_memstream (doesn't work well w/ stdout structure on netbsd portability) | ||
24 | * linux slack 7.1 uses "extern FILE *stdout", netbsd uses "extern FILE __sF[]" so i cannot make use of pointers | ||
25 | * Mon Oct 7 16:56:15 GMT 2002 | ||
26 | * Luis Figueiredo -- Repaired some safe bugs, Added vars to stats proposes, inserted an liblogo, added debug instructions | ||
27 | * | ||
28 | * VERSION 0.5.3 | ||
29 | */ | ||
30 | |||
31 | #ifndef _WEB_SERVER_H_ | ||
32 | #define _WEB_SERVER_H_ | ||
33 | |||
34 | #include <stdio.h> // for struct FILE | ||
35 | #include <time.h> // for time_t | ||
36 | |||
37 | #ifdef __cplusplus | ||
38 | extern "C"{ | ||
39 | #endif | ||
40 | |||
41 | extern char *_libwebserver_version; | ||
42 | extern char *_tmpnameprefix; | ||
43 | extern int WEBTIMEOUT; | ||
44 | |||
45 | struct _MultiPart { | ||
46 | char *id; | ||
47 | char *data; | ||
48 | unsigned int size; | ||
49 | char *filename; | ||
50 | void *pad; | ||
51 | }; | ||
52 | char *__Header(char *); | ||
53 | char *__Query(char *); | ||
54 | char *__Post(char *); | ||
55 | struct _MultiPart __MultiPart(char *); | ||
56 | char *__Cookie(char *); | ||
57 | |||
58 | extern struct ClientInfo { | ||
59 | int outfd; | ||
60 | char *inetname; | ||
61 | char *request; | ||
62 | char *method; | ||
63 | char *user; | ||
64 | char *pass; | ||
65 | char *(*Header)(char *); | ||
66 | char *(*Query)(char *); | ||
67 | char *(*Post)(char *); | ||
68 | char *(*Cookie)(char *); | ||
69 | char *(*Conf)(char *,char *); // new on 0.5.0 | ||
70 | struct _MultiPart (*MultiPart)(char *); | ||
71 | void *__pad[9]; | ||
72 | |||
73 | } *ClientInfo; // PROTOTYPE | ||
74 | |||
75 | struct web_server { | ||
76 | int socket; | ||
77 | unsigned int port; | ||
78 | char *logfile; | ||
79 | char *conffile; | ||
80 | time_t conffiletime; // tested only on win | ||
81 | char *mimefile; | ||
82 | char *dataconf; | ||
83 | FILE *weblog; | ||
84 | int flags; | ||
85 | struct gethandler *gethandler; | ||
86 | struct web_client *client; | ||
87 | int usessl; | ||
88 | void *pad[2]; // SSL pad | ||
89 | }; | ||
90 | |||
91 | #define WS_LOCAL 1 // Can be only accessed by localhost (usefull for local programs gui's) | ||
92 | #define WS_USESSL 2 // Use ssl conections (openssl lib required) (security transation) (there is no sense using WS_LOCAL & WS_USESSL together) | ||
93 | #define WS_USEEXTCONF 4 // Use external config file (new 0.5.0) | ||
94 | #define WS_DYNVAR 8 // Use dynamic variables on output (new 0.5.1) | ||
95 | #define WS_USELEN 16 //Use Content-length calculator(new 0.5.1) | ||
96 | |||
97 | |||
98 | void web_server_useSSLcert(struct web_server *,const char *); // useless if not using openssl | ||
99 | void web_server_useMIMEfile(struct web_server *,const char *); // new on 0.5.2 | ||
100 | int web_server_init(struct web_server *,int,const char *,int); | ||
101 | void web_server_shutdown(struct web_server *); | ||
102 | char *web_server_getconf(struct web_server *,char *,char *); | ||
103 | int web_server_addhandler(struct web_server *,const char *,void (*)(),int); | ||
104 | int web_server_aliasdir(struct web_server *, const char *,char *,int); // new on 0.5.2 | ||
105 | int web_server_run(struct web_server *); | ||
106 | |||
107 | |||
108 | int web_client_addfile(char *); | ||
109 | extern unsigned char GLOBALGIFPAL[256][3]; | ||
110 | void web_client_gifsetpalette(const char *); | ||
111 | int web_client_gifoutput(char *,int,int,int); | ||
112 | |||
113 | void web_client_setcookie(char *,char *,char *,char *, char *,int); // improved on 0.5.1 | ||
114 | void web_client_deletecookie(char *); // improved on 0.5.1 | ||
115 | int web_client_setvar(char *,char *); //(new (0.5.1) | ||
116 | char *web_client_getvar(char *); //(new (0.5.1) | ||
117 | int web_client_delvar(char *); //(new (0.5.1) | ||
118 | |||
119 | void web_client_HTTPdirective(char *); | ||
120 | void web_client_contenttype(char *); // 0.5.2 | ||
121 | void web_log(const char *,...); | ||
122 | |||
123 | |||
124 | #ifdef __cplusplus | ||
125 | } | ||
126 | #endif | ||
127 | |||
128 | #endif | ||
129 | |||