blob: d55148e6d9e5a887ee5c9736832eb2adecf5bf1c [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001
2#ifndef _h_WEBS_INTERNAL
3#define _h_WEBS_INTERNAL 1
4
5
6#include <ctype.h>
7#include <stdlib.h>
8#include <string.h>
9#include <stdarg.h>
10
11#ifdef NETWARE
12 #include <fcntl.h>
13 #include <sys/stat.h>
14 #include <signal.h>
15 #include <io.h>
16#endif
17
18#ifdef WIN
19 #include <fcntl.h>
20 #include <sys/stat.h>
21 #include <io.h>
22#endif
23
24#ifdef CE
25#ifndef UEMF
26 #include <io.h>
27#endif
28#endif
29
30#ifdef NW
31 #include <fcntl.h>
32 #include <sys/stat.h>
33#endif
34
35#ifdef SCOV5
36 #include <fcntl.h>
37 #include <sys/stat.h>
38 #include <signal.h>
39 #include <unistd.h>
40#endif
41
42#ifdef LYNX
43 #include <fcntl.h>
44 #include <sys/stat.h>
45 #include <signal.h>
46 #include <unistd.h>
47#endif
48
49#ifdef UNIX
50 #include <fcntl.h>
51 #include <sys/stat.h>
52 #include <signal.h>
53 #include <unistd.h>
54#endif
55
56#ifdef QNX4
57 #include <fcntl.h>
58 #include <sys/stat.h>
59 #include <signal.h>
60 #include <unistd.h>
61 #include <unix.h>
62#endif
63
64#ifdef SOLARIS
65 #include <macros.h>
66 #include <fcntl.h>
67 #include <sys/stat.h>
68#endif
69
70#ifdef VXWORKS
71 #include <vxWorks.h>
72 #include <fcntl.h>
73 #include <sys/stat.h>
74#endif
75
76#ifdef UW
77 #include <fcntl.h>
78 #include <sys/stat.h>
79#endif
80
81#ifdef UEMF
82 #include "uemf.h"
83 #include "ejIntrn.h"
84#else
85 #include "emf/emfInternal.h"
86 #include "ej/ejIntrn.h"
87#endif
88
89#include "webs.h"
90
91
92#define WEBS_BEGIN 0x1
93#define WEBS_HEADER 0x2
94#define WEBS_POST 0x4
95#define WEBS_POST_CLEN 0x8
96#define WEBS_PROCESSING 0x10
97#define WEBS_KEEP_TIMEOUT 15000
98#define WEBS_TIMEOUT 60000
99
100#define PAGE_READ_BUFSIZE 512
101#define MAX_PORT_LEN 10
102#define WEBS_SYM_INIT 64
103
104
105typedef struct {
106 int (*handler)(webs_t wp, char_t *urlPrefix, char_t *webDir, int arg,
107 char_t *url, char_t *path,
108 char_t *query);
109 char_t *webDir;
110 char_t *urlPrefix;
111 int len;
112 int arg;
113 int flags;
114} websUrlHandlerType;
115
116
117typedef struct {
118 long errors;
119 long redirects;
120 long net_requests;
121 long activeNetRequests;
122 long activeBrowserRequests;
123 long timeouts;
124 long access;
125 long localHits;
126 long remoteHits;
127 long formHits;
128 long cgiHits;
129 long handlerHits;
130} websStatsType;
131
132extern websStatsType websStats;
133
134typedef struct {
135 int code;
136 char_t *msg;
137} websErrorType;
138
139
140typedef struct {
141 char_t *type;
142 char_t *ext;
143} websMimeType;
144
145
146typedef struct {
147 unsigned long size;
148 int isDir;
149 time_t mtime;
150} websStatType;
151
152
153typedef struct {
154 char_t *path;
155 unsigned char *page;
156 int size;
157 int pos;
158} websRomPageIndexType;
159
160
161#ifndef CE
162#define SOCKET_RDONLY O_RDONLY
163#define SOCKET_BINARY O_BINARY
164#else /* CE */
165#define SOCKET_RDONLY 0x1
166#define SOCKET_BINARY 0x2
167#endif /* CE */
168
169//#define DOWNLOAD_INTERVAL 1048576 //4194304
170extern int zte_process_cgi_end(webs_t wp);
171extern int zte_check_downloading_file();
172extern int websCgiDownLoadHandler(webs_t wp, char_t *urlPrefix,
173 char_t *webDir, int arg, char_t *url, char_t *path,
174 char_t *query);
175
176#define DOWNLOAD_INTERVAL 1048576 //4194304
177#define UPLOAD_INTERVAL 65536
178
179#ifdef FEATURE_ZTE_WEB_TCARD
180//added by guo shoupeng 10124224 for http share 20111001 start
181#define UPLOAD_INTERVAL 65536
182#define DOWNLOAD_INTERVAL 1048576 //4194304
183#define PATH_SD_CARD "/mmc2"
184#define PATH_SD_MNT "/mnt"
185
186extern int sd_card_isExist();
187extern int sd_card_isClose (webs_t wp);
188extern int zte_process_cgi(webs_t wp);
189extern int zte_process_cgi_end(webs_t wp);
190extern int websGetState(webs_t wp);
191extern int websGetlen(webs_t wp);
192extern char_t * websGetURL(webs_t wp);
193extern int zte_efs_write(webs_t wp);
194
195extern int zte_http_share_process_flagfile_exist(const char *i_filename );
196extern int websCgiDownLoadHandler(webs_t wp, char_t *urlPrefix,
197 char_t *webDir, int arg, char_t *url, char_t *path,
198 char_t *query);
199
200//added by guo shoupeng 10124224 for http share 20111001 end
201#endif
202extern websRomPageIndexType websRomPageIndex[];
203extern websMimeType websMimeList[];
204extern sym_fd_t websMime;
205extern webs_t* webs;
206extern int websMax;
207extern char_t websHost[64];
208extern char_t websIpaddr[64];
209extern char_t *websHostUrl;
210extern char_t *websIpaddrUrl;
211extern int websPort;
212
213extern char_t* websGetDateString(websStatType* sbuf);
214
215extern int strcmpci(char_t* s1, char_t* s2);
216
217extern int websAspOpen();
218extern void websAspClose();
219
220extern int websAspWrite(int ejid, webs_t wp, int argc, char_t **argv);
221
222extern void websFormOpen();
223extern void websFormClose();
224
225extern int websCgiHandler(webs_t wp, char_t *urlPrefix, char_t *webDir,
226 int arg, char_t *url, char_t *path, char_t *query);
227extern void websCgiCleanup();
228extern int websCheckCgiProc(int handle, int *status);
229extern char_t *websGetCgiCommName();
230
231extern int websLaunchCgiProc(char_t *cgiPath, char_t **argp,
232 char_t **envp, char_t *stdIn, char_t *stdOut);
233
234extern void websDefaultClose();
235
236extern void websUrlHandlerClose();
237extern int websUrlHandlerOpen();
238
239extern int websDefaultHandler(webs_t wp, char_t *urlPrefix,
240 char_t *webDir, int arg, char_t *url, char_t *path,
241 char_t *query);
242extern int websFormHandler(webs_t wp, char_t *urlPrefix, char_t *webDir,
243 int arg, char_t *url, char_t *path, char_t *query);
244
245extern int websOpen(int sid);
246extern void websResponse(webs_t wp, int code, char_t *msg,
247 char_t *redirect);
248extern int websJavaScriptEval(webs_t wp, char_t *script);
249extern int websPageReadData(webs_t wp, char *buf, int nBytes);
250
251extern void websPageSeek(webs_t wp, long offset);
252extern int websPageStat(webs_t wp, char_t *lpath, char_t *path,
253 websStatType *sbuf);
254extern int websPageIsDirectory(char_t *lpath);
255
256extern int websPageOpen(webs_t wp, char_t *lpath, char_t *path, int mode,
257 int perm);
258extern void websPageClose(webs_t wp);
259
260
261extern int websRomPageOpen(webs_t wp, char_t *path, int mode, int perm);
262extern void websRomPageClose(int fd);
263extern int websRomPageReadData(webs_t wp, char *buf, int len);
264extern int websRomPageStat(char_t *path, websStatType *sbuf);
265extern long websRomPageSeek(webs_t wp, long offset, int origin);
266
267extern int websRomOpen();
268extern void websRomClose();
269
270extern void websSetRequestSocketHandler(webs_t wp, int mask,
271 void (*fn)(webs_t wp));
272extern int websSolutionHandler(webs_t wp, char_t *urlPrefix,
273 char_t *webDir, int arg, char_t *url, char_t *path,
274 char_t *query);
275
276extern int websOpenServer(int port, int retries);
277extern void websCloseServer();
278
279#ifdef CE
280extern int writeUniToAsc(int fid, void *buf, unsigned int len);
281extern int readAscToUni(int fid, void **buf, unsigned int len);
282#endif
283
284#ifdef EMF
285extern int websEmfOpen();
286extern void websSetEmfEnvironment(webs_t wp);
287extern void websEmfClose();
288#endif
289
290
291#endif /* _h_WEBS_INTERNAL */
292