source: rtems/cpukit/httpd/webs.h @ 9b05600

4.104.114.84.95
Last change on this file since 9b05600 was c1cdaa0, checked in by Joel Sherrill <joel.sherrill@…>, on 10/27/99 at 12:50:33

Patch from Emmanuel Raguet <raguet@…> and Eric Valette
<valette@…> to add a port of the GoAhead? web server
(httpd) to the RTEMS build tree. They have successfully used
this BSP on i386/pc386 and PowerPC/mcp750.

Mark and Joel spoke with Nick Berliner <nickb@…> on
26 Oct 1999 about this port and got verbal approval to include
it in RTEMS distributions.

  • Property mode set to 100644
File size: 7.7 KB
Line 
1/*
2 *      webs.h -- Go Ahead Web public header
3 *
4 *      Copyright (c) Go Ahead Software Inc., 1992-1999. All Rights Reserved.
5 *
6 *      See the file "license.txt" for information on usage and redistribution
7 */
8
9#ifndef _h_WEBS
10#define _h_WEBS 1
11
12/******************************** Description *********************************/
13
14/*
15 *      Go Ahead Web Server header. This defines the Web public APIs.
16 *      Include this header for files that contain ASP or Form procedures.
17 *      Include wsIntrn.h when creating URL handlers.
18 */
19
20/********************************* Includes ***********************************/
21
22#include        "ej.h"
23
24/********************************** Defines ***********************************/
25
26#define WEBS_HEADER_BUFINC              512                     /* Header buffer size */
27#define WEBS_ASP_BUFINC                 512                     /* Asp expansion increment */
28#define WEBS_MAX_PASS                   32                      /* Size of password */
29#define WEBS_BUFSIZE                    1000            /* websWrite max output string */
30#define WEBS_MAX_HEADER                 (5 * 1024)      /* Sanity check header */
31#define WEBS_MAX_URL                    4096            /* Maximum URL size for sanity */
32#define WEBS_SOCKET_BUFSIZ              256                     /* Bytes read from socket */
33
34/*
35 *      Request flags. Also returned by websGetRequestFlags().
36 */
37#define WEBS_LOCAL_PAGE                 0x1                     /* Request for local webs page */
38#define WEBS_KEEP_ALIVE                 0x2                     /* HTTP/1.1 keep alive */
39#define WEBS_DONT_USE_CACHE             0x4                     /* Not implemented cache support */
40#define WEBS_COOKIE                             0x8                     /* Cookie supplied in request */
41#define WEBS_IF_MODIFIED                0x10            /* If-modified-since in request */
42#define WEBS_POST_REQUEST               0x20            /* Post request operation */
43#define WEBS_LOCAL_REQUEST              0x40            /* Request from this system */
44#define WEBS_HOME_PAGE                  0x80            /* Request for the home page */
45#define WEBS_ASP                                0x100           /* ASP request */
46#define WEBS_HEAD_REQUEST               0x200           /* Head request */
47#define WEBS_CLEN                               0x400           /* Request had a content length */
48#define WEBS_FORM                               0x800           /* Request is a form */
49#define WEBS_REQUEST_DONE               0x1000          /* Request complete */
50#define WEBS_POST_DATA                  0x2000          /* Already appended post data */
51#define WEBS_HEADER_DONE                0x40000         /* Already output the HTTP header */
52
53/*
54 *      URL handler flags
55 */
56#define WEBS_HANDLER_FIRST      0x1                     /* Process this handler first */
57#define WEBS_HANDLER_LAST       0x2                     /* Process this handler last */
58
59/*
60 *      Per socket connection webs structure
61 */
62typedef struct websRec {
63        ringq_t                 header;                         /* Header dynamic string */
64        time_t                  since;                          /* Parsed if-modified-since time */
65        sym_fd_t                cgiVars;                        /* CGI standard variables */
66        sym_fd_t                cgiQuery;                       /* CGI decoded query string */
67        time_t                  timestamp;                      /* Last transaction with browser */
68        void*                   timeout;                        /* Timeout handle */
69        char_t                  ipaddr[32];                     /* Connecting ipaddress */
70        char_t                  type[64];                       /* Mime type */
71        char_t*                 dir;                            /* Directory containing the page */
72        char_t*                 path;                           /* Path name without query */
73        char_t*                 url;                            /* Full request url */
74        char_t*                 host;                           /* Requested host */
75        char_t*                 lpath;                          /* Cache local path name */
76        char_t*                 query;                          /* Request query */
77        char_t*                 decodedQuery;           /* Decoded request query */
78        char_t*                 password;                       /* Authorization password */
79        char_t*                 userName;                       /* Authorization username */
80        char_t*                 cookie;                         /* Cookie string */
81        char_t*                 userAgent;                      /* User agent (browser) */
82        int                             sid;                            /* Socket id (handler) */
83        int                             port;                           /* Request port number */
84        int                             state;                          /* Current state */
85        int                             flags;                          /* Current flags -- see above */
86        int                             code;                           /* Request result code */
87        int                             clen;                           /* Content length */
88        int                             wid;                            /* Index into webs */
89        int                             docfd;                          /* Document file descriptor */
90        int                             numbytes;                               /* Bytes to transfer to browser */
91        int                             written;                        /* Bytes actually transferred */
92        void                    (*writeSocket)(struct websRec *wp);
93} websRec;
94
95typedef websRec *webs_t;
96typedef websRec websType;
97
98/******************************** Prototypes **********************************/
99
100extern int               websAspDefine(char_t *name,
101                                        int (*fn)(int ejid, webs_t wp, int argc, char_t **argv));
102extern int               websAspRequest(webs_t wp, char_t *lpath);
103extern void              websCloseListen();
104extern int               websDecode64(char_t *outbuf, char_t *string, int buflen);
105extern void              websDecodeUrl(char_t *token, char_t *decoded, int len);
106extern void      websDone(webs_t wp, int code);
107extern void      websEncode64(char_t *outbuf, char_t *string, int buflen);
108extern void      websError(webs_t wp, int code, char_t *msg, ...);
109extern void      websFooter(webs_t wp);
110extern int               websFormDefine(char_t *name, void (*fn)(webs_t wp,
111                                        char_t *path, char_t *query));
112extern char_t   *websGetDefaultDir();
113extern char_t   *websGetDefaultPage();
114extern char_t   *websGetHostUrl();
115extern char_t   *websGetPassword();
116extern int               websGetPort();
117extern char_t   *websGetPublishDir(char_t *path, char_t **urlPrefix);
118extern int               websGetRequestBytes(webs_t wp);
119extern char_t   *websGetRequestDir(webs_t wp);
120extern int               websGetRequestFlags(webs_t wp);
121extern char_t   *websGetRequestIpaddr(webs_t wp);
122extern char_t   *websGetRequestLpath(webs_t wp);
123extern char_t   *websGetRequestPath(webs_t wp);
124extern char_t   *websGetRequestPassword(webs_t wp);
125extern char_t   *websGetRequestType(webs_t wp);
126extern int               websGetRequestWritten(webs_t wp);
127extern char_t   *websGetVar(webs_t wp, char_t *var, char_t *def);
128extern void      websHeader(webs_t wp);
129extern int               websOpenListen(int port, int retries);
130extern int               websPageOpen(webs_t wp, char_t *lpath, char_t *path,
131                                        int mode, int perm);
132extern void      websPageClose(webs_t wp);
133extern int               websPublish(char_t *urlPrefix, char_t *path);
134extern void              websRedirect(webs_t wp, char_t *url);
135extern void      websSecurityDelete();
136extern int               websSecurityHandler(webs_t wp, char_t *urlPrefix,
137                                        char_t *webDir, int arg, char_t *url, char_t *path,
138                                        char_t *query);
139extern void      websSetDefaultDir(char_t *dir);
140extern void      websSetDefaultPage(char_t *page);
141extern void      websSetEnv(webs_t wp);
142extern void      websSetHost(char_t *host);
143extern void      websSetIpaddr(char_t *ipaddr);
144extern void      websSetPassword(char_t *password);
145extern void      websSetRequestBytes(webs_t wp, int bytes);
146extern void              websSetRequestFlags(webs_t wp, int flags);
147extern void      websSetRequestLpath(webs_t wp, char_t *lpath);
148extern void      websSetRequestPath(webs_t wp, char_t *dir, char_t *path);
149extern char_t   *websGetRequestUserName(webs_t wp);
150extern void      websSetRequestWritten(webs_t wp, int written);
151extern void      websSetVar(webs_t wp, char_t *var, char_t *value);
152extern int               websTestVar(webs_t wp, char_t *var);
153extern int               websUrlHandlerDefine(char_t *urlPrefix, char_t *webDir,
154                                        int arg, int (*fn)(webs_t wp, char_t *urlPrefix,
155                                        char_t *webDir, int arg, char_t *url, char_t *path,
156                                        char_t *query), int flags);
157extern int               websUrlHandlerDelete(int (*fn)(webs_t wp, char_t *urlPrefix,
158                                        char_t *webDir, int arg, char_t *url, char_t *path,
159                                        char_t *query));
160extern int               websUrlHandlerRequest(webs_t wp);
161extern int               websUrlParse(char_t *url, char_t **buf, char_t **host,
162                                        char_t **path, char_t **port, char_t **query,
163                                        char_t **proto, char_t **tag, char_t **ext);
164extern char_t   *websUrlType(char_t *webs, char_t *buf, int charCnt);
165extern int               websWrite(webs_t wp, char_t* fmt, ...);
166extern int               websWriteBlock(webs_t wp, char_t *buf, int nChars);
167extern int               websWriteBlockData(webs_t wp, char *buf, int nChars);
168extern int               websValid(webs_t wp);
169extern int               websValidateUrl(webs_t wp, char_t *path);
170extern int               websCloseFileHandle(webs_t wp);
171
172/*
173 *      Prototypes for functions available when running as part of the
174 *      GoAhead Embedded Management Framework (EMF)
175 */
176#if EMF
177extern void      websFormExplain(webs_t wp, char_t *path, char_t *query);
178#endif
179
180#endif /* _h_WEBS */
181
182/******************************************************************************/
Note: See TracBrowser for help on using the repository browser.