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.

84 lines
1.9 KiB

  1. ///////////////////////////////////////////////////////////////////////////////
  2. //
  3. // FILE
  4. //
  5. // ldapsrv.h
  6. //
  7. // SYNOPSIS
  8. //
  9. // Declares the class LDAPServer.
  10. //
  11. // MODIFICATION HISTORY
  12. //
  13. // 05/07/1998 Original version.
  14. //
  15. ///////////////////////////////////////////////////////////////////////////////
  16. #ifndef _LDAPSRV_H_
  17. #define _LDAPSRV_H_
  18. #if _MSC_VER >= 1000
  19. #pragma once
  20. #endif
  21. #include <guard.h>
  22. #include <nocopy.h>
  23. class LDAPConnection;
  24. ///////////////////////////////////////////////////////////////////////////////
  25. //
  26. // CLASS
  27. //
  28. // LDAPServer
  29. //
  30. // DESCRIPTION
  31. //
  32. // This class maintains state information about an LDAP server.
  33. //
  34. ///////////////////////////////////////////////////////////////////////////////
  35. class LDAPServer
  36. : Guardable, NonCopyable
  37. {
  38. public:
  39. void AddRef() throw ()
  40. { InterlockedIncrement(&refCount); }
  41. void Release() throw ();
  42. DWORDLONG getExpiry() const throw ()
  43. { return expiry; }
  44. PCWSTR getHostname() const throw ()
  45. { return hostname; }
  46. // Forcibly open or close the cached connection.
  47. void forceOpen() throw ();
  48. void forceClosed() throw ();
  49. // Returns a connection to the server. The client is responsible for
  50. // releasing the connection when done.
  51. DWORD getConnection(LDAPConnection** cxn) throw ();
  52. static LDAPServer* createInstance(PCWSTR host) throw ();
  53. static DWORDLONG idleTimeout;
  54. static DWORDLONG retryInterval;
  55. protected:
  56. LDAPServer(PWSTR host) throw ();
  57. ~LDAPServer() throw ();
  58. // Opens an ldap connection to the server.
  59. void open() throw ();
  60. // Probes the existing connection to the server.
  61. void probe() throw ();
  62. LONG refCount; // Reference count.
  63. PWSTR hostname; // Remote host.
  64. LDAPConnection* connection; // Cached connection to server (if any).
  65. DWORD status; // Result of last open attempt.
  66. DWORDLONG expiry; // Time when current state expires.
  67. };
  68. #endif // _LDAPSRV_H_