| OLD | NEW |
| 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 "remoting/protocol/transport.h" |
| 12 |
| 11 namespace buzz { | 13 namespace buzz { |
| 12 class XmlElement; | 14 class XmlElement; |
| 13 } // namespace buzz | 15 } // namespace buzz |
| 14 | 16 |
| 15 namespace remoting { | 17 namespace remoting { |
| 16 | 18 |
| 17 class ServerLogEntry { | 19 class ServerLogEntry { |
| 18 public: | 20 public: |
| 19 // The mode of a connection. | 21 // The mode of a connection. |
| 20 enum Mode { | 22 enum Mode { |
| 21 IT2ME, | 23 IT2ME, |
| 22 ME2ME | 24 ME2ME |
| 23 }; | 25 }; |
| 24 | 26 |
| 25 // Constructs a log entry for a session state change. | 27 // Constructs a log entry for a session state change. |
| 26 // Currently this is either connection or disconnection. | 28 // Currently this is either connection or disconnection. |
| 27 static ServerLogEntry* MakeSessionStateChange(bool connection); | 29 static ServerLogEntry* MakeSessionStateChange(bool connection); |
| 28 | 30 |
| 29 ~ServerLogEntry(); | 31 ~ServerLogEntry(); |
| 30 | 32 |
| 31 // Adds fields describing the host to this log entry. | 33 // Adds fields describing the host to this log entry. |
| 32 void AddHostFields(); | 34 void AddHostFields(); |
| 33 | 35 |
| 34 // Adds a field describing the mode of a connection to this log entry. | 36 // Adds a field describing the mode of a connection to this log entry. |
| 35 void AddModeField(Mode mode); | 37 void AddModeField(Mode mode); |
| 36 | 38 |
| 39 // Adds a field describing connection type (direct/stun/relay). |
| 40 void AddConnectionTypeField(protocol::TransportRoute::RouteType type); |
| 41 |
| 37 // Converts this object to an XML stanza. | 42 // Converts this object to an XML stanza. |
| 38 // The caller takes ownership of the stanza. | 43 // The caller takes ownership of the stanza. |
| 39 buzz::XmlElement* ToStanza() const; | 44 buzz::XmlElement* ToStanza() const; |
| 40 | 45 |
| 41 private: | 46 private: |
| 42 typedef std::map<std::string, std::string> ValuesMap; | 47 typedef std::map<std::string, std::string> ValuesMap; |
| 43 | 48 |
| 44 ServerLogEntry(); | 49 ServerLogEntry(); |
| 45 void Set(const char* key, const char* value); | 50 void Set(const std::string& key, const std::string& value); |
| 46 | 51 |
| 47 static const char* GetValueSessionState(bool connected); | 52 static const char* GetValueSessionState(bool connected); |
| 48 static const char* GetValueMode(Mode mode); | 53 static const char* GetValueMode(Mode mode); |
| 49 | 54 |
| 50 ValuesMap values_map_; | 55 ValuesMap values_map_; |
| 51 }; | 56 }; |
| 52 | 57 |
| 53 } // namespace remoting | 58 } // namespace remoting |
| 54 | 59 |
| 55 #endif | 60 #endif |
| OLD | NEW |