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