| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 #include "bin/tls_socket.h" |
| 6 |
| 7 #include "bin/builtin.h" |
| 8 |
| 9 |
| 10 class TlsFilterPlatformData { |
| 11 }; |
| 12 |
| 13 |
| 14 TlsFilter::TlsFilter() : in_handshake_(false) { |
| 15 LockInitMutex(); |
| 16 if (!library_initialized_) { |
| 17 InitializeLibrary(); |
| 18 library_initialized_ = true; |
| 19 } |
| 20 UnlockInitMutex(); |
| 21 } |
| 22 |
| 23 |
| 24 void TlsFilter::InitializePlatformData() { |
| 25 UNIMPLEMENTED(); |
| 26 } |
| 27 |
| 28 |
| 29 void TlsFilter::InitializeLibrary() { |
| 30 UNIMPLEMENTED(); |
| 31 } |
| 32 |
| 33 |
| 34 void TlsFilter::Connect() { |
| 35 UNIMPLEMENTED(); |
| 36 } |
| 37 |
| 38 |
| 39 void TlsFilter::Destroy() { |
| 40 UNIMPLEMENTED(); |
| 41 } |
| 42 |
| 43 |
| 44 intptr_t TlsFilter::ProcessBuffer(int buffer_index) { |
| 45 Dart_Handle buffer_object = dart_buffer_objects_[buffer_index]; |
| 46 Dart_Handle start_object = HandleError( |
| 47 Dart_GetField(buffer_object, stringStart_)); |
| 48 Dart_Handle length_object = HandleError( |
| 49 Dart_GetField(buffer_object, stringLength_)); |
| 50 int64_t unsafe_start = DartUtils::GetIntegerValue(start_object); |
| 51 int64_t unsafe_length = DartUtils::GetIntegerValue(length_object); |
| 52 if (unsafe_start < 0 || unsafe_start >= buffer_size_ || |
| 53 unsafe_length < 0 || unsafe_length > buffer_size_) { |
| 54 Dart_ThrowException(DartUtils::NewDartIllegalArgumentException( |
| 55 "Illegal .start or .length on a _TlsExternalBuffer")); |
| 56 } |
| 57 intptr_t start = static_cast<intptr_t>(unsafe_start); |
| 58 intptr_t length = static_cast<intptr_t>(unsafe_length); |
| 59 |
| 60 intptr_t bytes_processed = 0; |
| 61 switch (buffer_index) { |
| 62 case kReadPlaintext: |
| 63 case kWriteEncrypted: |
| 64 // Write from the filter to the buffer. |
| 65 USE(start); |
| 66 UNIMPLEMENTED(); |
| 67 break; |
| 68 case kReadEncrypted: |
| 69 case kWritePlaintext: |
| 70 if (length > 0) { |
| 71 // Write from the buffer to the filter. |
| 72 UNIMPLEMENTED(); |
| 73 } |
| 74 break; |
| 75 } |
| 76 return bytes_processed; |
| 77 } |
| OLD | NEW |