source: rtems/c/src/libnetworking/rtems_webserver/wsIntrn.h @ d0d73ec

4.104.114.84.95
Last change on this file since d0d73ec was a6b4c0df, checked in by Joel Sherrill <joel.sherrill@…>, on 09/01/00 at 10:57:21

2000-08-30 Joel Sherrill <joel@…>

  • Merged version 2.1 of GoAhead? webserver. This update was submitted by Antti P Miettinen <antti.p.miettinen@…>.
  • NOTES, base64.c, ejIntrn.h, emfdb.c, emfdb.h, md5.h, md5c.c, um.c, um.h: New files.
  • wbase64.c: Removed.
  • Makefile.am, asp.c, balloc.c, default.c, ej.h, ejlex.c, ejparse.c, form.c, h.c, handler.c, mime.c, misc.c, ringq.c, rom.c, security.c, socket.c, sym.c, uemf.c, uemf.h, url.c, value.c, webcomp.c, webmain.c, webpage.c, webrom.c, webs.c, webs.h, websuemf.c, wsIntrn.h: Modified.
  • Property mode set to 100644
File size: 8.3 KB
Line 
1/*
2 *      wsIntrn.h -- Internal GoAhead Web server header
3 *
4 * Copyright (c) GoAhead Software Inc., 1992-2000. All Rights Reserved.
5 *
6 *      See the file "license.txt" for information on usage and redistribution
7 */
8 
9#ifndef _h_WEBS_INTERNAL
10#define _h_WEBS_INTERNAL 1
11
12/******************************** Description *********************************/
13
14/*
15 *      Internal GoAhead Web Server header. This defines the Web private APIs
16 *      Include this header when you want to create URL handlers.
17 */
18
19/*********************************** Defines **********************************/
20
21/*
22 *      Define this to enable login of web accesses to a file
23 *              #define WEBS_LOG_SUPPORT 1
24 *
25 *      Define this to enable HTTP/1.1 keep alive support
26 *              #define WEBS_KEEP_ALIVE_SUPPORT 1
27 *
28 *      Define this to enable if-modified-since support
29 *              #define WEBS_IF_MODIFIED_SUPPORT 1
30 *
31 *      Define this to support proxy capability and track local vs remote request
32 *              Note: this is not yet fully implemented.
33 *              #define WEBS_PROXY_SUPPORT 1
34 *
35 *      Define this to support reading pages from ROM
36 *              #define WEBS_PAGE_ROM 1
37 *
38 *      Define this to enable memory allocation and stack usage tracking
39 *              #define B_STATS 1
40 */
41
42/********************************** Includes **********************************/
43
44#include        <ctype.h>
45#include        <stdlib.h>
46#include        <string.h>
47#include        <stdarg.h>
48
49#if WIN
50        #include        <fcntl.h>
51        #include        <sys/stat.h>
52        #include        <io.h>
53#endif
54
55#if CE
56#if ! UEMF
57        #include        <io.h>
58#endif
59#endif
60
61#if NW
62        #include        <fcntl.h>
63        #include        <sys/stat.h>
64#endif
65
66#if SCOV5
67        #include        <fcntl.h>
68        #include        <sys/stat.h>
69        #include        <signal.h>
70        #include        <unistd.h>
71#endif
72
73#if LYNX
74        #include        <fcntl.h>
75        #include        <sys/stat.h>
76        #include        <signal.h>
77        #include        <unistd.h>
78#endif
79
80#if UNIX
81        #include        <fcntl.h>
82        #include        <sys/stat.h>
83        #include        <signal.h>
84        #include        <unistd.h>
85#endif
86
87#if QNX4
88        #include        <fcntl.h>
89        #include        <sys/stat.h>
90        #include        <signal.h>
91        #include        <unistd.h>
92        #include        <unix.h>
93#endif
94
95#if UW
96        #include        <fcntl.h>
97        #include        <sys/stat.h>
98#endif
99
100#if VXWORKS
101        #include        <vxWorks.h>
102        #include        <fcntl.h>
103        #include        <sys/stat.h>
104#endif
105
106#if SOLARIS
107        #include        <macros.h>
108        #include        <fcntl.h>
109        #include        <sys/stat.h>
110#endif
111
112#if UEMF
113        #include        "uemf.h"
114        #include        "ejIntrn.h"
115#else
116        #include        "emf/emfInternal.h"
117        #include        "ej/ejIntrn.h"
118#endif
119
120#include        "webs.h"
121
122/********************************** Defines ***********************************/
123/*
124 *      Read handler flags and state
125 */
126#define WEBS_BEGIN                      0x1                     /* Beginning state */
127#define WEBS_HEADER                     0x2                     /* Ready to read first line */
128#define WEBS_POST                       0x4                     /* POST without content */
129#define WEBS_POST_CLEN          0x8                     /* Ready to read content for POST */
130#define WEBS_PROCESSING         0x10            /* Processing request */
131#define WEBS_KEEP_TIMEOUT       15000           /* Keep-alive timeout (15 secs) */
132#define WEBS_TIMEOUT            60000           /* General request timeout (60) */
133
134#define PAGE_READ_BUFSIZE       512                     /* bytes read from page files */
135#define MAX_PORT_LEN            10                      /* max digits in port number */
136#define WEBS_SYM_INIT           64                      /* initial # of sym table entries */
137#define WEBS_VERSION_STR        T("2.1.3")      /* version of web server s/w */
138
139/*
140 *      URL handler structure. Stores the leading URL path and the handler
141 *      function to call when the URL path is seen.
142 */
143typedef struct {
144        int             (*handler)(webs_t wp, char_t *urlPrefix, char_t *webDir, int arg,
145                        char_t *url, char_t *path,
146                        char_t *query);                                 /* Callback URL handler function */
147        char_t  *webDir;                                                /* Web directory if required */
148        char_t  *urlPrefix;                                             /* URL leading prefix */
149        int             len;                                                    /* Length of urlPrefix for speed */
150        int             arg;                                                    /* Argument to provide to handler */
151        int             flags;                                                  /* Flags */
152} websUrlHandlerType;
153
154/*
155 *      Webs statistics
156 */
157typedef struct {
158        long                    errors;                                 /* General errors */
159        long                    redirects;
160        long                    net_requests;
161        long                    activeNetRequests;
162        long                    activeBrowserRequests;
163        long                    timeouts;
164        long                    access;                                 /* Access violations */
165        long                    localHits;
166        long                    remoteHits;
167        long                    formHits;
168        long                    cgiHits;
169        long                    handlerHits;
170} websStatsType;
171
172extern websStatsType websStats;                         /* Web access stats */
173
174/*
175 *      Error code list
176 */
177typedef struct {
178        int             code;                                                   /* HTTP error code */
179        char_t  *msg;                                                   /* HTTP error message */
180} websErrorType;
181
182/*
183 *      Mime type list
184 */
185typedef struct {
186        char_t  *type;                                                  /* Mime type */
187        char_t  *ext;                                                   /* File extension */
188} websMimeType;
189
190/*
191 *      File information structure.
192 */
193typedef struct {
194        unsigned long   size;                                   /* File length */
195        int                             isDir;                                  /* Set if directory */
196        time_t                  mtime;                                  /* Modified time */
197} websStatType;
198
199/*
200 *      Compiled Rom Page Index
201 */
202typedef struct {
203        char_t                  *path;                                  /* Web page URL path */
204        const unsigned char     *page;                                  /* Web page data */
205        int                             size;                                   /* Size of web page in bytes */
206        int                             pos;                                    /* Current read position */
207} websRomPageIndexType;
208
209/*
210 *      Defines for file open.
211 */
212#ifndef CE
213#define SOCKET_RDONLY   O_RDONLY
214#define SOCKET_BINARY   O_BINARY
215#else /* CE */
216#define SOCKET_RDONLY   0x1
217#define SOCKET_BINARY   0x2
218#endif /* CE */
219
220extern websRomPageIndexType     websRomPageIndex[];
221extern websMimeType             websMimeList[];         /* List of mime types */
222extern sym_fd_t                 websMime;                       /* Set of mime types */
223extern webs_t*                  webs;                           /* Session list head */
224extern int                              websMax;                        /* List size */
225extern char_t                   websHost[64];           /* Name of this host */
226extern char_t                   websIpaddr[64];         /* IP address of this host */
227extern char_t                   *websHostUrl;           /* URL for this host */
228extern char_t                   *websIpaddrUrl;         /* URL for this host */
229extern int                              websPort;                       /* Port number */
230
231/******************************** Prototypes **********************************/
232
233extern int               websAspOpen();
234extern void              websAspClose();
235extern void              websFormOpen();
236extern void              websFormClose();
237extern int               websAspWrite(int ejid, webs_t wp, int argc, char_t **argv);
238extern void      websDefaultClose();
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);
244extern int               websCgiHandler(webs_t wp, char_t *urlPrefix, char_t *webDir,
245                                        int arg, char_t *url, char_t *path, char_t *query);
246extern void              websCgiCleanup();
247extern int               websCheckCgiProc(int handle);
248extern char_t    *websGetCgiCommName();
249
250extern int               websLaunchCgiProc(char_t *cgiPath, char_t **argp,
251                                        char_t **envp, char_t *stdIn, char_t *stdOut);
252extern int               websOpen(int sid);
253extern void      websResponse(webs_t wp, int code, char_t *msg,
254                                        char_t *redirect);
255extern int               websJavaScriptEval(webs_t wp, char_t *script);
256extern int               websPageReadData(webs_t wp, char *buf, int nBytes);
257extern int               websPageOpen(webs_t wp, char_t *lpath, char_t *path, int mode,
258                                        int perm);
259extern void              websPageClose(webs_t wp);
260extern void              websPageSeek(webs_t wp, long offset);
261extern int               websPageStat(webs_t wp, char_t *lpath, char_t *path,
262                                        websStatType *sbuf);
263extern int               websPageIsDirectory(char_t *lpath);
264extern int               websRomOpen();
265extern void              websRomClose();
266extern int               websRomPageOpen(webs_t wp, char_t *path, int mode, int perm);
267extern void      websRomPageClose(int fd);
268extern int               websRomPageReadData(webs_t wp, char *buf, int len);
269extern int               websRomPageStat(char_t *path, websStatType *sbuf);
270extern long              websRomPageSeek(webs_t wp, long offset, int origin);
271extern void      websSetRequestSocketHandler(webs_t wp, int mask,
272                                        void (*fn)(webs_t wp));
273extern int               websSolutionHandler(webs_t wp, char_t *urlPrefix,
274                                        char_t *webDir, int arg, char_t *url, char_t *path,
275                                        char_t *query);
276extern void      websUrlHandlerClose();
277extern int               websUrlHandlerOpen();
278extern int               websOpenServer(int port, int retries);
279extern void      websCloseServer();
280extern char_t*   websGetDateString(websStatType* sbuf);
281
282extern int              strcmpci(char_t* s1, char_t* s2);
283
284/*
285 *      Prototypes for functions available when running as part of the
286 *      GoAhead Embedded Management Framework (EMF)
287 */
288#if EMF
289extern int               websEmfOpen();
290extern void      websEmfClose();
291extern void      websSetEmfEnvironment(webs_t wp);
292#endif
293
294#if CE
295extern int writeUniToAsc(int fid, void *buf, unsigned int len);
296extern int readAscToUni(int fid, void **buf, unsigned int len);
297#endif
298
299#endif /* _h_WEBS_INTERNAL */
300
301/******************************************************************************/
Note: See TracBrowser for help on using the repository browser.