roll skia to 4057
[chromium-blink-merge.git] / net / curvecp / curvecp_client_socket.cc
blob4aaea1b361ce7021eb22c2e9b1e5bf8a06af0e44
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
3 // found in the LICENSE file.
5 #include "net/base/ip_endpoint.h"
6 #include "net/base/net_errors.h"
7 #include "net/curvecp/curvecp_client_socket.h"
8 #include "net/curvecp/messenger.h"
10 namespace net {
12 CurveCPClientSocket::CurveCPClientSocket(const AddressList& addresses,
13 net::NetLog* net_log,
14 const net::NetLog::Source& source)
15 : addresses_(addresses),
16 net_log_(BoundNetLog::Make(net_log, NetLog::SOURCE_SOCKET)),
17 messenger_(&packetizer_) {
20 CurveCPClientSocket::~CurveCPClientSocket() {
23 int CurveCPClientSocket::Connect(const CompletionCallback& callback) {
24 return packetizer_.Connect(addresses_, &messenger_, callback);
27 void CurveCPClientSocket::Disconnect() {
28 // TODO(mbelshe): DCHECK that we're connected.
29 // Record the ConnectionKey so that we can disconnect it properly.
30 // Do we need a close() on the messenger?
31 // packetizer_.Close();
34 bool CurveCPClientSocket::IsConnected() const {
35 // TODO(mbelshe): return packetizer_.IsConnected();
36 return false;
39 bool CurveCPClientSocket::IsConnectedAndIdle() const {
40 // TODO(mbelshe): return packetizer_.IsConnectedAndIdle();
41 return false;
44 int CurveCPClientSocket::GetPeerAddress(AddressList* address) const {
45 IPEndPoint endpoint;
46 int rv = packetizer_.GetPeerAddress(&endpoint);
47 if (rv < 0)
48 return rv;
49 *address = AddressList(endpoint);
50 return OK;
53 int CurveCPClientSocket::GetLocalAddress(IPEndPoint* address) const {
54 NOTIMPLEMENTED();
55 return ERR_FAILED;
58 const BoundNetLog& CurveCPClientSocket::NetLog() const {
59 return net_log_;
62 void CurveCPClientSocket::SetSubresourceSpeculation() {
63 // This is ridiculous.
66 void CurveCPClientSocket::SetOmniboxSpeculation() {
67 // This is ridiculous.
70 bool CurveCPClientSocket::WasEverUsed() const {
71 // This is ridiculous.
72 return true;
75 bool CurveCPClientSocket::UsingTCPFastOpen() const {
76 // This is ridiculous.
77 return false;
80 int64 CurveCPClientSocket::NumBytesRead() const {
81 return -1;
84 base::TimeDelta CurveCPClientSocket::GetConnectTimeMicros() const {
85 return base::TimeDelta::FromMicroseconds(-1);
88 NextProto CurveCPClientSocket::GetNegotiatedProtocol() const {
89 return kProtoUnknown;
92 int CurveCPClientSocket::Read(IOBuffer* buf,
93 int buf_len,
94 const CompletionCallback& callback) {
95 return messenger_.Read(buf, buf_len, callback);
98 int CurveCPClientSocket::Write(IOBuffer* buf,
99 int buf_len,
100 const CompletionCallback& callback) {
101 return messenger_.Write(buf, buf_len, callback);
104 bool CurveCPClientSocket::SetReceiveBufferSize(int32 size) {
105 return true;
108 bool CurveCPClientSocket::SetSendBufferSize(int32 size) {
109 return true;
112 } // namespace net