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

Side by Side Diff: remoting/host/offline_status_sender.h

Issue 18075003: Host offline status reporting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 5 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
OLDNEW
(Empty)
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.
4
5 #ifndef REMOTING_HOST_OFFLINE_STATUS_SENDER_H_
6 #define REMOTING_HOST_OFFLINE_STATUS_SENDER_H_
7
8 #include <string>
9
10 #include "base/compiler_specific.h"
11 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "remoting/base/rsa_key_pair.h"
14 #include "remoting/jingle_glue/signal_strategy.h"
15
16 namespace base {
17 class MessageLoopProxy;
18 } // namespace base
19
20 namespace buzz {
21 class XmlElement;
22 } // namespace buzz
23
24 namespace remoting {
25
26 class RsaKeyPair;
27 class IqSender;
28
29 // OfflineStatusSender sends the offline status to the Chromoting Bot.
30 // Each offline status stanza looks as follows:
31 //
32 // <iq type="set" to="remoting@bot.talk.google.com"
33 // from="user@gmail.com/chromoting123123" id="5" xmlns="jabber:client">
34 // <rem:offline_status rem:hostid="a1ddb11e-8aef-11df-bccf-18a905b9cb5a"
35 // rem:status="100" rem:errorcode="5"
36 // xmlns:rem="google:remoting">
37 // <rem:signature>.signature.</rem:signature>
38 // </rem:offline_status>
39 // </iq>
40 //
41 // The signature is a base-64 encoded SHA-1 hash, signed with the host's
42 // private RSA key. The message being signed is the full Jid, e.g.
43 // "user@gmail.com/chromoting123123 456".
rmsousa 2013/07/02 02:09:24 Nit: please update the example and/or the descript
weitao 2013/07/03 19:23:31 Done.
44 class OfflineStatusSender : SignalStrategy::Listener {
45 public:
46
47 OfflineStatusSender(const std::string& host_id,
48 SignalStrategy* signal_strategy,
49 scoped_refptr<RsaKeyPair> key_pair,
50 const std::string& directory_bot_jid);
51 virtual ~OfflineStatusSender();
52
53 // SignalStrategy::Listener interface.
54 virtual void OnSignalStrategyStateChange(
55 SignalStrategy::State state) OVERRIDE;
56 virtual bool OnSignalStrategyIncomingStanza(
57 const buzz::XmlElement* stanza) OVERRIDE;
58
59 void SendOfflineStatus(int status, uint errorcode = 0);
rmsousa 2013/07/02 02:09:24 Do not use default arguments: http://google-styleg
rmsousa 2013/07/02 02:09:24 Please add a comment explaining the function and i
weitao 2013/07/03 19:23:31 Done.
weitao 2013/07/03 19:23:31 Done.
60
61 private:
62 // Helper methods used by SendStanza() to generate offline status stanzas.
63 scoped_ptr<buzz::XmlElement> CreateOfflineStatusMessage(int status,
64 uint errorcode);
65 scoped_ptr<buzz::XmlElement> CreateSignature();
66
67 std::string host_id_;
68 SignalStrategy* signal_strategy_;
69 scoped_refptr<RsaKeyPair> key_pair_;
70 std::string directory_bot_jid_;
71 scoped_ptr<IqSender> iq_sender_;
72
73 DISALLOW_COPY_AND_ASSIGN(OfflineStatusSender);
74 };
75
76 } // namespace remoting
77
78 #endif // REMOTING_HOST_OFFLINE_STATUS_SENDER_H_
OLDNEW
« no previous file with comments | « no previous file | remoting/host/offline_status_sender.cc » ('j') | remoting/host/offline_status_sender.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698