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.

194 lines
5.4 KiB

  1. /*****************************************************************************\
  2. * MODULE: inetpp.h
  3. *
  4. * Header file for the INETPP provider routines.
  5. *
  6. *
  7. * Copyright (C) 1996-1997 Microsoft Corporation
  8. * Copyright (C) 1996-1997 Hewlett Packard
  9. *
  10. * History:
  11. * 07-Oct-1996 HWP-Guys Initiated port from win95 to winNT
  12. *
  13. \*****************************************************************************/
  14. #ifndef _INETPP_H
  15. #define _INETPP_H
  16. // Buffer sizes/Constants.
  17. //
  18. #define MAX_INET_BUFFER 256
  19. #define MIN_DISK_SPACE 8192
  20. #define MAX_IPP_BUFFER 1024
  21. #define MAX_INET_RETRY 3 // 3 times for internet-connect.
  22. // Error return codes for Request-Auth-Sends.
  23. //
  24. #define RET_SUCESS 0
  25. #define RET_FAILURE 1
  26. // Return value for the customized authentication dialog
  27. //
  28. #define AUTHDLG_OK 1
  29. #define AUTHDLG_CANCEL 2
  30. #define AUTHDLG_TIMEOUT 3
  31. #define AUTHDLG_ERROR 4
  32. // Flags.
  33. //
  34. #define INETPP_REQ_FLAGS (INTERNET_FLAG_KEEP_CONNECTION | INTERNET_FLAG_RELOAD)
  35. // Offsets into structure. Used for the PORT_INFO fields in obtaining
  36. // port-information.
  37. //
  38. #ifdef offsetof
  39. #undef offsetof
  40. #endif
  41. #define offsetof(type, identifier) ((DWORD)(UINT_PTR)(&(((type)0)->identifier)))
  42. // Function types for the HTTP calls in WININET.DLL.
  43. //
  44. typedef BOOL (WINAPI *PFNHTTPQUERYINFO) (HINTERNET, DWORD, LPVOID, LPDWORD, LPDWORD);
  45. typedef HINTERNET (WINAPI *PFNINTERNETOPENURL) (HINTERNET, LPCTSTR, LPCTSTR, DWORD, DWORD, DWORD_PTR);
  46. typedef DWORD (WINAPI *PFNINTERNETERRORDLG) (HWND, HINTERNET, DWORD, DWORD, LPVOID);
  47. typedef BOOL (WINAPI *PFNHTTPSENDREQUEST) (HINTERNET, LPCTSTR, DWORD, LPVOID, DWORD);
  48. #ifdef UNIMPLEMENTED
  49. typedef BOOL (WINAPI *PFNHTTPSENDREQUESTEX) (HINTERNET, LPINTERNET_BUFFERS, LPINTERNET_BUFFERS, DWORD, DWORD_PTR);
  50. #else
  51. typedef BOOL (WINAPI *PFNHTTPSENDREQUESTEX) (HINTERNET, LPINTERNET_BUFFERSA, LPINTERNET_BUFFERS, DWORD, DWORD_PTR);
  52. #endif
  53. typedef BOOL (WINAPI *PFNINTERNETREADFILE) (HINTERNET, LPVOID, DWORD, LPDWORD);
  54. typedef BOOL (WINAPI *PFNINTERNETWRITEFILE) (HINTERNET, LPCVOID, DWORD, LPDWORD);
  55. typedef BOOL (WINAPI *PFNINTERNETCLOSEHANDLE) (HINTERNET);
  56. typedef HINTERNET (WINAPI *PFNINTERNETOPEN) (LPCTSTR, DWORD, LPCTSTR, LPCTSTR, DWORD);
  57. typedef HINTERNET (WINAPI *PFNINTERNETCONNECT) (HINTERNET, LPCTSTR, INTERNET_PORT, LPCTSTR, LPCTSTR, DWORD, DWORD, DWORD_PTR);
  58. typedef HINTERNET (WINAPI *PFNHTTPOPENREQUEST) (HINTERNET, LPCTSTR, LPCTSTR, LPCTSTR, LPCTSTR, LPCTSTR *, DWORD, DWORD_PTR);
  59. typedef BOOL (WINAPI *PFNHTTPADDREQUESTHEADERS) (HINTERNET, LPCTSTR, DWORD, DWORD);
  60. typedef BOOL (WINAPI *PFNHTTPENDREQUEST) (HINTERNET, LPINTERNET_BUFFERS, DWORD, DWORD_PTR);
  61. typedef BOOL (WINAPI *PFNINTERNETSETOPTION) (HINTERNET, DWORD, LPVOID, DWORD);
  62. // InetmonSendReq Response callback.
  63. //
  64. typedef BOOL (CALLBACK *IPPRSPPROC)(CAnyConnection *pConnection,
  65. HINTERNET hReq,
  66. PCINETMONPORT pIniPort,
  67. LPARAM lParam);
  68. class CInetMon {
  69. public:
  70. CInetMon ();
  71. ~CInetMon ();
  72. inline BOOL
  73. bValid (VOID) CONST { return m_bValid; }
  74. BOOL
  75. InetmonSendReq(
  76. HANDLE hPort,
  77. LPBYTE lpIpp,
  78. DWORD cbIpp,
  79. IPPRSPPROC pfnRsp,
  80. LPARAM lParam,
  81. BOOL bLeaveCrit);
  82. PCINETMONPORT
  83. InetmonOpenPort(
  84. LPCTSTR lpszPortName,
  85. PBOOL pbXcv);
  86. BOOL
  87. InetmonReleasePort(
  88. PCINETMONPORT pIniPort);
  89. BOOL
  90. InetmonClosePort(
  91. PCINETMONPORT hPort,
  92. HANDLE hPrinter);
  93. BOOL
  94. InetmonEnumPorts(
  95. LPTSTR lpszServerName,
  96. DWORD dwLevel,
  97. LPBYTE pPorts,
  98. DWORD cbBuf,
  99. LPDWORD pcbNeeded,
  100. LPDWORD pcReturned);
  101. BOOL
  102. InetmonDeletePort(
  103. LPCTSTR lpszPortName,
  104. HWND hWnd,
  105. LPCTSTR lpszMonitorName);
  106. BOOL
  107. InetmonAddPort(
  108. LPCTSTR lpszPortName,
  109. LPCTSTR lpszMonitorName);
  110. PCINETMONPORT
  111. InetmonFindPort(
  112. LPCTSTR lpszPortName);
  113. private:
  114. // Port-List Structure. This defines the global-header for the
  115. // print-provider port-list.
  116. //
  117. typedef struct _INIMONPORTLIST {
  118. HINTERNET hSession; // Handle for session connection.
  119. int cRef; // Count of hSession opens.
  120. PCINETMONPORT pIniFirstPort; // List of port-entries.
  121. } INIMONPORTLIST;
  122. typedef INIMONPORTLIST *PINIMONPORTLIST;
  123. inline BOOL
  124. _inet_validate_portname(
  125. LPCTSTR lpszPortName);
  126. PCINETMONPORT
  127. _inet_find_port(
  128. LPCTSTR lpszPortName);
  129. PCINETMONPORT
  130. _inet_create_port(
  131. LPCTSTR lpszPortName,
  132. PCPORTMGR pPortMgr);
  133. BOOL
  134. _inet_delete_port(
  135. LPCTSTR lpszPortName);
  136. DWORD
  137. _inet_size_entry(
  138. PCINETMONPORT pIniPort,
  139. DWORD dwLevel);
  140. LPBYTE
  141. _inet_copy_entry(
  142. PCINETMONPORT pIniPort,
  143. DWORD dwLevel,
  144. LPBYTE pPortInfo,
  145. LPBYTE pEnd);
  146. BOOL
  147. _inet_is_xcv_open (
  148. LPCTSTR lpszPortName,
  149. LPTSTR *ppszServerName,
  150. LPTSTR *ppszRealPortName,
  151. LPBOOL pbXcv);
  152. BOOL m_bValid;
  153. PINIMONPORTLIST m_pPortList;
  154. };
  155. typedef class CInetMon* PCINETMON;
  156. #endif