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

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: Stub out win32 and macos platforms. 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 #include <stdlib.h>
9 #include <string.h>
10 #include <stdio.h>
11 #include <sys/types.h>
12
13 #include "bin/builtin.h"
14 #include "bin/dartutils.h"
15 #include "platform/globals.h"
16 #include "platform/thread.h"
17
18 static Dart_Handle HandleError(Dart_Handle handle) {
19 if (Dart_IsError(handle)) Dart_PropagateError(handle);
20 return handle;
21 }
22
23
24 class TlsFilterPlatformData;
25
26 class TlsFilter {
27 public:
28 enum BufferIndex { kReadPlaintext,
29 kWritePlaintext,
30 kReadEncrypted,
31 kWriteEncrypted,
32 kNumBuffers};
33
34 TlsFilter();
35 void Init(Dart_Handle dart_this);
36 void Connect();
37 void Destroy();
38 void RegisterHandshakeCallbacks(Dart_Handle start, Dart_Handle finish);
39
40 intptr_t ProcessBuffer(int bufferIndex);
41
42 private:
43 // static const char* bufferNames_[kNumBuffers];
44 static bool library_initialized_; // Should be mutex protected.
45
46 uint8_t* buffers_[kNumBuffers];
47 int64_t buffer_size_;
48 Dart_Handle stringStart_;
49 Dart_Handle stringLength_;
50 Dart_Handle dart_buffer_objects_[kNumBuffers];
51 Dart_Handle handshake_start_;
52 Dart_Handle handshake_finish_;
53 bool in_handshake_;
54 TlsFilterPlatformData* data_;
55
56 void InitializeBuffers(Dart_Handle dart_this);
57 void InitializePlatformData();
58 void InitializeLibrary();
59 void LockInitMutex() {}
60 void UnlockInitMutex() {}
61
62 DISALLOW_COPY_AND_ASSIGN(TlsFilter);
63 };
64
65 #endif // BIN_TLS_SOCKET_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698