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_SECURE_SOCKET_H_ | 5 #ifndef BIN_SECURE_SOCKET_H_ |
6 #define BIN_SECURE_SOCKET_H_ | 6 #define BIN_SECURE_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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
80 int start2, int end2); | 80 int start2, int end2); |
81 intptr_t ProcessReadEncryptedBuffer(int start, int end); | 81 intptr_t ProcessReadEncryptedBuffer(int start, int end); |
82 intptr_t ProcessWriteEncryptedBuffer(int start, int end); | 82 intptr_t ProcessWriteEncryptedBuffer(int start, int end); |
83 bool ProcessAllBuffers(int starts[kNumBuffers], | 83 bool ProcessAllBuffers(int starts[kNumBuffers], |
84 int ends[kNumBuffers], | 84 int ends[kNumBuffers], |
85 bool in_handshake); | 85 bool in_handshake); |
86 Dart_Handle PeerCertificate(); | 86 Dart_Handle PeerCertificate(); |
87 static void InitializeLibrary(const char* certificate_database, | 87 static void InitializeLibrary(const char* certificate_database, |
88 const char* password, | 88 const char* password, |
89 bool use_builtin_root_certificates, | 89 bool use_builtin_root_certificates, |
90 bool read_only, | |
90 bool report_duplicate_initialization = true); | 91 bool report_duplicate_initialization = true); |
91 static Dart_Port GetServicePort(); | 92 static Dart_Port GetServicePort(); |
92 Dart_Handle callback_error; | 93 Dart_Handle callback_error; |
93 | 94 |
95 static char* GetPassword() { return password_; } | |
96 | |
94 private: | 97 private: |
95 static const int kMemioBufferSize = 20 * KB; | 98 static const int kMemioBufferSize = 20 * KB; |
96 static bool library_initialized_; | 99 static bool library_initialized_; |
97 static const char* password_; | 100 static char* password_; |
Bill Hesse
2013/08/06 16:47:59
Most of the uses of the password require it to be
| |
98 static dart::Mutex* mutex_; // To protect library initialization. | 101 static dart::Mutex* mutex_; // To protect library initialization. |
99 static NativeService filter_service_; | 102 static NativeService filter_service_; |
100 | 103 |
101 uint8_t* buffers_[kNumBuffers]; | 104 uint8_t* buffers_[kNumBuffers]; |
102 int buffer_size_; | 105 int buffer_size_; |
103 int encrypted_buffer_size_; | 106 int encrypted_buffer_size_; |
104 Dart_PersistentHandle string_start_; | 107 Dart_PersistentHandle string_start_; |
105 Dart_PersistentHandle string_length_; | 108 Dart_PersistentHandle string_length_; |
106 Dart_PersistentHandle dart_buffer_objects_[kNumBuffers]; | 109 Dart_PersistentHandle dart_buffer_objects_[kNumBuffers]; |
107 Dart_PersistentHandle handshake_complete_; | 110 Dart_PersistentHandle handshake_complete_; |
108 Dart_PersistentHandle bad_certificate_callback_; | 111 Dart_PersistentHandle bad_certificate_callback_; |
109 bool in_handshake_; | 112 bool in_handshake_; |
110 bool is_server_; | 113 bool is_server_; |
111 char* client_certificate_name_; | 114 char* client_certificate_name_; |
112 PRFileDesc* filter_; | 115 PRFileDesc* filter_; |
113 | 116 |
114 static bool isBufferEncrypted(int i) { | 117 static bool isBufferEncrypted(int i) { |
115 return static_cast<BufferIndex>(i) >= kFirstEncrypted; | 118 return static_cast<BufferIndex>(i) >= kFirstEncrypted; |
116 } | 119 } |
117 void InitializeBuffers(Dart_Handle dart_this); | 120 void InitializeBuffers(Dart_Handle dart_this); |
118 void InitializePlatformData(); | 121 void InitializePlatformData(); |
119 | 122 |
120 DISALLOW_COPY_AND_ASSIGN(SSLFilter); | 123 DISALLOW_COPY_AND_ASSIGN(SSLFilter); |
121 }; | 124 }; |
122 | 125 |
123 } // namespace bin | 126 } // namespace bin |
124 } // namespace dart | 127 } // namespace dart |
125 | 128 |
126 #endif // BIN_SECURE_SOCKET_H_ | 129 #endif // BIN_SECURE_SOCKET_H_ |
OLD | NEW |