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.

62 lines
2.5 KiB

  1. // --------------------------------------------------------------------------
  2. // Module Name: ServerAPI.h
  3. //
  4. // Copyright (c) 1999-2000, Microsoft Corporation
  5. //
  6. // An abstract base class containing virtual functions that allow the basic
  7. // port functionality code to be reused to create another server. These
  8. // virtual functions create other objects with pure virtual functions which
  9. // the basic port functionality code invokes thru the v-table.
  10. //
  11. // History: 1999-11-07 vtan created
  12. // 2000-08-25 vtan moved from Neptune to Whistler
  13. // --------------------------------------------------------------------------
  14. #ifndef _ServerAPI_
  15. #define _ServerAPI_
  16. #include "APIDispatcher.h"
  17. #include "CountedObject.h"
  18. #include "PortMessage.h"
  19. class CAPIConnection; // This would be circular otherwise
  20. // --------------------------------------------------------------------------
  21. // CServerAPI
  22. //
  23. // Purpose: The abstract base class which the server connection monitor
  24. // thread uses to determine whether server connection should be
  25. // accepted or rejected as well as creating threads to process
  26. // client requests.
  27. //
  28. // History: 1999-11-07 vtan created
  29. // 2000-08-25 vtan moved from Neptune to Whistler
  30. // --------------------------------------------------------------------------
  31. class CServerAPI : public CCountedObject
  32. {
  33. protected:
  34. CServerAPI (void);
  35. virtual ~CServerAPI (void);
  36. public:
  37. virtual const WCHAR* GetPortName (void) = 0;
  38. virtual const TCHAR* GetServiceName (void) = 0;
  39. virtual bool ConnectionAccepted (const CPortMessage& portMessage) = 0;
  40. virtual CAPIDispatcher* CreateDispatcher (const CPortMessage& portMessage) = 0;
  41. virtual NTSTATUS Connect (HANDLE* phPort) = 0;
  42. NTSTATUS Start (void);
  43. NTSTATUS Stop (void);
  44. bool IsRunning (void);
  45. bool IsAutoStart (void);
  46. NTSTATUS Wait (DWORD dwTimeout);
  47. static NTSTATUS StaticInitialize (void);
  48. static NTSTATUS StaticTerminate (void);
  49. protected:
  50. static bool IsClientTheSystem (const CPortMessage& portMessage);
  51. static bool IsClientAnAdministrator (const CPortMessage& portMessage);
  52. };
  53. #endif /* _ServerAPI_ */