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 #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 DestroyPlatformIndependent(); |
| 39 void RegisterHandshakeCallbacks(Dart_Handle start, Dart_Handle finish); |
| 40 static void InitializeLibrary(const char* pkcert_directory); |
| 41 |
| 42 intptr_t ProcessBuffer(int bufferIndex); |
| 43 |
| 44 private: |
| 45 // static const char* bufferNames_[kNumBuffers]; |
| 46 static bool library_initialized_; // Should be mutex protected. |
| 47 |
| 48 uint8_t* buffers_[kNumBuffers]; |
| 49 int64_t buffer_size_; |
| 50 Dart_Handle stringStart_; |
| 51 Dart_Handle stringLength_; |
| 52 Dart_Handle dart_buffer_objects_[kNumBuffers]; |
| 53 Dart_Handle handshake_start_; |
| 54 Dart_Handle handshake_finish_; |
| 55 bool in_handshake_; |
| 56 TlsFilterPlatformData* data_; |
| 57 |
| 58 void InitializeBuffers(Dart_Handle dart_this); |
| 59 void InitializePlatformData(); |
| 60 static void LockInitMutex() {} |
| 61 static void UnlockInitMutex() {} |
| 62 |
| 63 DISALLOW_COPY_AND_ASSIGN(TlsFilter); |
| 64 }; |
| 65 |
| 66 #endif // BIN_TLS_SOCKET_H_ |
OLD | NEW |