#ifdef __cplusplus
extern "C" {
#pragma info(none)
#else
#pragma nomargins nosequence
#endif
/* ** -- SOURCE PROLOG -- ***********************************************
Module Specifications
**********************************************************************
Product: I/Net's Web Server/400
Copyright: (C) Copyright I/Net Inc. Corporation 1995
**********************************************************************
File Name: WWWAPI.H
Descriptive Name: ILE C header file for Web Server/400 APIs.
Change History:
9/15/95 - Added WwwWriteCrLf, WwwWriteHeader, WwwWriteCrLfc,
WwwWriteHeaderc functions
12/4/95 - Added WwwGetFormVarEnum and WwwGetFormVarEnumc functions
12/6/96 - Changed extern "OS" to extern "ILE nowiden" to enable
the calling of our APIs by C++ programs
12/6/96 - Added Site Search support
** -- SOURCE PROLOG END -- ******************************************* */
#ifndef _WWWAPI_INCLUDED /* Check if already included */
#define _WWWAPI_INCLUDED /* Set the included flag */
/***********************************************************************/
/******************************** MACROS *******************************/
/***********************************************************************/
/* Define WWW_PREFIX_REQUIRED prior to including wwwapi.h if you don't */
/* want Web Server/400's functions to be called. */
#ifndef WWW_PREFIX_REQUIRED
/* Macros that redefine standard C functions */
#define read(a,b,c) WwwReadc(b,c)
#define write(a,b,c) WwwWritec(b,c)
#define getenv WwwGetEnvc
#define UnEscape WwwUnEscapec
#define Escape WwwEscapec
#define printf WwwPrintfc
#endif
/* Must use these EBCDIC defines for proper conversion of special */
/* characters. */
#define LF 0x25 /* Linefeed */
#define CR 0x0D /* Carriage Return (Same in ASCII as EBCDIC) */
/* Valid values for escape & unescape function InPlace parameter */
#define WWW_IN_PLACE_YES '1'
#define WWW_IN_PLACE_NO '0'
/* Valid values for WwwSearch API search options */
/* (Search options may be ORd) */
/* The text between the HTML tags listed after */
/* the definition is included in the search when */
/* the corresponding #define is requested */
#define WWW_IN_FILE 1 /* Anywhere in file */
#define WWW_HTML_TITLE 2 /*
*/
#define WWW_HTML_HEAD 4 /* */
#define WWW_HTML_BODY 8 /* */
#define WWW_HTML_COMMENTS 16 /* */
#define WWW_HTML_HEADINGS 32 /* etc. */
#define WWW_HTML_EMPHASIZED 64 /* */
/* */
#define WWW_HTML_ALL 126 /* Search all of the above */
/* HTML tags */
/* Valid values for WwwSearch API output options */
/* (Output options _RESULT and _TERM may be ORd) */
#define WWW_LARGE_RESULT 2 /* Results returned in _WWWSEARCH_LARGE struct */
#define WWW_SMALL_RESULT 4 /* Results returned in _WWWSEARCH_SMALL struct */
#define WWW_SPACE_TERM 8 /* Pad achTitle and achUrl fields with spaces */
#define WWW_NULL_TERM 16 /* Remove trailing spaces and null-terminate */
/* achTitle and achUrl fields */
/***********************************************************************/
/*************************** TYPEDEFs/STRUCTS **************************/
/***********************************************************************/
/* Results from WwwSearch API are returned in this structure when */
/* the output option SMALL_RESULT is requested */
typedef _Packed struct _WWWSEARCH_SMALL {
int iRank; /* Search ranking */
int iFileSize; /* Size of the file/document */
char achTitle[120]; /* Document title */
char achUrl[128]; /* URL to the document */
} WWWSEARCH_SMALL;
/* Results from WwwSearch API are returned in this structure when */
/* the output option LARGE_RESULT is requested (used when URLs */
/* will exceed 128 characters) */
typedef _Packed struct _WWWSEARCH_LARGE {
int iRank; /* Search ranking */
int iFileSize; /* Size of the file/document */
char achTitle[120]; /* Document title */
char achUrl[512]; /* URL to the document */
} WWWSEARCH_LARGE;
/***********************************************************************/
/************************** FUNCTION PROTOTYPES ************************/
/***********************************************************************/
#ifdef __cplusplus
extern "ILE nowiden" {
#else
#pragma argument(WwwGetFormVar,OS,nowiden)
#pragma argument(WwwGetFormVarc,OS,nowiden)
#pragma argument(WwwGetFormVarEnum,OS,nowiden)
#pragma argument(WwwGetFormVarEnumc,OS,nowiden)
#pragma argument(WwwRead,OS,nowiden)
#pragma argument(WwwReadc,OS,nowiden)
#pragma argument(WwwWrite,OS,nowiden)
#pragma argument(WwwWriteCrLf,OS,nowiden)
#pragma argument(WwwWriteHeader,OS,nowiden)
#pragma argument(WwwWritec,OS,nowiden)
#pragma argument(WwwWriteCrLfc,OS,nowiden)
#pragma argument(WwwWriteHeaderc,OS,nowiden)
#pragma argument(WwwGetEnv,OS,nowiden)
#pragma argument(WwwGetEnvc,OS,nowiden)
#pragma argument(WwwUnEscape,OS,nowiden)
#pragma argument(WwwUnEscapec,OS,nowiden)
#pragma argument(WwwEscape,OS,nowiden)
#pragma argument(WwwEscapec,OS,nowiden)
#pragma argument(WwwSearch,OS,nowiden)
#endif
/* Functions used to receive form variables; independent of how the */
/* form variables were sent (i.e., stdin or query string), the "enum" */
/* functions are used to retrieve form variables that can have */
/* multiple values (e.g., multiple selection lists) */
void WwwGetFormVar(char *pachFormVar,
long lFormVarLength,
char *pachFormVarValue,
long lFormVarValueBytesProvided,
long *plFormVarValueBytesAvailable);
char *WwwGetFormVarc(char *pszFormVar);
void WwwGetFormVarEnum(char *pachFormVar,
long lFormVarLength,
long lNumber,
char *pachFormVarValue,
long lFormVarValueBytesProvided,
long *plFormVarValueBytesAvailable);
char *WwwGetFormVarEnumc(char *pszFormVar,
long lNumber);
/* Functions used to read script data from "stdin" (form data from browser) */
void WwwRead(void *pBuffer,
long lBufferSize,
long *plBytesRead);
long WwwReadc(void *pBuffer,
long lBufferSize);
/* Functions used to write script data to "stdout" (return to browser) */
/* NOTE: CrLf functions add 1 carriage return and line feed after the data. */
/* Header functions add 2 CR,LFs after the data. */
void WwwWrite(void *pBuffer,
long lBytesToWrite,
long *plBytesWritten);
void WwwWriteCrLf(void *pBuffer,
long lBytesToWrite,
long *plBytesWritten);
void WwwWriteHeader(void *pBuffer,
long lBytesToWrite,
long *plBytesWritten);
long WwwWritec(void *pBuffer,
long lBytesToWrite);
long WwwWriteCrLfc(void *pBuffer,
long lBytesToWrite);
long WwwWriteHeaderc(void *pBuffer,
long lBytesToWrite);
/* Functions used to retrieve script environment variable values */
void WwwGetEnv(char *pachEnvVar,
long lEnvVarLength,
char *pachEnvVarValue,
long lEnvVarValueBytesProvided,
long *plEnvVarValueBytesAvailable);
char *WwwGetEnvc(char *pszEnvVar);
/* Functions used to unescape data received from browser */
void WwwUnEscape(char chInPlace,
char *pachEscaped,
long lEscapedLength,
char *pachUnEscaped,
long lUnEscapedBytesProvided,
long *plUnEscapedBytesAvailable);
long WwwUnEscapec(char *pszEscaped,
char *pszUnEscaped);
/* Functions used to escape data before sending to the browser */
void WwwEscape(char chInPlace,
char *pachUnEscaped,
long lUnEscapedLength,
char *pachEscaped,
long lEscapedBytesProvided,
long *plEscapedBytesAvailable);
long WwwEscapec(char *pszUnEscaped,
char *pszEscaped,
long lEscapedBytesProvided);
/* Function (ILE C only) used to send formatted data to the browser */
long WwwPrintfc(char *pszFormat,...);
/* Function used to search a site index */
void WwwSearch(char *pachIndexFile,
int iIndexFileLen,
char *pachSearchStr,
int iSearchStrLen,
int iSearchOptions,
int iOutputOptions,
void *pSearchResults,
int iMaxReturned,
int *iNumAvail);
#ifdef __cplusplus
} /* terminate extern "ILE nowiden" { */
#endif
#endif /* defined _WWWAPI_INCLUDED */
#ifdef __cplusplus
#pragma info(restore)
} /* terminate extern "C" { */
#endif