[0001] [0002] [0003] [0004] [0005] [0006] [0007] [0008] [0009] [0010] [0011] [0012] [0013] [0014] [0015] [0016] [0017] [0018] [0019] [0020] [0021] [0022] [0023] [0024] [0025] [0026] [0027] [0028] [0029] [0030] [0031] [0032] [0033] [0034] [0035] [0036] [0037] [0038] [0039] [0040] [0041] [0042] [0043] [0044] [0045] [0046] [0047] [0048] [0049] [0050] [0051] [0052] [0053] [0054] [0055] [0056] [0057] [0058] [0059] [0060] [0061] [0062] [0063] [0064] [0065] [0066] [0067] [0068] [0069] [0070] [0071] [0072] [0073] [0074] [0075] [0076] [0077] [0078] [0079] [0080] [0081] [0082] [0083] [0084] [0085] [0086] [0087] [0088] [0089] [0090] [0091] [0092] [0093] [0094] [0095] [0096] [0097] [0098] [0099] [0100] [0101] [0102] [0103] [0104] [0105] [0106] [0107] [0108] [0109] [0110] [0111] [0112] [0113] [0114] [0115] [0116] [0117] [0118] [0119] [0120] [0121] [0122] [0123] [0124] [0125] [0126] [0127] [0128] [0129] [0130] [0131] [0132] [0133] [0134] [0135] [0136] [0137] [0138] [0139] [0140] [0141] [0142] [0143] [0144] [0145] [0146] [0147] [0148] [0149] [0150] [0151] [0152] [0153] [0154] [0155] [0156] [0157] [0158] [0159] [0160] [0161] [0162] [0163] [0164] [0165] [0166] [0167] [0168] [0169] [0170] [0171] [0172] [0173] [0174] [0175] [0176] [0177] [0178] [0179] [0180] [0181] [0182] [0183] [0184] [0185] [0186] [0187] [0188] [0189] [0190] [0191] [0192] [0193] [0194] [0195] [0196] [0197] [0198] [0199] [0200] [0201] [0202] [0203] [0204] [0205] [0206] [0207] [0208] [0209] [0210] [0211] [0212] [0213] [0214] [0215] [0216] [0217] [0218] [0219] [0220] [0221] [0222] [0223] [0224] [0225] [0226] [0227] [0228] [0229] [0230] [0231] [0232] [0233] [0234] [0235] [0236] [0237] [0238] [0239] [0240] [0241] [0242] [0243] [0244] [0245] [0246] [0247] [0248] [0249] [0250] [0251] [0252] [0253] [0254] [0255] [0256] [0257] [0258] [0259] [0260] [0261] [0262] [0263] [0264] [0265] [0266] [0267] [0268] [0269] [0270] [0271] [0272]
/*****************************************************************************/ /* CgiLib.h See CGILIB.C for version information. */ /*****************************************************************************/ #ifndef CGILIB_H_LOADED #define CGILIB_H_LOADED 1 #include <descrip.h> #include <stdio.h> #define CGILIB_CGIPLUS_VAR_RECORD "CGILIB_CGIPLUS_VAR_RECORD" #ifndef CGILIB_SOFTWAREID #define CGILIB_SOFTWAREID CgiLib__SoftwareID extern char CgiLib__SoftwareID []; #endif /* mainly to allow easy use of the __unaligned directive */ #ifndef ULONGPTR #define ULONGPTR __unaligned unsigned long* #define USHORTPTR __unaligned unsigned short* #define INT64PTR __unaligned __int64* #define UINT64PTR __unaligned unsigned __int64* #endif /* Alpha NO MEMBER ALIGNMENT unless otherwise specified */ #ifndef __VAX # pragma member_alignment __save # pragma nomember_alignment #endif /* constants for tracking what environment it's catering for */ #define CGILIB_ENVIRONMENT_WASD 1 #define CGILIB_ENVIRONMENT_CGIPLUS 2 #define CGILIB_ENVIRONMENT_OSU 3 #define CGILIB_ENVIRONMENT_PURVEYOR 4 #define CGILIB_ENVIRONMENT_APACHE 5 #define CGILIB_ENVIRONMENT_CGI 6 #define CGILIB_ENVIRONMENT_STDOUT_BINARY 1 #define CGILIB_ENVIRONMENT_STDOUT_RECORD 2 #ifndef CGILIB_VARLIST_CHUNK # define CGILIB_VARLIST_CHUNK 2048 #endif #ifdef CGILIB_CGIPLUS_LINE_SIZE /* for backward compatibility */ # define CGILIB_CGIPLUS_RECORD_SIZE CGILIB_CGIPLUS_RECORD_SIZE #endif #ifndef CGILIB_CGIPLUS_RECORD_SIZE /* set fairly large to allow for CGIplus stream variables */ # define CGILIB_CGIPLUS_RECORD_SIZE 16384 #endif #ifndef CGILIB_BODY_CHUNK # define CGILIB_BODY_CHUNK 4096 #endif /* size of memory allocation in CgiLib__VarList() */ #ifndef CGILIB_VARLIST_CHUNK # define CGILIB_VARLIST_CHUNK 2048 #endif #ifndef CGILIB_ENCODED_CHUNK # define CGILIB_ENCODED_CHUNK 256 #endif #ifndef CGILIB_ESCAPED_CHUNK # define CGILIB_ESCAPED_CHUNK 256 #endif /* bitwise values used in CgiLibAnchorEscapeHtml() */ #define CGILIB_ANCHOR_NONE 0x00000000 #define CGILIB_ANCHOR_WEB 0x00000001 #define CGILIB_ANCHOR_MAIL 0x00000002 #define CGILIB_ANCHOR_ALL2 0x0000ffff /* to use with _SPLIT */ #define CGILIB_ANCHOR_SPLIT 0x00010000 #define CGILIB_ANCHOR_MASK1 0x0000ffff #define CGILIB_ANCHOR_MASK2 0xffff0000 #define CGILIB_ANCHOR_ALL 0xffffffff /* for 'backward' compatibility */ #ifndef CGILIB_RESPONSE_BODY /* <BODY...> tag parameters */ # define CGILIB_RESPONSE_BODY "" #endif #ifndef CGILIB_RESPONSE_CHARSET /* script-specified ";charset=xxx" if the content is text */ # define CGILIB_RESPONSE_CHARSET NULL #endif #ifndef CGILIB_RESPONSE_DEFAULT_CHARSET /* default ";charset=xxx" if the content is text */ # define CGILIB_RESPONSE_DEFAULT_CHARSET "ISO-8859-1" #endif #ifndef CGILIB_RESPONSE_SOFTWAREID /* for <META...> tag information */ # define CGILIB_RESPONSE_SOFTWAREID CGILIB_SOFTWAREID #endif #ifndef CGILIB_RESPONSE_ERROR_MESSAGE # define CGILIB_RESPONSE_ERROR_MESSAGE "Reported by script." #endif #ifndef CGILIB_RESPONSE_ERROR_STATUS /* HTTP status code when reporting errors */ # define CGILIB_RESPONSE_ERROR_STATUS 404 #endif #ifndef CGILIB_RESPONSE_ERROR_TITLE /* large, bolded error report page title */ # define CGILIB_RESPONSE_ERROR_TITLE "ERROR" #endif #ifndef CGILIB_RESPONSE_ERROR_INFO /* post-error-report text message (site-specific) */ # define CGILIB_RESPONSE_ERROR_INFO "" #endif #ifndef CGILIB_RESPONSE_SUCCESS_STATUS /* HTTP status code when reporting success */ # define CGILIB_RESPONSE_SUCCESS_STATUS 200 #endif #ifndef CGILIB_RESPONSE_SUCCESS_TITLE /* large, bolded success report page title */ # define CGILIB_RESPONSE_SUCCESS_TITLE "SUCCESS" #endif #ifndef CGILIB_RESPONSE_SUCCESS_MESSAGE # define CGILIB_RESPONSE_SUCCESS_MESSAGE "Reported by script." #endif #ifndef CGILIB_DEBUG # define CGILIB_DEBUG 0 #endif #ifndef CGILIB_NONE # define CGILIB_NONE "" #endif #define sys$getmsg SYS$GETMSG /* elbow-room :-) additional bytes on a memory allocation */ #define CGILIB_VEEMEM_EBROOM 16 /* the size of the VeeMem chunk */ #define CGILIB_VEEMEM_SIZE(vptr) \ (*(unsigned long*)(((char*)vptr)-sizeof(unsigned long))) /* is the VeeMem chunk exhausted? */ #define CGILIB_VEEMEM_GONE(vptr,mptr) \ (((char*)vptr)+(*(unsigned long*)(((char*)vptr)-sizeof(unsigned long))) > \ ((char*)mptr)) /**************/ /* prototypes */ /**************/ char* CgiLibVar (char*); char* CgiLibVarNull (char*); char* CgiLibVeeMemVar (char*); char* CgiLibVeeMemVarNull (char*); int CgiLibVarByDesc (struct dsc$descriptor*, struct dsc$descriptor*, ...); /* for backward-compatibility */ char* CgiVar (char*); char* CgiLibHttpStatusCodeText (int); int CgiLibUrlDecode (char*); void CgiLibCgiPlusEOF (); void CgiLibCgiPlusEOT (); void CgiLibCgiPlusESC (); void CgiLibCgiPlusInGets (char*, int); void CgiLibCgiPlusSetVarRecord (); void CgiLibCgiPlusSetVarStruct (); char* CgiLibCgiPlusCallout (char*, ...); void CgiLibInit (int, char*[], void(*)(void)); void CgiLib__PrepareRequest (void(*)(void)); void CgiLib__ApacheFixBg (); int CgiLib__ApacheFixBgHandler (); void CgiLib__ApacheSetSockOpt (); int CgiLib__ApacheSetSockOptHandler (); void CgiLibEnvironmentBinaryOut (); void CgiLibEnvironmentInit (int, char*[], int); int CgiLibEnvironmentIsApache (); int CgiLibEnvironmentIsCgi (); int CgiLibEnvironmentIsCgiPlus (); int CgiLibEnvironmentIsOsu (); int CgiLibEnvironmentIsPurveyor (); int CgiLibEnvironmentIsWasd (); char* CgiLibEnvironmentName (); int CgiLibEnvironmentSetDebug (int); void CgiLibEnvironmentRecordOut (); /* for backward compatibility */ void CgiLibEnvironmentStandardOut (); int CgiLibEnvironmentWasdVersion (); char* CgiLibEnvironmentVersion (); int CgiLibHttpProtocolVersion (); char* CgiLibXUACompatible (char*); char* CgiLibReadRequestBody (char**, int*); int CgiLibFormRequestBody (char*, int); int CgiLibSetUnChunkRequestBody (int); int CgiLibUnChunkRequestBody (char*, int); int CgiLibBodyIsFormUrlEncoded (); int CgiLibBodyIsMultipartFormData (); void CgiLibOsuInit (int, char*[]); void CgiLibOsuStdoutCgi (); void CgiLibOsuStdoutRaw (); void CgiLibOsuStdoutText (); int CgiLibAnchorHtmlEscape (char*, int, char*, int, int); char* CgiLibFormEncodedParse (char*, int*); char* CgiLibFaoPrint (FILE*, char*, ...); int CgiLibHtmlDeEntify (char*); int CgiLibHtmlEscape (char*, int, char*, int); int CgiLibUrlEncode (char*, int, char*, int); int CgiLibUrlEncodeFileName (char*, char*, int, int, int); int CgiLibResponseGetStatus (); int CgiLibResponseError (char*, int, int, char*, ...); int CgiLibResponseHeader (int, char*, ...); int CgiLibResponseRedirect (char*, ...); int CgiLibResponseSuccess (char*, ...); char* CgiLibResponseSetBody (char*); char* CgiLibResponseSetCharset (char*); char* CgiLibResponseSetDefaultCharset (char*); char* CgiLibResponseSetErrorMessage (char*); int CgiLibResponseSetErrorStatus (int); char* CgiLibResponseSetErrorTitle (char*); char* CgiLibResponseSetErrorInfo (char*); int CgiLibResponseSetRecordMode (int); int CgiLibResponseSetStreamMode (int); char* CgiLibResponseSetSoftwareID (char*); char* CgiLibResponseSetSuccessMessage (char*); int CgiLibResponseSetSuccessStatus (int); char* CgiLibResponseSetSuccessTitle (char*); void* CgiLibVeeMemCalloc (unsigned long); int CgiLibVeeMemContinue (int); void CgiLibVeeMemFree (void*); int CgiLibVeeMemInit (); int CgiLibVeeMemInUse (int); void* CgiLibVeeMemRealloc (void*, unsigned long); int CgiLibVeeMemShow (void*); /*****************************************************/ /* these functions are for INTERNAL CGILIB USE only! */ /*****************************************************/ void CgiLib__SetEnvironment (); char* CgiLib__GetVar (char*, char*); char* CgiLib__GetKey (char*, char*); char* CgiLib__GetForm (char*, char*); char* CgiLib__GetPathTranslated (char*); char* CgiLib__VarList (char*, char*, char*); int CgiLib__BodyFormUrlEncoded (char*, int); int CgiLib__BodyMultipartFormData (char*, int, char*); void CgiLib__ApacheExitRecordMode (); void CgiLib__OsuExitCgi (); void CgiLib__OsuExitRaw (); void CgiLib__OsuExitText (); char* CgiLib__OsuQueryNetLink (char*, int); #ifndef __VAX # pragma member_alignment __restore #endif #endif /* CGILIB_H_LOADED */ /*****************************************************************************/