OLD | NEW |
---|---|
(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() native "TlsSocket_Destroy"; | |
36 | |
37 void handshake() native "TlsSocket_Handshake"; | |
38 | |
39 void init() native "TlsSocket_Init"; | |
40 | |
41 int processBuffer(int bufferIndex) native "TlsSocket_ProcessBuffer"; | |
42 | |
43 void registerHandshakeCallbacks(Function startHandshakeHandler, | |
44 Function finishHandshakeHandler) | |
45 native "TlsSocket_RegisterHandshakeCallbacks"; | |
46 | |
47 List<_TlsExternalBuffer> buffers; | |
Søren Gjesse
2012/11/14 08:18:59
Add final.
Bill Hesse
2012/11/14 13:33:30
I just made this non-final, for the sake of explic
| |
48 } | |
OLD | NEW |