gcgi  0.9.5
About: GCGI implements NCSA's Common Gateway Interface along with the extensions to that interface defined in RFC2388.
  Fossies Dox: gcgi-0.9.5.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

gcgi.h File Reference
#include <stdio.h>
Include dependency graph for gcgi.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Enumerations

enum  gcgiEnvVars {
  gcgiHttpCookie = 0, gcgiHttpReferer, gcgiAuthType, gcgiContentLength,
  gcgiContentType, gcgiGatewayInterface, gcgiPathInfo, gcgiPathTranslated,
  gcgiQueryString, gcgiRemoteAddr, gcgiRemoteHost, gcgiRemoteIdent,
  gcgiRemoteUser, gcgiRequestMethod, gcgiScriptName, gcgiServerName,
  gcgiServerPort, gcgiServerProtocol, gcgiServerSoftware
}
 
enum  gcgiReturnType {
  GCGIFATALERROR = -1, GCGISUCCESS, GCGIFIELDNOTFOUND, GCGIFIELDEMPTY,
  GCGITRUNCATED, GCGIBADDATA
}
 
enum  MimeType {
  text, image, audio, video,
  application, multipart, message, unknown
}
 
enum  MimeEncoding {
  sevenbit, eightbit, binary, quotedprintable,
  basesixtyfour
}
 
enum  MimeFormat { fixed, flowed }
 
enum  MimeDisposition { inlined, attachment, formdata }
 
enum  MimeHeader {
  contentType, contentEncoding, contentDisposition, contentDescription,
  mimeVersion, unknownHeader
}
 
enum  HTTPHeader {
  NONE = 0, COOKIE, DISPOSITION, LENGTH,
  LAST
}
 

Functions

gcgiReturnType initCgi (void)
 
void freeCgi (void)
 
gcgiReturnType gcgiSetLimits (size_t fieldLimit, size_t queryLimit)
 
gcgiReturnType gcgiSendContentType (char *mimeType, char *name, char *charset, HTTPHeader header)
 
gcgiReturnType gcgiSendContentDisp (MimeDisposition disp, char *filename, HTTPHeader header)
 
gcgiReturnType gcgiSendContentLength (int length, HTTPHeader header)
 
gcgiReturnType gcgiSendCacheControl (char *cache, HTTPHeader header)
 
gcgiReturnType gcgiSendLocation (char *redirectURL)
 
gcgiReturnType gcgiSendStatus (int status, char *message)
 
gcgiReturnType gcgiSendCookie (char *name, char *value, char *path, char *domain, char *expires, int secure, HTTPHeader header)
 
gcgiReturnType gcgiFetchCookies (char ***cookies)
 
gcgiReturnType gcgiParseCookie (char *cookie, char **name, char **value)
 
gcgiReturnType gcgiFreeCookies (char **cookies)
 
gcgiReturnType gcgiSendEncryptedCookie (char *name, char *value, char *path, char *domain, char *expires, int secure, unsigned char *key, HTTPHeader header)
 
gcgiReturnType gcgiParseEncryptedCookie (char *cookie, unsigned char *key, char **name, char **value)
 
gcgiReturnType gcgiGenerateKey (unsigned char **key)
 
gcgiReturnType gcgiWriteKeyToFile (unsigned char *key, char *path)
 
gcgiReturnType gcgiReadKeyFromFile (char *path, unsigned char **key)
 
char * gcgiFetchEnvVar (int env)
 
gcgiReturnType gcgiFetchInteger (char *field, int *ret, int defaultRet)
 
gcgiReturnType gcgiFetchIntegerNext (char *field, int *ret, int defaultRet)
 
gcgiReturnType gcgiFetchDouble (char *field, double *ret, double defaultRet)
 
gcgiReturnType gcgiFetchDoubleNext (char *field, double *ret, double defaultRet)
 
gcgiReturnType gcgiFetchString (char *field, char *ret, int max)
 
gcgiReturnType gcgiFetchStringNext (char *field, char *ret, int max)
 
gcgiReturnType gcgiFetchStringNoNewLines (char *field, char *ret, int max)
 
