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

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

Issue 17589007: dart:io | Change names for SecureSocket exceptions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix bad upload to review tool. Created 7 years, 5 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
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" 25 #include "bin/native_service.h"
26 26
27 namespace dart { 27 namespace dart {
28 namespace bin { 28 namespace bin {
29 29
30 static void ThrowException(const char* message) {
31 Dart_Handle socket_exception =
32 DartUtils::NewDartSocketException(message, Dart_Null());
33 Dart_ThrowException(socket_exception);
34 }
35
36
37 /* Handle an error reported from the NSS library. */
38 static void ThrowPRException(const char* message) {
39 PRErrorCode error_code = PR_GetError();
40 const char* error_message = PR_ErrorToString(error_code, PR_LANGUAGE_EN);
41 OSError os_error_struct(error_code, error_message, OSError::kNSS);
42 Dart_Handle os_error = DartUtils::NewDartOSError(&os_error_struct);
43 Dart_Handle socket_exception =
44 DartUtils::NewDartSocketException(message, os_error);
45 Dart_ThrowException(socket_exception);
46 }
47
48 /* 30 /*
49 * SSLFilter encapsulates the NSS SSL(TLS) code in a filter, that communicates 31 * SSLFilter encapsulates the NSS SSL(TLS) code in a filter, that communicates
50 * with the containing _SecureFilterImpl Dart object through four shared 32 * with the containing _SecureFilterImpl Dart object through four shared
51 * ExternalByteArray buffers, for reading and writing plaintext, and 33 * ExternalByteArray buffers, for reading and writing plaintext, and
52 * reading and writing encrypted text. The filter handles handshaking 34 * reading and writing encrypted text. The filter handles handshaking
53 * and certificate verification. 35 * and certificate verification.
54 */ 36 */
55 class SSLFilter { 37 class SSLFilter {
56 public: 38 public:
57 // These enums must agree with those in sdk/lib/io/secure_socket.dart. 39 // These enums must agree with those in sdk/lib/io/secure_socket.dart.
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 void InitializeBuffers(Dart_Handle dart_this); 112 void InitializeBuffers(Dart_Handle dart_this);
131 void InitializePlatformData(); 113 void InitializePlatformData();
132 114
133 DISALLOW_COPY_AND_ASSIGN(SSLFilter); 115 DISALLOW_COPY_AND_ASSIGN(SSLFilter);
134 }; 116 };
135 117
136 } // namespace bin 118 } // namespace bin
137 } // namespace dart 119 } // namespace dart
138 120
139 #endif // BIN_SECURE_SOCKET_H_ 121 #endif // BIN_SECURE_SOCKET_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698