OLD | NEW |
| (Empty) |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef BLIMP_NET_SSL_CLIENT_TRANSPORT_H_ | |
6 #define BLIMP_NET_SSL_CLIENT_TRANSPORT_H_ | |
7 | |
8 #include <string> | |
9 #include "base/callback_forward.h" | |
10 #include "base/macros.h" | |
11 #include "base/memory/scoped_ptr.h" | |
12 #include "blimp/net/blimp_net_export.h" | |
13 #include "blimp/net/blimp_transport.h" | |
14 #include "blimp/net/exact_match_cert_verifier.h" | |
15 #include "blimp/net/tcp_client_transport.h" | |
16 #include "net/base/address_list.h" | |
17 #include "net/base/net_errors.h" | |
18 #include "net/http/transport_security_state.h" | |
19 | |
20 namespace net { | |
21 class ClientSocketFactory; | |
22 class NetLog; | |
23 class StreamSocket; | |
24 class TCPClientSocket; | |
25 class TransportSecurityState; | |
26 } // namespace net | |
27 | |
28 namespace blimp { | |
29 | |
30 class BlimpConnection; | |
31 | |
32 // Creates and connects SSL socket connections to an Engine. | |
33 class BLIMP_NET_EXPORT SSLClientTransport : public TCPClientTransport { | |
34 public: | |
35 // |ip_endpoint|: the address to connect to. | |
36 // |cert|: the certificate required from the remote peer. | |
37 // SSL connections that use different certificates are rejected. | |
38 // |net_log|: the socket event log (optional). | |
39 SSLClientTransport(const net::IPEndPoint& ip_endpoint, | |
40 scoped_refptr<net::X509Certificate> cert, | |
41 net::NetLog* net_log); | |
42 | |
43 ~SSLClientTransport() override; | |
44 | |
45 // BlimpTransport implementation. | |
46 const char* GetName() const override; | |
47 | |
48 private: | |
49 // Method called after TCPClientSocket::Connect finishes. | |
50 void OnTCPConnectComplete(int result) override; | |
51 | |
52 // Method called after SSLClientSocket::Connect finishes. | |
53 void OnSSLConnectComplete(int result); | |
54 | |
55 net::IPEndPoint ip_endpoint_; | |
56 scoped_ptr<ExactMatchCertVerifier> cert_verifier_; | |
57 net::TransportSecurityState transport_security_state_; | |
58 | |
59 DISALLOW_COPY_AND_ASSIGN(SSLClientTransport); | |
60 }; | |
61 | |
62 } // namespace blimp | |
63 | |
64 #endif // BLIMP_NET_SSL_CLIENT_TRANSPORT_H_ | |
OLD | NEW |