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.

64 lines
2.8 KiB

  1. // --------------------------------------------------------------------------
  2. // Module Name: APIConnectionThread.h
  3. //
  4. // Copyright (c) 1999-2000, Microsoft Corporation
  5. //
  6. // A class that listens to an LPC connection port waiting for requests from
  7. // a client to connect to the port or a request which references a previously
  8. // established connection.
  9. //
  10. // History: 1999-11-07 vtan created
  11. // 2000-08-25 vtan moved from Neptune to Whistler
  12. // --------------------------------------------------------------------------
  13. #ifndef _APIConnectionThread_
  14. #define _APIConnectionThread_
  15. #include "DynamicArray.h"
  16. #include "PortMessage.h"
  17. #include "ServerAPI.h"
  18. // --------------------------------------------------------------------------
  19. // CAPIConnection
  20. //
  21. // Purpose: This class listens to the server connection port for an LPC
  22. // connection request, an LPC request or an LPC connect closed
  23. // message. It correctly handles each request. LPC requests are
  24. // queued to the managing CAPIDispatcher.
  25. //
  26. // History: 1999-11-07 vtan created
  27. // 2000-08-25 vtan moved from Neptune to Whistler
  28. // 2000-11-28 vtan removed thread functionality
  29. // --------------------------------------------------------------------------
  30. class CAPIConnection : public CCountedObject
  31. {
  32. private:
  33. CAPIConnection (void);
  34. public:
  35. CAPIConnection (CServerAPI* pServerAPI);
  36. ~CAPIConnection (void);
  37. NTSTATUS ConstructorStatusCode (void) const;
  38. NTSTATUS Listen (void);
  39. NTSTATUS AddAccess (PSID pSID, DWORD dwMask);
  40. NTSTATUS RemoveAccess (PSID pSID);
  41. private:
  42. NTSTATUS ListenToServerConnectionPort (void);
  43. NTSTATUS HandleServerRequest (const CPortMessage& portMessage, CAPIDispatcher *pAPIDispatcher);
  44. NTSTATUS HandleServerConnectionRequest (const CPortMessage& portMessage);
  45. NTSTATUS HandleServerConnectionClosed (const CPortMessage& portMessage, CAPIDispatcher *pAPIDispatcher);
  46. int FindIndexDispatcher (CAPIDispatcher *pAPIDispatcher);
  47. private:
  48. NTSTATUS _status;
  49. bool _fStopListening;
  50. CServerAPI* _pServerAPI;
  51. HANDLE _hPort;
  52. CDynamicCountedObjectArray _dispatchers;
  53. };
  54. #endif /* _APIConnectionThread_ */