OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_PROTOCOL_SESSION_PLUGIN_H_ | 5 #ifndef REMOTING_PROTOCOL_SESSION_PLUGIN_H_ |
6 #define REMOTING_PROTOCOL_SESSION_PLUGIN_H_ | 6 #define REMOTING_PROTOCOL_SESSION_PLUGIN_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/callback.h" | |
11 #include "remoting/protocol/jingle_messages.h" | |
12 #include "remoting/protocol/session.h" | |
13 #include "third_party/libjingle_xmpp/xmllite/xmlelement.h" | 10 #include "third_party/libjingle_xmpp/xmllite/xmlelement.h" |
14 | 11 |
15 namespace remoting { | 12 namespace remoting { |
16 namespace protocol { | 13 namespace protocol { |
17 | 14 |
18 // Interface for Session plugins. Plugins allow to send and receive optional | 15 // Interface for Session plugins. Plugins allow to send and receive optional |
19 // information that is not essential for session handshake. Messages generated | 16 // information that is not essential for session handshake. Messages generated |
20 // by the plugins on one end of a connection are attached to the session | 17 // by the plugins on one end of a connection are attached to the session |
21 // handshake messages and passed to the plugins on the other end. Plugins are | 18 // handshake messages and passed to the plugins on the other end. Plugins are |
22 // optional, i.e. Session doesn't need any plugins to connect successfully. | 19 // optional, i.e. Session doesn't need any plugins to connect successfully. |
23 class SessionPlugin { | 20 class SessionPlugin { |
24 public: | 21 public: |
25 SessionPlugin() = default; | 22 SessionPlugin() = default; |
26 virtual ~SessionPlugin() = default; | 23 virtual ~SessionPlugin() = default; |
27 | 24 |
28 // Returns an XmlElement if the SessionPlugin requires to attach some data | 25 // Returns an XmlElement if the SessionPlugin requires to attach some data |
29 // into the outgoing message. | 26 // into the outgoing message. |
30 virtual std::unique_ptr<buzz::XmlElement> GetNextMessage() = 0; | 27 virtual std::unique_ptr<buzz::XmlElement> GetNextMessage() = 0; |
31 | 28 |
32 // Handles messages in |attachments|. | 29 // Handles messages in |attachments|. |
33 virtual void OnIncomingMessage(const buzz::XmlElement& attachments) = 0; | 30 virtual void OnIncomingMessage(const buzz::XmlElement& attachments) = 0; |
34 }; | 31 }; |
35 | 32 |
36 } // namespace protocol | 33 } // namespace protocol |
37 } // namespace remoting | 34 } // namespace remoting |
38 | 35 |
39 #endif // REMOTING_PROTOCOL_SESSION_PLUGIN_H_ | 36 #endif // REMOTING_PROTOCOL_SESSION_PLUGIN_H_ |
OLD | NEW |