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 AddPlugin(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 |
| 129 // Sends session-initiate message. |
| 130 void SendSessionInitiateMessage(); |
| 131 |
122 // Returns the value of the ID attribute of the next outgoing set IQ with the | 132 // Returns the value of the ID attribute of the next outgoing set IQ with the |
123 // sequence ID encoded. | 133 // sequence ID encoded. |
124 std::string GetNextOutgoingId(); | 134 std::string GetNextOutgoingId(); |
125 | 135 |
126 base::ThreadChecker thread_checker_; | 136 base::ThreadChecker thread_checker_; |
127 | 137 |
128 JingleSessionManager* session_manager_; | 138 JingleSessionManager* session_manager_; |
129 SignalingAddress peer_address_; | 139 SignalingAddress peer_address_; |
130 Session::EventHandler* event_handler_; | 140 Session::EventHandler* event_handler_; |
131 | 141 |
(...skipping 30 matching lines...) Expand all Loading... |
162 | 172 |
163 // This prefix is necessary to disambiguate between the ID's sent from the | 173 // This prefix is necessary to disambiguate between the ID's sent from the |
164 // client and the ID's sent from the host. | 174 // client and the ID's sent from the host. |
165 std::string outgoing_id_prefix_ = base::Uint64ToString(base::RandUint64()); | 175 std::string outgoing_id_prefix_ = base::Uint64ToString(base::RandUint64()); |
166 int next_outgoing_id_ = 0; | 176 int next_outgoing_id_ = 0; |
167 | 177 |
168 // Transport info messages that are received while the session is being | 178 // Transport info messages that are received while the session is being |
169 // authenticated. | 179 // authenticated. |
170 std::vector<PendingMessage> pending_transport_info_; | 180 std::vector<PendingMessage> pending_transport_info_; |
171 | 181 |
| 182 // The SessionPlugins attached to this session. |
| 183 std::vector<SessionPlugin*> plugins_; |
| 184 |
172 base::WeakPtrFactory<JingleSession> weak_factory_; | 185 base::WeakPtrFactory<JingleSession> weak_factory_; |
173 | 186 |
174 DISALLOW_COPY_AND_ASSIGN(JingleSession); | 187 DISALLOW_COPY_AND_ASSIGN(JingleSession); |
175 }; | 188 }; |
176 | 189 |
177 } // namespace protocol | 190 } // namespace protocol |
178 } // namespace remoting | 191 } // namespace remoting |
179 | 192 |
180 #endif // REMOTING_PROTOCOL_JINGLE_SESSION_H_ | 193 #endif // REMOTING_PROTOCOL_JINGLE_SESSION_H_ |
OLD | NEW |