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

Unified 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, 5 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 side-by-side diff with in-line comments
Download patch
Index: runtime/bin/tls_socket.h
diff --git a/runtime/bin/tls_socket.h b/runtime/bin/tls_socket.h
new file mode 100644
index 0000000000000000000000000000000000000000..ea312ab959195496239048ff6f7a28b68be1f95e
--- /dev/null
+++ b/runtime/bin/tls_socket.h
@@ -0,0 +1,73 @@
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+#ifndef BIN_TLS_SOCKET_H_
+#define BIN_TLS_SOCKET_H_
+
+#if defined(_WIN32)
+typedef signed __int64 int64_t;
+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.
+#else
+#include <stdint.h>
+#endif
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <sys/types.h>
+
+#include "bin/builtin.h"
+#include "bin/dartutils.h"
+#include "platform/globals.h"
+#include "platform/thread.h"
+
+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?
+ if (Dart_IsError(handle)) Dart_PropagateError(handle);
+ return handle;
+}
+
+
+class TlsFilterPlatformData;
+
+class TlsFilter {
+ public:
+ enum BufferIndex { kReadPlaintext,
+ kWritePlaintext,
+ kReadEncrypted,
+ kWriteEncrypted,
+ kNumBuffers};
+
+ TlsFilter();
+ void Init(Dart_Handle dart_this);
+ void Connect();
+ void Destroy();
+ void RegisterHandshakeCallbacks(Dart_Handle start, Dart_Handle finish);
+
+ intptr_t ProcessBuffer(int bufferIndex);
+
+ 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.
+ 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.
+ int64_t buffer_size;
+ uint8_t* buffers[kNumBuffers];
+
+ Dart_Handle peer_;
+ Dart_Handle stringStart;
+ Dart_Handle stringLength;
+ Dart_Handle dart_buffer_objects[kNumBuffers];
+ Dart_Handle handshake_start;
+ Dart_Handle handshake_finish;
+ bool in_handshake;
+ 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.
+
+ void InitializeBuffers();
+ void InitializePlatformData();
+ static bool library_initialized_; // Should be mutex protected.
+ void InitializeLibrary();
+ void LockInitMutex() {}
+ void UnlockInitMutex() {}
+
+ DISALLOW_COPY_AND_ASSIGN(TlsFilter);
+};
+
+#endif // BIN_TLS_SOCKET_H_

Powered by Google App Engine
This is Rietveld 408576698