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.
5 #ifndef REMOTING_HOST_SERVER_LOG_ENTRY_H_
6 #define REMOTING_HOST_SERVER_LOG_ENTRY_H_
11 #include "base/memory/scoped_ptr.h"
12 #include "remoting/host/host_exit_codes.h"
13 #include "remoting/host/host_status_sender.h"
14 #include "remoting/protocol/transport.h"
22 class ServerLogEntry
{
24 // The mode of a connection.
30 // Constructs a log stanza. The caller should add one or more log entry
31 // stanzas as children of this stanza, before sending the log stanza to
33 static scoped_ptr
<buzz::XmlElement
> MakeStanza();
35 // Constructs a log entry for a session state change.
36 // Currently this is either connection or disconnection.
37 static scoped_ptr
<ServerLogEntry
> MakeForSessionStateChange(bool connection
);
39 // Constructs a log entry for a heartbeat.
40 static scoped_ptr
<ServerLogEntry
> MakeForHeartbeat();
42 // Constructs a log entry for a host status message.
43 static scoped_ptr
<ServerLogEntry
> MakeForHostStatus(
44 HostStatusSender::HostStatus host_status
, HostExitCodes exit_code
);
48 // Adds fields describing the host to this log entry.
51 // Adds a field describing the mode of a connection to this log entry.
52 void AddModeField(Mode mode
);
54 // Adds a field describing connection type (direct/stun/relay).
55 void AddConnectionTypeField(protocol::TransportRoute::RouteType type
);
57 // Converts this object to an XML stanza.
58 scoped_ptr
<buzz::XmlElement
> ToStanza() const;
61 typedef std::map
<std::string
, std::string
> ValuesMap
;
64 void Set(const std::string
& key
, const std::string
& value
);
66 static const char* GetValueSessionState(bool connected
);
67 static const char* GetValueMode(Mode mode
);
69 ValuesMap values_map_
;
72 } // namespace remoting