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

浏览器

开发平台:

Unix_Linux

  1. /*                                                                       Extra Header Manager
  2.                                    EXTRA HEADER 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 handles lists of callback functions for generating and parsing protocol
  11.    headers. This works exactly like the lists in HTFormat.
  12.    
  13.    This module is implemented by HTheader.c, and it is a part of the  W3C Reference
  14.    Library.
  15.    
  16.  */
  17. #ifndef HTHEADER_H
  18. #define HTHEADER_H
  19. #include "HTReq.h"
  20. #include "HTStream.h"
  21. /*
  22.    We have two call back functions: the first is for generating headers. This needs a
  23.    stream to put down the extra headers. This one is defined in the Request Manager. The
  24.    other one is for parsing. This needs the string to parse.
  25.    
  26.  */
  27. typedef int HTParserCallback (HTRequest * request, CONST char * token);
  28. /*
  29. Header Parser Management
  30.    Header Parsers can be registered to handle any header that is not part of the "default
  31.    set" handled by the HTMIME module. This is mainlu the set defined by HTTP/1.1.
  32.    
  33.   ADD A HEADER PARSER
  34.   
  35.    Register a Header parser to be called if we encounter the token in teh protocol
  36.    response. Tokens can contain a wildcard '*' which will match zero or more arbritary
  37.    chars.
  38.    
  39.  */
  40. extern BOOL HTParser_add (HTList *              parsers,
  41.                           CONST char *          token,
  42.                           BOOL                  case_sensitive,
  43.                           HTParserCallback *    callback);
  44. /*
  45.   UNREGISTER A HEADER PARSER
  46.   
  47.  */
  48. extern BOOL HTParser_delete (HTList * parsers, CONST char * token);
  49. /*
  50.   DELETE THE LIST OF REGISTERED HEADER PARSERS.
  51.   
  52.  */
  53. extern BOOL HTParser_deleteAll (HTList * parsers);
  54. /*
  55.   FIND A PARSER
  56.   
  57.    Search registered parsers to find suitable one for this token If a parser isn't found,
  58.    the function returns NULL
  59.    
  60.  */
  61. extern HTParserCallback * HTParser_find (HTList *parsers, CONST char * token);
  62. /*
  63. Header Generator Management
  64.    Header Generators can be use to add additional information to aprotocol request. They
  65.    will all be called.
  66.    
  67.   ADD A HEADER GENERATOR
  68.   
  69.  */
  70. extern BOOL HTGenerator_add (HTList * gens, HTPostCallback * callback);
  71. /*
  72.   UNREGISTER A HEADER GENERATOR
  73.   
  74.  */
  75. extern BOOL HTGenerator_delete (HTList * gens, HTPostCallback * callback);
  76. /*
  77.   DELETE THE LIST OF REGISTERED HEADER GENERATORS.
  78.   
  79.  */
  80. extern BOOL HTGenerator_deleteAll (HTList * gens);
  81. /*
  82. Global List Of Parsers and Generators
  83.    As in HTFormat module you can register a list globally or locally as you like. The
  84.    local registrations is managed by Request Manager
  85.    
  86.   HEADER PARSERS
  87.   
  88.  */
  89. extern void HTHeader_setParser (HTList * list);
  90. extern BOOL HTHeader_addParser (CONST char * token, BOOL case_sensitive,
  91.                                 HTParserCallback * callback);
  92. extern BOOL HTHeader_deleteParser (CONST char * token);
  93. extern HTList * HTHeader_parser (void);
  94. /*
  95.   HEADER GENERATION
  96.   
  97.  */
  98. extern void HTHeader_setGenerator (HTList * list);
  99. extern BOOL HTHeader_addGenerator (HTPostCallback * callback);
  100. extern BOOL HTHeader_deleteGenerator (HTPostCallback * callback);
  101. extern HTList * HTHeader_generator (void);
  102. /*
  103.   DELETE ALL GLOBAL LISTS
  104.   
  105.  */
  106. extern void HTHeader_deleteAll (void);
  107. /*
  108.  */
  109. #endif /* HTHEADER_H */
  110. /*
  111.    End of Declaration  */