gcgiReturnType gcgiFetchStringNoNewLinesNext (char *field, char *ret, int max)
 
gcgiReturnType gcgiFetchData (char *field, char *ret, int max, MimeType *type, char **subtype, MimeEncoding *encoding, char **filename, int *truncated)
 
gcgiReturnType gcgiFetchDataNext (char *field, char *ret, int max, MimeType *type, char **subtype, MimeEncoding *encoding, char **filename, int *truncated)
 
gcgiReturnType gcgiFieldLength (char *field, int *ret)
 
gcgiReturnType gcgiFieldLengthCur (char *field, int *ret)
 
gcgiReturnType gcgiFieldLengthNext (char *field, int *ret)
 
gcgiReturnType gcgiFieldSize (char *field, int *ret)
 
gcgiReturnType gcgiFieldSizeCur (char *field, int *ret)
 
gcgiReturnType gcgiFieldSizeNext (char *field, int *ret)
 
gcgiReturnType gcgiNumFormFields (int *ret)
 
gcgiReturnType gcgiNumFields (char *field, int *ret)
 
gcgiReturnType gcgiFetchCheckbox (char *field, int *ret)
 
gcgiReturnType gcgiFetchMultipleCheckbox (char *field, char **data, int size, int **ret)
 
gcgiReturnType gcgiFetchMultipleString (char *field, char ***data)
 
gcgiReturnType gcgiFreeMultipleString (char **data)
 
gcgiReturnType gcgiFetchSelectIndex (char *field, char **data, int size, int *ret, int defaultVal)
 
gcgiReturnType gcgiResetMultipleField (char *field)
 
gcgiReturnType gcgiLoadEnvVariables (char *path)
 
gcgiReturnType gcgiSaveEnvVariables (char *path)
 
gcgiReturnType gcgiDebug (char *envVarsPath, char *cgiQueryPath)
 
gcgiReturnType gcgiDecodeBaseSixtyFourString (char *text, char **decodedText, int *numBytes)
 
gcgiReturnType gcgiEncodeBaseSixtyFourString (char *text, int numBytes, char **encodedText)
 
gcgiReturnType gcgiDecodeQuotedPrintableString (char *text, char **decodedText, int *size)
 
gcgiReturnType gcgiEncodeQuotedPrintableString (char *text, char **encodedText, int *size)
 
gcgiReturnType gcgiDecodeRfc2047String (char *text, char **charset, char **decodedText)
 
gcgiReturnType gcgiDecodeUrlEncodedString (char *text, char **decodedText, int *size)
 
gcgiReturnType gcgiEncodeUrlString (char *text, char **encodedText, int *size)
 
gcgiReturnType printQuery (FILE *stream)
 

Variables

FILE * gcgiOut
 

Enumeration Type Documentation

◆ gcgiEnvVars

Enumerator
gcgiHttpCookie 
gcgiHttpReferer 
gcgiAuthType 
gcgiContentLength 
gcgiContentType 
gcgiGatewayInterface 
gcgiPathInfo 
gcgiPathTranslated 
gcgiQueryString 
gcgiRemoteAddr 
gcgiRemoteHost 
gcgiRemoteIdent 
gcgiRemoteUser 
gcgiRequestMethod 
gcgiScriptName 
gcgiServerName 
gcgiServerPort 
gcgiServerProtocol 
gcgiServerSoftware 

Definition at line 31 of file gcgi.h.

◆ gcgiReturnType

Enumerator
GCGIFATALERROR 
GCGISUCCESS 
GCGIFIELDNOTFOUND 
GCGIFIELDEMPTY 
GCGITRUNCATED 
GCGIBADDATA 

Definition at line 54 of file gcgi.h.

◆ HTTPHeader

enum HTTPHeader
Enumerator
NONE 
COOKIE 
DISPOSITION 
LENGTH 
LAST 

Definition at line 104 of file gcgi.h.

◆ MimeDisposition

Enumerator
inlined 
attachment 
formdata 

Definition at line 89 of file gcgi.h.

◆ MimeEncoding

