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.

122 lines
3.3 KiB

  1. /*++
  2. Copyright (c) 2002 Microsoft Corporation
  3. Module Name:
  4. rpcsrv.h
  5. Abstract:
  6. L-PRC interface for the auto-proxy service.
  7. Author:
  8. Biao Wang (biaow) 10-May-2002
  9. --*/
  10. #ifndef _AUTOPROXY_RPC_SERVER_H
  11. #define _AUTOPROXY_RPC_SERVER_H
  12. class AUTOPROXY_RPC_SERVER
  13. {
  14. public:
  15. AUTOPROXY_RPC_SERVER(VOID);
  16. ~AUTOPROXY_RPC_SERVER(VOID);
  17. BOOL Open(LPSERVICE_STATUS);
  18. BOOL Pause(VOID); // 1) complete all pending calls /w error ERROR_WINHTTP_OPERATION_CANCELLED
  19. // 2) abort all pending WinHttpGetProxyForUrl() calls
  20. // 3) mark _fInService FALSE
  21. BOOL Resume(VOID); // mark _fInService TRUE
  22. BOOL Refresh(VOID); // invalidate results of all pending calls and cause all calls to retry
  23. // to be called in case of a Resume-Critical power event
  24. BOOL Close(VOID); // 1) call Pause() and 2) wait till all calls to exit gracefully
  25. LPSERVICE_STATUS GetServiceStatus(VOID) const { return _pServiceStatus; }
  26. RPC_STATUS GetLastError(VOID) const { return _RpcStatus; }
  27. BOOL IsIdle(DWORD dwMilliSeconds);
  28. private:
  29. RPC_STATUS OnSecurityCallback(void *Context);
  30. // BOOL SafeImpersonate(VOID);
  31. // RPC call defined in the IDL interface file; should always be keep in-sync w/ the generated header file
  32. VOID AUTOPROXY_RPC_SERVER::GetProxyForUrl(
  33. /* [in] */ PRPC_ASYNC_STATE GetProxyForUrl_AsyncHandle,
  34. /* [in] */ handle_t hBinding,
  35. /* [string][in] */ const wchar_t *pcwszUrl,
  36. /* [in] */ const P_AUTOPROXY_OPTIONS pAutoProxyOptions,
  37. /* [in] */ const P_SESSION_OPTIONS pSessionOptions,
  38. /* [out][in] */ P_AUTOPROXY_RESULT pAutoProxyResult,
  39. /* [out][in] */ unsigned long *pdwLastError);
  40. private:
  41. struct PENDING_CALL
  42. {
  43. PENDING_CALL() {
  44. hSession = NULL;
  45. fCallCancelled = FALSE;
  46. fDiscardAndRetry = FALSE;
  47. }
  48. ~PENDING_CALL() {
  49. if (hSession)
  50. {
  51. ::WinHttpCloseHandle(hSession);
  52. }
  53. }
  54. LIST_ENTRY List;
  55. HINTERNET hSession; // if client wants auto-logon, we than create a session per request
  56. // otherwise, global session handle will be used.
  57. PRPC_ASYNC_STATE hAsyncRequest;
  58. handle_t hBinding;
  59. LPDWORD pdwLastError;
  60. BOOL fCallCancelled;
  61. BOOL fDiscardAndRetry;
  62. };
  63. private:
  64. RPC_STATUS _RpcStatus;
  65. BOOL _fInService;
  66. HINTERNET _hSession; // "global" session for anonymous access
  67. SERIALIZED_LIST _PendingRequestList;
  68. LPSERVICE_STATUS _pServiceStatus;
  69. // RPC_BINDING_HANDLE _hClientBinding;
  70. HANDLE _hExitEvent;
  71. BOOL _fServiceIdle;
  72. DWORD _dwIdleTimeStamp;
  73. friend
  74. RPC_STATUS
  75. RPC_ENTRY
  76. RpcSecurityCallback (
  77. IN RPC_IF_HANDLE InterfaceUuid,
  78. IN void *Context
  79. );
  80. friend
  81. /* [async] */ void GetProxyForUrl(
  82. /* [in] */ PRPC_ASYNC_STATE GetProxyForUrl_AsyncHandle,
  83. /* [in] */ handle_t hBinding,
  84. /* [string][in] */ const wchar_t *pcwszUrl,
  85. /* [in] */ const P_AUTOPROXY_OPTIONS pAutoProxyOptions,
  86. /* [in] */ const P_SESSION_OPTIONS pSessionOptions,
  87. /* [out][in] */ P_AUTOPROXY_RESULT pAutoProxyResult,
  88. /* [out][in] */ unsigned long *pdwLastError);
  89. };
  90. #endif