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.

68 lines
3.0 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 "APIRequest.h"
  16. #include "DynamicArray.h"
  17. #include "PortMessage.h"
  18. #include "ServerAPI.h"
  19. // --------------------------------------------------------------------------
  20. // CAPIConnection
  21. //
  22. // Purpose: This class listens to the server connection port for an LPC
  23. // connection request, an LPC request or an LPC connect closed
  24. // message. It correctly handles each request. LPC requests are
  25. // queued to the managing CAPIDispatcher.
  26. //
  27. // History: 1999-11-07 vtan created
  28. // 2000-08-25 vtan moved from Neptune to Whistler
  29. // 2000-11-28 vtan removed thread functionality
  30. // --------------------------------------------------------------------------
  31. class CAPIConnection : public CCountedObject
  32. {
  33. private:
  34. CAPIConnection (void);
  35. public:
  36. CAPIConnection (CServerAPI* pServerAPI);
  37. ~CAPIConnection (void);
  38. NTSTATUS ConstructorStatusCode (void) const;
  39. NTSTATUS Listen ( CAPIDispatchSync* pAPIDispatchSync );
  40. NTSTATUS AddAccess (PSID pSID, DWORD dwMask);
  41. NTSTATUS RemoveAccess (PSID pSID);
  42. private:
  43. NTSTATUS ListenToServerConnectionPort (void);
  44. NTSTATUS HandleServerRequest (const CPortMessage& portMessage, CAPIDispatcher *pAPIDispatcher);
  45. NTSTATUS HandleServerConnectionRequest (const CPortMessage& portMessage);
  46. NTSTATUS HandleServerConnectionClosed (const CPortMessage& portMessage, CAPIDispatcher *pAPIDispatcher);
  47. int FindIndexDispatcher (CAPIDispatcher *pAPIDispatcher);
  48. private:
  49. NTSTATUS _status;
  50. bool _fStopListening;
  51. CServerAPI* _pServerAPI;
  52. HANDLE _hPort;
  53. CAPIDispatchSync* _pAPIDispatchSync;
  54. CCriticalSection _dispatchers_lock;
  55. CDynamicCountedObjectArray _dispatchers;
  56. };
  57. #endif /* _APIConnectionThread_ */