Enumerator
sevenbit 
eightbit 
binary 
quotedprintable 
basesixtyfour 

Definition at line 76 of file gcgi.h.

◆ MimeFormat

enum MimeFormat
Enumerator
fixed 
flowed 

Definition at line 84 of file gcgi.h.

◆ MimeHeader

enum MimeHeader
Enumerator
contentType 
contentEncoding 
contentDisposition 
contentDescription 
mimeVersion 
unknownHeader 

Definition at line 95 of file gcgi.h.

◆ MimeType

enum MimeType
Enumerator
text 
image 
audio 
video 
application 
multipart 
message 
unknown 

Definition at line 65 of file gcgi.h.

Function Documentation

◆ freeCgi()

void freeCgi ( void  )

Definition at line 96 of file gcgi.c.

References cgiQueryFile, envVariablesFile, freeCgiQuery(), and XFREE.

◆ gcgiDebug()

gcgiReturnType gcgiDebug ( char *  envVarsPath,
char *  cgiQueryPath 
)

Definition at line 1248 of file gcgi.c.

References cgiQueryFile, debug, envVariablesFile, GCGISUCCESS, and XMALLOC.

◆ gcgiDecodeBaseSixtyFourString()

gcgiReturnType gcgiDecodeBaseSixtyFourString ( char *  text,
char **  decodedText,
int *  numBytes 
)

Definition at line 41 of file code.c.

References GCGISUCCESS, text, and XMALLOC.

Referenced by gcgiDecodeRfc2047String(), and gcgiParseCookie().

◆ gcgiDecodeQuotedPrintableString()

gcgiReturnType gcgiDecodeQuotedPrintableString ( char *  text,
char **  decodedText,
int *  size 
)

Definition at line 133 of file code.c.

References GCGISUCCESS, text, and XMALLOC.

Referenced by gcgiDecodeRfc2047String().

◆ gcgiDecodeRfc2047String()

gcgiReturnType gcgiDecodeRfc2047String ( char *  text,
char **  charset,
char **  decodedText 
)

◆ gcgiDecodeUrlEncodedString()

gcgiReturnType gcgiDecodeUrlEncodedString ( char *  text,
char **  decodedText,
int *  size 
)

Definition at line 290 of file code.c.

References GCGISUCCESS, hextochar(), plustospace(), text, and XMALLOC.

Referenced by decodeUrl().

◆ gcgiEncodeBaseSixtyFourString()

gcgiReturnType gcgiEncodeBaseSixtyFourString ( char *  text,
int  numBytes,
char **  encodedText 
)

Definition at line 96 of file code.c.

References GCGISUCCESS, mimeBase64, text, and XMALLOC.

Referenced by gcgiSendCookie().

◆ gcgiEncodeQuotedPrintableString()

gcgiReturnType gcgiEncodeQuotedPrintableString ( char *  text,
char **  encodedText,
int *  size 
)

Definition at line 175 of file code.c.

References chartohex(), GCGISUCCESS, text, and XMALLOC.

◆ gcgiEncodeUrlString()

gcgiReturnType gcgiEncodeUrlString ( char *  text,
char **  encodedText,
int *  size 
)

Definition at line 318 of file code.c.

References chartohex(), GCGISUCCESS, text, and XMALLOC.

◆ gcgiFetchCheckbox()

gcgiReturnType gcgiFetchCheckbox ( char *  field,
int *  ret 
)

Definition at line 1137 of file gcgi.c.

References findQueryStringNodeFirst(), GCGIFIELDNOTFOUND, and GCGISUCCESS.

◆ gcgiFetchCookies()

gcgiReturnType gcgiFetchCookies ( char ***  cookies)

Definition at line 448 of file gcgi.c.

References cgiQuery, cgiquery::env, gcgiHttpCookie, GCGISUCCESS, and tokenizeString().

◆ gcgiFetchData()

gcgiReturnType gcgiFetchData ( char *  field,
char *  ret,
int  max,
MimeType type,
char **  subtype,
MimeEncoding encoding,
char **  filename,
int *  truncated 
)

