• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Copyright 2004 The WebRTC Project Authors. All rights reserved.
3  *
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
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 
11 #if HAVE_CONFIG_H
12 #include "config.h"
13 #endif  // HAVE_CONFIG_H
14 
15 #include "webrtc/base/sslstreamadapter.h"
16 #include "webrtc/base/sslconfig.h"
17 
18 #if SSL_USE_SCHANNEL
19 
20 // SChannel support for DTLS and peer-to-peer mode are not
21 // done.
22 #elif SSL_USE_OPENSSL  // && !SSL_USE_SCHANNEL
23 
24 #include "webrtc/base/opensslstreamadapter.h"
25 
26 #elif SSL_USE_NSS      // && !SSL_USE_SCHANNEL && !SSL_USE_OPENSSL
27 
28 #include "webrtc/base/nssstreamadapter.h"
29 
30 #endif  // !SSL_USE_OPENSSL && !SSL_USE_SCHANNEL && !SSL_USE_NSS
31 
32 ///////////////////////////////////////////////////////////////////////////////
33 
34 namespace rtc {
35 
Create(StreamInterface * stream)36 SSLStreamAdapter* SSLStreamAdapter::Create(StreamInterface* stream) {
37 #if SSL_USE_SCHANNEL
38   return NULL;
39 #elif SSL_USE_OPENSSL  // !SSL_USE_SCHANNEL
40   return new OpenSSLStreamAdapter(stream);
41 #elif SSL_USE_NSS     //  !SSL_USE_SCHANNEL && !SSL_USE_OPENSSL
42   return new NSSStreamAdapter(stream);
43 #else  // !SSL_USE_SCHANNEL && !SSL_USE_OPENSSL && !SSL_USE_NSS
44   return NULL;
45 #endif
46 }
47 
48 // Note: this matches the logic above with SCHANNEL dominating
49 #if SSL_USE_SCHANNEL
HaveDtls()50 bool SSLStreamAdapter::HaveDtls() { return false; }
HaveDtlsSrtp()51 bool SSLStreamAdapter::HaveDtlsSrtp() { return false; }
HaveExporter()52 bool SSLStreamAdapter::HaveExporter() { return false; }
53 #elif SSL_USE_OPENSSL
HaveDtls()54 bool SSLStreamAdapter::HaveDtls() {
55   return OpenSSLStreamAdapter::HaveDtls();
56 }
HaveDtlsSrtp()57 bool SSLStreamAdapter::HaveDtlsSrtp() {
58   return OpenSSLStreamAdapter::HaveDtlsSrtp();
59 }
HaveExporter()60 bool SSLStreamAdapter::HaveExporter() {
61   return OpenSSLStreamAdapter::HaveExporter();
62 }
63 #elif SSL_USE_NSS
HaveDtls()64 bool SSLStreamAdapter::HaveDtls() {
65   return NSSStreamAdapter::HaveDtls();
66 }
HaveDtlsSrtp()67 bool SSLStreamAdapter::HaveDtlsSrtp() {
68   return NSSStreamAdapter::HaveDtlsSrtp();
69 }
HaveExporter()70 bool SSLStreamAdapter::HaveExporter() {
71   return NSSStreamAdapter::HaveExporter();
72 }
73 #endif  // !SSL_USE_SCHANNEL && !SSL_USE_OPENSSL && !SSL_USE_NSS
74 
75 ///////////////////////////////////////////////////////////////////////////////
76 
77 }  // namespace rtc
78