OLD | NEW |
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 #ifndef REMOTING_PROTOCOL_JINGLE_SESSION_H_ | 5 #ifndef REMOTING_PROTOCOL_JINGLE_SESSION_H_ |
6 #define REMOTING_PROTOCOL_JINGLE_SESSION_H_ | 6 #define REMOTING_PROTOCOL_JINGLE_SESSION_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 25 matching lines...) Expand all Loading... |
36 public: | 36 public: |
37 ~JingleSession() override; | 37 ~JingleSession() override; |
38 | 38 |
39 // Session interface. | 39 // Session interface. |
40 void SetEventHandler(Session::EventHandler* event_handler) override; | 40 void SetEventHandler(Session::EventHandler* event_handler) override; |
41 ErrorCode error() override; | 41 ErrorCode error() override; |
42 const std::string& jid() override; | 42 const std::string& jid() override; |
43 const SessionConfig& config() override; | 43 const SessionConfig& config() override; |
44 void SetTransport(Transport* transport) override; | 44 void SetTransport(Transport* transport) override; |
45 void Close(protocol::ErrorCode error) override; | 45 void Close(protocol::ErrorCode error) override; |
| 46 void Attach(std::unique_ptr<SessionPlugin> plugin) override; |
46 | 47 |
47 private: | 48 private: |
48 friend class JingleSessionManager; | 49 friend class JingleSessionManager; |
49 | 50 |
50 typedef base::Callback<void(JingleMessageReply::ErrorType)> ReplyCallback; | 51 typedef base::Callback<void(JingleMessageReply::ErrorType)> ReplyCallback; |
51 | 52 |
52 explicit JingleSession(JingleSessionManager* session_manager); | 53 explicit JingleSession(JingleSessionManager* session_manager); |
53 | 54 |
54 // Start connection by sending session-initiate message. | 55 // Start connection by sending session-initiate message. |
55 void StartConnection(const std::string& peer_jid, | 56 void StartConnection(const std::string& peer_jid, |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 | 113 |
113 // Called when authentication is finished. | 114 // Called when authentication is finished. |
114 void OnAuthenticated(); | 115 void OnAuthenticated(); |
115 | 116 |
116 // Sets |state_| to |new_state| and calls state change callback. | 117 // Sets |state_| to |new_state| and calls state change callback. |
117 void SetState(State new_state); | 118 void SetState(State new_state); |
118 | 119 |
119 // Returns true if the state of the session is not CLOSED or FAILED | 120 // Returns true if the state of the session is not CLOSED or FAILED |
120 bool is_session_active(); | 121 bool is_session_active(); |
121 | 122 |
| 123 // Executes all plugins against incoming JingleMessage. |
| 124 void ExecutePluginsOnIncomingMessage(const JingleMessage& message); |
| 125 |
| 126 // Executes all plugins against outgoing JingleMessage. |
| 127 void ExecutePluginsOnOutgoingMessage(JingleMessage* message); |
| 128 |
122 // Returns the value of the ID attribute of the next outgoing set IQ with the | 129 // Returns the value of the ID attribute of the next outgoing set IQ with the |
123 // sequence ID encoded. | 130 // sequence ID encoded. |
124 std::string GetNextOutgoingId(); | 131 std::string GetNextOutgoingId(); |
125 | 132 |
126 base::ThreadChecker thread_checker_; | 133 base::ThreadChecker thread_checker_; |
127 | 134 |
128 JingleSessionManager* session_manager_; | 135 JingleSessionManager* session_manager_; |
129 SignalingAddress peer_address_; | 136 SignalingAddress peer_address_; |
130 Session::EventHandler* event_handler_; | 137 Session::EventHandler* event_handler_; |
131 | 138 |
(...skipping 30 matching lines...) Expand all Loading... |
162 | 169 |
163 // This prefix is necessary to disambiguate between the ID's sent from the | 170 // This prefix is necessary to disambiguate between the ID's sent from the |
164 // client and the ID's sent from the host. | 171 // client and the ID's sent from the host. |
165 std::string outgoing_id_prefix_ = base::Uint64ToString(base::RandUint64()); | 172 std::string outgoing_id_prefix_ = base::Uint64ToString(base::RandUint64()); |
166 int next_outgoing_id_ = 0; | 173 int next_outgoing_id_ = 0; |
167 | 174 |
168 // Transport info messages that are received while the session is being | 175 // Transport info messages that are received while the session is being |
169 // authenticated. | 176 // authenticated. |
170 std::vector<PendingMessage> pending_transport_info_; | 177 std::vector<PendingMessage> pending_transport_info_; |
171 | 178 |
| 179 // The SessionPlugins attached to this session. |
| 180 std::vector<std::unique_ptr<SessionPlugin>> plugins_; |
| 181 |
172 base::WeakPtrFactory<JingleSession> weak_factory_; | 182 base::WeakPtrFactory<JingleSession> weak_factory_; |
173 | 183 |
174 DISALLOW_COPY_AND_ASSIGN(JingleSession); | 184 DISALLOW_COPY_AND_ASSIGN(JingleSession); |
175 }; | 185 }; |
176 | 186 |
177 } // namespace protocol | 187 } // namespace protocol |
178 } // namespace remoting | 188 } // namespace remoting |
179 | 189 |
180 #endif // REMOTING_PROTOCOL_JINGLE_SESSION_H_ | 190 #endif // REMOTING_PROTOCOL_JINGLE_SESSION_H_ |
OLD | NEW |