Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(548)

Side by Side Diff: runtime/bin/secure_socket.h

Issue 24395013: Merge services into a shared IOService in dart:io, and use a native port. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Finish off native_service Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/bin/native_service.cc ('k') | runtime/bin/secure_socket.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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>
11 #include <sys/types.h> 11 #include <sys/types.h>
12 12
13 #include <prinit.h> 13 #include <prinit.h>
14 #include <prerror.h> 14 #include <prerror.h>
15 #include <prnetdb.h> 15 #include <prnetdb.h>
16 #include <ssl.h> 16 #include <ssl.h>
17 17
18 #include "platform/globals.h" 18 #include "platform/globals.h"
19 #include "platform/thread.h" 19 #include "platform/thread.h"
20 20
21 #include "bin/builtin.h" 21 #include "bin/builtin.h"
22 #include "bin/dartutils.h" 22 #include "bin/dartutils.h"
23 #include "bin/socket.h" 23 #include "bin/socket.h"
24 #include "bin/utils.h" 24 #include "bin/utils.h"
25 #include "bin/native_service.h"
26 25
27 namespace dart { 26 namespace dart {
28 namespace bin { 27 namespace bin {
29 28
30 /* 29 /*
31 * SSLFilter encapsulates the NSS SSL(TLS) code in a filter, that communicates 30 * SSLFilter encapsulates the NSS SSL(TLS) code in a filter, that communicates
32 * with the containing _SecureFilterImpl Dart object through four shared 31 * with the containing _SecureFilterImpl Dart object through four shared
33 * ExternalByteArray buffers, for reading and writing plaintext, and 32 * ExternalByteArray buffers, for reading and writing plaintext, and
34 * reading and writing encrypted text. The filter handles handshaking 33 * reading and writing encrypted text. The filter handles handshaking
35 * and certificate verification. 34 * and certificate verification.
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 intptr_t ProcessReadEncryptedBuffer(int start, int end); 80 intptr_t ProcessReadEncryptedBuffer(int start, int end);
82 intptr_t ProcessWriteEncryptedBuffer(int start, int end); 81 intptr_t ProcessWriteEncryptedBuffer(int start, int end);
83 bool ProcessAllBuffers(int starts[kNumBuffers], 82 bool ProcessAllBuffers(int starts[kNumBuffers],
84 int ends[kNumBuffers], 83 int ends[kNumBuffers],
85 bool in_handshake); 84 bool in_handshake);
86 Dart_Handle PeerCertificate(); 85 Dart_Handle PeerCertificate();
87 static void InitializeLibrary(const char* certificate_database, 86 static void InitializeLibrary(const char* certificate_database,
88 const char* password, 87 const char* password,
89 bool use_builtin_root_certificates, 88 bool use_builtin_root_certificates,
90 bool report_duplicate_initialization = true); 89 bool report_duplicate_initialization = true);
91 static Dart_Port GetServicePort();
92 Dart_Handle callback_error; 90 Dart_Handle callback_error;
93 91
92 static CObject* ProcessFilterRequest(const CObjectArray& request);
93
94 private: 94 private:
95 static const int kMemioBufferSize = 20 * KB; 95 static const int kMemioBufferSize = 20 * KB;
96 static bool library_initialized_; 96 static bool library_initialized_;
97 static const char* password_; 97 static const char* password_;
98 static dart::Mutex* mutex_; // To protect library initialization. 98 static dart::Mutex* mutex_; // To protect library initialization.
99 static NativeService filter_service_;
100 99
101 uint8_t* buffers_[kNumBuffers]; 100 uint8_t* buffers_[kNumBuffers];
102 int buffer_size_; 101 int buffer_size_;
103 int encrypted_buffer_size_; 102 int encrypted_buffer_size_;
104 Dart_PersistentHandle string_start_; 103 Dart_PersistentHandle string_start_;
105 Dart_PersistentHandle string_length_; 104 Dart_PersistentHandle string_length_;
106 Dart_PersistentHandle dart_buffer_objects_[kNumBuffers]; 105 Dart_PersistentHandle dart_buffer_objects_[kNumBuffers];
107 Dart_PersistentHandle handshake_complete_; 106 Dart_PersistentHandle handshake_complete_;
108 Dart_PersistentHandle bad_certificate_callback_; 107 Dart_PersistentHandle bad_certificate_callback_;
109 bool in_handshake_; 108 bool in_handshake_;
110 bool is_server_; 109 bool is_server_;
111 char* client_certificate_name_; 110 char* client_certificate_name_;
112 PRFileDesc* filter_; 111 PRFileDesc* filter_;
113 112
114 static bool isBufferEncrypted(int i) { 113 static bool isBufferEncrypted(int i) {
115 return static_cast<BufferIndex>(i) >= kFirstEncrypted; 114 return static_cast<BufferIndex>(i) >= kFirstEncrypted;
116 } 115 }
117 void InitializeBuffers(Dart_Handle dart_this); 116 void InitializeBuffers(Dart_Handle dart_this);
118 void InitializePlatformData(); 117 void InitializePlatformData();
119 118
120 DISALLOW_COPY_AND_ASSIGN(SSLFilter); 119 DISALLOW_COPY_AND_ASSIGN(SSLFilter);
121 }; 120 };
122 121
123 } // namespace bin 122 } // namespace bin
124 } // namespace dart 123 } // namespace dart
125 124
126 #endif // BIN_SECURE_SOCKET_H_ 125 #endif // BIN_SECURE_SOCKET_H_
OLDNEW
« no previous file with comments | « runtime/bin/native_service.cc ('k') | runtime/bin/secure_socket.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698