Source code of Windows XP (NT5)
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.

132 lines
3.3 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows NT **/
  3. /** Copyright(c) Microsoft Corp., 1995 **/
  4. /**********************************************************************/
  5. /*
  6. smalprox.h
  7. This module contains the small proxy common code
  8. FILE HISTORY:
  9. Johnl 04-Apr-1995 Created
  10. */
  11. #ifndef _SMALPROX_H_
  12. #define _SMALPROX_H_
  13. #include <urlutil.h>
  14. #include <dirlist.h>
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. typedef BOOL (*PFN_INTERNET_PROTOCOL)(
  19. IN struct _INET_DATA_CONTEXT * pIC,
  20. OUT VOID * pBuffer,
  21. IN DWORD cbBuffer,
  22. OUT DWORD * pcbWritten
  23. );
  24. #define INET_STATE_UNINITIALIZED 0
  25. #define INET_STATE_OPENNED 1
  26. #define INET_STATE_DONE 2
  27. typedef struct _INET_DATA_CONTEXT
  28. {
  29. HINTERNET hServer; // InternetConnect handle
  30. HINTERNET hRequest; // Protocol request handle
  31. PFN_INTERNET_PROTOCOL pfnProtocol;
  32. DWORD dwServiceType; // Protocol Type
  33. DWORD dwState;
  34. URL_DESCRIPTOR UrlDesc; // Various URL bits and pieces
  35. CHAR * pszUrlData; // Allocated buffer for UrlDesc
  36. //
  37. // If an error occurred on open, dwLastError records the error
  38. // so we can feed back a nice error during InternetReadFile
  39. //
  40. // pszErrAPI will point to the API which generated the error
  41. //
  42. DWORD dwLastError;
  43. //
  44. // When ftp or gopher return extended errors, we store the text here.
  45. // It's inline because we're not guaranteed a CloseInternetData will
  46. // happen after an error
  47. //
  48. CHAR achExtError[1024];
  49. DWORD dwErrorTextLength;
  50. DWORD dwErrorTextLeft;
  51. DWORD dwErrorCategory;
  52. #if DBG
  53. CHAR * pszErrAPI;
  54. #endif
  55. } INET_DATA_CONTEXT, *LPINET_DATA_CONTEXT;
  56. //
  57. // Macro for conditionally setting the error API string
  58. //
  59. #if DBG
  60. #define RECORD_ERROR_API( pIC, API ) (pIC)->pszErrAPI = (#API)
  61. #else
  62. #define RECORD_ERROR_API( pIC, API )
  63. #endif
  64. BOOL
  65. OpenInternetData(
  66. IN HINTERNET hInternet,
  67. IN OUT CHAR * pszHttpProxyReq,
  68. IN DWORD cbHttpProxyReq,
  69. IN VOID * pvOptionalData,
  70. IN DWORD cbOptionalData,
  71. IN OUT INET_DATA_CONTEXT * pIC,
  72. IN BOOL fCheckHeaders
  73. );
  74. BOOL
  75. ReadInternetData(
  76. IN INET_DATA_CONTEXT * pInetContext,
  77. OUT VOID * pBuffer,
  78. IN DWORD cbBuffer,
  79. OUT DWORD * pcbRead
  80. );
  81. #if 0
  82. BOOL
  83. WriteInternetData(
  84. IN INET_DATA_CONTEXT * pInetContext,
  85. IN VOID * pBuffer,
  86. IN DWORD cbBuffer,
  87. OUT DWORD * pcbWritten
  88. );
  89. #endif
  90. BOOL
  91. CloseInternetData(
  92. IN INET_DATA_CONTEXT * pInetContext
  93. );
  94. BOOL
  95. FormatInternetError(
  96. IN DWORD dwWin32Error,
  97. IN CHAR * pszErrorAPI OPTIONAL,
  98. OUT VOID * pBuffer,
  99. IN DWORD cbBuffer,
  100. OUT DWORD * pcbRead,
  101. IN const CHAR * pszErrorMessage OPTIONAL
  102. );
  103. #ifdef __cplusplus
  104. }
  105. #endif
  106. #endif //_SMALPROX_H_
  107.