OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2015 Google Inc. | 3 * Copyright 2015 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 // This interface defines an in-memory DTLS identity store, which generates DTLS | 65 // This interface defines an in-memory DTLS identity store, which generates DTLS |
66 // identities. | 66 // identities. |
67 // APIs calls must be made on the signaling thread and the callbacks are also | 67 // APIs calls must be made on the signaling thread and the callbacks are also |
68 // called on the signaling thread. | 68 // called on the signaling thread. |
69 class DtlsIdentityStoreInterface { | 69 class DtlsIdentityStoreInterface { |
70 public: | 70 public: |
71 virtual ~DtlsIdentityStoreInterface() { } | 71 virtual ~DtlsIdentityStoreInterface() { } |
72 | 72 |
73 // The |observer| will be called when the requested identity is ready, or when | 73 // The |observer| will be called when the requested identity is ready, or when |
74 // identity generation fails. | 74 // identity generation fails. |
| 75 // TODO(torbjorng,hbos): The following RequestIdentity is about to be removed, |
| 76 // see below todo. |
75 virtual void RequestIdentity( | 77 virtual void RequestIdentity( |
76 rtc::KeyType key_type, | 78 rtc::KeyType key_type, |
77 const rtc::scoped_refptr<DtlsIdentityRequestObserver>& observer) = 0; | 79 const rtc::scoped_refptr<DtlsIdentityRequestObserver>& observer) { |
| 80 // Add default parameterization. |
| 81 RequestIdentity(rtc::KeyParams(key_type), observer); |
| 82 } |
| 83 // TODO(torbjorng,hbos): Parameterized key types! The following |
| 84 // RequestIdentity should replace the old one that takes rtc::KeyType. When |
| 85 // the new one is implemented by Chromium and WebRTC the old one should be |
| 86 // removed. crbug.com/544902, webrtc:5092. |
| 87 virtual void RequestIdentity( |
| 88 rtc::KeyParams key_params, |
| 89 const rtc::scoped_refptr<DtlsIdentityRequestObserver>& observer) { |
| 90 // Drop parameterization. |
| 91 RequestIdentity(key_params.type(), observer); |
| 92 } |
78 }; | 93 }; |
79 | 94 |
80 // The WebRTC default implementation of DtlsIdentityStoreInterface. | 95 // The WebRTC default implementation of DtlsIdentityStoreInterface. |
81 // Identity generation is performed on the worker thread. | 96 // Identity generation is performed on the worker thread. |
82 class DtlsIdentityStoreImpl : public DtlsIdentityStoreInterface, | 97 class DtlsIdentityStoreImpl : public DtlsIdentityStoreInterface, |
83 public rtc::MessageHandler { | 98 public rtc::MessageHandler { |
84 public: | 99 public: |
85 // This will start to preemptively generating an RSA identity in the | 100 // This will start to preemptively generating an RSA identity in the |
86 // background if the worker thread is not the same as the signaling thread. | 101 // background if the worker thread is not the same as the signaling thread. |
87 DtlsIdentityStoreImpl(rtc::Thread* signaling_thread, | 102 DtlsIdentityStoreImpl(rtc::Thread* signaling_thread, |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 rtc::scoped_ptr<rtc::SSLIdentity> free_identity_; | 155 rtc::scoped_ptr<rtc::SSLIdentity> free_identity_; |
141 }; | 156 }; |
142 | 157 |
143 // One RequestInfo per KeyType. Only touch on the |signaling_thread_|. | 158 // One RequestInfo per KeyType. Only touch on the |signaling_thread_|. |
144 RequestInfo request_info_[rtc::KT_LAST]; | 159 RequestInfo request_info_[rtc::KT_LAST]; |
145 }; | 160 }; |
146 | 161 |
147 } // namespace webrtc | 162 } // namespace webrtc |
148 | 163 |
149 #endif // TALK_APP_WEBRTC_DTLSIDENTITYSTORE_H_ | 164 #endif // TALK_APP_WEBRTC_DTLSIDENTITYSTORE_H_ |
OLD | NEW |