◆ gcgiFetchDataNext()

gcgiReturnType gcgiFetchDataNext ( char *  field,
char *  ret,
int  max,
MimeType type,
char **  subtype,
MimeEncoding encoding,
char **  filename,
int *  truncated 
)

◆ gcgiFetchDouble()

gcgiReturnType gcgiFetchDouble ( char *  field,
double *  ret,
double  defaultRet 
)

◆ gcgiFetchDoubleNext()

gcgiReturnType gcgiFetchDoubleNext ( char *  field,
double *  ret,
double  defaultRet 
)

◆ gcgiFetchEnvVar()

char* gcgiFetchEnvVar ( int  env)

Definition at line 851 of file gcgi.c.

References cgiQuery, and cgiquery::env.

Referenced by mimeParseHeadersFromEnv().

◆ gcgiFetchInteger()

gcgiReturnType gcgiFetchInteger ( char *  field,
int *  ret,
int  defaultRet 
)

◆ gcgiFetchIntegerNext()

gcgiReturnType gcgiFetchIntegerNext ( char *  field,
int *  ret,
int  defaultRet 
)

◆ gcgiFetchMultipleCheckbox()

gcgiReturnType gcgiFetchMultipleCheckbox ( char *  field,
char **  data,
int  size,
int **  ret 
)

Definition at line 1153 of file gcgi.c.

References findQueryStringNodeByData(), GCGIFIELDNOTFOUND, and GCGISUCCESS.

◆ gcgiFetchMultipleString()

◆ gcgiFetchSelectIndex()

gcgiReturnType gcgiFetchSelectIndex ( char *  field,
char **  data,
int  size,
int *  ret,
int  defaultVal 
)

◆ gcgiFetchString()

gcgiReturnType gcgiFetchString ( char *  field,
char *  ret,
int  max 
)

◆ gcgiFetchStringNext()

gcgiReturnType gcgiFetchStringNext ( char *  field,
char *  ret,
int  max 
)

◆ gcgiFetchStringNoNewLines()

gcgiReturnType gcgiFetchStringNoNewLines ( char *  field,
char *  ret,
int  max 
)

◆ gcgiFetchStringNoNewLinesNext()

gcgiReturnType gcgiFetchStringNoNewLinesNext ( char *  field,
char *  ret,
int  max 
)

◆ gcgiFieldLength()

gcgiReturnType gcgiFieldLength ( char *  field,
int *  ret 
)

◆ gcgiFieldLengthCur()

gcgiReturnType gcgiFieldLengthCur ( char *  field,
int *  ret 
)

◆ gcgiFieldLengthNext()

gcgiReturnType gcgiFieldLengthNext ( char *  field,
int *  ret 
)

◆ gcgiFieldSize()

gcgiReturnType gcgiFieldSize ( char *  field,
int *  ret 
)

◆ gcgiFieldSizeCur()

gcgiReturnType gcgiFieldSizeCur ( char *  field,
int *  ret 
)

◆ gcgiFieldSizeNext()

gcgiReturnType gcgiFieldSizeNext ( char *  field,
int *  ret 
)

Definition at line 835 of file gcgi.c.

References findQueryStringNode(), GCGIFIELDNOTFOUND, GCGISUCCESS, and querystringnode::size.

◆ gcgiFreeCookies()

gcgiReturnType gcgiFreeCookies ( char **  cookies)

Definition at line 478 of file gcgi.c.

References freeStringArray(), and GCGISUCCESS.

◆ gcgiFreeMultipleString()

gcgiReturnType gcgiFreeMultipleString ( char **  data)

Definition at line 1083 of file gcgi.c.

References GCGISUCCESS, and XFREE.

◆ gcgiGenerateKey()

gcgiReturnType gcgiGenerateKey ( unsigned char **  key)

◆ gcgiLoadEnvVariables()

gcgiReturnType gcgiLoadEnvVariables ( char *  path)

Definition at line 1170 of file gcgi.c.

References GCGIFATALERROR, GCGISUCCESS, XFREE, XMALLOC, and XREALLOC.

Referenced by initCgi().

