| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 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 | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef BIN_TLS_SOCKET_H_ | 5 #ifndef BIN_TLS_SOCKET_H_ |
| 6 #define BIN_TLS_SOCKET_H_ | 6 #define BIN_TLS_SOCKET_H_ |
| 7 | 7 |
| 8 #include <stdlib.h> | 8 #include <stdlib.h> |
| 9 #include <string.h> | 9 #include <string.h> |
| 10 #include <stdio.h> | 10 #include <stdio.h> |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 kReadEncrypted, | 59 kReadEncrypted, |
| 60 kWriteEncrypted, | 60 kWriteEncrypted, |
| 61 kNumBuffers | 61 kNumBuffers |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 TlsFilter() | 64 TlsFilter() |
| 65 : string_start_(NULL), | 65 : string_start_(NULL), |
| 66 string_length_(NULL), | 66 string_length_(NULL), |
| 67 handshake_complete_(NULL), | 67 handshake_complete_(NULL), |
| 68 in_handshake_(false), | 68 in_handshake_(false), |
| 69 memio_(NULL) { } | 69 filter_(NULL) { } |
| 70 | 70 |
| 71 void Init(Dart_Handle dart_this); | 71 void Init(Dart_Handle dart_this); |
| 72 void Connect(const char* host, int port); | 72 void Connect(const char* host, |
| 73 int port, |
| 74 bool is_server, |
| 75 const char* certificate_name); |
| 73 void Destroy(); | 76 void Destroy(); |
| 74 void DestroyPlatformIndependent(); | |
| 75 void Handshake(); | 77 void Handshake(); |
| 76 void RegisterHandshakeCompleteCallback(Dart_Handle handshake_complete); | 78 void RegisterHandshakeCompleteCallback(Dart_Handle handshake_complete); |
| 77 static void InitializeLibrary(const char* pkcert_directory); | 79 static void InitializeLibrary(const char* certificate_database, |
| 80 const char* password); |
| 78 | 81 |
| 79 intptr_t ProcessBuffer(int bufferIndex); | 82 intptr_t ProcessBuffer(int bufferIndex); |
| 80 | 83 |
| 81 private: | 84 private: |
| 82 static const int kMemioBufferSize = 20 * KB; | 85 static const int kMemioBufferSize = 20 * KB; |
| 83 static bool library_initialized_; | 86 static bool library_initialized_; |
| 87 static const char* password_; |
| 84 static dart::Mutex mutex_; // To protect library initialization. | 88 static dart::Mutex mutex_; // To protect library initialization. |
| 85 | 89 |
| 86 uint8_t* buffers_[kNumBuffers]; | 90 uint8_t* buffers_[kNumBuffers]; |
| 87 int64_t buffer_size_; | 91 int64_t buffer_size_; |
| 88 Dart_Handle string_start_; | 92 Dart_Handle string_start_; |
| 89 Dart_Handle string_length_; | 93 Dart_Handle string_length_; |
| 90 Dart_Handle dart_buffer_objects_[kNumBuffers]; | 94 Dart_Handle dart_buffer_objects_[kNumBuffers]; |
| 91 Dart_Handle handshake_complete_; | 95 Dart_Handle handshake_complete_; |
| 92 bool in_handshake_; | 96 bool in_handshake_; |
| 93 PRFileDesc* memio_; | 97 bool is_server_; |
| 98 PRFileDesc* filter_; |
| 94 | 99 |
| 95 void InitializeBuffers(Dart_Handle dart_this); | 100 void InitializeBuffers(Dart_Handle dart_this); |
| 96 void InitializePlatformData(); | 101 void InitializePlatformData(); |
| 97 | 102 |
| 98 DISALLOW_COPY_AND_ASSIGN(TlsFilter); | 103 DISALLOW_COPY_AND_ASSIGN(TlsFilter); |
| 99 }; | 104 }; |
| 100 | 105 |
| 101 #endif // BIN_TLS_SOCKET_H_ | 106 #endif // BIN_TLS_SOCKET_H_ |
| OLD | NEW |