home *** CD-ROM | disk | FTP | other *** search
/ CGI How-To / CGI HOW-TO.iso / chap4 / 4_4 / comp_c / cgilib.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-06-15  |  1.5 KB  |  70 lines

  1.  
  2. /*
  3.  * This file describes the interface for a
  4.  * library of functions to read CGI input.
  5.  * The library depends on two ADTs, Array and
  6.  * Dicitonary.
  7.  *
  8.  * To use the library, declare a string and Dictionary.
  9.  * Call read data, passing in the un-allocated string.
  10.  * The library will allocate space if needed.
  11.  * Then call parse data, to convert the encoded
  12.  * string into a dictionary of data.
  13.  *
  14.  * Dictionary dataDict;
  15.  * char *data;
  16.  * 
  17.  * dataDict = dict_alloc();
  18.  *     
  19.  * readData(&data);
  20.  *         
  21.  * if(data) parseData(data,dataDict);
  22.  *
  23.  * You can also use the convience function readParse():
  24.  *
  25.  * Dictionary dataDict;
  26.  * dataDict = readParse();
  27.  */
  28.  
  29. #ifndef CGILIB_H
  30. #define CGILIB_H
  31.  
  32. #include "dict.h"
  33. #include "array.h"
  34. #include "string.h"
  35.  
  36. /* Calls readData and parseData, then returns the dictionary */
  37.  
  38. Dictionary readParse();
  39.  
  40. /* Calls readGetData or readPostData appropriately */
  41.  
  42. void readData(char **aString);
  43.  
  44. /* readGetData() reads get data and puts it into aString */
  45. void readGetData(char **aString);
  46.  
  47. /* readPostData() reads POST data and puts it into aString */
  48. void readPostData(char **aString);
  49.  
  50. /* decodeData() decodes a string of CGI encoded data */
  51.  
  52. void decodeData(char *queryString);
  53.  
  54. /* encodeData() encodes a string for CGI */
  55. void encodeData(String aString);
  56.  
  57. /* 
  58.  * encodeDictionary() encodes a dictionary in the form
  59.  * of CGI data and returns a String ADT.
  60.  */
  61. String encodeDictionary(Dictionary dataDict);
  62.  
  63. /* 
  64.  * parseData() breaks a CGI encoded string into
  65.  * a Dictionary.
  66.  */
  67. int parseData(char *queryString, Dictionary dataDict);
  68.  
  69. #endif
  70.