◆ gcgiNumFields()

gcgiReturnType gcgiNumFields ( char *  field,
int *  ret 
)

◆ gcgiNumFormFields()

gcgiReturnType gcgiNumFormFields ( int *  ret)

Definition at line 605 of file gcgi.c.

References cgiQuery, GCGISUCCESS, and cgiquery::queryCount.

◆ gcgiParseCookie()

gcgiReturnType gcgiParseCookie ( char *  cookie,
char **  name,
char **  value 
)

Definition at line 457 of file gcgi.c.

References gcgiDecodeBaseSixtyFourString(), GCGISUCCESS, parseToken(), XFREE, and XREALLOC.

◆ gcgiParseEncryptedCookie()

gcgiReturnType gcgiParseEncryptedCookie ( char *  cookie,
unsigned char *  key,
char **  name,
char **  value 
)

◆ gcgiReadKeyFromFile()

gcgiReturnType gcgiReadKeyFromFile ( char *  path,
unsigned char **  key 
)

◆ gcgiResetMultipleField()

gcgiReturnType gcgiResetMultipleField ( char *  field)

◆ gcgiSaveEnvVariables()

gcgiReturnType gcgiSaveEnvVariables ( char *  path)

Definition at line 1226 of file gcgi.c.

References cgiQuery, cgiquery::env, ENVCOUNT, envVars, GCGIFATALERROR, and GCGISUCCESS.

◆ gcgiSendCacheControl()

gcgiReturnType gcgiSendCacheControl ( char *  cache,
HTTPHeader  header 
)

Definition at line 406 of file gcgi.c.

References gcgiOut, GCGISUCCESS, and LAST.

◆ gcgiSendContentDisp()

gcgiReturnType gcgiSendContentDisp ( MimeDisposition  disp,
char *  filename,
HTTPHeader  header 
)

Definition at line 353 of file gcgi.c.

References gcgiOut, GCGISUCCESS, and LAST.

◆ gcgiSendContentLength()

gcgiReturnType gcgiSendContentLength ( int  length,
HTTPHeader  header 
)

Definition at line 374 of file gcgi.c.

References gcgiOut, GCGISUCCESS, and LAST.

◆ gcgiSendContentType()

gcgiReturnType gcgiSendContentType ( char *  mimeType,
char *  name,
char *  charset,
HTTPHeader  header 
)

Definition at line 333 of file gcgi.c.

References gcgiOut, GCGISUCCESS, and LAST.

◆ gcgiSendCookie()

gcgiReturnType gcgiSendCookie ( char *  name,
char *  value,
char *  path,
char *  domain,
char *  expires,
int  secure,
HTTPHeader  header 
)

Definition at line 420 of file gcgi.c.

References gcgiEncodeBaseSixtyFourString(), gcgiOut, GCGISUCCESS, LAST, and XFREE.

◆ gcgiSendEncryptedCookie()

gcgiReturnType gcgiSendEncryptedCookie ( char *  name,
char *  value,
char *  path,
char *  domain,
char *  expires,
int  secure,
unsigned char *  key,
HTTPHeader  header 
)

◆ gcgiSendLocation()

gcgiReturnType gcgiSendLocation ( char *  redirectURL)

Definition at line 388 of file gcgi.c.

References gcgiOut, and GCGISUCCESS.

◆ gcgiSendStatus()

gcgiReturnType gcgiSendStatus ( int  status,
char *  message 
)

Definition at line 397 of file gcgi.c.

References gcgiOut, GCGISUCCESS, and message.

◆ gcgiSetLimits()

gcgiReturnType gcgiSetLimits ( size_t  fieldLimit,
size_t  queryLimit 
)

Definition at line 108 of file gcgi.c.

References fieldLimit, GCGISUCCESS, and queryLimit.

◆ gcgiWriteKeyToFile()

gcgiReturnType gcgiWriteKeyToFile ( unsigned char *  key,
char *  path 
)

◆ initCgi()

◆ printQuery()

gcgiReturnType printQuery ( FILE *  stream)

Variable Documentation

◆ gcgiOut