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 #include "net/socket/socks_client_socket.h" | 5 #include "net/socket/socks_client_socket.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/sys_byteorder.h" | 10 #include "base/sys_byteorder.h" |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 } | 173 } |
174 | 174 |
175 base::TimeDelta SOCKSClientSocket::GetConnectTimeMicros() const { | 175 base::TimeDelta SOCKSClientSocket::GetConnectTimeMicros() const { |
176 if (transport_.get() && transport_->socket()) { | 176 if (transport_.get() && transport_->socket()) { |
177 return transport_->socket()->GetConnectTimeMicros(); | 177 return transport_->socket()->GetConnectTimeMicros(); |
178 } | 178 } |
179 NOTREACHED(); | 179 NOTREACHED(); |
180 return base::TimeDelta::FromMicroseconds(-1); | 180 return base::TimeDelta::FromMicroseconds(-1); |
181 } | 181 } |
182 | 182 |
| 183 bool SOCKSClientSocket::WasNpnNegotiated() const { |
| 184 if (transport_.get() && transport_->socket()) { |
| 185 return transport_->socket()->WasNpnNegotiated(); |
| 186 } |
| 187 NOTREACHED(); |
| 188 return false; |
| 189 } |
| 190 |
183 NextProto SOCKSClientSocket::GetNegotiatedProtocol() const { | 191 NextProto SOCKSClientSocket::GetNegotiatedProtocol() const { |
184 if (transport_.get() && transport_->socket()) { | 192 if (transport_.get() && transport_->socket()) { |
185 return transport_->socket()->GetNegotiatedProtocol(); | 193 return transport_->socket()->GetNegotiatedProtocol(); |
186 } | 194 } |
187 NOTREACHED(); | 195 NOTREACHED(); |
188 return kProtoUnknown; | 196 return kProtoUnknown; |
189 } | 197 } |
190 | 198 |
| 199 bool SOCKSClientSocket::GetSSLInfo(SSLInfo* ssl_info) const { |
| 200 if (transport_.get() && transport_->socket()) { |
| 201 return transport_->socket()->GetSSLInfo(ssl_info); |
| 202 } |
| 203 NOTREACHED(); |
| 204 return false; |
| 205 |
| 206 } |
| 207 |
191 // Read is called by the transport layer above to read. This can only be done | 208 // Read is called by the transport layer above to read. This can only be done |
192 // if the SOCKS handshake is complete. | 209 // if the SOCKS handshake is complete. |
193 int SOCKSClientSocket::Read(IOBuffer* buf, int buf_len, | 210 int SOCKSClientSocket::Read(IOBuffer* buf, int buf_len, |
194 const CompletionCallback& callback) { | 211 const CompletionCallback& callback) { |
195 DCHECK(completed_handshake_); | 212 DCHECK(completed_handshake_); |
196 DCHECK_EQ(STATE_NONE, next_state_); | 213 DCHECK_EQ(STATE_NONE, next_state_); |
197 DCHECK(user_callback_.is_null()); | 214 DCHECK(user_callback_.is_null()); |
198 | 215 |
199 return transport_->socket()->Read(buf, buf_len, callback); | 216 return transport_->socket()->Read(buf, buf_len, callback); |
200 } | 217 } |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 | 450 |
434 int SOCKSClientSocket::GetPeerAddress(IPEndPoint* address) const { | 451 int SOCKSClientSocket::GetPeerAddress(IPEndPoint* address) const { |
435 return transport_->socket()->GetPeerAddress(address); | 452 return transport_->socket()->GetPeerAddress(address); |
436 } | 453 } |
437 | 454 |
438 int SOCKSClientSocket::GetLocalAddress(IPEndPoint* address) const { | 455 int SOCKSClientSocket::GetLocalAddress(IPEndPoint* address) const { |
439 return transport_->socket()->GetLocalAddress(address); | 456 return transport_->socket()->GetLocalAddress(address); |
440 } | 457 } |
441 | 458 |
442 } // namespace net | 459 } // namespace net |
OLD | NEW |