summaryrefslogtreecommitdiffstats
path: root/remoting
diff options
context:
space:
mode:
authorlambroslambrou@chromium.org <lambroslambrou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-27 01:51:44 +0000
committerlambroslambrou@chromium.org <lambroslambrou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-27 01:51:44 +0000
commitf2bb8a1b0fa22e038acbc592bf41a3639f176760 (patch)
tree890332736ea33753f39eb7485c66860f9ff3425d /remoting
parent3e2870c682b36d440a2ff3f9fecd63d4e9ded5d3 (diff)
downloadchromium_src-f2bb8a1b0fa22e038acbc592bf41a3639f176760.zip
chromium_src-f2bb8a1b0fa22e038acbc592bf41a3639f176760.tar.gz
chromium_src-f2bb8a1b0fa22e038acbc592bf41a3639f176760.tar.bz2
Log client IP addresses to syslog in Me2Me host.
Follows on from http://codereview.chromium.org/9288010/ and http://codereview.chromium.org/9271026/ BUG=109682 TEST=Manual Review URL: http://codereview.chromium.org/9288040 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@119326 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting')
-rw-r--r--remoting/host/chromoting_host.cc6
-rw-r--r--remoting/host/host_event_logger.cc14
-rw-r--r--remoting/host/host_event_logger.h3
-rw-r--r--remoting/host/host_status_observer.h10
4 files changed, 27 insertions, 6 deletions
diff --git a/remoting/host/chromoting_host.cc b/remoting/host/chromoting_host.cc
index 0e8561a..6821e75 100644
--- a/remoting/host/chromoting_host.cc
+++ b/remoting/host/chromoting_host.cc
@@ -228,8 +228,10 @@ void ChromotingHost::OnSessionSequenceNumber(ClientSession* session,
void ChromotingHost::OnSessionIpAddress(ClientSession* session,
const std::string& channel_name,
const net::IPEndPoint& end_point) {
- // TODO(lambroslambrou): Notify the HostStatusObservers via a new interface
- // method.
+ DCHECK(context_->network_message_loop()->BelongsToCurrentThread());
+ FOR_EACH_OBSERVER(HostStatusObserver, status_observers_,
+ OnClientIpAddress(session->client_jid(), channel_name,
+ end_point));
}
void ChromotingHost::OnSessionManagerReady() {
diff --git a/remoting/host/host_event_logger.cc b/remoting/host/host_event_logger.cc
index ca8e49a..d559f5d 100644
--- a/remoting/host/host_event_logger.cc
+++ b/remoting/host/host_event_logger.cc
@@ -12,6 +12,7 @@
#undef LOG_WARNING
#endif // defined(OS_LINUX)
+#include "net/base/ip_endpoint.h"
#include "remoting/host/chromoting_host.h"
#include "remoting/host/system_event_logger.h"
@@ -43,19 +44,24 @@ HostEventLogger::~HostEventLogger() {
}
void HostEventLogger::OnClientAuthenticated(const std::string& jid) {
- std::string username = jid.substr(0, jid.find('/'));
- Log("Client connected: " + username);
+ Log("Client connected: " + jid);
}
void HostEventLogger::OnClientDisconnected(const std::string& jid) {
- std::string username = jid.substr(0, jid.find('/'));
- Log("Client disconnected: " + username);
+ Log("Client disconnected: " + jid);
}
void HostEventLogger::OnAccessDenied(const std::string& jid) {
Log("Access denied for client: " + jid);
}
+void HostEventLogger::OnClientIpAddress(const std::string& jid,
+ const std::string& channel_name,
+ const net::IPEndPoint& end_point) {
+ Log("Channel IP for client: " + jid + " ip='" + end_point.ToString() +
+ "' channel='" + channel_name + "'");
+}
+
void HostEventLogger::OnShutdown() {
}
diff --git a/remoting/host/host_event_logger.h b/remoting/host/host_event_logger.h
index 2ca9afc..1944756 100644
--- a/remoting/host/host_event_logger.h
+++ b/remoting/host/host_event_logger.h
@@ -28,6 +28,9 @@ class HostEventLogger : public HostStatusObserver {
virtual void OnClientAuthenticated(const std::string& jid) OVERRIDE;
virtual void OnClientDisconnected(const std::string& jid) OVERRIDE;
virtual void OnAccessDenied(const std::string& jid) OVERRIDE;
+ virtual void OnClientIpAddress(const std::string& jid,
+ const std::string& channel_name,
+ const net::IPEndPoint& end_point) OVERRIDE;
virtual void OnShutdown() OVERRIDE;
private:
diff --git a/remoting/host/host_status_observer.h b/remoting/host/host_status_observer.h
index c3c8a0b..29a7193 100644
--- a/remoting/host/host_status_observer.h
+++ b/remoting/host/host_status_observer.h
@@ -7,6 +7,10 @@
#include <string>
+namespace net {
+class IPEndPoint;
+} // namespace net
+
namespace remoting {
class SignalStrategy;
@@ -26,6 +30,12 @@ class HostStatusObserver {
virtual void OnClientAuthenticated(const std::string& jid) = 0;
virtual void OnClientDisconnected(const std::string& jid) = 0;
+ // Called on notification of a route change event, when a channel is
+ // connected.
+ virtual void OnClientIpAddress(const std::string& jid,
+ const std::string& channel_name,
+ const net::IPEndPoint& end_point) { }
+
// Called when the host shuts down.
virtual void OnShutdown() = 0;
};