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

Side by Side Diff: runtime/bin/socket.h

Issue 25411003: Remove usage of legacy inet_ntop from dart:io. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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 | « no previous file | runtime/bin/socket_android.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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef BIN_SOCKET_H_ 5 #ifndef BIN_SOCKET_H_
6 #define BIN_SOCKET_H_ 6 #define BIN_SOCKET_H_
7 7
8 #include "bin/builtin.h" 8 #include "bin/builtin.h"
9 #include "bin/utils.h" 9 #include "bin/utils.h"
10 #include "bin/dartutils.h" 10 #include "bin/dartutils.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 45
46 enum { 46 enum {
47 ADDRESS_LOOPBACK_IP_V4, 47 ADDRESS_LOOPBACK_IP_V4,
48 ADDRESS_LOOPBACK_IP_V6, 48 ADDRESS_LOOPBACK_IP_V6,
49 ADDRESS_ANY_IP_V4, 49 ADDRESS_ANY_IP_V4,
50 ADDRESS_ANY_IP_V6, 50 ADDRESS_ANY_IP_V6,
51 ADDRESS_FIRST = ADDRESS_LOOPBACK_IP_V4, 51 ADDRESS_FIRST = ADDRESS_LOOPBACK_IP_V4,
52 ADDRESS_LAST = ADDRESS_ANY_IP_V6, 52 ADDRESS_LAST = ADDRESS_ANY_IP_V6,
53 }; 53 };
54 54
55 explicit SocketAddress(struct sockaddr* sockaddr); 55 explicit SocketAddress(struct sockaddr* sa);
56 56
57 ~SocketAddress() {} 57 ~SocketAddress() {}
58 58
59 int GetType() { 59 int GetType() {
60 if (addr_.ss.ss_family == AF_INET6) return TYPE_IPV6; 60 if (addr_.ss.ss_family == AF_INET6) return TYPE_IPV6;
61 return TYPE_IPV4; 61 return TYPE_IPV4;
62 } 62 }
63 63
64 const char* as_string() const { return as_string_; } 64 const char* as_string() const { return as_string_; }
65 const RawAddr& addr() const { return addr_; } 65 const RawAddr& addr() const { return addr_; }
(...skipping 28 matching lines...) Expand all
94 94
95 private: 95 private:
96 char as_string_[INET6_ADDRSTRLEN]; 96 char as_string_[INET6_ADDRSTRLEN];
97 RawAddr addr_; 97 RawAddr addr_;
98 98
99 DISALLOW_COPY_AND_ASSIGN(SocketAddress); 99 DISALLOW_COPY_AND_ASSIGN(SocketAddress);
100 }; 100 };
101 101
102 class InterfaceSocketAddress { 102 class InterfaceSocketAddress {
103 public: 103 public:
104 explicit InterfaceSocketAddress(struct sockaddr* sockaddr, 104 explicit InterfaceSocketAddress(struct sockaddr* sa,
105 const char* interface_name) 105 const char* interface_name)
106 : socket_address_(new SocketAddress(sockaddr)), 106 : socket_address_(new SocketAddress(sa)),
107 interface_name_(interface_name) {} 107 interface_name_(interface_name) {}
108 108
109 ~InterfaceSocketAddress() { 109 ~InterfaceSocketAddress() {
110 delete socket_address_; 110 delete socket_address_;
111 free(const_cast<char*>(interface_name_)); 111 free(const_cast<char*>(interface_name_));
112 } 112 }
113 113
114 SocketAddress* socket_address() const { return socket_address_; } 114 SocketAddress* socket_address() const { return socket_address_; }
115 const char* interface_name() const { return interface_name_; } 115 const char* interface_name() const { return interface_name_; }
116 116
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 224
225 private: 225 private:
226 DISALLOW_ALLOCATION(); 226 DISALLOW_ALLOCATION();
227 DISALLOW_IMPLICIT_CONSTRUCTORS(ServerSocket); 227 DISALLOW_IMPLICIT_CONSTRUCTORS(ServerSocket);
228 }; 228 };
229 229
230 } // namespace bin 230 } // namespace bin
231 } // namespace dart 231 } // namespace dart
232 232
233 #endif // BIN_SOCKET_H_ 233 #endif // BIN_SOCKET_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/socket_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698