HTReqMan.h
Upload User: zlh9724
Upload Date: 2007-01-04
Package Size: 1991k
Code Size: 7k
Category:

Browser Client

Development Platform:

Unix_Linux

  1. /*                                                                             Request Object
  2.                                       REQUEST OBJECT
  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 is the private part of the request object. It has the functions
  11.    declarations that are private to the Library and that shouldn't be used by
  12.    applications. The module has been separated from the old HTAccess module. See also the
  13.    public part of the declarition in the HTReq Module.
  14.    
  15.    This module is implemented by HTReqMan.c, and it is a part of the  W3C Reference
  16.    Library.
  17.    
  18.  */
  19. #ifndef HTREQMAN_H
  20. #define HTREQMAN_H
  21. #include "HTReq.h"
  22. #include "HTList.h"
  23. #include "HTFormat.h"
  24. #include "HTAnchor.h"
  25. #include "HTMethod.h"
  26. #include "HTAABrow.h"
  27. #include "HTStream.h"
  28. #include "HTSocket.h"
  29. #include "HTNet.h"
  30. /*
  31. The Request structure
  32.    When a request is handled, all kinds of things about it need to be passed along
  33.    together with a request. It is intended to live as long as the request is still active,
  34.    but can be deleted as soon as it has terminated. Only the anchor object stays around
  35.    after the request itself is terminated.
  36.    
  37.  */
  38. struct _HTRequest {
  39.     BOOL                internal;      /* Does the app knows about this one? */
  40.     HTMethod            method;
  41.     HTReload            reload;
  42.     char *              boundary;                 /* MIME multipart boundary */
  43.     int                 retrys;               /* Number of automatic reloads */
  44.     time_t              retry_after;             /* Absolut time for a retry */
  45.     HTNet *             net;                /* Information about socket etc. */
  46.     HTPriority          priority;               /* Priority for this request */
  47. /*
  48.   ACCEPT HEADERS
  49.   
  50.  */
  51.     HTList *            conversions;
  52.     BOOL                conv_local;
  53.     HTList *            encodings;
  54.     BOOL                enc_local;
  55.     HTList *            languages;
  56.     BOOL                lang_local;
  57.     HTList *            charsets;
  58.     BOOL                char_local;
  59. /*
  60.   HEADERS AND HEADER INFORMATION
  61.   
  62.  */
  63.     HTGnHd              GenMask;
  64.     HTRsHd              ResponseMask;
  65.     HTRqHd              RequestMask;
  66.     HTEnHd              EntityMask;
  67.     HTList *            parsers;
  68.     BOOL                pars_local;
  69.     HTList *            generators;
  70.     BOOL                gens_local;
  71. /*
  72.   ANCHORS
  73.   
  74.  */
  75.     HTParentAnchor *    anchor;        /* The Client anchor for this request */
  76.     HTChildAnchor *     childAnchor;        /* For element within the object */
  77.     HTParentAnchor *    parentAnchor;                   /* For referer field */
  78. /*
  79.     Redirection
  80.     
  81.    If we get a redirection back then we return the new destination for this request to the
  82.    application using this anchor.
  83.    
  84.  */
  85.     HTAnchor *          redirectionAnchor;                /* Redirection URL */
  86. /*
  87.   STREAMS FROM NETWORK TO APPLICATION
  88.   
  89.  */
  90.     HTStream *          output_stream;
  91.     HTFormat            output_format;
  92.     HTStream*           debug_stream;
  93.     HTFormat            debug_format;
  94. /*
  95.   STREAMS FROM APPLICATION TO NETWORK
  96.   
  97.  */
  98.     HTStream *          input_stream;
  99.     HTFormat            input_format;
  100. /*
  101.   CALLBACK FUNCTION FOR GETTING DATA DOWN THE INPUT STREAM
  102.   
  103.  */
  104.     HTPostCallback *    PostCallback;
  105. /*
  106.   CONTEXT SWAPPING
  107.   
  108.  */
  109.     HTRequestCallback * callback;
  110.     void *              context;
  111. /*
  112.   OTHER FLAGS
  113.   
  114.  */
  115.     BOOL                preemptive;
  116.     BOOL                ContentNegotiation;
  117.     BOOL                using_proxy;
  118. /*
  119.   ERROR MANAGER
  120.   
  121.  */
  122.     HTList *            error_stack;                       /* List of errors */
  123. /*
  124.   POSTWEB INFORMATION
  125.   
  126.  */
  127.     HTRequest *         source;              /* Source for request or itself */
  128.     HTParentAnchor *    source_anchor;            /* Source anchor or itself */
  129.     HTRequest *         mainDestination;             /* For the typical case */
  130.     HTList *            destinations;            /* List of related requests */
  131.     int                 destRequests;      /* Number of destination requests */
  132.     int                 destStreams;        /* Number of destination streams */
  133. /*
  134.   ACCESS AUTHENTICATION INFORMATION
  135.   
  136.    This will go into its own structure
  137.    
  138.  */
  139.     char *      WWWAAScheme;            /* WWW-Authenticate scheme */
  140.     char *      WWWAARealm;             /* WWW-Authenticate realm */
  141.     char *      WWWprotection;          /* WWW-Protection-Template */
  142.     char *      authorization;          /* Authorization: field */
  143.     HTAAScheme  scheme;                 /* Authentication scheme used */
  144.     HTList *    valid_schemes;          /* Valid auth.schemes             */
  145.     HTAssocList **      scheme_specifics;/* Scheme-specific parameters    */
  146.     char *      authenticate;           /* WWW-authenticate: field */
  147.     char *      prot_template;          /* WWW-Protection-Template: field */
  148.     HTAASetup * setup;                  /* Doc protection info            */
  149.     HTAARealm * realm;                  /* Password realm                 */
  150.     char *      dialog_msg;             /* Authentication prompt (client) */
  151. /*
  152.   WINDOWS SPECIFIC INFORMATION
  153.   
  154.  */
  155. #ifdef WWW_WIN_ASYNC
  156.     HWND                hwnd;           /* Windows handle for MSWindows   */
  157.     unsigned long       winMsg;         /* msg number of Windows eloop    */
  158. #endif /* WWW_WIN_ASYNC */
  159. /*
  160.  */
  161. };
  162. /*
  163. Post Web Management
  164.    These functions are mainly used internally in the Library but there is no reason for
  165.    them not to be public.
  166.    
  167.  */
  168. extern BOOL HTRequest_addDestination (HTRequest * src, HTRequest * dest);
  169. extern BOOL HTRequest_removeDestination (HTRequest * dest);
  170. extern BOOL HTRequest_destinationsReady (HTRequest * me);
  171. extern BOOL HTRequest_linkDestination (HTRequest * dest);
  172. extern BOOL HTRequest_unlinkDestination (HTRequest * dest);
  173. extern BOOL HTRequest_removePostWeb (HTRequest * me);
  174. extern BOOL HTRequest_killPostWeb (HTRequest * me);
  175. #define HTRequest_mainDestination(me) 
  176.         ((me) && (me)->source ? (me)->source->mainDestination : NULL)
  177. #define HTRequest_isDestination(me) 
  178.         ((me) && (me)->source && (me) != (me)->source)
  179. #define HTRequest_isMainDestination(me) 
  180.         ((me) && (me)->source && 
  181.         (me) == (me)->source->mainDestination)
  182. #define HTRequest_isSource(me) 
  183.         ((me) && (me)->source && (me) == (me)->source)
  184. #define HTRequest_isPostWeb(me) ((me) && (me)->source)
  185. #define HTRequest_source(me) ((me) ? (me)->source : NULL)
  186. /*
  187.    End of Declaration
  188.    
  189.  */
  190. #endif /* HTREQMAN_H */
  191. /*
  192.    end of HTAccess */