Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(942)

Side by Side Diff: net/curvecp/curvecp_client_socket.cc

Issue 10309002: Reimplements net::AddressList without struct addrinfo. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: get_canonical_name -> canonical_name. iterator to indexing Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/curvecp/client_packetizer.cc ('k') | net/curvecp/curvecp_server_socket.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/base/ip_endpoint.h" 5 #include "net/base/ip_endpoint.h"
6 #include "net/base/net_errors.h" 6 #include "net/base/net_errors.h"
7 #include "net/base/sys_addrinfo.h"
8 #include "net/curvecp/curvecp_client_socket.h" 7 #include "net/curvecp/curvecp_client_socket.h"
9 #include "net/curvecp/messenger.h" 8 #include "net/curvecp/messenger.h"
10 9
11 namespace net { 10 namespace net {
12 11
13 CurveCPClientSocket::CurveCPClientSocket(const AddressList& addresses, 12 CurveCPClientSocket::CurveCPClientSocket(const AddressList& addresses,
14 net::NetLog* net_log, 13 net::NetLog* net_log,
15 const net::NetLog::Source& source) 14 const net::NetLog::Source& source)
16 : addresses_(addresses), 15 : addresses_(addresses),
17 net_log_(BoundNetLog::Make(net_log, NetLog::SOURCE_SOCKET)), 16 net_log_(BoundNetLog::Make(net_log, NetLog::SOURCE_SOCKET)),
(...skipping 22 matching lines...) Expand all
40 bool CurveCPClientSocket::IsConnectedAndIdle() const { 39 bool CurveCPClientSocket::IsConnectedAndIdle() const {
41 // TODO(mbelshe): return packetizer_.IsConnectedAndIdle(); 40 // TODO(mbelshe): return packetizer_.IsConnectedAndIdle();
42 return false; 41 return false;
43 } 42 }
44 43
45 int CurveCPClientSocket::GetPeerAddress(AddressList* address) const { 44 int CurveCPClientSocket::GetPeerAddress(AddressList* address) const {
46 IPEndPoint endpoint; 45 IPEndPoint endpoint;
47 int rv = packetizer_.GetPeerAddress(&endpoint); 46 int rv = packetizer_.GetPeerAddress(&endpoint);
48 if (rv < 0) 47 if (rv < 0)
49 return rv; 48 return rv;
50 struct sockaddr_storage sockaddr; 49 *address = AddressList(endpoint);
51 size_t sockaddr_length = sizeof(sockaddr);
52 bool success = endpoint.ToSockAddr(
53 reinterpret_cast<struct sockaddr*>(&sockaddr), &sockaddr_length);
54 if (!success)
55 return ERR_FAILED;
56 struct addrinfo ai;
57 memset(&ai, 0, sizeof(ai));
58 memcpy(&ai.ai_addr, &sockaddr, sockaddr_length);
59 ai.ai_addrlen = sockaddr_length;
60 *address = AddressList::CreateByCopying(&ai);
61 return OK; 50 return OK;
62 } 51 }
63 52
64 int CurveCPClientSocket::GetLocalAddress(IPEndPoint* address) const { 53 int CurveCPClientSocket::GetLocalAddress(IPEndPoint* address) const {
65 NOTIMPLEMENTED(); 54 NOTIMPLEMENTED();
66 return ERR_FAILED; 55 return ERR_FAILED;
67 } 56 }
68 57
69 const BoundNetLog& CurveCPClientSocket::NetLog() const { 58 const BoundNetLog& CurveCPClientSocket::NetLog() const {
70 return net_log_; 59 return net_log_;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 103
115 bool CurveCPClientSocket::SetReceiveBufferSize(int32 size) { 104 bool CurveCPClientSocket::SetReceiveBufferSize(int32 size) {
116 return true; 105 return true;
117 } 106 }
118 107
119 bool CurveCPClientSocket::SetSendBufferSize(int32 size) { 108 bool CurveCPClientSocket::SetSendBufferSize(int32 size) {
120 return true; 109 return true;
121 } 110 }
122 111
123 } // namespace net 112 } // namespace net
OLDNEW
« no previous file with comments | « net/curvecp/client_packetizer.cc ('k') | net/curvecp/curvecp_server_socket.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698