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

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 tls_socket.dart back. This should not be compared to socket.dart. 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)
9 typedef signed __int64 int64_t;
10 typedef unsigned __int8 uint8_t;
Søren Gjesse 2012/07/31 09:07:15 We now have these typedefs in a number of places.
Mads Ager (google) 2012/07/31 10:16:01 They are already there in platform/globals.h. They
Bill Hesse 2012/08/08 17:00:05 Done.
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) {
Søren Gjesse 2012/07/31 09:07:15 Isn't this more of a function for dartutils.h?
Mads Ager (google) 2012/07/31 10:16:01 I don't think we should have this at all?
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:
Mads Ager (google) 2012/07/31 10:16:01 Please use the '_' suffix for all private fields.
Bill Hesse 2012/08/08 17:00:05 Done.
50 static const char* bufferNames[kNumBuffers];
Mads Ager (google) 2012/07/31 10:16:01 No camel case in C++: buffer_names_[kNumBuffers];
Bill Hesse 2012/08/08 17:00:05 Done.
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;
Søren Gjesse 2012/07/31 09:07:15 Shouldn't all private variables end with and under
Bill Hesse 2012/08/08 17:00:05 Done.
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