home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Leser 15 / Amiga Plus Leser CD 15.iso / Tools / Development / MosaicSRC / libwww2 / HTFile.h < prev    next >
Encoding:
C/C++ Source or Header  |  2002-03-13  |  4.7 KB  |  213 lines

  1. /*                                                                      File access in libwww
  2.                                        FILE ACCESS
  3.                                              
  4.    These are routines for local file access used by WWW browsers and
  5.    servers. Implemented by HTFile.c.
  6.    
  7.    If the file is not a local file, then we pass it on to HTFTP in
  8.    case it can be reached by FTP.
  9.    
  10.  */
  11. #ifndef HTFILE_H
  12. #define HTFILE_H
  13.  
  14. #include "HTFormat.h"
  15. #include "HTAccess.h"
  16. #include "HTML.h"               /* SCW */
  17.  
  18.  
  19.  
  20. /*
  21.  
  22. Controlling globals
  23.  
  24.    These flags control how directories and files are represented as
  25.    hypertext, and are typically set by the application from command
  26.    line options, etc.
  27.    
  28.  */
  29. extern int HTDirAccess; /* Directory access level */
  30.  
  31. #define HT_DIR_FORBID           0       /* Altogether forbidden */
  32. #define HT_DIR_SELECTIVE        1       /* If HT_DIR_ENABLE_FILE exists */
  33. #define HT_DIR_OK               2       /* Any accesible directory */
  34.  
  35. #define HT_DIR_ENABLE_FILE      ".www_browsable" /* If exists, can browse */
  36.  
  37. extern int HTDirReadme;         /* Include readme files in listing? */
  38.                                         /* Values: */
  39. #define HT_DIR_README_NONE      0       /* No */
  40. #define HT_DIR_README_TOP       1       /* Yes, first */
  41. #define HT_DIR_README_BOTTOM    2       /* Yes, at the end */
  42.  
  43. #define HT_DIR_README_FILE              "README"
  44.  
  45. extern HTList *HTSuffixes;
  46.  
  47. /*
  48.  
  49. Convert filenames between local and WWW formats
  50.  
  51.  */
  52. extern char * HTLocalName PARAMS((CONST char * name));
  53.  
  54.  
  55. /*
  56.  
  57. Make a WWW name from a full local path name
  58.  
  59.  */
  60. extern char * WWW_nameOfFile PARAMS((char * name));
  61.  
  62.  
  63. /*
  64.  
  65. Generate the name of a cache file
  66.  
  67.  */
  68. extern char * HTCacheFileName PARAMS((CONST char * name));
  69.  
  70.  
  71. /*
  72.  
  73. Output directory titles
  74.  
  75.    This is (like the next one) used by HTFTP. It is common code to
  76.    generate the title and heading 1 and the parent directory link for
  77.    any anchor.
  78.    
  79.  */
  80. extern void HTDirTitles PARAMS((
  81.         HTStructured *  target,
  82.         HTAnchor *      anchor));
  83.  
  84. /*
  85.  
  86. Output a directory entry
  87.  
  88.    This is used by HTFTP.c for example -- it is a common routine for
  89.    generating a linked directory entry.
  90.    
  91.  */
  92. extern void HTDirEntry PARAMS((
  93.         HTStructured *  target,         /* in which to put the linked text */
  94.         CONST char *    tail,           /* last part of directory name */
  95.         CONST char *    entry));        /* name of this entry */
  96.  
  97. /*
  98.  
  99. HTSetSuffix: Define the representation for a file suffix
  100.  
  101.    This defines a mapping between local file suffixes and file content
  102.    types and encodings.
  103.    
  104.   ON ENTRY,
  105.   
  106.   suffix includes the "." if that is important (normally, yes!)
  107.                          
  108.   representation is MIME-style content-type
  109.                          
  110.   encoding is MIME-style content-transfer-encoding (8bit, 7bit, etc)
  111.                          
  112.   quality an a priori judgement of the quality of such files
  113.   (0.0..1.0)
  114.                          
  115.  */
  116. /* Example:   HTSetSuffix(".ps", "application/postscript", "8bit", 1.0);
  117. **
  118. */
  119.  
  120. extern void HTSetSuffix PARAMS((
  121.         CONST char *    suffix,
  122.         CONST char *    representation,
  123.         CONST char *    encoding,
  124.         float           quality));
  125.         
  126.  
  127. /*
  128.  
  129. HTFileFormat: Get Representation and Encoding from file name
  130.  
  131.   ON EXIT,
  132.   
  133.   return                 The represntation it imagines the file is in
  134.                          
  135.   *pEncoding             The encoding (binary, 7bit, etc). See HTSetSuffix.
  136.                          
  137.  */
  138.  
  139. #define COMPRESSED_NOT    0
  140. #define COMPRESSED_BIGZ   1
  141. #define COMPRESSED_GNUZIP 2
  142.  
  143. extern HTFormat HTFileFormat PARAMS((
  144.                 char *    filename,
  145.                 HTAtom **       pEncoding,
  146.                 HTAtom *,
  147.                 int *compressed));
  148. extern char * HTFileMimeType PARAMS((
  149.                 CONST char *    filename,
  150.                 CONST char *    default_type));
  151. extern char *HTDescribeURL (char *);
  152.  
  153. /*
  154.  
  155. Determine file value from file name
  156.  
  157.  */
  158.  
  159.  
  160. extern float HTFileValue PARAMS((
  161.                 CONST char * filename));
  162.  
  163.  
  164. /*
  165.  
  166. Determine write access to a file
  167.  
  168.   ON EXIT,
  169.   
  170.   return value YES if file can be accessed and can be written to.
  171.                          
  172.  */
  173.  
  174. /*
  175.  
  176.   BUGS
  177.   
  178.    Isn't there a quicker way?
  179.    
  180.  */
  181.  
  182.  
  183. extern BOOL HTEditable PARAMS((CONST char * filename));
  184.  
  185.  
  186. /*
  187.  
  188. Determine a suitable suffix, given the representation
  189.  
  190.   ON ENTRY,
  191.   
  192.   rep                     is the atomized MIME style representation
  193.                          
  194.   ON EXIT,
  195.   
  196.   returns a pointer to a suitable suffix string if one has been found,
  197.                          else NULL.
  198.                          
  199.  */
  200. extern CONST char * HTFileSuffix PARAMS((
  201.                 HTAtom* rep));
  202.  
  203.  
  204.  
  205. /*
  206.  
  207. The Protocols
  208.  
  209.  */
  210. extern HTProtocol HTFTP, HTFile;
  211.  
  212. #endif /* HTFILE_H */
  213.