OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 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 16 matching lines...) Expand all Loading... |
27 void set_ignore_bad_cert(bool ignore) { ignore_bad_cert_ = ignore; } | 27 void set_ignore_bad_cert(bool ignore) { ignore_bad_cert_ = ignore; } |
28 | 28 |
29 // Do DTLS or TLS (default is TLS, if unspecified) | 29 // Do DTLS or TLS (default is TLS, if unspecified) |
30 virtual void SetMode(SSLMode mode) = 0; | 30 virtual void SetMode(SSLMode mode) = 0; |
31 | 31 |
32 // StartSSL returns 0 if successful. | 32 // StartSSL returns 0 if successful. |
33 // If StartSSL is called while the socket is closed or connecting, the SSL | 33 // If StartSSL is called while the socket is closed or connecting, the SSL |
34 // negotiation will begin as soon as the socket connects. | 34 // negotiation will begin as soon as the socket connects. |
35 virtual int StartSSL(const char* hostname, bool restartable) = 0; | 35 virtual int StartSSL(const char* hostname, bool restartable) = 0; |
36 | 36 |
37 // Create the default SSL adapter for this platform. On failure, returns NULL | 37 // Create the default SSL adapter for this platform. On failure, returns null |
38 // and deletes |socket|. Otherwise, the returned SSLAdapter takes ownership | 38 // and deletes |socket|. Otherwise, the returned SSLAdapter takes ownership |
39 // of |socket|. | 39 // of |socket|. |
40 static SSLAdapter* Create(AsyncSocket* socket); | 40 static SSLAdapter* Create(AsyncSocket* socket); |
41 | 41 |
42 private: | 42 private: |
43 // If true, the server certificate need not match the configured hostname. | 43 // If true, the server certificate need not match the configured hostname. |
44 bool ignore_bad_cert_; | 44 bool ignore_bad_cert_; |
45 }; | 45 }; |
46 | 46 |
47 /////////////////////////////////////////////////////////////////////////////// | 47 /////////////////////////////////////////////////////////////////////////////// |
48 | 48 |
49 typedef bool (*VerificationCallback)(void* cert); | 49 typedef bool (*VerificationCallback)(void* cert); |
50 | 50 |
51 // Call this on the main thread, before using SSL. | 51 // Call this on the main thread, before using SSL. |
52 // Call CleanupSSLThread when finished with SSL. | 52 // Call CleanupSSLThread when finished with SSL. |
53 bool InitializeSSL(VerificationCallback callback = NULL); | 53 bool InitializeSSL(VerificationCallback callback = nullptr); |
54 | 54 |
55 // Call to initialize additional threads. | 55 // Call to initialize additional threads. |
56 bool InitializeSSLThread(); | 56 bool InitializeSSLThread(); |
57 | 57 |
58 // Call to cleanup additional threads, and also the main thread. | 58 // Call to cleanup additional threads, and also the main thread. |
59 bool CleanupSSL(); | 59 bool CleanupSSL(); |
60 | 60 |
61 /////////////////////////////////////////////////////////////////////////////// | 61 /////////////////////////////////////////////////////////////////////////////// |
62 | 62 |
63 } // namespace rtc | 63 } // namespace rtc |
64 | 64 |
65 #endif // WEBRTC_BASE_SSLADAPTER_H_ | 65 #endif // WEBRTC_BASE_SSLADAPTER_H_ |
OLD | NEW |