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

Unified Diff: runtime/bin/secure_socket_patch.dart

Issue 11419138: Rename TlsSocket to SecureSocket, and all other Tls... items to Secure.... (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rename C++ class from Filter to SSLFilter. Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/secure_socket.cc ('k') | runtime/bin/tls_socket.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/secure_socket_patch.dart
diff --git a/runtime/bin/secure_socket_patch.dart b/runtime/bin/secure_socket_patch.dart
new file mode 100644
index 0000000000000000000000000000000000000000..34edc7e12c395f9106f0374700e64937ad71b046
--- /dev/null
+++ b/runtime/bin/secure_socket_patch.dart
@@ -0,0 +1,58 @@
+// 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.
+
+patch class SecureSocket {
+ /* patch */ static void setCertificateDatabase(String certificateDatabase,
+ [String password])
+ native "SecureSocket_SetCertificateDatabase";
+}
+
+
+patch class _SecureFilter {
+ /* patch */ factory _SecureFilter() => new _SecureFilterImpl();
+}
+
+
+/**
+ * _SecureFilterImpl wraps a filter that encrypts and decrypts data travelling
+ * over an encrypted socket. The filter also handles the handshaking
+ * and certificate verification.
+ *
+ * The filter exposes its input and output buffers as Dart objects that
+ * are backed by an external C array of bytes, so that both Dart code and
+ * native code can access the same data.
+ */
+class _SecureFilterImpl
+ extends NativeFieldWrapperClass1
+ implements _SecureFilter {
+ _SecureFilterImpl() {
+ buffers = new List<_ExternalBuffer>(_SecureSocket.NUM_BUFFERS);
+ for (int i = 0; i < _SecureSocket.NUM_BUFFERS; ++i) {
+ buffers[i] = new _ExternalBuffer();
+ }
+ }
+
+ void connect(String hostName,
+ int port,
+ bool is_server,
+ String certificate_name) native "SecureSocket_Connect";
+
+ void destroy() {
+ buffers = null;
+ _destroy();
+ }
+
+ void _destroy() native "SecureSocket_Destroy";
+
+ void handshake() native "SecureSocket_Handshake";
+
+ void init() native "SecureSocket_Init";
+
+ int processBuffer(int bufferIndex) native "SecureSocket_ProcessBuffer";
+
+ void registerHandshakeCompleteCallback(Function handshakeCompleteHandler)
+ native "SecureSocket_RegisterHandshakeCompleteCallback";
+
+ List<_ExternalBuffer> buffers;
+}
« no previous file with comments | « runtime/bin/secure_socket.cc ('k') | runtime/bin/tls_socket.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698