Chromium Code Reviews| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 67 string_length_(NULL), | 67 string_length_(NULL), |
| 68 handshake_complete_(NULL), | 68 handshake_complete_(NULL), |
| 69 bad_certificate_callback_(NULL), | 69 bad_certificate_callback_(NULL), |
| 70 in_handshake_(false), | 70 in_handshake_(false), |
| 71 filter_(NULL) { } | 71 filter_(NULL) { } |
| 72 | 72 |
| 73 void Init(Dart_Handle dart_this); | 73 void Init(Dart_Handle dart_this); |
| 74 void Connect(const char* host, | 74 void Connect(const char* host, |
| 75 int port, | 75 int port, |
| 76 bool is_server, | 76 bool is_server, |
| 77 const char* certificate_name); | 77 const char* certificate_name, |
|
Søren Gjesse
2012/12/07 13:00:23
Now about making an int with flags here instead of
Bill Hesse
2012/12/10 15:15:48
Because we would just pack them all up before call
| |
| 78 bool request_client_certificate, | |
| 79 bool require_client_certificate, | |
| 80 bool send_client_certificate); | |
| 78 void Destroy(); | 81 void Destroy(); |
| 79 void Handshake(); | 82 void Handshake(); |
| 80 void RegisterHandshakeCompleteCallback(Dart_Handle handshake_complete); | 83 void RegisterHandshakeCompleteCallback(Dart_Handle handshake_complete); |
| 81 void RegisterBadCertificateCallback(Dart_Handle callback); | 84 void RegisterBadCertificateCallback(Dart_Handle callback); |
| 85 Dart_Handle bad_certificate_callback() { return bad_certificate_callback_; } | |
| 82 static void InitializeLibrary(const char* certificate_database, | 86 static void InitializeLibrary(const char* certificate_database, |
| 83 const char* password, | 87 const char* password, |
| 84 bool use_builtin_root_certificates); | 88 bool use_builtin_root_certificates); |
| 85 | |
| 86 intptr_t ProcessBuffer(int bufferIndex); | 89 intptr_t ProcessBuffer(int bufferIndex); |
| 87 | 90 Dart_Handle PeerCertificate(); |
| 88 SECStatus HandleBadCertificate(PRFileDesc* fd); | |
| 89 | 91 |
| 90 private: | 92 private: |
| 91 static const int kMemioBufferSize = 20 * KB; | 93 static const int kMemioBufferSize = 20 * KB; |
| 92 static bool library_initialized_; | 94 static bool library_initialized_; |
| 93 static const char* password_; | 95 static const char* password_; |
| 94 static dart::Mutex mutex_; // To protect library initialization. | 96 static dart::Mutex mutex_; // To protect library initialization. |
| 95 | 97 |
| 96 uint8_t* buffers_[kNumBuffers]; | 98 uint8_t* buffers_[kNumBuffers]; |
| 97 int64_t buffer_size_; | 99 int64_t buffer_size_; |
| 98 Dart_Handle string_start_; | 100 Dart_Handle string_start_; |
| 99 Dart_Handle string_length_; | 101 Dart_Handle string_length_; |
| 100 Dart_Handle dart_buffer_objects_[kNumBuffers]; | 102 Dart_Handle dart_buffer_objects_[kNumBuffers]; |
| 101 Dart_Handle handshake_complete_; | 103 Dart_Handle handshake_complete_; |
| 102 Dart_Handle bad_certificate_callback_; | 104 Dart_Handle bad_certificate_callback_; |
| 103 bool in_handshake_; | 105 bool in_handshake_; |
| 104 bool is_server_; | 106 bool is_server_; |
| 105 PRFileDesc* filter_; | 107 PRFileDesc* filter_; |
| 106 | 108 |
| 107 void InitializeBuffers(Dart_Handle dart_this); | 109 void InitializeBuffers(Dart_Handle dart_this); |
| 108 void InitializePlatformData(); | 110 void InitializePlatformData(); |
| 109 | 111 |
| 110 DISALLOW_COPY_AND_ASSIGN(SSLFilter); | 112 DISALLOW_COPY_AND_ASSIGN(SSLFilter); |
| 111 }; | 113 }; |
| 112 | 114 |
| 113 #endif // BIN_SECURE_SOCKET_H_ | 115 #endif // BIN_SECURE_SOCKET_H_ |
| OLD | NEW |