HTBind.h
上传用户:zlh9724
上传日期:2007-01-04
资源大小:1991k
文件大小:6k
源码类别:

浏览器

开发平台:

Unix_Linux

  1. /*                                                                   File Suffix Bind Manager
  2.                                  FILE SUFFIX BIND MANAGER
  3.                                              
  4.  */
  5. /*
  6. **      (c) COPYRIGHT MIT 1995.
  7. **      Please first read the full copyright statement in the file COPYRIGH.
  8. */
  9. /*
  10.    This module sets up the binding between a file Bind and a media type, language,
  11.    encoding etc. In a client application the Binds are used in protocols that does not
  12.    support media types etc., like FTP, and in server applications they are used to make
  13.    the bindings between the server and the local file store that the server can serve to
  14.    the rest of the world (well almost). The HTFormat module holds this information against
  15.    the accept headers received in a request and uses if for format negotiation. All the
  16.    binding management can all be replace by a database interface.
  17.    
  18.    This module is implemented by HTBind.c, and it is a part of the  W3C Reference Library.
  19.    
  20.  */
  21. #ifndef HTBIND_H
  22. #define HTBIND_H
  23. #include "HTFormat.h"
  24. #include "HTAnchor.h"
  25. /*
  26. Initialization of the Module
  27.    These functions must be called on startup and termination of the application. This is
  28.    done automatically by HTLibInit() and HTLibTerminate().
  29.    
  30.  */
  31. extern BOOL HTBind_init         (void);
  32. extern BOOL HTBind_deleteAll    (void);
  33. /*
  34. Case Sensitivity
  35.    Should the search for suffixes be case sensitive or not? The default value is case
  36.    sensitive.
  37.    
  38.  */
  39. extern void HTBind_caseSensitive        (BOOL sensitive);
  40. /*
  41. Suffix Delimiters
  42.    Change the set of suffix delimiters. The default is a platform dependent set defined in
  43.    the tcp module.
  44.    
  45.  */
  46. extern CONST char *HTBind_delimiters    (void);
  47. extern void HTBind_setDelimiters        (CONST char * new_suffixes);
  48. /*
  49. Set up Bindings Associated with a File Suffix
  50.    There are three types of bindings:
  51.    
  52.       Content Type (media type)
  53.       
  54.       Language
  55.       
  56.       Content Encoding
  57.       
  58.    And the associated set of methods is defined as:
  59.    
  60.  */
  61. extern BOOL HTBind_add          (CONST char *   suffix,
  62.                                  CONST char *   representation,
  63.                                  CONST char *   encoding,
  64.                                  CONST char *   language,
  65.                                  double         value);
  66. extern BOOL HTBind_addType      (CONST char *   suffix,
  67.                                  CONST char *   format,
  68.                                  double         value);
  69. extern BOOL HTBind_addEncoding  (CONST char *   suffix,
  70.                                  CONST char *   encoding,
  71.                                  double         value);
  72. extern BOOL HTBind_addLanguage  (CONST char *   suffix,
  73.                                  CONST char *   language,
  74.                                  double         value);
  75. /*
  76.    The first method is a "super" method for binding information to a file suffic. Any of
  77.    the string values can be NULL. If filename suffix is already defined its previous
  78.    definition is overridden or modified. For example, a HTBind_setType and
  79.    HTBind_setEncoding can be called with the same suffix.
  80.    
  81.    Calling this with suffix set to "*" will set the default representation. Calling this
  82.    with suffix set to "*.*" will set the default representation for unknown suffix files
  83.    which contain a "."
  84.    
  85.    NOTE: The suffixes can contain characters that must be escaped in a URL. However, they
  86.    should not be encoded when parsed as the suffix parameter.
  87.    
  88. Determine a suitable suffix
  89.    Use the set of bindings to find a suitable suffix (or index) for a certain combination
  90.    of language, media type and encoding given in the anchor. Returns a pointer to a
  91.    suitable suffix string that must be freed  by the caller. If more than one suffix is
  92.    found they are all concatenated. If no suffix is found, NULL is returned.
  93.    
  94.  */
  95. extern char * HTBind_getSuffix  (HTParentAnchor * anchor);
  96. /*
  97. Determine the content of an Anchor
  98.    Use the set of bindings to find the combination of language, media type and encoding of
  99.    a given anchor. If more than one suffix is found they are all searched. The last suffix
  100.    has highest priority, the first one lowest. Returns the anchor object with the
  101.    representations found. See also HTBind_getFormat
  102.    
  103.  */
  104. extern BOOL HTBind_getBindings  (HTParentAnchor * anchor);
  105. /*
  106. Determine the content of File
  107.    Use the set of bindings to find the combination of language, media type and encoding of
  108.    a given anchor. If more than one suffix is found they are all searched. The last suffix
  109.    has highest priority, the first one lowest. Returns the format, encoding, and language
  110.    found. See also HTBind_getBindings.
  111.    
  112.  */
  113. extern BOOL HTBind_getFormat    (CONST char *   filename,
  114.                                  HTFormat *     format,
  115.                                  HTEncoding *   encoding,
  116.                                  HTLanguage *   language,
  117.                                  double *       quality);
  118. /*
  119. Multi Format Management
  120.    Use the set of bindings to find the combination of language, media type and encoding of
  121.    a given anchor. If more than one suffix is found they are all searched. The last suffix
  122.    has highest priority, the first one lowest. Returns the format, encoding, and language
  123.    found. See also HTBind_getBindings, and HTBind_getFormat.
  124.    
  125.  */
  126. #define MULTI_SUFFIX ".multi"   /* Extension for scanning formats */
  127. #define MAX_SUFF 15             /* Maximum number of suffixes for a file */
  128. extern HTContentDescription * HTBind_getDescription (char * file);
  129. /*
  130.    End of declaration module
  131.    
  132.  */
  133. #endif /* HTBIND_H */
  134. /*
  135.     */