OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 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_PROTOCOL_SERVER_LOG_ENTRY_H_ |
| 6 #define REMOTING_PROTOCOL_SERVER_LOG_ENTRY_H_ |
| 7 |
| 8 #include <map> |
| 9 #include <string> |
| 10 |
| 11 #include "base/memory/scoped_ptr.h" |
| 12 |
| 13 namespace buzz { |
| 14 class XmlElement; |
| 15 } // namespace buzz |
| 16 |
| 17 namespace remoting { |
| 18 namespace protocol { |
| 19 |
| 20 // Utility class for building log entries to send to the remoting bot. This is |
| 21 // a wrapper around a key/value map and is copyable so it can be used in STL |
| 22 // containers. |
| 23 class ServerLogEntry { |
| 24 public: |
| 25 // The mode of a connection. |
| 26 enum Mode { |
| 27 IT2ME, |
| 28 ME2ME |
| 29 }; |
| 30 |
| 31 ServerLogEntry(); |
| 32 ~ServerLogEntry(); |
| 33 |
| 34 // Sets an arbitrary key/value entry. |
| 35 void Set(const std::string& key, const std::string& value); |
| 36 |
| 37 // Adds a field describing the CPU type of the platform. |
| 38 void AddCpuField(); |
| 39 |
| 40 // Adds a field describing the mode of a connection to this log entry. |
| 41 void AddModeField(Mode mode); |
| 42 |
| 43 // Adds a field describing the role (client/host). |
| 44 void AddRoleField(const char* role); |
| 45 |
| 46 // Adds a field describing the type of log entry. |
| 47 void AddEventNameField(const char* name); |
| 48 |
| 49 // Constructs a log stanza. The caller should add one or more log entry |
| 50 // stanzas as children of this stanza, before sending the log stanza to |
| 51 // the remoting bot. |
| 52 static scoped_ptr<buzz::XmlElement> MakeStanza(); |
| 53 |
| 54 // Converts this object to an XML stanza. |
| 55 scoped_ptr<buzz::XmlElement> ToStanza() const; |
| 56 |
| 57 private: |
| 58 typedef std::map<std::string, std::string> ValuesMap; |
| 59 |
| 60 ValuesMap values_map_; |
| 61 }; |
| 62 |
| 63 } // namespace protocol |
| 64 } // namespace remoting |
| 65 |
| 66 #endif // REMOTING_PROTOCOL_SERVER_LOG_ENTRY_H_ |
OLD | NEW |