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 26 matching lines...) Expand all Loading... |
37 #include "webrtc/base/scoped_ptr.h" | 37 #include "webrtc/base/scoped_ptr.h" |
38 #include "webrtc/base/scoped_ref_ptr.h" | 38 #include "webrtc/base/scoped_ref_ptr.h" |
39 #include "webrtc/base/sslidentity.h" | 39 #include "webrtc/base/sslidentity.h" |
40 #include "webrtc/base/thread.h" | 40 #include "webrtc/base/thread.h" |
41 | 41 |
42 namespace webrtc { | 42 namespace webrtc { |
43 class SSLIdentity; | 43 class SSLIdentity; |
44 class Thread; | 44 class Thread; |
45 | 45 |
46 // Used to receive callbacks of DTLS identity requests. | 46 // Used to receive callbacks of DTLS identity requests. |
47 class DTLSIdentityRequestObserver : public rtc::RefCountInterface { | |
48 public: | |
49 virtual void OnFailure(int error) = 0; | |
50 // TODO(jiayl): Unify the OnSuccess method once Chrome code is updated. | |
51 virtual void OnSuccess(const std::string& der_cert, | |
52 const std::string& der_private_key) = 0; | |
53 // |identity| is a scoped_ptr because rtc::SSLIdentity is not copyable and the | |
54 // client has to get the ownership of the object to make use of it. | |
55 virtual void OnSuccessWithIdentityObj( | |
56 rtc::scoped_ptr<rtc::SSLIdentity> identity) = 0; | |
57 | |
58 protected: | |
59 virtual ~DTLSIdentityRequestObserver() {} | |
60 }; | |
61 | |
62 // TODO(hbos): To replace DTLSIdentityRequestObserver. | |
63 // Used to receive callbacks of DTLS identity requests. | |
64 class DtlsIdentityRequestObserver : public rtc::RefCountInterface { | 47 class DtlsIdentityRequestObserver : public rtc::RefCountInterface { |
65 public: | 48 public: |
66 virtual void OnFailure(int error) = 0; | 49 virtual void OnFailure(int error) = 0; |
67 // TODO(hbos): Unify the OnSuccess method once Chrome code is updated. | 50 // TODO(hbos): Unify the OnSuccess method once Chrome code is updated. |
68 virtual void OnSuccess(const std::string& der_cert, | 51 virtual void OnSuccess(const std::string& der_cert, |
69 const std::string& der_private_key) = 0; | 52 const std::string& der_private_key) = 0; |
70 // |identity| is a scoped_ptr because rtc::SSLIdentity is not copyable and the | 53 // |identity| is a scoped_ptr because rtc::SSLIdentity is not copyable and the |
71 // client has to get the ownership of the object to make use of it. | 54 // client has to get the ownership of the object to make use of it. |
72 virtual void OnSuccess(rtc::scoped_ptr<rtc::SSLIdentity> identity) = 0; | 55 virtual void OnSuccess(rtc::scoped_ptr<rtc::SSLIdentity> identity) = 0; |
73 | 56 |
74 protected: | 57 protected: |
75 virtual ~DtlsIdentityRequestObserver() {} | 58 virtual ~DtlsIdentityRequestObserver() {} |
76 }; | 59 }; |
77 | 60 |
78 // TODO(hbos): To be implemented. | |
79 // This interface defines an in-memory DTLS identity store, which generates DTLS | 61 // This interface defines an in-memory DTLS identity store, which generates DTLS |
80 // identities. | 62 // identities. |
81 // APIs calls must be made on the signaling thread and the callbacks are also | 63 // APIs calls must be made on the signaling thread and the callbacks are also |
82 // called on the signaling thread. | 64 // called on the signaling thread. |
83 class DtlsIdentityStoreInterface { | 65 class DtlsIdentityStoreInterface { |
84 public: | 66 public: |
85 virtual ~DtlsIdentityStoreInterface() { } | 67 virtual ~DtlsIdentityStoreInterface() { } |
86 | 68 |
87 // The |observer| will be called when the requested identity is ready, or when | 69 // The |observer| will be called when the requested identity is ready, or when |
88 // identity generation fails. | 70 // identity generation fails. |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 rtc::scoped_ptr<rtc::SSLIdentity> free_identity_; | 136 rtc::scoped_ptr<rtc::SSLIdentity> free_identity_; |
155 }; | 137 }; |
156 | 138 |
157 // One RequestInfo per KeyType. Only touch on the |signaling_thread_|. | 139 // One RequestInfo per KeyType. Only touch on the |signaling_thread_|. |
158 RequestInfo request_info_[rtc::KT_LAST]; | 140 RequestInfo request_info_[rtc::KT_LAST]; |
159 }; | 141 }; |
160 | 142 |
161 } // namespace webrtc | 143 } // namespace webrtc |
162 | 144 |
163 #endif // TALK_APP_WEBRTC_DTLSIDENTITYSTORE_H_ | 145 #endif // TALK_APP_WEBRTC_DTLSIDENTITYSTORE_H_ |
OLD | NEW |