| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2015 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 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 // This interface defines an in-memory DTLS identity store, which generates DTLS | 50 // This interface defines an in-memory DTLS identity store, which generates DTLS |
| 51 // identities. | 51 // identities. |
| 52 // APIs calls must be made on the signaling thread and the callbacks are also | 52 // APIs calls must be made on the signaling thread and the callbacks are also |
| 53 // called on the signaling thread. | 53 // called on the signaling thread. |
| 54 class DtlsIdentityStoreInterface { | 54 class DtlsIdentityStoreInterface { |
| 55 public: | 55 public: |
| 56 virtual ~DtlsIdentityStoreInterface() { } | 56 virtual ~DtlsIdentityStoreInterface() { } |
| 57 | 57 |
| 58 // The |observer| will be called when the requested identity is ready, or when | 58 // The |observer| will be called when the requested identity is ready, or when |
| 59 // identity generation fails. | 59 // identity generation fails. |
| 60 // TODO(torbjorng,hbos): There are currently two versions of RequestIdentity, | |
| 61 // with default implementation to call the other version of itself (so that a | |
| 62 // call can be made regardless of which version has been overridden). The 1st | |
| 63 // version exists because it is currently implemented in chromium. The 2nd | |
| 64 // version will become the one and only RequestIdentity as soon as chromium | |
| 65 // implements the correct version. crbug.com/544902, webrtc:5092. | |
| 66 virtual void RequestIdentity( | |
| 67 rtc::KeyParams key_params, | |
| 68 const rtc::scoped_refptr<DtlsIdentityRequestObserver>& observer) { | |
| 69 // Add default ("null") expiration. | |
| 70 RequestIdentity(key_params, rtc::Optional<uint64_t>(), observer); | |
| 71 } | |
| 72 virtual void RequestIdentity( | 60 virtual void RequestIdentity( |
| 73 const rtc::KeyParams& key_params, | 61 const rtc::KeyParams& key_params, |
| 74 const rtc::Optional<uint64_t>& expires_ms, | 62 const rtc::Optional<uint64_t>& expires_ms, |
| 75 const rtc::scoped_refptr<DtlsIdentityRequestObserver>& observer) { | 63 const rtc::scoped_refptr<DtlsIdentityRequestObserver>& observer) = 0; |
| 76 // Drop |expires|. | |
| 77 RequestIdentity(key_params, observer); | |
| 78 } | |
| 79 }; | 64 }; |
| 80 | 65 |
| 81 // The WebRTC default implementation of DtlsIdentityStoreInterface. | 66 // The WebRTC default implementation of DtlsIdentityStoreInterface. |
| 82 // Identity generation is performed on the worker thread. | 67 // Identity generation is performed on the worker thread. |
| 83 class DtlsIdentityStoreImpl : public DtlsIdentityStoreInterface, | 68 class DtlsIdentityStoreImpl : public DtlsIdentityStoreInterface, |
| 84 public rtc::MessageHandler { | 69 public rtc::MessageHandler { |
| 85 public: | 70 public: |
| 86 // This will start to preemptively generating an RSA identity in the | 71 // This will start to preemptively generating an RSA identity in the |
| 87 // background if the worker thread is not the same as the signaling thread. | 72 // background if the worker thread is not the same as the signaling thread. |
| 88 DtlsIdentityStoreImpl(rtc::Thread* signaling_thread, | 73 DtlsIdentityStoreImpl(rtc::Thread* signaling_thread, |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 std::unique_ptr<rtc::SSLIdentity> free_identity_; | 127 std::unique_ptr<rtc::SSLIdentity> free_identity_; |
| 143 }; | 128 }; |
| 144 | 129 |
| 145 // One RequestInfo per KeyType. Only touch on the |signaling_thread_|. | 130 // One RequestInfo per KeyType. Only touch on the |signaling_thread_|. |
| 146 RequestInfo request_info_[rtc::KT_LAST]; | 131 RequestInfo request_info_[rtc::KT_LAST]; |
| 147 }; | 132 }; |
| 148 | 133 |
| 149 } // namespace webrtc | 134 } // namespace webrtc |
| 150 | 135 |
| 151 #endif // WEBRTC_API_DTLSIDENTITYSTORE_H_ | 136 #endif // WEBRTC_API_DTLSIDENTITYSTORE_H_ |
| OLD | NEW |