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

Side by Side Diff: runtime/bin/tls_socket.h

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 proper event handling during handshake phase of connection. 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 unified diff | Download patch | Annotate | Revision Log
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 #ifndef BIN_TLS_SOCKET_H_
6 #define BIN_TLS_SOCKET_H_
7
8 #if defined(_WIN32)
Anders Johnsen 2012/07/27 15:58:49 Is this how we are supposed to do stuff like this?
Bill Hesse 2012/08/08 17:00:05 No. Removed. On 2012/07/27 15:58:49, ajohnsen wr
9 typedef signed __int64 int64_t;
10 typedef unsigned __int8 uint8_t;
11 #else
12 #include <stdint.h>
13 #endif
14
15 #include <stdlib.h>
16 #include <string.h>
17 #include <stdio.h>
18 #include <sys/types.h>
19
20 #include "bin/builtin.h"
21 #include "bin/dartutils.h"
22 #include "platform/globals.h"
23 #include "platform/thread.h"
24
25 static Dart_Handle HandleError(Dart_Handle handle) {
26 if (Dart_IsError(handle)) Dart_PropagateError(handle);
27 return handle;
28 }
29
30
31 class TlsFilterPlatformData;
32
33 class TlsFilter {
34 public:
35 enum BufferIndex { kReadPlaintext,
36 kWritePlaintext,
37 kReadEncrypted,
38 kWriteEncrypted,
39 kNumBuffers};
40
41 TlsFilter();
42 void Init(Dart_Handle dart_this);
43 void Connect();
44 void Destroy();
45 void RegisterHandshakeCallbacks(Dart_Handle start, Dart_Handle finish);
46
47 intptr_t ProcessBuffer(int bufferIndex);
48
49 private:
50 static const char* bufferNames[kNumBuffers];
51 int64_t buffer_size;
52 uint8_t* buffers[kNumBuffers];
53
54 Dart_Handle peer_;
55 Dart_Handle stringStart;
56 Dart_Handle stringLength;
57 Dart_Handle dart_buffer_objects[kNumBuffers];
58 Dart_Handle handshake_start;
59 Dart_Handle handshake_finish;
60 bool in_handshake;
61 TlsFilterPlatformData* data;
62
63 void InitializeBuffers();
64 void InitializePlatformData();
65 static bool library_initialized_; // Should be mutex protected.
66 void InitializeLibrary();
67 void LockInitMutex() {}
68 void UnlockInitMutex() {}
69
70 DISALLOW_COPY_AND_ASSIGN(TlsFilter);
71 };
72
73 #endif // BIN_TLS_SOCKET_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698