Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(153)

Side by Side Diff: talk/app/webrtc/dtlsidentitystore.h

Issue 1268363002: DtlsIdentityStoreInterface added. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | talk/app/webrtc/peerconnectioninterface.h » ('j') | webrtc/base/sslidentity.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 18 matching lines...) Expand all
29 #define TALK_APP_WEBRTC_DTLSIDENTITYSTORE_H_ 29 #define TALK_APP_WEBRTC_DTLSIDENTITYSTORE_H_
30 30
31 #include <queue> 31 #include <queue>
32 #include <string> 32 #include <string>
33 33
34 #include "talk/app/webrtc/peerconnectioninterface.h" 34 #include "talk/app/webrtc/peerconnectioninterface.h"
35 #include "webrtc/base/messagehandler.h" 35 #include "webrtc/base/messagehandler.h"
36 #include "webrtc/base/messagequeue.h" 36 #include "webrtc/base/messagequeue.h"
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"
40 #include "webrtc/base/thread.h"
39 41
40 namespace webrtc { 42 namespace webrtc {
41 class DTLSIdentityRequestObserver; 43 class DTLSIdentityRequestObserver;
42 class SSLIdentity; 44 class SSLIdentity;
43 class Thread; 45 class Thread;
44 46
47 // TODO(hbos): To replace DTLSIdentityRequestObserver.
48 // Used to receive callbacks of DTLS identity requests.
49 class DtlsIdentityRequestObserver : public rtc::RefCountInterface {
50 public:
51 virtual void OnFailure(int error) = 0;
52 // TODO(hbos): Unify the OnSuccess method once Chrome code is updated.
53 virtual void OnSuccess(const std::string& der_cert,
54 const std::string& der_private_key) = 0;
55 // |identity| is a scoped_ptr because rtc::SSLIdentity is not copyable and the
56 // client has to get the ownership of the object to make use of it.
57 virtual void OnSuccess(rtc::scoped_ptr<rtc::SSLIdentity> identity) = 0;
58
59 protected:
60 virtual ~DtlsIdentityRequestObserver() {}
61 };
62
63 // TODO(hbos): To be implemented.
64 // This interface defines an in-memory DTLS identity store, which generates DTLS
65 // identities.
66 // APIs calls must be made on the signaling thread and the callbacks are also
67 // called on the signaling thread.
68 class DtlsIdentityStoreInterface {
69 public:
70 virtual ~DtlsIdentityStoreInterface() { }
71
72 virtual void RequestIdentity(
73 rtc::KeyType key_type,
74 const rtc::scoped_refptr<DtlsIdentityRequestObserver>& observer) = 0;
75 };
76
45 // This class implements an in-memory DTLS identity store, which generates the 77 // This class implements an in-memory DTLS identity store, which generates the
46 // DTLS identity on the worker thread. 78 // DTLS identity on the worker thread.
47 // APIs calls must be made on the signaling thread and the callbacks are also 79 // APIs calls must be made on the signaling thread and the callbacks are also
48 // called on the signaling thread. 80 // called on the signaling thread.
49 class DtlsIdentityStore : public rtc::MessageHandler { 81 class DtlsIdentityStore : public rtc::MessageHandler {
50 public: 82 public:
51 static const char kIdentityName[]; 83 static const char kIdentityName[];
52 84
53 DtlsIdentityStore(rtc::Thread* signaling_thread, 85 DtlsIdentityStore(rtc::Thread* signaling_thread,
54 rtc::Thread* worker_thread); 86 rtc::Thread* worker_thread);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 int pending_jobs_; 118 int pending_jobs_;
87 rtc::scoped_ptr<rtc::SSLIdentity> free_identity_; 119 rtc::scoped_ptr<rtc::SSLIdentity> free_identity_;
88 typedef std::queue<rtc::scoped_refptr<webrtc::DTLSIdentityRequestObserver>> 120 typedef std::queue<rtc::scoped_refptr<webrtc::DTLSIdentityRequestObserver>>
89 ObserverList; 121 ObserverList;
90 ObserverList pending_observers_; 122 ObserverList pending_observers_;
91 }; 123 };
92 124
93 } // namespace webrtc 125 } // namespace webrtc
94 126
95 #endif // TALK_APP_WEBRTC_DTLSIDENTITYSTORE_H_ 127 #endif // TALK_APP_WEBRTC_DTLSIDENTITYSTORE_H_
OLDNEW
« no previous file with comments | « no previous file | talk/app/webrtc/peerconnectioninterface.h » ('j') | webrtc/base/sslidentity.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698