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 29 matching lines...) Expand all Loading... |
40 enum BufferIndex { | 40 enum BufferIndex { |
41 kReadPlaintext, | 41 kReadPlaintext, |
42 kWritePlaintext, | 42 kWritePlaintext, |
43 kReadEncrypted, | 43 kReadEncrypted, |
44 kWriteEncrypted, | 44 kWriteEncrypted, |
45 kNumBuffers, | 45 kNumBuffers, |
46 kFirstEncrypted = kReadEncrypted | 46 kFirstEncrypted = kReadEncrypted |
47 }; | 47 }; |
48 | 48 |
49 SSLFilter() | 49 SSLFilter() |
50 : string_start_(NULL), | 50 : callback_error(NULL), |
| 51 string_start_(NULL), |
51 string_length_(NULL), | 52 string_length_(NULL), |
52 handshake_complete_(NULL), | 53 handshake_complete_(NULL), |
53 bad_certificate_callback_(NULL), | 54 bad_certificate_callback_(NULL), |
54 in_handshake_(false), | 55 in_handshake_(false), |
55 client_certificate_name_(NULL), | 56 client_certificate_name_(NULL), |
56 filter_(NULL) { } | 57 filter_(NULL) { } |
57 | 58 |
58 void Init(Dart_Handle dart_this); | 59 void Init(Dart_Handle dart_this); |
59 void Connect(const char* host, | 60 void Connect(const char* host, |
60 RawAddr* raw_addr, | 61 RawAddr* raw_addr, |
(...skipping 20 matching lines...) Expand all Loading... |
81 intptr_t ProcessWriteEncryptedBuffer(int start, int end); | 82 intptr_t ProcessWriteEncryptedBuffer(int start, int end); |
82 bool ProcessAllBuffers(int starts[kNumBuffers], | 83 bool ProcessAllBuffers(int starts[kNumBuffers], |
83 int ends[kNumBuffers], | 84 int ends[kNumBuffers], |
84 bool in_handshake); | 85 bool in_handshake); |
85 Dart_Handle PeerCertificate(); | 86 Dart_Handle PeerCertificate(); |
86 static void InitializeLibrary(const char* certificate_database, | 87 static void InitializeLibrary(const char* certificate_database, |
87 const char* password, | 88 const char* password, |
88 bool use_builtin_root_certificates, | 89 bool use_builtin_root_certificates, |
89 bool report_duplicate_initialization = true); | 90 bool report_duplicate_initialization = true); |
90 static Dart_Port GetServicePort(); | 91 static Dart_Port GetServicePort(); |
| 92 Dart_Handle callback_error; |
91 | 93 |
92 private: | 94 private: |
93 static const int kMemioBufferSize = 20 * KB; | 95 static const int kMemioBufferSize = 20 * KB; |
94 static bool library_initialized_; | 96 static bool library_initialized_; |
95 static const char* password_; | 97 static const char* password_; |
96 static dart::Mutex* mutex_; // To protect library initialization. | 98 static dart::Mutex* mutex_; // To protect library initialization. |
97 static NativeService filter_service_; | 99 static NativeService filter_service_; |
98 | 100 |
99 uint8_t* buffers_[kNumBuffers]; | 101 uint8_t* buffers_[kNumBuffers]; |
100 int buffer_size_; | 102 int buffer_size_; |
(...skipping 14 matching lines...) Expand all Loading... |
115 void InitializeBuffers(Dart_Handle dart_this); | 117 void InitializeBuffers(Dart_Handle dart_this); |
116 void InitializePlatformData(); | 118 void InitializePlatformData(); |
117 | 119 |
118 DISALLOW_COPY_AND_ASSIGN(SSLFilter); | 120 DISALLOW_COPY_AND_ASSIGN(SSLFilter); |
119 }; | 121 }; |
120 | 122 |
121 } // namespace bin | 123 } // namespace bin |
122 } // namespace dart | 124 } // namespace dart |
123 | 125 |
124 #endif // BIN_SECURE_SOCKET_H_ | 126 #endif // BIN_SECURE_SOCKET_H_ |
OLD | NEW |