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

Side by Side Diff: runtime/bin/tls_socket_patch.dart

Issue 10916081: Add secure sockets to dart:io (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments, remove HandshakeStartHandler. 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/bin/tls_socket.cc ('k') | runtime/bin/utils.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 patch class TlsSocket {
6 /* patch */ static void setCertificateDatabase(String pkcertDirectory)
7 native "TlsSocket_SetCertificateDatabase";
8 }
9
10
11 patch class _TlsFilter {
12 /* patch */ factory _TlsFilter() => new _TlsFilterImpl();
13 }
14
15
16 /**
17 * _TlsFilterImpl wraps a filter that encrypts and decrypts data travelling
18 * over a TLS encrypted socket. The filter also handles the handshaking
19 * and certificate verification.
20 *
21 * The filter exposes its input and output buffers as Dart objects that
22 * are backed by an external C array of bytes, so that both Dart code and
23 * native code can access the same data.
24 */
25 class _TlsFilterImpl extends NativeFieldWrapperClass1 implements _TlsFilter {
26 _TlsFilterImpl() {
27 buffers = new List<_TlsExternalBuffer>(_TlsSocket.NUM_BUFFERS);
28 for (int i = 0; i < _TlsSocket.NUM_BUFFERS; ++i) {
29 buffers[i] = new _TlsExternalBuffer();
30 }
31 }
32
33 void connect(String hostName, int port) native "TlsSocket_Connect";
34
35 void destroy() {
36 buffers = null;
37 _destroy();
38 }
39
40 void _destroy() native "TlsSocket_Destroy";
41
42 void handshake() native "TlsSocket_Handshake";
43
44 void init() native "TlsSocket_Init";
45
46 int processBuffer(int bufferIndex) native "TlsSocket_ProcessBuffer";
47
48 void registerHandshakeCompleteCallback(Function handshakeCompleteHandler)
49 native "TlsSocket_RegisterHandshakeCompleteCallback";
50
51 List<_TlsExternalBuffer> buffers;
52 }
OLDNEW
« no previous file with comments | « runtime/bin/tls_socket.cc ('k') | runtime/bin/utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698