Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

181 lines
3.9 KiB

  1. /*++
  2. Copyright (c) 1994 Microsoft Corporation
  3. Module Name:
  4. handle.hxx
  5. Abstract:
  6. Contains client-side internet handle class
  7. Author:
  8. Madan Appiah (madana) 16-Nov-1994
  9. Environment:
  10. User Mode - Win32
  11. Revision History:
  12. Sophia Chung (sophiac) 12-Feb-1995 (added FTP handle obj. class defs)
  13. --*/
  14. #ifndef _HINET_
  15. #define _HINET_
  16. #include "hndlobj.hxx"
  17. #include "hbase.hxx"
  18. //
  19. // types
  20. //
  21. typedef
  22. DWORD
  23. (*URLGEN_FUNC)(
  24. INTERNET_SCHEME,
  25. LPSTR,
  26. LPSTR,
  27. LPSTR,
  28. LPSTR,
  29. DWORD,
  30. LPSTR *,
  31. LPDWORD
  32. );
  33. //
  34. // typedef virtual close function
  35. //
  36. typedef BOOL (*CLOSE_HANDLE_FUNC)(HINTERNET);
  37. typedef BOOL (*CONNECT_CLOSE_HANDLE_FUNC)(HINTERNET, DWORD);
  38. //
  39. // forward references
  40. //
  41. class CCookieJar;
  42. //These parameters make most sense on request handle, but we're good enuf to allow apps. to set this
  43. // on the global handle at the cost of allocing this.
  44. struct OPTIONAL_SESSION_PARAMS
  45. {
  46. DWORD dwResolveTimeout;
  47. DWORD dwConnectTimeout;
  48. DWORD dwConnectRetries;
  49. DWORD dwSendTimeout;
  50. DWORD dwReceiveTimeout;
  51. OPTIONAL_SESSION_PARAMS()
  52. {
  53. dwResolveTimeout = GlobalResolveTimeout;
  54. dwConnectTimeout = GlobalConnectTimeout;
  55. dwConnectRetries = GlobalConnectRetries;
  56. dwSendTimeout = GlobalSendTimeout;
  57. dwReceiveTimeout = GlobalReceiveTimeout;
  58. }
  59. };
  60. typedef OPTIONAL_SESSION_PARAMS* POPTIONAL_SESSION_PARAMS;
  61. class CResolverCache;
  62. class INTERNET_HANDLE_OBJECT : public INTERNET_HANDLE_BASE
  63. {
  64. //
  65. // This is the class to place all members and methods that should
  66. // not be inherited by connect handles and request handles.
  67. //
  68. SERIALIZED_LIST _ServerInfoList;
  69. OPTIONAL_SESSION_PARAMS * _pOptionalParams;
  70. // Hostent cache is now a per-session object
  71. CResolverCache* _pResolverCache;
  72. SECURITY_CACHE_LIST _SessionCertCache;
  73. BOOL _fUseSessionCertCache;
  74. public:
  75. CCookieJar * _CookieJar;
  76. ChunkFilter _ChunkFilter;
  77. public:
  78. BOOL SetTimeout(DWORD dwTimeoutOption, DWORD dwTimeoutValue);
  79. BOOL GetTimeout(DWORD dwTimeoutOption, DWORD* pdwTimeoutValue);
  80. BOOL SetTimeouts(
  81. IN DWORD dwResolveTimeout,
  82. IN DWORD dwConnectTimeout,
  83. IN DWORD dwSendTimeout,
  84. IN DWORD dwReceiveTimeout
  85. );
  86. OPTIONAL_SESSION_PARAMS * GetOptionalParams()
  87. {
  88. return _pOptionalParams;
  89. }
  90. //This should always return a positive value because if we failed to allocate this in the
  91. //constructor, we bailed with _Status=ERROR_NOT_ENOUGH_MEMORY
  92. CResolverCache* GetResolverCache()
  93. {
  94. return _pResolverCache;
  95. }
  96. //
  97. // Server Info methods.
  98. //
  99. DWORD GetServerInfo(
  100. IN LPSTR lpszHostName,
  101. IN DWORD dwServiceType,
  102. IN BOOL bDoResolution,
  103. OUT CServerInfo * * lplpServerInfo
  104. );
  105. CServerInfo * FindServerInfo(IN LPSTR lpszHostName);
  106. VOID PurgeServerInfoList(IN BOOL bForce);
  107. VOID PurgeKeepAlives(IN DWORD dwForce);
  108. // For winhttp5, this should be exposed as an option
  109. VOID SetUseSslSessionCache(IN BOOL fEnable)
  110. {
  111. _fUseSessionCertCache = fEnable;
  112. }
  113. BOOL IsSslCachePerSession()
  114. {
  115. return _fUseSessionCertCache;
  116. }
  117. SECURITY_CACHE_LIST *GetSslSessionCache()
  118. {
  119. if (_fUseSessionCertCache)
  120. return &_SessionCertCache;
  121. else
  122. return &GlobalCertCache;
  123. }
  124. //
  125. // Constructor
  126. //
  127. INTERNET_HANDLE_OBJECT::INTERNET_HANDLE_OBJECT
  128. (LPCSTR ua, DWORD access, LPSTR proxy, LPSTR bypass, DWORD flags);
  129. ~INTERNET_HANDLE_OBJECT ( );
  130. };
  131. //
  132. // prototypes
  133. //
  134. INTERNET_HANDLE_OBJECT* GetRootHandle (HANDLE_OBJECT* pHandle);
  135. #endif // _HINET_