1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef REMOTING_HOST_WIN_WTS_TERMINAL_MONITOR_H_ 6 #define REMOTING_HOST_WIN_WTS_TERMINAL_MONITOR_H_ 7 8 #include <string> 9 10 #include "base/basictypes.h" 11 #include "base/strings/utf_string_conversions.h" 12 13 namespace remoting { 14 15 class WtsTerminalObserver; 16 17 // Session id that does not represent any session. 18 extern const uint32 kInvalidSessionId; 19 20 class WtsTerminalMonitor { 21 public: 22 // The console terminal ID. 23 static const char* kConsole; 24 25 virtual ~WtsTerminalMonitor(); 26 27 // Registers an observer to receive notifications about a particular WTS 28 // terminal. |terminal_id| is used to specify an RdpClient instance for which 29 // the connected session should be monitored, or |kConsole| may be passed to 30 // monitor the console session. 31 // 32 // Each observer instance can monitor a single WTS console. Returns 33 // |true| of success. Returns |false| if |observer| is already registered. 34 virtual bool AddWtsTerminalObserver(const std::string& terminal_id, 35 WtsTerminalObserver* observer) = 0; 36 37 // Unregisters a previously registered observer. 38 virtual void RemoveWtsTerminalObserver(WtsTerminalObserver* observer) = 0; 39 40 // Returns ID of the terminal connected to |session_id| in |*terminal_id|. 41 // Returns false if |session_id| is not attached to the physical console or 42 // does not have an assigned terminal ID. 43 static bool LookupTerminalId(uint32 session_id, std::string* terminal_id); 44 45 // Returns ID of the session that |terminal_id| is attached. 46 // |kInvalidSessionId| is returned if none of the sessions is currently 47 // attahced to |client_endpoint|. 48 static uint32 LookupSessionId(const std::string& terminal_id); 49 50 protected: 51 WtsTerminalMonitor(); 52 53 private: 54 DISALLOW_COPY_AND_ASSIGN(WtsTerminalMonitor); 55 }; 56 57 } // namespace remoting 58 59 #endif // REMOTING_HOST_WIN_WTS_TERMINAL_MONITOR_H_ 60