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

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

Issue 9727005: Log connection type to syslogs and to the server. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « remoting/host/server_log_entry.h ('k') | remoting/protocol/connection_to_client.h » ('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 #include "remoting/host/server_log_entry.h" 5 #include "remoting/host/server_log_entry.h"
6 6
7 #include "base/sys_info.h" 7 #include "base/sys_info.h"
8 #include "remoting/base/constants.h" 8 #include "remoting/base/constants.h"
9 #include "remoting/protocol/session.h" 9 #include "remoting/protocol/session.h"
10 #include "third_party/libjingle/source/talk/xmllite/xmlelement.h" 10 #include "third_party/libjingle/source/talk/xmllite/xmlelement.h"
(...skipping 24 matching lines...) Expand all
35 35
36 const char kKeyOsName[] = "os-name"; 36 const char kKeyOsName[] = "os-name";
37 const char kValueOsNameWindows[] = "Windows"; 37 const char kValueOsNameWindows[] = "Windows";
38 const char kValueOsNameLinux[] = "Linux"; 38 const char kValueOsNameLinux[] = "Linux";
39 const char kValueOsNameMac[] = "Mac"; 39 const char kValueOsNameMac[] = "Mac";
40 const char kValueOsNameChromeOS[] = "ChromeOS"; 40 const char kValueOsNameChromeOS[] = "ChromeOS";
41 41
42 const char kKeyOsVersion[] = "os-version"; 42 const char kKeyOsVersion[] = "os-version";
43 43
44 const char kKeyCpu[] = "cpu"; 44 const char kKeyCpu[] = "cpu";
45
46 const char kKeyConnectionType[] = "connection-type";
47
45 } // namespace 48 } // namespace
46 49
47 ServerLogEntry::ServerLogEntry() { 50 ServerLogEntry::ServerLogEntry() {
48 } 51 }
49 52
50 ServerLogEntry::~ServerLogEntry() { 53 ServerLogEntry::~ServerLogEntry() {
51 } 54 }
52 55
53 ServerLogEntry* ServerLogEntry::MakeSessionStateChange(bool connected) { 56 ServerLogEntry* ServerLogEntry::MakeSessionStateChange(bool connected) {
54 ServerLogEntry* entry = new ServerLogEntry(); 57 ServerLogEntry* entry = new ServerLogEntry();
(...skipping 18 matching lines...) Expand all
73 // OSes: see base/sys_info_unittest.cc. 76 // OSes: see base/sys_info_unittest.cc.
74 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_CHROMEOS) 77 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_CHROMEOS)
75 std::stringstream os_version; 78 std::stringstream os_version;
76 int32 os_major_version = 0; 79 int32 os_major_version = 0;
77 int32 os_minor_version = 0; 80 int32 os_minor_version = 0;
78 int32 os_bugfix_version = 0; 81 int32 os_bugfix_version = 0;
79 SysInfo::OperatingSystemVersionNumbers(&os_major_version, &os_minor_version, 82 SysInfo::OperatingSystemVersionNumbers(&os_major_version, &os_minor_version,
80 &os_bugfix_version); 83 &os_bugfix_version);
81 os_version << os_major_version << "." << os_minor_version << "." 84 os_version << os_major_version << "." << os_minor_version << "."
82 << os_bugfix_version; 85 << os_bugfix_version;
83 Set(kKeyOsVersion, os_version.str().c_str()); 86 Set(kKeyOsVersion, os_version.str());
84 #endif 87 #endif
85 88
86 Set(kKeyCpu, SysInfo::CPUArchitecture().c_str()); 89 Set(kKeyCpu, SysInfo::CPUArchitecture());
87 }; 90 };
88 91
89 void ServerLogEntry::AddModeField(ServerLogEntry::Mode mode) { 92 void ServerLogEntry::AddModeField(ServerLogEntry::Mode mode) {
90 Set(kKeyMode, GetValueMode(mode)); 93 Set(kKeyMode, GetValueMode(mode));
91 } 94 }
92 95
96 void ServerLogEntry::AddConnectionTypeField(
97 protocol::TransportRoute::RouteType type) {
98 Set(kKeyConnectionType, protocol::TransportRoute::GetTypeString(type));
99 }
100
93 const char* ServerLogEntry::GetValueMode(ServerLogEntry::Mode mode) { 101 const char* ServerLogEntry::GetValueMode(ServerLogEntry::Mode mode) {
94 switch(mode) { 102 switch(mode) {
95 case IT2ME: 103 case IT2ME:
96 return kValueModeIt2Me; 104 return kValueModeIt2Me;
97 case ME2ME: 105 case ME2ME:
98 return kValueModeMe2Me; 106 return kValueModeMe2Me;
99 default: 107 default:
100 NOTREACHED(); 108 NOTREACHED();
101 return NULL; 109 return NULL;
102 } 110 }
103 } 111 }
104 112
105 XmlElement* ServerLogEntry::ToStanza() const { 113 XmlElement* ServerLogEntry::ToStanza() const {
106 XmlElement* stanza = new XmlElement(QName( 114 XmlElement* stanza = new XmlElement(QName(
107 kChromotingXmlNamespace, kLogEntry)); 115 kChromotingXmlNamespace, kLogEntry));
108 ValuesMap::const_iterator iter; 116 ValuesMap::const_iterator iter;
109 for (iter = values_map_.begin(); iter != values_map_.end(); ++iter) { 117 for (iter = values_map_.begin(); iter != values_map_.end(); ++iter) {
110 stanza->AddAttr(QName("", iter->first), iter->second); 118 stanza->AddAttr(QName("", iter->first), iter->second);
111 } 119 }
112 return stanza; 120 return stanza;
113 } 121 }
114 122
115 const char* ServerLogEntry::GetValueSessionState(bool connected) { 123 const char* ServerLogEntry::GetValueSessionState(bool connected) {
116 return connected ? kValueSessionStateConnected : kValueSessionStateClosed; 124 return connected ? kValueSessionStateConnected : kValueSessionStateClosed;
117 } 125 }
118 126
119 void ServerLogEntry::Set(const char* key, const char* value) { 127 void ServerLogEntry::Set(const std::string& key, const std::string& value) {
120 values_map_[key] = value; 128 values_map_[key] = value;
121 } 129 }
122 130
123 } // namespace remoting 131 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/server_log_entry.h ('k') | remoting/protocol/connection_to_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698