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 #ifdef DART_IO_SECURE_SOCKET_DISABLED | 8 #ifdef DART_IO_SECURE_SOCKET_DISABLED |
9 #error "secure_socket.h can only be included on builds with SSL enabled" | 9 #error "secure_socket.h can only be included on builds with SSL enabled" |
10 #endif | 10 #endif |
11 | 11 |
| 12 #include <stdio.h> |
12 #include <stdlib.h> | 13 #include <stdlib.h> |
13 #include <string.h> | 14 #include <string.h> |
14 #include <stdio.h> | |
15 #include <sys/types.h> | 15 #include <sys/types.h> |
16 | 16 |
17 #include <openssl/bio.h> | 17 #include <openssl/bio.h> |
| 18 #include <openssl/err.h> |
18 #include <openssl/ssl.h> | 19 #include <openssl/ssl.h> |
19 #include <openssl/err.h> | |
20 #include <openssl/x509.h> | 20 #include <openssl/x509.h> |
21 | 21 |
22 #include "bin/builtin.h" | 22 #include "bin/builtin.h" |
23 #include "bin/dartutils.h" | 23 #include "bin/dartutils.h" |
24 #include "bin/socket.h" | 24 #include "bin/socket.h" |
25 #include "bin/thread.h" | 25 #include "bin/thread.h" |
26 #include "bin/utils.h" | 26 #include "bin/utils.h" |
27 | 27 |
28 namespace dart { | 28 namespace dart { |
29 namespace bin { | 29 namespace bin { |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 | 95 |
96 static CObject* ProcessFilterRequest(const CObjectArray& request); | 96 static CObject* ProcessFilterRequest(const CObjectArray& request); |
97 | 97 |
98 // The index of the external data field in _ssl that points to the SSLFilter. | 98 // The index of the external data field in _ssl that points to the SSLFilter. |
99 static int filter_ssl_index; | 99 static int filter_ssl_index; |
100 | 100 |
101 // TODO(whesse): make private: | 101 // TODO(whesse): make private: |
102 SSL* ssl_; | 102 SSL* ssl_; |
103 BIO* socket_side_; | 103 BIO* socket_side_; |
104 | 104 |
105 | |
106 private: | 105 private: |
107 static bool library_initialized_; | 106 static bool library_initialized_; |
108 static Mutex* mutex_; // To protect library initialization. | 107 static Mutex* mutex_; // To protect library initialization. |
109 | 108 |
110 uint8_t* buffers_[kNumBuffers]; | 109 uint8_t* buffers_[kNumBuffers]; |
111 int buffer_size_; | 110 int buffer_size_; |
112 int encrypted_buffer_size_; | 111 int encrypted_buffer_size_; |
113 Dart_PersistentHandle string_start_; | 112 Dart_PersistentHandle string_start_; |
114 Dart_PersistentHandle string_length_; | 113 Dart_PersistentHandle string_length_; |
115 Dart_PersistentHandle dart_buffer_objects_[kNumBuffers]; | 114 Dart_PersistentHandle dart_buffer_objects_[kNumBuffers]; |
116 Dart_PersistentHandle handshake_complete_; | 115 Dart_PersistentHandle handshake_complete_; |
117 Dart_PersistentHandle bad_certificate_callback_; | 116 Dart_PersistentHandle bad_certificate_callback_; |
118 bool in_handshake_; | 117 bool in_handshake_; |
119 bool is_server_; | 118 bool is_server_; |
120 char* hostname_; | 119 char* hostname_; |
121 | 120 |
122 static bool isBufferEncrypted(int i) { | 121 static bool isBufferEncrypted(int i) { |
123 return static_cast<BufferIndex>(i) >= kFirstEncrypted; | 122 return static_cast<BufferIndex>(i) >= kFirstEncrypted; |
124 } | 123 } |
125 Dart_Handle InitializeBuffers(Dart_Handle dart_this); | 124 Dart_Handle InitializeBuffers(Dart_Handle dart_this); |
126 void InitializePlatformData(); | 125 void InitializePlatformData(); |
127 | 126 |
128 DISALLOW_COPY_AND_ASSIGN(SSLFilter); | 127 DISALLOW_COPY_AND_ASSIGN(SSLFilter); |
129 }; | 128 }; |
130 | 129 |
131 } // namespace bin | 130 } // namespace bin |
132 } // namespace dart | 131 } // namespace dart |
133 | 132 |
134 #endif // BIN_SECURE_SOCKET_H_ | 133 #endif // BIN_SECURE_SOCKET_H_ |
OLD | NEW |