OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef NET_SOCKET_SSL_CLIENT_SOCKET_H_ | 5 #ifndef NET_SOCKET_SSL_CLIENT_SOCKET_H_ |
6 #define NET_SOCKET_SSL_CLIENT_SOCKET_H_ | 6 #define NET_SOCKET_SSL_CLIENT_SOCKET_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "net/base/completion_callback.h" | 10 #include "net/base/completion_callback.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 // connection. | 62 // connection. |
63 enum NextProtoStatus { | 63 enum NextProtoStatus { |
64 // WARNING: These values are serialized to disk. Don't change them. | 64 // WARNING: These values are serialized to disk. Don't change them. |
65 | 65 |
66 kNextProtoUnsupported = 0, // The server doesn't support NPN. | 66 kNextProtoUnsupported = 0, // The server doesn't support NPN. |
67 kNextProtoNegotiated = 1, // We agreed on a protocol. | 67 kNextProtoNegotiated = 1, // We agreed on a protocol. |
68 kNextProtoNoOverlap = 2, // No protocols in common. We requested | 68 kNextProtoNoOverlap = 2, // No protocols in common. We requested |
69 // the first protocol in our list. | 69 // the first protocol in our list. |
70 }; | 70 }; |
71 | 71 |
72 // Gets the SSL connection information of the socket. | 72 // StreamSocket: |
73 // | 73 virtual bool WasNpnNegotiated() const OVERRIDE; |
74 // TODO(sergeyu): Move this method to the SSLSocket interface and | 74 virtual NextProto GetNegotiatedProtocol() const OVERRIDE; |
75 // implemented in SSLServerSocket too. | |
76 virtual void GetSSLInfo(SSLInfo* ssl_info) = 0; | |
77 | 75 |
78 // Gets the SSL CertificateRequest info of the socket after Connect failed | 76 // Gets the SSL CertificateRequest info of the socket after Connect failed |
79 // with ERR_SSL_CLIENT_AUTH_CERT_NEEDED. | 77 // with ERR_SSL_CLIENT_AUTH_CERT_NEEDED. |
80 virtual void GetSSLCertRequestInfo( | 78 virtual void GetSSLCertRequestInfo( |
81 SSLCertRequestInfo* cert_request_info) = 0; | 79 SSLCertRequestInfo* cert_request_info) = 0; |
82 | 80 |
83 // StreamSocket: | |
84 virtual NextProto GetNegotiatedProtocol() const OVERRIDE; | |
85 | |
86 // Get the application level protocol that we negotiated with the server. | 81 // Get the application level protocol that we negotiated with the server. |
87 // *proto is set to the resulting protocol (n.b. that the string may have | 82 // *proto is set to the resulting protocol (n.b. that the string may have |
88 // embedded NULs). | 83 // embedded NULs). |
89 // kNextProtoUnsupported: *proto is cleared. | 84 // kNextProtoUnsupported: *proto is cleared. |
90 // kNextProtoNegotiated: *proto is set to the negotiated protocol. | 85 // kNextProtoNegotiated: *proto is set to the negotiated protocol. |
91 // kNextProtoNoOverlap: *proto is set to the first protocol in the | 86 // kNextProtoNoOverlap: *proto is set to the first protocol in the |
92 // supported list. | 87 // supported list. |
93 // *server_protos is set to the server advertised protocols. | 88 // *server_protos is set to the server advertised protocols. |
94 virtual NextProtoStatus GetNextProto(std::string* proto, | 89 virtual NextProtoStatus GetNextProto(std::string* proto, |
95 std::string* server_protos) = 0; | 90 std::string* server_protos) = 0; |
96 | 91 |
97 static NextProto NextProtoFromString(const std::string& proto_string); | 92 static NextProto NextProtoFromString(const std::string& proto_string); |
98 | 93 |
99 static const char* NextProtoToString(NextProto next_proto); | 94 static const char* NextProtoToString(NextProto next_proto); |
100 | 95 |
101 static const char* NextProtoStatusToString(const NextProtoStatus status); | 96 static const char* NextProtoStatusToString(const NextProtoStatus status); |
102 | 97 |
103 // Can be used with the second argument(|server_protos|) of |GetNextProto| to | 98 // Can be used with the second argument(|server_protos|) of |GetNextProto| to |
104 // construct a comma separated string of server advertised protocols. | 99 // construct a comma separated string of server advertised protocols. |
105 static std::string ServerProtosToString(const std::string& server_protos); | 100 static std::string ServerProtosToString(const std::string& server_protos); |
106 | 101 |
107 static bool IgnoreCertError(int error, int load_flags); | 102 static bool IgnoreCertError(int error, int load_flags); |
108 | 103 |
109 // ClearSessionCache clears the SSL session cache, used to resume SSL | 104 // ClearSessionCache clears the SSL session cache, used to resume SSL |
110 // sessions. | 105 // sessions. |
111 static void ClearSessionCache(); | 106 static void ClearSessionCache(); |
112 | 107 |
113 virtual bool was_npn_negotiated() const; | |
114 | |
115 virtual bool set_was_npn_negotiated(bool negotiated); | 108 virtual bool set_was_npn_negotiated(bool negotiated); |
116 | 109 |
117 virtual bool was_spdy_negotiated() const; | 110 virtual bool was_spdy_negotiated() const; |
118 | 111 |
119 virtual bool set_was_spdy_negotiated(bool negotiated); | 112 virtual bool set_was_spdy_negotiated(bool negotiated); |
120 | 113 |
121 virtual void set_protocol_negotiated(NextProto protocol_negotiated); | 114 virtual void set_protocol_negotiated(NextProto protocol_negotiated); |
122 | 115 |
123 // Returns the ServerBoundCertService used by this socket, or NULL if | 116 // Returns the ServerBoundCertService used by this socket, or NULL if |
124 // server bound certificates are not supported. | 117 // server bound certificates are not supported. |
(...skipping 14 matching lines...) Expand all Loading... |
139 bool was_spdy_negotiated_; | 132 bool was_spdy_negotiated_; |
140 // Protocol that we negotiated with the server. | 133 // Protocol that we negotiated with the server. |
141 NextProto protocol_negotiated_; | 134 NextProto protocol_negotiated_; |
142 // True if a channel ID was sent. | 135 // True if a channel ID was sent. |
143 bool channel_id_sent_; | 136 bool channel_id_sent_; |
144 }; | 137 }; |
145 | 138 |
146 } // namespace net | 139 } // namespace net |
147 | 140 |
148 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_H_ | 141 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_H_ |
OLD | NEW |