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

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

Issue 76383002: Update InternetAddress (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review commetns Created 7 years, 1 month 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 | « runtime/bin/io_natives.cc ('k') | runtime/bin/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) 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 } 85 }
86 86
87 static intptr_t GetAddrPort(RawAddr* addr) { 87 static intptr_t GetAddrPort(RawAddr* addr) {
88 if (addr->ss.ss_family == AF_INET) { 88 if (addr->ss.ss_family == AF_INET) {
89 return ntohs(addr->in.sin_port); 89 return ntohs(addr->in.sin_port);
90 } else { 90 } else {
91 return ntohs(addr->in6.sin6_port); 91 return ntohs(addr->in6.sin6_port);
92 } 92 }
93 } 93 }
94 94
95 static Dart_Handle ToTypedData(RawAddr* addr) {
96 int len = GetAddrLength(addr);
97 Dart_Handle result = Dart_NewTypedData(Dart_TypedData_kUint8, len);
98 if (Dart_IsError(result)) Dart_PropagateError(result);
99 Dart_ListSetAsBytes(result, 0, reinterpret_cast<uint8_t *>(addr), len);
100 return result;
101 }
102
95 private: 103 private:
96 char as_string_[INET6_ADDRSTRLEN]; 104 char as_string_[INET6_ADDRSTRLEN];
97 RawAddr addr_; 105 RawAddr addr_;
98 106
99 DISALLOW_COPY_AND_ASSIGN(SocketAddress); 107 DISALLOW_COPY_AND_ASSIGN(SocketAddress);
100 }; 108 };
101 109
102 class InterfaceSocketAddress { 110 class InterfaceSocketAddress {
103 public: 111 public:
104 explicit InterfaceSocketAddress(struct sockaddr* sa, 112 explicit InterfaceSocketAddress(struct sockaddr* sa,
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 182
175 // Perform a hostname lookup. Returns a AddressList of SocketAddress's. 183 // Perform a hostname lookup. Returns a AddressList of SocketAddress's.
176 static AddressList<SocketAddress>* LookupAddress(const char* host, 184 static AddressList<SocketAddress>* LookupAddress(const char* host,
177 int type, 185 int type,
178 OSError** os_error); 186 OSError** os_error);
179 static bool ReverseLookup(RawAddr addr, 187 static bool ReverseLookup(RawAddr addr,
180 char* host, 188 char* host,
181 intptr_t host_len, 189 intptr_t host_len,
182 OSError** os_error); 190 OSError** os_error);
183 191
192 static bool ParseAddress(int type, const char* address, RawAddr* addr);
193
184 // List interfaces. Returns a AddressList of InterfaceSocketAddress's. 194 // List interfaces. Returns a AddressList of InterfaceSocketAddress's.
185 static AddressList<InterfaceSocketAddress>* ListInterfaces( 195 static AddressList<InterfaceSocketAddress>* ListInterfaces(
186 int type, 196 int type,
187 OSError** os_error); 197 OSError** os_error);
188 198
189 static CObject* LookupRequest(const CObjectArray& request); 199 static CObject* LookupRequest(const CObjectArray& request);
190 static CObject* ListInterfacesRequest(const CObjectArray& request); 200 static CObject* ListInterfacesRequest(const CObjectArray& request);
191 static CObject* ReverseLookupRequest(const CObjectArray& request); 201 static CObject* ReverseLookupRequest(const CObjectArray& request);
192 202
193 static Dart_Port GetServicePort(); 203 static Dart_Port GetServicePort();
(...skipping 30 matching lines...) Expand all
224 234
225 private: 235 private:
226 DISALLOW_ALLOCATION(); 236 DISALLOW_ALLOCATION();
227 DISALLOW_IMPLICIT_CONSTRUCTORS(ServerSocket); 237 DISALLOW_IMPLICIT_CONSTRUCTORS(ServerSocket);
228 }; 238 };
229 239
230 } // namespace bin 240 } // namespace bin
231 } // namespace dart 241 } // namespace dart
232 242
233 #endif // BIN_SOCKET_H_ 243 #endif // BIN_SOCKET_H_
OLDNEW
« no previous file with comments | « runtime/bin/io_natives.cc ('k') | runtime/bin/socket.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698