OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2009 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2009 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #ifndef TALK_SESSION_MEDIA_SRTPFILTER_H_ | 11 #ifndef TALK_SESSION_MEDIA_SRTPFILTER_H_ |
12 #define TALK_SESSION_MEDIA_SRTPFILTER_H_ | 12 #define TALK_SESSION_MEDIA_SRTPFILTER_H_ |
13 | 13 |
14 #include <list> | 14 #include <list> |
15 #include <map> | 15 #include <map> |
| 16 #include <memory> |
16 #include <string> | 17 #include <string> |
17 #include <vector> | 18 #include <vector> |
18 | 19 |
19 #include "webrtc/base/basictypes.h" | 20 #include "webrtc/base/basictypes.h" |
20 #include "webrtc/base/criticalsection.h" | 21 #include "webrtc/base/criticalsection.h" |
21 #include "webrtc/base/scoped_ptr.h" | |
22 #include "webrtc/base/sigslotrepeater.h" | 22 #include "webrtc/base/sigslotrepeater.h" |
23 #include "webrtc/base/sslstreamadapter.h" | 23 #include "webrtc/base/sslstreamadapter.h" |
24 #include "webrtc/media/base/cryptoparams.h" | 24 #include "webrtc/media/base/cryptoparams.h" |
25 #include "webrtc/p2p/base/sessiondescription.h" | 25 #include "webrtc/p2p/base/sessiondescription.h" |
26 | 26 |
27 // Forward declaration to avoid pulling in libsrtp headers here | 27 // Forward declaration to avoid pulling in libsrtp headers here |
28 struct srtp_event_data_t; | 28 struct srtp_event_data_t; |
29 struct srtp_ctx_t; | 29 struct srtp_ctx_t; |
30 struct srtp_policy_t; | 30 struct srtp_policy_t; |
31 | 31 |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 // ST_INIT. | 160 // ST_INIT. |
161 ST_SENTPRANSWER, | 161 ST_SENTPRANSWER, |
162 // SRTP filter is active but the received answer is only provisional. | 162 // SRTP filter is active but the received answer is only provisional. |
163 // When the final answer is set, the state transitions to ST_ACTIVE or | 163 // When the final answer is set, the state transitions to ST_ACTIVE or |
164 // ST_INIT. | 164 // ST_INIT. |
165 ST_RECEIVEDPRANSWER | 165 ST_RECEIVEDPRANSWER |
166 }; | 166 }; |
167 State state_; | 167 State state_; |
168 uint32_t signal_silent_time_in_ms_; | 168 uint32_t signal_silent_time_in_ms_; |
169 std::vector<CryptoParams> offer_params_; | 169 std::vector<CryptoParams> offer_params_; |
170 rtc::scoped_ptr<SrtpSession> send_session_; | 170 std::unique_ptr<SrtpSession> send_session_; |
171 rtc::scoped_ptr<SrtpSession> recv_session_; | 171 std::unique_ptr<SrtpSession> recv_session_; |
172 rtc::scoped_ptr<SrtpSession> send_rtcp_session_; | 172 std::unique_ptr<SrtpSession> send_rtcp_session_; |
173 rtc::scoped_ptr<SrtpSession> recv_rtcp_session_; | 173 std::unique_ptr<SrtpSession> recv_rtcp_session_; |
174 CryptoParams applied_send_params_; | 174 CryptoParams applied_send_params_; |
175 CryptoParams applied_recv_params_; | 175 CryptoParams applied_recv_params_; |
176 }; | 176 }; |
177 | 177 |
178 // Class that wraps a libSRTP session. | 178 // Class that wraps a libSRTP session. |
179 class SrtpSession { | 179 class SrtpSession { |
180 public: | 180 public: |
181 SrtpSession(); | 181 SrtpSession(); |
182 ~SrtpSession(); | 182 ~SrtpSession(); |
183 | 183 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 | 222 |
223 static bool Init(); | 223 static bool Init(); |
224 void HandleEvent(const srtp_event_data_t* ev); | 224 void HandleEvent(const srtp_event_data_t* ev); |
225 static void HandleEventThunk(srtp_event_data_t* ev); | 225 static void HandleEventThunk(srtp_event_data_t* ev); |
226 | 226 |
227 static std::list<SrtpSession*>* sessions(); | 227 static std::list<SrtpSession*>* sessions(); |
228 | 228 |
229 srtp_ctx_t* session_; | 229 srtp_ctx_t* session_; |
230 int rtp_auth_tag_len_; | 230 int rtp_auth_tag_len_; |
231 int rtcp_auth_tag_len_; | 231 int rtcp_auth_tag_len_; |
232 rtc::scoped_ptr<SrtpStat> srtp_stat_; | 232 std::unique_ptr<SrtpStat> srtp_stat_; |
233 static bool inited_; | 233 static bool inited_; |
234 static rtc::GlobalLockPod lock_; | 234 static rtc::GlobalLockPod lock_; |
235 int last_send_seq_num_; | 235 int last_send_seq_num_; |
236 RTC_DISALLOW_COPY_AND_ASSIGN(SrtpSession); | 236 RTC_DISALLOW_COPY_AND_ASSIGN(SrtpSession); |
237 }; | 237 }; |
238 | 238 |
239 // Class that collects failures of SRTP. | 239 // Class that collects failures of SRTP. |
240 class SrtpStat { | 240 class SrtpStat { |
241 public: | 241 public: |
242 SrtpStat(); | 242 SrtpStat(); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 std::map<FailureKey, FailureStat> failures_; | 304 std::map<FailureKey, FailureStat> failures_; |
305 // Threshold in ms to silent the signaling errors. | 305 // Threshold in ms to silent the signaling errors. |
306 uint32_t signal_silent_time_; | 306 uint32_t signal_silent_time_; |
307 | 307 |
308 RTC_DISALLOW_COPY_AND_ASSIGN(SrtpStat); | 308 RTC_DISALLOW_COPY_AND_ASSIGN(SrtpStat); |
309 }; | 309 }; |
310 | 310 |
311 } // namespace cricket | 311 } // namespace cricket |
312 | 312 |
313 #endif // TALK_SESSION_MEDIA_SRTPFILTER_H_ | 313 #endif // TALK_SESSION_MEDIA_SRTPFILTER_H_ |
OLD | NEW |