OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 #include "bin/secure_socket.h" | 5 #include "bin/secure_socket.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <fcntl.h> | 8 #include <fcntl.h> |
9 #include <sys/stat.h> | 9 #include <sys/stat.h> |
10 #include <stdio.h> | 10 #include <stdio.h> |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 bool require_client_certificate = | 119 bool require_client_certificate = |
120 DartUtils::GetBooleanValue(Dart_GetNativeArgument(args, 7)); | 120 DartUtils::GetBooleanValue(Dart_GetNativeArgument(args, 7)); |
121 bool send_client_certificate = | 121 bool send_client_certificate = |
122 DartUtils::GetBooleanValue(Dart_GetNativeArgument(args, 8)); | 122 DartUtils::GetBooleanValue(Dart_GetNativeArgument(args, 8)); |
123 | 123 |
124 const char* host_name = NULL; | 124 const char* host_name = NULL; |
125 // TODO(whesse): Is truncating a Dart string containing \0 what we want? | 125 // TODO(whesse): Is truncating a Dart string containing \0 what we want? |
126 ThrowIfError(Dart_StringToCString(host_name_object, &host_name)); | 126 ThrowIfError(Dart_StringToCString(host_name_object, &host_name)); |
127 | 127 |
128 RawAddr raw_addr; | 128 RawAddr raw_addr; |
129 Dart_TypedData_Type type; | 129 SocketAddress::GetSockAddr(host_sockaddr_storage_object, &raw_addr); |
130 uint8_t* buffer = NULL; | |
131 intptr_t len; | |
132 ThrowIfError(Dart_TypedDataAcquireData(host_sockaddr_storage_object, | |
133 &type, | |
134 reinterpret_cast<void**>(&buffer), | |
135 &len)); | |
136 ASSERT(static_cast<size_t>(len) <= sizeof(raw_addr)); | |
137 memmove(&raw_addr, buffer, len); | |
138 Dart_TypedDataReleaseData(host_sockaddr_storage_object); | |
139 | 130 |
140 int64_t port; | 131 int64_t port; |
141 if (!DartUtils::GetInt64Value(port_object, &port)) { | 132 if (!DartUtils::GetInt64Value(port_object, &port)) { |
142 FATAL("The range of port_object was checked in Dart - it cannot fail here"); | 133 FATAL("The range of port_object was checked in Dart - it cannot fail here"); |
143 } | 134 } |
144 | 135 |
145 const char* certificate_name = NULL; | 136 const char* certificate_name = NULL; |
146 if (Dart_IsString(certificate_name_object)) { | 137 if (Dart_IsString(certificate_name_object)) { |
147 ThrowIfError(Dart_StringToCString(certificate_name_object, | 138 ThrowIfError(Dart_StringToCString(certificate_name_object, |
148 &certificate_name)); | 139 &certificate_name)); |
(...skipping 816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
965 } | 956 } |
966 if (bytes_processed > 0) { | 957 if (bytes_processed > 0) { |
967 memio_PutWriteResult(secret, bytes_processed); | 958 memio_PutWriteResult(secret, bytes_processed); |
968 } | 959 } |
969 } | 960 } |
970 return bytes_processed; | 961 return bytes_processed; |
971 } | 962 } |
972 | 963 |
973 } // namespace bin | 964 } // namespace bin |
974 } // namespace dart | 965 } // namespace dart |
OLD | NEW |