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

Unified Diff: runtime/bin/tls_socket_macos.cc

Issue 10704159: Start adding TLS (SSL) sockets to dart:io. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add Android stubs for TlsSocket implementation. Created 8 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: runtime/bin/tls_socket_macos.cc
diff --git a/runtime/bin/tls_socket_macos.cc b/runtime/bin/tls_socket_macos.cc
new file mode 100644
index 0000000000000000000000000000000000000000..cf14d6b4af50e08fc7b6f634b71358a445da3c6f
--- /dev/null
+++ b/runtime/bin/tls_socket_macos.cc
@@ -0,0 +1,77 @@
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+#include "bin/tls_socket.h"
+
+#include "bin/builtin.h"
+
+
+class TlsFilterPlatformData {
+};
+
+
+TlsFilter::TlsFilter() : in_handshake_(false) {
+ LockInitMutex();
+ if (!library_initialized_) {
+ InitializeLibrary();
+ library_initialized_ = true;
+ }
+ UnlockInitMutex();
+}
+
+
+void TlsFilter::InitializePlatformData() {
+ UNIMPLEMENTED();
+}
+
+
+void TlsFilter::InitializeLibrary() {
+ UNIMPLEMENTED();
+}
+
+
+void TlsFilter::Connect() {
+ UNIMPLEMENTED();
+}
+
+
+void TlsFilter::Destroy() {
+ UNIMPLEMENTED();
+}
+
+
+intptr_t TlsFilter::ProcessBuffer(int buffer_index) {
+ Dart_Handle buffer_object = dart_buffer_objects_[buffer_index];
+ Dart_Handle start_object = HandleError(
+ Dart_GetField(buffer_object, stringStart_));
+ Dart_Handle length_object = HandleError(
+ Dart_GetField(buffer_object, stringLength_));
+ int64_t unsafe_start = DartUtils::GetIntegerValue(start_object);
+ int64_t unsafe_length = DartUtils::GetIntegerValue(length_object);
+ if (unsafe_start < 0 || unsafe_start >= buffer_size_ ||
+ unsafe_length < 0 || unsafe_length > buffer_size_) {
+ Dart_ThrowException(DartUtils::NewDartIllegalArgumentException(
+ "Illegal .start or .length on a _TlsExternalBuffer"));
+ }
+ intptr_t start = static_cast<intptr_t>(unsafe_start);
+ intptr_t length = static_cast<intptr_t>(unsafe_length);
+
+ intptr_t bytes_processed = 0;
+ switch (buffer_index) {
+ case kReadPlaintext:
+ case kWriteEncrypted:
+ // Write from the filter to the buffer.
+ USE(start);
+ UNIMPLEMENTED();
+ break;
+ case kReadEncrypted:
+ case kWritePlaintext:
+ if (length > 0) {
+ // Write from the buffer to the filter.
+ UNIMPLEMENTED();
+ }
+ break;
+ }
+ return bytes_processed;
+}

Powered by Google App Engine
This is Rietveld 408576698