Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Side by Side Diff: remoting/host/server_log_entry.h

Issue 18075003: Host offline status reporting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « remoting/host/remoting_me2me_host.cc ('k') | remoting/host/server_log_entry.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef REMOTING_HOST_SERVER_LOG_ENTRY_H_ 5 #ifndef REMOTING_HOST_SERVER_LOG_ENTRY_H_
6 #define REMOTING_HOST_SERVER_LOG_ENTRY_H_ 6 #define REMOTING_HOST_SERVER_LOG_ENTRY_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "remoting/host/host_exit_codes.h"
13 #include "remoting/host/host_status_sender.h"
12 #include "remoting/protocol/transport.h" 14 #include "remoting/protocol/transport.h"
13 15
14 namespace buzz { 16 namespace buzz {
15 class XmlElement; 17 class XmlElement;
16 } // namespace buzz 18 } // namespace buzz
17 19
18 namespace remoting { 20 namespace remoting {
19 21
20 class ServerLogEntry { 22 class ServerLogEntry {
21 public: 23 public:
22 // The mode of a connection. 24 // The mode of a connection.
23 enum Mode { 25 enum Mode {
24 IT2ME, 26 IT2ME,
25 ME2ME 27 ME2ME
26 }; 28 };
27 29
28 // Constructs a log stanza. The caller should add one or more log entry 30 // Constructs a log stanza. The caller should add one or more log entry
29 // stanzas as children of this stanza, before sending the log stanza to 31 // stanzas as children of this stanza, before sending the log stanza to
30 // the remoting bot. 32 // the remoting bot.
31 static scoped_ptr<buzz::XmlElement> MakeStanza(); 33 static scoped_ptr<buzz::XmlElement> MakeStanza();
32 34
33 // Constructs a log entry for a session state change. 35 // Constructs a log entry for a session state change.
34 // Currently this is either connection or disconnection. 36 // Currently this is either connection or disconnection.
35 static scoped_ptr<ServerLogEntry> MakeForSessionStateChange(bool connection); 37 static scoped_ptr<ServerLogEntry> MakeForSessionStateChange(bool connection);
36 38
37 // Constructs a log entry for a heartbeat. 39 // Constructs a log entry for a heartbeat.
38 static scoped_ptr<ServerLogEntry> MakeForHeartbeat(); 40 static scoped_ptr<ServerLogEntry> MakeForHeartbeat();
39 41
42 // Constructs a log entry for a host status message.
43 static scoped_ptr<ServerLogEntry> MakeForHostStatus(
44 HostStatusSender::HostStatus host_status, HostExitCodes exit_code);
45
40 ~ServerLogEntry(); 46 ~ServerLogEntry();
41 47
42 // Adds fields describing the host to this log entry. 48 // Adds fields describing the host to this log entry.
43 void AddHostFields(); 49 void AddHostFields();
44 50
45 // Adds a field describing the mode of a connection to this log entry. 51 // Adds a field describing the mode of a connection to this log entry.
46 void AddModeField(Mode mode); 52 void AddModeField(Mode mode);
47 53
48 // Adds a field describing connection type (direct/stun/relay). 54 // Adds a field describing connection type (direct/stun/relay).
49 void AddConnectionTypeField(protocol::TransportRoute::RouteType type); 55 void AddConnectionTypeField(protocol::TransportRoute::RouteType type);
50 56
51 // Converts this object to an XML stanza. 57 // Converts this object to an XML stanza.
52 scoped_ptr<buzz::XmlElement> ToStanza() const; 58 scoped_ptr<buzz::XmlElement> ToStanza() const;
53 59
54 private: 60 private:
55 typedef std::map<std::string, std::string> ValuesMap; 61 typedef std::map<std::string, std::string> ValuesMap;
56 62
57 ServerLogEntry(); 63 ServerLogEntry();
58 void Set(const std::string& key, const std::string& value); 64 void Set(const std::string& key, const std::string& value);
59 65
60 static const char* GetValueSessionState(bool connected); 66 static const char* GetValueSessionState(bool connected);
61 static const char* GetValueMode(Mode mode); 67 static const char* GetValueMode(Mode mode);
62 68
63 ValuesMap values_map_; 69 ValuesMap values_map_;
64 }; 70 };
65 71
66 } // namespace remoting 72 } // namespace remoting
67 73
68 #endif 74 #endif
OLDNEW
« no previous file with comments | « remoting/host/remoting_me2me_host.cc ('k') | remoting/host/server_log_entry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698