diff options
Diffstat (limited to 'c/src/libnetworking/rtems_webserver/webs.h')
-rw-r--r-- | c/src/libnetworking/rtems_webserver/webs.h | 85 |
1 files changed, 66 insertions, 19 deletions
diff --git a/c/src/libnetworking/rtems_webserver/webs.h b/c/src/libnetworking/rtems_webserver/webs.h index 46e11bc2fc..4b847502a5 100644 --- a/c/src/libnetworking/rtems_webserver/webs.h +++ b/c/src/libnetworking/rtems_webserver/webs.h @@ -1,7 +1,7 @@ /* - * webs.h -- Go Ahead Web public header + * webs.h -- GoAhead Web public header * - * Copyright (c) Go Ahead Software Inc., 1992-1999. All Rights Reserved. + * Copyright (c) GoAhead Software Inc., 1992-2000. All Rights Reserved. * * See the file "license.txt" for information on usage and redistribution */ @@ -12,7 +12,7 @@ /******************************** Description *********************************/ /* - * Go Ahead Web Server header. This defines the Web public APIs. + * GoAhead Web Server header. This defines the Web public APIs. * Include this header for files that contain ASP or Form procedures. * Include wsIntrn.h when creating URL handlers. */ @@ -20,8 +20,17 @@ /********************************* Includes ***********************************/ #include "ej.h" +#ifdef WEBS_SSL_SUPPORT +#include "websSSL.h" +#endif /********************************** Defines ***********************************/ +/* + * By license terms the server software name defined in the following line of + * code must not be modified. + */ +#define WEBS_NAME T("GoAhead-Webs") +#define WEBS_VERSION T("2.1") #define WEBS_HEADER_BUFINC 512 /* Header buffer size */ #define WEBS_ASP_BUFINC 512 /* Asp expansion increment */ @@ -31,6 +40,9 @@ #define WEBS_MAX_URL 4096 /* Maximum URL size for sanity */ #define WEBS_SOCKET_BUFSIZ 256 /* Bytes read from socket */ +#define WEBS_HTTP_PORT T("httpPort") +#define CGI_BIN T("cgi-bin") + /* * Request flags. Also returned by websGetRequestFlags(). */ @@ -48,6 +60,10 @@ #define WEBS_FORM 0x800 /* Request is a form */ #define WEBS_REQUEST_DONE 0x1000 /* Request complete */ #define WEBS_POST_DATA 0x2000 /* Already appended post data */ +#define WEBS_CGI_REQUEST 0x4000 /* cgi-bin request */ +#define WEBS_SECURE 0x8000 /* connection uses SSL */ +#define WEBS_AUTH_BASIC 0x10000 /* Basic authentication request */ +#define WEBS_AUTH_DIGEST 0x20000 /* Digest authentication request */ #define WEBS_HEADER_DONE 0x40000 /* Already output the HTTP header */ /* @@ -65,38 +81,56 @@ typedef struct websRec { sym_fd_t cgiVars; /* CGI standard variables */ sym_fd_t cgiQuery; /* CGI decoded query string */ time_t timestamp; /* Last transaction with browser */ - void* timeout; /* Timeout handle */ + int timeout; /* Timeout handle */ char_t ipaddr[32]; /* Connecting ipaddress */ char_t type[64]; /* Mime type */ - char_t* dir; /* Directory containing the page */ - char_t* path; /* Path name without query */ - char_t* url; /* Full request url */ - char_t* host; /* Requested host */ - char_t* lpath; /* Cache local path name */ - char_t* query; /* Request query */ - char_t* decodedQuery; /* Decoded request query */ - char_t* password; /* Authorization password */ - char_t* userName; /* Authorization username */ - char_t* cookie; /* Cookie string */ - char_t* userAgent; /* User agent (browser) */ + char_t *dir; /* Directory containing the page */ + char_t *path; /* Path name without query */ + char_t *url; /* Full request url */ + char_t *host; /* Requested host */ + char_t *lpath; /* Cache local path name */ + char_t *query; /* Request query */ + char_t *decodedQuery; /* Decoded request query */ + char_t *authType; /* Authorization type (Basic/DAA) */ + char_t *password; /* Authorization password */ + char_t *userName; /* Authorization username */ + char_t *cookie; /* Cookie string */ + char_t *userAgent; /* User agent (browser) */ + char_t *protocol; /* Protocol (normally HTTP) */ + char_t *protoVersion; /* Protocol version */ int sid; /* Socket id (handler) */ + int listenSid; /* Listen Socket id */ int port; /* Request port number */ int state; /* Current state */ int flags; /* Current flags -- see above */ int code; /* Request result code */ int clen; /* Content length */ int wid; /* Index into webs */ + char_t *cgiStdin; /* filename for CGI stdin */ int docfd; /* Document file descriptor */ - int numbytes; /* Bytes to transfer to browser */ + int numbytes; /* Bytes to transfer to browser */ int written; /* Bytes actually transferred */ void (*writeSocket)(struct websRec *wp); +#ifdef DIGEST_ACCESS_SUPPORT + char_t *realm; /* usually the same as "host" from websRec */ + char_t *nonce; /* opaque-to-client string sent by server */ + char_t *digest; /* digest form of user password */ + char_t *uri; /* URI found in DAA header */ + char_t *opaque; /* opaque value passed from server */ + char_t *nc; /* nonce count */ + char_t *cnonce; /* check nonce */ + char_t *qop; /* quality operator */ +#endif +#ifdef WEBS_SSL_SUPPORT + websSSL_t *wsp; /* SSL data structure */ +#endif } websRec; typedef websRec *webs_t; typedef websRec websType; /******************************** Prototypes **********************************/ - +extern int websAccept(int sid, char *ipaddr, int port, int listenSid); extern int websAspDefine(char_t *name, int (*fn)(int ejid, webs_t wp, int argc, char_t **argv)); extern int websAspRequest(webs_t wp, char_t *lpath); @@ -112,9 +146,11 @@ extern int websFormDefine(char_t *name, void (*fn)(webs_t wp, extern char_t *websGetDefaultDir(); extern char_t *websGetDefaultPage(); extern char_t *websGetHostUrl(); +extern char_t *websGetIpaddrUrl(); extern char_t *websGetPassword(); extern int websGetPort(); extern char_t *websGetPublishDir(char_t *path, char_t **urlPrefix); +extern char_t *websGetRealm(); extern int websGetRequestBytes(webs_t wp); extern char_t *websGetRequestDir(webs_t wp); extern int websGetRequestFlags(webs_t wp); @@ -125,6 +161,7 @@ extern char_t *websGetRequestPassword(webs_t wp); extern char_t *websGetRequestType(webs_t wp); extern int websGetRequestWritten(webs_t wp); extern char_t *websGetVar(webs_t wp, char_t *var, char_t *def); +extern int websCompareVar(webs_t wp, char_t *var, char_t *value); extern void websHeader(webs_t wp); extern int websOpenListen(int port, int retries); extern int websPageOpen(webs_t wp, char_t *lpath, char_t *path, @@ -142,6 +179,7 @@ extern void websSetEnv(webs_t wp); extern void websSetHost(char_t *host); extern void websSetIpaddr(char_t *ipaddr); extern void websSetPassword(char_t *password); +extern void websSetRealm(char_t *realmName); extern void websSetRequestBytes(webs_t wp, int bytes); extern void websSetRequestFlags(webs_t wp, int flags); extern void websSetRequestLpath(webs_t wp, char_t *lpath); @@ -150,6 +188,7 @@ extern char_t *websGetRequestUserName(webs_t wp); extern void websSetRequestWritten(webs_t wp, int written); extern void websSetVar(webs_t wp, char_t *var, char_t *value); extern int websTestVar(webs_t wp, char_t *var); +extern void websTimeoutCancel(webs_t wp); extern int websUrlHandlerDefine(char_t *urlPrefix, char_t *webDir, int arg, int (*fn)(webs_t wp, char_t *urlPrefix, char_t *webDir, int arg, char_t *url, char_t *path, @@ -164,10 +203,18 @@ extern int websUrlParse(char_t *url, char_t **buf, char_t **host, extern char_t *websUrlType(char_t *webs, char_t *buf, int charCnt); extern int websWrite(webs_t wp, char_t* fmt, ...); extern int websWriteBlock(webs_t wp, char_t *buf, int nChars); -extern int websWriteBlockData(webs_t wp, char *buf, int nChars); +extern int websWriteDataNonBlock(webs_t wp, char *buf, int nChars); extern int websValid(webs_t wp); extern int websValidateUrl(webs_t wp, char_t *path); -extern int websCloseFileHandle(webs_t wp); +extern void websMarkTime(webs_t wp); + +/* + * The following prototypes are used by the SSL patch found in websSSL.c + */ +extern int websAlloc(int sid); +extern void websFree(webs_t wp); +extern void websTimeout(void *arg, int id); +extern void websReadEvent(webs_t wp); /* * Prototypes for functions available when running as part of the |