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.

111 lines
3.6 KiB

  1. /******************************************************************************
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. Client.h
  5. Abstract:
  6. This file contains the declaration of the MPCClient class,
  7. that describes a client's state.
  8. Revision History:
  9. Davide Massarenti (Dmassare) 04/20/99
  10. created
  11. ******************************************************************************/
  12. #if !defined(__INCLUDED___ULSERVER___CLIENT_H___)
  13. #define __INCLUDED___ULSERVER___CLIENT_H___
  14. #include <Wrapper.h>
  15. #define CLIENT_DB_VERSION 0xDB000003
  16. #define CLIENT_CONST__DB_EXTENSION L".db"
  17. class MPCClient : public MPCPersist
  18. {
  19. public:
  20. typedef UploadLibrary::Signature Sig;
  21. typedef std::list<MPCSession> List;
  22. typedef List::iterator Iter;
  23. typedef List::const_iterator IterConst;
  24. private:
  25. MPCServer* m_mpcsServer;
  26. MPC::wstring m_szFile; // For direct access.
  27. Sig m_sigID;
  28. List m_lstActiveSessions;
  29. SYSTEMTIME m_stLastUsed;
  30. DWORD m_dwLastSession;
  31. mutable bool m_fDirty;
  32. mutable HANDLE m_hfFile;
  33. static const DWORD c_dwVersion = CLIENT_DB_VERSION;
  34. //////////////////////////////////////////////////////////////////
  35. HRESULT IDtoPath( /*[out]*/ MPC::wstring& szStr ) const;
  36. //////////////////////////////////////////////////////////////////
  37. public:
  38. MPCClient( /*[in]*/ MPCServer* mpcsServer, /*[in]*/ const Sig& sigID );
  39. MPCClient( /*[in]*/ MPCServer* mpcsServer, /*[in]*/ const MPC::wstring& szFile );
  40. virtual ~MPCClient();
  41. MPCServer* GetServer();
  42. /////////////////////////////////////////////
  43. virtual bool IsDirty() const;
  44. virtual HRESULT Load( /*[in]*/ MPC::Serializer& streamIn );
  45. virtual HRESULT Save( /*[in]*/ MPC::Serializer& streamOut ) const;
  46. /////////////////////////////////////////////
  47. bool operator==( /*[in]*/ const UploadLibrary::Signature& rhs );
  48. bool Find ( /*[in]*/ const MPC::wstring& szJobID, /*[out]*/ Iter& it );
  49. void Erase( /*[in] */ Iter& it );
  50. /////////////////////////////////////////////
  51. HRESULT GetInstance( /*[out]*/ CISAPIinstance*& isapiInstance, /*[out]*/ bool& fFound ) const;
  52. HRESULT GetInstance( /*[out]*/ MPC::wstring& szURL ) const;
  53. /////////////////////////////////////////////
  54. HRESULT BuildClientPath( /*[out]*/ MPC::wstring& szPath ) const;
  55. HRESULT GetFileName ( /*[out]*/ MPC::wstring& szFile ) const;
  56. HRESULT GetFileSize ( /*[out]*/ DWORD& dwSize ) const;
  57. HRESULT FormatID ( /*[out]*/ MPC::wstring& szID ) const;
  58. bool CheckSignature() const;
  59. /////////////////////////////////////////////
  60. HRESULT OpenStorage ( /*[in]*/ bool fCheckFreeSpace );
  61. HRESULT InitFromDisk( /*[in]*/ bool fCheckFreeSpace );
  62. HRESULT SaveToDisk ( );
  63. HRESULT SyncToDisk ( );
  64. HRESULT GetSessions( /*[out]*/ Iter& itBegin, /*[out]*/ Iter& itEnd );
  65. /////////////////////////////////////////////
  66. Iter NewSession( /*[in]*/ UploadLibrary::ClientRequest_OpenSession& crosReq );
  67. HRESULT AppendData( /*[in]*/ MPCSession& mpcsSession, /*[in]*/ MPC::Serializer& streamConn, /*[in]*/ DWORD dwSize );
  68. HRESULT CheckQuotas( /*[in]*/ MPCSession& mpcsSession, /*[out]*/ bool& fServerBusy, /*[out]*/ bool& fAccessDenied, /*[out]*/ bool& fExceeded );
  69. };
  70. #endif // !defined(__INCLUDED___ULSERVER___CLIENT_H___)