From 272257483e5370c0daf163ce3fe7976bf02e35bb Mon Sep 17 00:00:00 2001 From: Son Dinh Date: Tue, 12 Mar 2024 13:00:57 -0500 Subject: [PATCH 01/23] Use updated ValueReader, ValueWriter interface --- src/NodeValueReader.cpp | 20 +++++-- src/NodeValueReader.h | 12 ++-- src/NodeValueWriter.cpp | 126 +++++++++++++++++++++++++++------------- src/NodeValueWriter.h | 78 +++++++++++++------------ 4 files changed, 149 insertions(+), 87 deletions(-) diff --git a/src/NodeValueReader.cpp b/src/NodeValueReader.cpp index 84e8899..075bfb0 100644 --- a/src/NodeValueReader.cpp +++ b/src/NodeValueReader.cpp @@ -38,7 +38,7 @@ NodeValueReader::NodeValueReader(v8::Local obj) use_name_ = false; } -bool NodeValueReader::begin_struct() +bool NodeValueReader::begin_struct(OpenDDS::DCPS::Extensibility /*extensibility*/) { return begin_nested(); } @@ -66,13 +66,19 @@ bool NodeValueReader::begin_struct_member(OpenDDS::XTypes::MemberId& member_id, return false; } +bool NodeValueReader::members_remaining() +{ + // TODO(sonndinh): + return true; +} + bool NodeValueReader::end_struct_member() { ++current_index_; return true; } -bool NodeValueReader::begin_union() +bool NodeValueReader::begin_union(OpenDDS::DCPS::Extensibility /*extensibility*/) { return begin_nested(); } @@ -130,7 +136,7 @@ bool NodeValueReader::end_union_member() return true; } -bool NodeValueReader::begin_array() +bool NodeValueReader::begin_array(OpenDDS::XTypes::TypeKind /*elem_kind*/) { return begin_nested(); } @@ -140,7 +146,7 @@ bool NodeValueReader::end_array() return end_nested(); } -bool NodeValueReader::begin_sequence() +bool NodeValueReader::begin_sequence(OpenDDS::XTypes::TypeKind /*elem_kind*/) { return begin_nested(); } @@ -362,6 +368,12 @@ bool NodeValueReader::read_long_enum(ACE_CDR::Long& value, const OpenDDS::DCPS:: return false; } +bool NodeValueReader::read_bitmask(ACE_CDR::ULongLong& value, const OpenDDS::DCPS::BitmaskHelper& helper) +{ + // TODO(sonndinh): + return true; +} + bool NodeValueReader::begin_nested() { Nan::MaybeLocal mlvai = use_name_ ? Nan::Get(current_object_, current_property_name_) : Nan::Get(current_object_, current_index_); diff --git a/src/NodeValueReader.h b/src/NodeValueReader.h index c5eb36e..19a4e54 100644 --- a/src/NodeValueReader.h +++ b/src/NodeValueReader.h @@ -27,21 +27,22 @@ class NodeValueReader : public OpenDDS::DCPS::ValueReader { public: explicit NodeValueReader(v8::Local obj); - bool begin_struct(); + bool begin_struct(OpenDDS::DCPS::Extensibility extensibility); bool end_struct(); bool begin_struct_member(OpenDDS::XTypes::MemberId& member_id, const OpenDDS::DCPS::MemberHelper& helper); + bool members_remaining(); bool end_struct_member(); - bool begin_union(); + bool begin_union(OpenDDS::DCPS::Extensibility extensibility); bool end_union(); bool begin_discriminator(); bool end_discriminator(); bool begin_union_member(); bool end_union_member(); - bool begin_array(); + bool begin_array(OpenDDS::XTypes::TypeKind elem_kind); bool end_array(); - bool begin_sequence(); + bool begin_sequence(OpenDDS::XTypes::TypeKind elem_kind); bool elements_remaining(); bool end_sequence(); bool begin_element(); @@ -67,13 +68,14 @@ class NodeValueReader : public OpenDDS::DCPS::ValueReader { bool read_float128(long double& value); #endif - bool read_fixed(OpenDDS::FaceTypes::Fixed& value); + bool read_fixed(ACE_CDR::Fixed& value); bool read_char8(ACE_CDR::Char& value); bool read_char16(ACE_CDR::WChar& value); bool read_string(std::string& value); bool read_wstring(std::wstring& value); bool read_long_enum(ACE_CDR::Long& value, const OpenDDS::DCPS::EnumHelper& helper); + bool read_bitmask(ACE_CDR::ULongLong& value, const OpenDDS::DCPS::BitmaskHelper& helper); private: NodeValueReader(); diff --git a/src/NodeValueWriter.cpp b/src/NodeValueWriter.cpp index d9d2962..2377140 100644 --- a/src/NodeValueWriter.cpp +++ b/src/NodeValueWriter.cpp @@ -21,142 +21,166 @@ void NodeValueWriter::use_bigint(bool value) use_bigint_ = value; } -void NodeValueWriter::begin_struct() +bool NodeValueWriter::begin_struct(OpenDDS::DCPS::Extensibility /*extensibility*/) { object_helper(); + return true; } -void NodeValueWriter::end_struct() +bool NodeValueWriter::end_struct() { if (object_stack_.size() == 1) { result_ = object_stack_.back(); } object_stack_.pop_back(); + return true; } -void NodeValueWriter::begin_struct_member(const DDS::MemberDescriptor& descriptor) +bool NodeValueWriter::begin_struct_member(OpenDDS::DCPS::MemberParam params) { - next_key_ = descriptor.name(); + next_key_ = params.name; + return true; } -void NodeValueWriter::end_struct_member() +bool NodeValueWriter::end_struct_member() { + return true; } -void NodeValueWriter::begin_union() +bool NodeValueWriter::begin_union(OpenDDS::DCPS::Extensibility /*extensibility*/) { object_helper(); + return true; } -void NodeValueWriter::end_union() +bool NodeValueWriter::end_union() { if (object_stack_.size() == 1) { result_ = object_stack_.back(); } object_stack_.pop_back(); + return true; } -void NodeValueWriter::begin_discriminator() +bool NodeValueWriter::begin_discriminator(OpenDDS::DCPS::MemberParam /*params*/) { next_key_ = "$discriminator"; + return true; } -void NodeValueWriter::end_discriminator() +bool NodeValueWriter::end_discriminator() { + return true; } -void NodeValueWriter::begin_union_member(const char* name) +bool NodeValueWriter::begin_union_member(OpenDDS::DCPS::MemberParam params) { - next_key_ = name; + next_key_ = params.name; + return true; } -void NodeValueWriter::end_union_member() +bool NodeValueWriter::end_union_member() { + return true; } -void NodeValueWriter::begin_array() +bool NodeValueWriter::begin_array(OpenDDS::XTypes::TypeKind /*elem_kind*/) { object_helper(); + return true; } -void NodeValueWriter::end_array() +bool NodeValueWriter::end_array() { if (object_stack_.size() == 1) { result_ = object_stack_.back(); } object_stack_.pop_back(); + return true; } -void NodeValueWriter::begin_sequence() +bool NodeValueWriter::begin_sequence(OpenDDS::XTypes::TypeKind /*elem_kind*/, ACE_CDR::ULong /*length*/) { object_helper(); + return true; } -void NodeValueWriter::end_sequence() +bool NodeValueWriter::end_sequence() { if (object_stack_.size() == 1) { result_ = object_stack_.back(); } object_stack_.pop_back(); + return true; } -void NodeValueWriter::begin_element(size_t idx) +bool NodeValueWriter::begin_element(ACE_CDR::ULong idx) { next_index_ = idx; + return true; } -void NodeValueWriter::end_element() +bool NodeValueWriter::end_element() { + return true; } -void NodeValueWriter::write_boolean(ACE_CDR::Boolean value) +bool NodeValueWriter::write_boolean(ACE_CDR::Boolean value) { primitive_helper(value); + return true; } -void NodeValueWriter::write_byte(ACE_CDR::Octet value) +bool NodeValueWriter::write_byte(ACE_CDR::Octet value) { primitive_helper(value); + return true; } #if OPENDDS_HAS_EXPLICIT_INTS -void NodeValueWriter::write_int8(ACE_CDR::Int8 value) +bool NodeValueWriter::write_int8(ACE_CDR::Int8 value) { primitive_helper(value); + return true; } -void NodeValueWriter::write_uint8(ACE_CDR::UInt8 value) +bool NodeValueWriter::write_uint8(ACE_CDR::UInt8 value) { primitive_helper(value); + return true; } #endif -void NodeValueWriter::write_int16(ACE_CDR::Short value) +bool NodeValueWriter::write_int16(ACE_CDR::Short value) { primitive_helper(value); + return true; } -void NodeValueWriter::write_uint16(ACE_CDR::UShort value) +bool NodeValueWriter::write_uint16(ACE_CDR::UShort value) { primitive_helper(value); + return true; } -void NodeValueWriter::write_int32(ACE_CDR::Long value) +bool NodeValueWriter::write_int32(ACE_CDR::Long value) { primitive_helper(value); + return true; } -void NodeValueWriter::write_uint32(ACE_CDR::ULong value) +bool NodeValueWriter::write_uint32(ACE_CDR::ULong value) { primitive_helper(value); + return true; } -void NodeValueWriter::write_int64(ACE_CDR::LongLong value) +bool NodeValueWriter::write_int64(ACE_CDR::LongLong value) { if (value <= NODE_MAX_SAFE_INT) { primitive_helper(value); - return; + return true; } #ifdef HAS_BIGINT @@ -172,13 +196,14 @@ void NodeValueWriter::write_int64(ACE_CDR::LongLong value) #ifdef HAS_BIGINT } #endif + return true; } -void NodeValueWriter::write_uint64(ACE_CDR::ULongLong value) +bool NodeValueWriter::write_uint64(ACE_CDR::ULongLong value) { if (value <= static_cast(NODE_MAX_SAFE_INT)) { primitive_helper(value); - return; + return true; } #ifdef HAS_BIGINT @@ -194,51 +219,59 @@ void NodeValueWriter::write_uint64(ACE_CDR::ULongLong value) #ifdef HAS_BIGINT } #endif + return true; } -void NodeValueWriter::write_float32(ACE_CDR::Float value) +bool NodeValueWriter::write_float32(ACE_CDR::Float value) { primitive_helper(value); + return true; } -void NodeValueWriter::write_float64(ACE_CDR::Double value) +bool NodeValueWriter::write_float64(ACE_CDR::Double value) { primitive_helper(value); + return true; } -void NodeValueWriter::write_float128(ACE_CDR::LongDouble value) +bool NodeValueWriter::write_float128(ACE_CDR::LongDouble value) { #if ACE_SIZEOF_LONG_DOUBLE == 16 primitive_helper(value); #else primitive_helper(value); #endif + return true; } -void NodeValueWriter::write_fixed(const OpenDDS::FaceTypes::Fixed& /*value*/) +bool NodeValueWriter::write_fixed(const ACE_CDR::Fixed& /*value*/) { + return true; } -void NodeValueWriter::write_char8(ACE_CDR::Char value) +bool NodeValueWriter::write_char8(ACE_CDR::Char value) { v8::MaybeLocal v8_value = Nan::New(&value, 1); value_helper(v8_value); + return true; } -void NodeValueWriter::write_char16(ACE_CDR::WChar value) +bool NodeValueWriter::write_char16(ACE_CDR::WChar value) { const uint16_t c = static_cast(value); v8::MaybeLocal v8_value = Nan::New(&c, 1); value_helper(v8_value); + return true; } -void NodeValueWriter::write_string(const ACE_CDR::Char* value, size_t length) +bool NodeValueWriter::write_string(const ACE_CDR::Char* value, size_t length) { v8::MaybeLocal v8_value = Nan::New(value, length); value_helper(v8_value); + return true; } -void NodeValueWriter::write_wstring(const ACE_CDR::WChar* value, size_t length) +bool NodeValueWriter::write_wstring(const ACE_CDR::WChar* value, size_t length) { uint16_t* const str = new uint16_t[length]; for (size_t i = 0; i < length; ++i) { @@ -247,13 +280,26 @@ void NodeValueWriter::write_wstring(const ACE_CDR::WChar* value, size_t length) v8::MaybeLocal v8_value = Nan::New(str, length); value_helper(v8_value); delete [] str; + return true; } -void NodeValueWriter::write_enum(const char* name, ACE_CDR::Long value) +bool NodeValueWriter::write_enum(ACE_CDR::Long value, const OpenDDS::DCPS::EnumHelper& helper) { - ACE_UNUSED_ARG(value); + const char* name = 0; + if (!helper.get_name(name, value)) { + return false; + } v8::MaybeLocal v8_value = Nan::New(name); value_helper(v8_value); + return true; +} + +bool NodeValueWriter::write_bitmask(ACE_CDR::ULongLong value, const OpenDDS::DCPS::BitmaskHelper& helper) +{ + const String flags = bitmask_to_string(value, helper); + v8::MaybeLocal v8_value = Nan::New(flags.c_str()); + value_helper(v8_value); + return true; } } // NodeOpenDDS diff --git a/src/NodeValueWriter.h b/src/NodeValueWriter.h index d82e346..99909e7 100644 --- a/src/NodeValueWriter.h +++ b/src/NodeValueWriter.h @@ -17,46 +17,48 @@ class NodeValueWriter : public OpenDDS::DCPS::ValueWriter { void use_bigint(bool value); - void begin_struct(); - void end_struct(); - void begin_struct_member(const DDS::MemberDescriptor& descriptor); - void end_struct_member(); - - void begin_union(); - void end_union(); - void begin_discriminator(); - void end_discriminator(); - void begin_union_member(const char* name); - void end_union_member(); - - void begin_array(); - void end_array(); - void begin_sequence(); - void end_sequence(); - void begin_element(size_t idx); - void end_element(); - - void write_boolean(ACE_CDR::Boolean value); - void write_byte(ACE_CDR::Octet value); + bool begin_struct(OpenDDS::DCPS::Extensibility extensibility); + bool end_struct(); + bool begin_struct_member(OpenDDS::DCPS::MemberParam params); + bool end_struct_member(); + + bool begin_union(OpenDDS::DCPS::Extensibility extensibility); + bool end_union(); + bool begin_discriminator(OpenDDS::DCPS::MemberParam params); + bool end_discriminator(); + bool begin_union_member(OpenDDS::DCPS::MemberParam params); + bool end_union_member(); + + bool begin_array(OpenDDS::XTypes::TypeKind elem_kind); + bool end_array(); + bool begin_sequence(OpenDDS::XTypes::TypeKind elem_kind, ACE_CDR::ULong length); + bool end_sequence(); + bool begin_element(ACE_CDR::ULong idx); + bool end_element(); + + bool write_boolean(ACE_CDR::Boolean value); + bool write_byte(ACE_CDR::Octet value); #if OPENDDS_HAS_EXPLICIT_INTS - void write_int8(ACE_CDR::Int8 value); - void write_uint8(ACE_CDR::UInt8 value); + bool write_int8(ACE_CDR::Int8 value); + bool write_uint8(ACE_CDR::UInt8 value); #endif - void write_int16(ACE_CDR::Short value); - void write_uint16(ACE_CDR::UShort value); - void write_int32(ACE_CDR::Long value); - void write_uint32(ACE_CDR::ULong value); - void write_int64(ACE_CDR::LongLong value); - void write_uint64(ACE_CDR::ULongLong value); - void write_float32(ACE_CDR::Float value); - void write_float64(ACE_CDR::Double value); - void write_float128(ACE_CDR::LongDouble value); - void write_fixed(const OpenDDS::FaceTypes::Fixed& value); - void write_char8(ACE_CDR::Char value); - void write_char16(ACE_CDR::WChar value); - void write_string(const ACE_CDR::Char* value, size_t length); - void write_wstring(const ACE_CDR::WChar* value, size_t length); - void write_enum(const char* name, ACE_CDR::Long value); + bool write_int16(ACE_CDR::Short value); + bool write_uint16(ACE_CDR::UShort value); + bool write_int32(ACE_CDR::Long value); + bool write_uint32(ACE_CDR::ULong value); + bool write_int64(ACE_CDR::LongLong value); + bool write_uint64(ACE_CDR::ULongLong value); + bool write_float32(ACE_CDR::Float value); + bool write_float64(ACE_CDR::Double value); + bool write_float128(ACE_CDR::LongDouble value); + bool write_fixed(const ACE_CDR::Fixed& value); + bool write_char8(ACE_CDR::Char value); + bool write_char16(ACE_CDR::WChar value); + bool write_string(const ACE_CDR::Char* value, size_t length); + bool write_wstring(const ACE_CDR::WChar* value, size_t length); + bool write_enum(ACE_CDR::Long value, const OpenDDS::DCPS::EnumHelper& helper); + bool write_bitmask(ACE_CDR::ULongLong value, const OpenDDS::DCPS::BitmaskHelper& helper); + bool write_absent_value(); template void value_helper(v8::MaybeLocal& v8_value) From 90fcf1d8402cf598cf88010e796875212c1d5e60 Mon Sep 17 00:00:00 2001 From: Son Dinh Date: Mon, 18 Mar 2024 12:53:14 -0500 Subject: [PATCH 02/23] Fix CI and add read_bitmask --- src/NodeValueReader.cpp | 24 +++++++++++++++++++++--- src/NodeValueReader.h | 1 + test/test_publisher.cpp | 11 ++++++----- 3 files changed, 28 insertions(+), 8 deletions(-) diff --git a/src/NodeValueReader.cpp b/src/NodeValueReader.cpp index 075bfb0..8ad7934 100644 --- a/src/NodeValueReader.cpp +++ b/src/NodeValueReader.cpp @@ -72,6 +72,12 @@ bool NodeValueReader::members_remaining() return true; } +// bool NodeValueReader::member_has_value() +// { +// // TODO(sonndinh): +// return true; +// } + bool NodeValueReader::end_struct_member() { ++current_index_; @@ -296,7 +302,7 @@ bool NodeValueReader::read_float128(long double& value) #endif -bool NodeValueReader::read_fixed(OpenDDS::FaceTypes::Fixed& /*value*/) +bool NodeValueReader::read_fixed(ACE_CDR::Fixed& /*value*/) { return false; } @@ -370,8 +376,20 @@ bool NodeValueReader::read_long_enum(ACE_CDR::Long& value, const OpenDDS::DCPS:: bool NodeValueReader::read_bitmask(ACE_CDR::ULongLong& value, const OpenDDS::DCPS::BitmaskHelper& helper) { - // TODO(sonndinh): - return true; + Nan::MaybeLocal mlvai = use_name_ ? Nan::Get(current_object_, current_property_name_) : Nan::Get(current_object_, current_index_); + if (!mlvai.IsEmpty()) { + std::string temp; + if (read_string(temp)) { + value = string_to_bitmask(temp, helper); + return true; + } + } + + if (primitive_helper(value, &v8::Value::IsNumber, strtoull)) { + return true; + } + + return false; } bool NodeValueReader::begin_nested() diff --git a/src/NodeValueReader.h b/src/NodeValueReader.h index 19a4e54..892cf30 100644 --- a/src/NodeValueReader.h +++ b/src/NodeValueReader.h @@ -31,6 +31,7 @@ class NodeValueReader : public OpenDDS::DCPS::ValueReader { bool end_struct(); bool begin_struct_member(OpenDDS::XTypes::MemberId& member_id, const OpenDDS::DCPS::MemberHelper& helper); bool members_remaining(); + // bool member_has_value(); bool end_struct_member(); bool begin_union(OpenDDS::DCPS::Extensibility extensibility); diff --git a/test/test_publisher.cpp b/test/test_publisher.cpp index 93c26de..da3b38a 100644 --- a/test/test_publisher.cpp +++ b/test/test_publisher.cpp @@ -1,10 +1,11 @@ -#include "dds/DCPS/Service_Participant.h" -#include "dds/DCPS/Marked_Default_Qos.h" -#include "dds/DCPS/WaitSet.h" +#include "idl/NodeJSTestTypeSupportImpl.h" -#include "tests/Utils/StatusMatching.h" +#include + +#include +#include +#include -#include "idl/NodeJSTestTypeSupportImpl.h" #include #include From 51f91928c86bba2e942a275e54235a20d1b7ad32 Mon Sep 17 00:00:00 2001 From: Son Dinh Date: Wed, 20 Mar 2024 01:42:29 -0500 Subject: [PATCH 03/23] Update value reader --- src/NodeValueReader.cpp | 45 ++++++++++++++++++++++++----------------- src/NodeValueReader.h | 2 +- src/NodeValueWriter.cpp | 2 +- 3 files changed, 29 insertions(+), 20 deletions(-) diff --git a/src/NodeValueReader.cpp b/src/NodeValueReader.cpp index 8ad7934..59683e6 100644 --- a/src/NodeValueReader.cpp +++ b/src/NodeValueReader.cpp @@ -29,13 +29,12 @@ struct ToFactory : ToFactoryBase { namespace NodeOpenDDS { NodeValueReader::NodeValueReader(v8::Local obj) + : current_index_(0) + , use_name_(false) { // Nest initial object so first begin_struct behaves appropriately current_object_ = Nan::New(); Nan::Set(current_object_, 0, obj); - - current_index_ = 0; - use_name_ = false; } bool NodeValueReader::begin_struct(OpenDDS::DCPS::Extensibility /*extensibility*/) @@ -49,16 +48,27 @@ bool NodeValueReader::end_struct() } bool NodeValueReader::begin_struct_member(OpenDDS::XTypes::MemberId& member_id, const OpenDDS::DCPS::MemberHelper& helper) +{ + while (members_remaining()) { + Nan::MaybeLocal mlv = Nan::Get(property_names_.ToLocalChecked(), current_index_); + // mlv is not empty at this point. + current_property_name_ = mlv.ToLocalChecked(); + Nan::Utf8String name(current_property_name_); + if (helper.get_value(member_id, *name)) { + return true; + } + ++current_index_; + } + return false; +} + +bool NodeValueReader::members_remaining() { if (!property_names_.IsEmpty()) { - while (property_names_.ToLocalChecked()->Length() > current_index_) { + while (current_index_ < property_names_.ToLocalChecked()->Length()) { Nan::MaybeLocal mlv = Nan::Get(property_names_.ToLocalChecked(), current_index_); if (!mlv.IsEmpty()) { - current_property_name_ = mlv.ToLocalChecked(); - Nan::Utf8String name(current_property_name_); - if (helper.get_value(member_id, *name)) { - return true; - } + return true; } ++current_index_; } @@ -66,18 +76,17 @@ bool NodeValueReader::begin_struct_member(OpenDDS::XTypes::MemberId& member_id, return false; } -bool NodeValueReader::members_remaining() +bool NodeValueReader::member_has_value() { - // TODO(sonndinh): - return true; + Nan::MaybeLocal mlvai = current_property_name_.IsEmpty() ? + Nan::Get(current_object_, current_index_) : Nan::Get(current_object_, current_property_name_); + if (!mlvai.IsEmpty()) { + v8::Local lvai = mlvai.ToLocalChecked(); + return !lvai->IsNull(); + } + return false; } -// bool NodeValueReader::member_has_value() -// { -// // TODO(sonndinh): -// return true; -// } - bool NodeValueReader::end_struct_member() { ++current_index_; diff --git a/src/NodeValueReader.h b/src/NodeValueReader.h index 892cf30..55cbafa 100644 --- a/src/NodeValueReader.h +++ b/src/NodeValueReader.h @@ -31,7 +31,7 @@ class NodeValueReader : public OpenDDS::DCPS::ValueReader { bool end_struct(); bool begin_struct_member(OpenDDS::XTypes::MemberId& member_id, const OpenDDS::DCPS::MemberHelper& helper); bool members_remaining(); - // bool member_has_value(); + bool member_has_value(); bool end_struct_member(); bool begin_union(OpenDDS::DCPS::Extensibility extensibility); diff --git a/src/NodeValueWriter.cpp b/src/NodeValueWriter.cpp index 2377140..8ee29d3 100644 --- a/src/NodeValueWriter.cpp +++ b/src/NodeValueWriter.cpp @@ -296,7 +296,7 @@ bool NodeValueWriter::write_enum(ACE_CDR::Long value, const OpenDDS::DCPS::EnumH bool NodeValueWriter::write_bitmask(ACE_CDR::ULongLong value, const OpenDDS::DCPS::BitmaskHelper& helper) { - const String flags = bitmask_to_string(value, helper); + const OpenDDS::DCPS::String flags = bitmask_to_string(value, helper); v8::MaybeLocal v8_value = Nan::New(flags.c_str()); value_helper(v8_value); return true; From 6b0514215caaf7d2d1d7f974365d0ed6178c0c09 Mon Sep 17 00:00:00 2001 From: Son Dinh Date: Wed, 20 Mar 2024 12:44:37 -0500 Subject: [PATCH 04/23] Add write_absent_value --- package-lock.json | 14 +++++++------- package.json | 2 +- src/NodeValueWriter.cpp | 15 +++++++++++++++ 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 0eb63c7..677f388 100755 --- a/package-lock.json +++ b/package-lock.json @@ -10,20 +10,20 @@ "hasInstallScript": true, "license": "BSD-3-Clause", "dependencies": { - "nan": "^2.16.0" + "nan": "^2.17.0" } }, "node_modules/nan": { - "version": "2.16.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.16.0.tgz", - "integrity": "sha512-UdAqHyFngu7TfQKsCBgAA6pWDkT8MAO7d0jyOecVhN5354xbLqdn8mV9Tat9gepAupm0bt2DbeaSC8vS52MuFA==" + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.19.0.tgz", + "integrity": "sha512-nO1xXxfh/RWNxfd/XPfbIfFk5vgLsAxUR9y5O0cHMJu/AW9U95JLXqthYHjEp+8gQ5p96K9jUp8nbVOxCdRbtw==" } }, "dependencies": { "nan": { - "version": "2.16.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.16.0.tgz", - "integrity": "sha512-UdAqHyFngu7TfQKsCBgAA6pWDkT8MAO7d0jyOecVhN5354xbLqdn8mV9Tat9gepAupm0bt2DbeaSC8vS52MuFA==" + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.19.0.tgz", + "integrity": "sha512-nO1xXxfh/RWNxfd/XPfbIfFk5vgLsAxUR9y5O0cHMJu/AW9U95JLXqthYHjEp+8gQ5p96K9jUp8nbVOxCdRbtw==" } } } diff --git a/package.json b/package.json index 13b9bae..dcfcb83 100755 --- a/package.json +++ b/package.json @@ -27,6 +27,6 @@ "license": "BSD-3-Clause", "gypfile": true, "dependencies": { - "nan": "^2.16.0" + "nan": "^2.17.0" } } diff --git a/src/NodeValueWriter.cpp b/src/NodeValueWriter.cpp index 8ee29d3..1b828b5 100644 --- a/src/NodeValueWriter.cpp +++ b/src/NodeValueWriter.cpp @@ -302,4 +302,19 @@ bool NodeValueWriter::write_bitmask(ACE_CDR::ULongLong value, const OpenDDS::DCP return true; } +bool NodeValueWriter::write_absent_value() +{ + if (object_stack_.empty()) { + return false; + } + + v8::Local null_value = Nan::Null(); + v8::MaybeLocal key = Nan::New(next_key_.c_str()); + if (!key.IsEmpty()) { + Nan::Set(object_stack_.back(), key.ToLocalChecked(), null_value); + return true; + } + return false; +} + } // NodeOpenDDS From 5d4e445a471107036d0bd5478447dc7ce64c6f2c Mon Sep 17 00:00:00 2001 From: Son Dinh Date: Wed, 20 Mar 2024 14:30:05 -0500 Subject: [PATCH 05/23] Check debugger availability --- .github/workflows/build.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2c8f18e..916c59e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -57,6 +57,11 @@ jobs: runs-on: ${{ matrix.m.os }} steps: - uses: actions/checkout@v3 + - name: Check debugger version + if: ${{ matrix.m.os == 'ubuntu-20.04' || matrix.m.os == 'macos-11' }} + shell: |- + gdb --version + lldb --version - name: 'Checkout MPC' uses: actions/checkout@v3 with: @@ -157,7 +162,7 @@ jobs: cd OpenDDS ./configure --no-tests ${{ env.CONFIG_OPTIONS }} . setenv.sh - make -j3 ${{ env.BUILD_TARGETS }} + make -j4 ${{ env.BUILD_TARGETS }} - name: 'Configure OpenDDS (windows)' if: ${{ matrix.m.os == 'windows-2019' }} shell: cmd @@ -178,7 +183,7 @@ jobs: run: |- npm install ${{ env.ACE_ROOT }}/bin/mwc.pl -type gnuace -exclude ACE_TAO,OpenDDS - make -j2 || make + make -j4 || make - name: 'Change Core File Pattern (ubuntu)' if: ${{ matrix.m.os == 'ubuntu-20.04' }} shell: bash From 61c71ff4f5db64a1d9989227514ef87ec11b5371 Mon Sep 17 00:00:00 2001 From: Son Dinh Date: Wed, 20 Mar 2024 14:46:48 -0500 Subject: [PATCH 06/23] Install gdb --- .github/workflows/build.yml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 916c59e..42bc35a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -59,7 +59,8 @@ jobs: - uses: actions/checkout@v3 - name: Check debugger version if: ${{ matrix.m.os == 'ubuntu-20.04' || matrix.m.os == 'macos-11' }} - shell: |- + shell: bash + run: |- gdb --version lldb --version - name: 'Checkout MPC' @@ -184,6 +185,19 @@ jobs: npm install ${{ env.ACE_ROOT }}/bin/mwc.pl -type gnuace -exclude ACE_TAO,OpenDDS make -j4 || make + - name: Install gdb + if: ${{ matrix.m.os == 'ubuntu-20.04' }} + shell: bash + run: | + sudo apt-get update + sudo apt-get install gdb + echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope + #- name: Install lldb + # if: ${{ matrix.m.os == 'macos-11' }} + # shell: bash + # run: | + # sudo apt-get update + # sudo apt-get install lldb - name: 'Change Core File Pattern (ubuntu)' if: ${{ matrix.m.os == 'ubuntu-20.04' }} shell: bash From 372058a27344f9ae075e5f8724471c15be095ae3 Mon Sep 17 00:00:00 2001 From: Son Dinh Date: Wed, 20 Mar 2024 14:52:14 -0500 Subject: [PATCH 07/23] Remove debugger check --- .github/workflows/build.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 42bc35a..7493dd7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -57,12 +57,6 @@ jobs: runs-on: ${{ matrix.m.os }} steps: - uses: actions/checkout@v3 - - name: Check debugger version - if: ${{ matrix.m.os == 'ubuntu-20.04' || matrix.m.os == 'macos-11' }} - shell: bash - run: |- - gdb --version - lldb --version - name: 'Checkout MPC' uses: actions/checkout@v3 with: From 89c969c236b0df9be68182e35d9607b50a4e59d5 Mon Sep 17 00:00:00 2001 From: Son Dinh Date: Thu, 21 Mar 2024 17:41:46 -0500 Subject: [PATCH 08/23] Disable jobs with latest-release branch. Try fixing the test bug. --- .github/workflows/build.yml | 47 +++++++++++++++++-------------------- src/NodeDRListener.cpp | 25 +++++++++++++++++++- src/NodeDRListener.h | 2 ++ src/node-opendds.cpp | 2 +- 4 files changed, 49 insertions(+), 27 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7493dd7..427d725 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,6 +15,9 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true +# The jobs with latest-release configuration are disabled until OpenDDS 3.28 +# which will have the updated ValueReader and ValueWriter interfaces. + jobs: build: strategy: @@ -26,7 +29,7 @@ jobs: - 18 opendds_branch: - master - - latest-release + #- latest-release m: - {os: ubuntu-20.04, dds_security: 1} - {os: ubuntu-20.04, dds_security: 0} @@ -35,24 +38,24 @@ jobs: - {os: windows-2019, dds_security: 1} - {os: windows-2019, dds_security: 0} include: - - node_version: 8 - opendds_branch: latest-release - m: {os: ubuntu-20.04, security: 0} - - node_version: 8 - opendds_branch: latest-release - m: {os: windows-2019, security: 0} - - node_version: 10 - opendds_branch: latest-release - m: {os: ubuntu-20.04, security: 1} - - node_version: 10 - opendds_branch: latest-release - m: {os: windows-2019, security: 1} - - node_version: 12 - opendds_branch: latest-release - m: {os: ubuntu-20.04, security: 1} - - node_version: 12 - opendds_branch: latest-release - m: {os: windows-2019, security: 1} + #- node_version: 8 + # opendds_branch: latest-release + # m: {os: ubuntu-20.04, security: 0} + #- node_version: 8 + # opendds_branch: latest-release + # m: {os: windows-2019, security: 0} + #- node_version: 10 + # opendds_branch: latest-release + # m: {os: ubuntu-20.04, security: 1} + #- node_version: 10 + # opendds_branch: latest-release + # m: {os: windows-2019, security: 1} + #- node_version: 12 + # opendds_branch: latest-release + # m: {os: ubuntu-20.04, security: 1} + #- node_version: 12 + # opendds_branch: latest-release + # m: {os: windows-2019, security: 1} runs-on: ${{ matrix.m.os }} steps: @@ -186,12 +189,6 @@ jobs: sudo apt-get update sudo apt-get install gdb echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope - #- name: Install lldb - # if: ${{ matrix.m.os == 'macos-11' }} - # shell: bash - # run: | - # sudo apt-get update - # sudo apt-get install lldb - name: 'Change Core File Pattern (ubuntu)' if: ${{ matrix.m.os == 'ubuntu-20.04' }} shell: bash diff --git a/src/NodeDRListener.cpp b/src/NodeDRListener.cpp index 98f6aa9..27e3959 100644 --- a/src/NodeDRListener.cpp +++ b/src/NodeDRListener.cpp @@ -46,6 +46,7 @@ NodeDRListener::NodeDRListener(DDS::DomainParticipant* dp, , unsubscribing_(false) , unsubscribed_(false) , receiving_samples_(false) + , count_samples_(0) { uv_async_init(uv_default_loop(), &async_uv_, async_cb); } @@ -120,12 +121,34 @@ void NodeDRListener::reserve(CORBA::ULong) void NodeDRListener::push_back(const DDS::SampleInfo& src, const void* sample) { std::unique_lock lock(mutex_); + ++count_samples_; + ACE_DEBUG((LM_DEBUG, "Receive sample number %u. Data pointer: %@\n", count_samples_, sample)); + ACE_DEBUG((LM_DEBUG, "SampleInfo: {\n")); + ACE_DEBUG((LM_DEBUG, "sample_state: %d\n", src.sample_state)); + ACE_DEBUG((LM_DEBUG, "view_state: %d\n", src.view_state)); + ACE_DEBUG((LM_DEBUG, "instance_state: %d\n", src.instance_state)); + ACE_DEBUG((LM_DEBUG, "instance_handle: %u\n", src.instance_handle)); + ACE_DEBUG((LM_DEBUG, "publication_handle: %u\n", src.publication_handle)); + ACE_DEBUG((LM_DEBUG, "disposed_generation_count: %u\n", src.disposed_generation_count)); + ACE_DEBUG((LM_DEBUG, "no_writers_generation_count: %u\n", src.no_writers_generation_count)); + ACE_DEBUG((LM_DEBUG, "valid_data: %d\n", src.valid_data)); + ACE_DEBUG((LM_DEBUG, "}\n")); + if (unsubscribing_) { + ACE_DEBUG((LM_DEBUG, "unsubscribing_ value: %d\n", unsubscribing_)); + return; + } + + if (!src.valid_data) { return; } if (vd_) { - vd_->write(nvw_, sample); + ACE_DEBUG((LM_DEBUG, "Write sample using NodeValueWriter...\n")); + if (!vd_->write(nvw_, sample)) { + ACE_ERROR((LM_ERROR, "ERROR: ValueDispatcher write failed\n")); + return; + } } Local argv[] = { diff --git a/src/NodeDRListener.h b/src/NodeDRListener.h index 5110f6e..8112637 100644 --- a/src/NodeDRListener.h +++ b/src/NodeDRListener.h @@ -79,6 +79,8 @@ namespace NodeOpenDDS { /// True if Datareader Listener taking samples. bool receiving_samples_; + unsigned long count_samples_; + mutable std::mutex mutex_; }; diff --git a/src/node-opendds.cpp b/src/node-opendds.cpp index 099b502..f70022d 100644 --- a/src/node-opendds.cpp +++ b/src/node-opendds.cpp @@ -180,7 +180,7 @@ namespace { } Local qos_js; - if (fci.Length() > 2 && fci[2]->IsObject()) { + if (fci[2]->IsObject()) { qos_js = fci[2]->ToObject(Nan::GetCurrentContext()).ToLocalChecked(); } Nan::MaybeLocal cft_str = Nan::New("ContentFilteredTopic"); From c2ae821516f39ac025c7ce96a7473810c8ee7da8 Mon Sep 17 00:00:00 2001 From: Son Dinh Date: Thu, 21 Mar 2024 17:45:01 -0500 Subject: [PATCH 09/23] Fix workflow --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 427d725..80f5856 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -37,7 +37,7 @@ jobs: - {os: macos-11, dds_security: 0} - {os: windows-2019, dds_security: 1} - {os: windows-2019, dds_security: 0} - include: + #include: #- node_version: 8 # opendds_branch: latest-release # m: {os: ubuntu-20.04, security: 0} From a9055649ac9cb596e12ac20125e1811f7a993c1e Mon Sep 17 00:00:00 2001 From: Son Dinh Date: Fri, 22 Mar 2024 12:04:22 -0500 Subject: [PATCH 10/23] Failed to parse DataWriterQos because of invalid input --- src/NodeValueReader.cpp | 12 ++++++++++++ src/node-opendds.cpp | 15 ++++++++++++++- test/test_publisher.js | 4 ++-- 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/src/NodeValueReader.cpp b/src/NodeValueReader.cpp index 59683e6..09dd889 100644 --- a/src/NodeValueReader.cpp +++ b/src/NodeValueReader.cpp @@ -39,40 +39,49 @@ NodeValueReader::NodeValueReader(v8::Local obj) bool NodeValueReader::begin_struct(OpenDDS::DCPS::Extensibility /*extensibility*/) { + ACE_DEBUG((LM_DEBUG, "begin_struct\n")); return begin_nested(); } bool NodeValueReader::end_struct() { + ACE_DEBUG((LM_DEBUG, "end_struct\n")); return end_nested(); } bool NodeValueReader::begin_struct_member(OpenDDS::XTypes::MemberId& member_id, const OpenDDS::DCPS::MemberHelper& helper) { + ACE_DEBUG((LM_DEBUG, "begin_struct_member...\n")); while (members_remaining()) { Nan::MaybeLocal mlv = Nan::Get(property_names_.ToLocalChecked(), current_index_); // mlv is not empty at this point. current_property_name_ = mlv.ToLocalChecked(); Nan::Utf8String name(current_property_name_); + ACE_DEBUG((LM_DEBUG, "Member name: %C\n", *name)); if (helper.get_value(member_id, *name)) { return true; } ++current_index_; } + ACE_DEBUG((LM_DEBUG, "No members remaining\n")); return false; } bool NodeValueReader::members_remaining() { + ACE_DEBUG((LM_DEBUG, "members_remaining...\n")); if (!property_names_.IsEmpty()) { while (current_index_ < property_names_.ToLocalChecked()->Length()) { + ACE_DEBUG((LM_DEBUG, "current_index_: %u\n", current_index_)); Nan::MaybeLocal mlv = Nan::Get(property_names_.ToLocalChecked(), current_index_); if (!mlv.IsEmpty()) { + ACE_DEBUG((LM_DEBUG, "Returning true\n")); return true; } ++current_index_; } } + ACE_DEBUG((LM_DEBUG, "Returning false\n")); return false; } @@ -89,6 +98,7 @@ bool NodeValueReader::member_has_value() bool NodeValueReader::end_struct_member() { + ACE_DEBUG((LM_DEBUG, "end_struct_member\n")); ++current_index_; return true; } @@ -415,8 +425,10 @@ bool NodeValueReader::begin_nested() property_names_ = Nan::GetPropertyNames(current_object_); current_property_name_.Clear(); + ACE_DEBUG((LM_DEBUG, "Returning true\n")); return true; } + ACE_DEBUG((LM_DEBUG, "Returning false\n")); return false; } diff --git a/src/node-opendds.cpp b/src/node-opendds.cpp index f70022d..a666376 100644 --- a/src/node-opendds.cpp +++ b/src/node-opendds.cpp @@ -341,7 +341,7 @@ namespace { dp->create_topic(*topic_name, *topic_type, TOPIC_QOS_DEFAULT, 0, 0); Local qos_js; - if (fci.Length() > 2 && fci[2]->IsObject()) { + if (fci[2]->IsObject()) { qos_js = fci[2]->ToObject(Nan::GetCurrentContext()).ToLocalChecked(); } @@ -379,6 +379,19 @@ namespace { const Local dwqos_lv = Nan::Get(qos_js, dwqos_lstr).ToLocalChecked(); if (dwqos_lv->IsObject()) { try { + v8::Local tmp = dwqos_lv->ToObject(Nan::GetCurrentContext()).ToLocalChecked(); + //v8::Local property_names = tmp->GetOwnPropertyNames(Nan::GetCurrentContext()).ToLocalChecked(); + v8::MaybeLocal property_names = Nan::GetPropertyNames(tmp); + for (uint32_t i = 0; i < property_names.ToLocalChecked()->Length(); ++i) { + //v8::Local key = property_names->Get(Nan::GetCurrentContext(), i).ToLocalChecked(); + //v8::Local value = obj->Get(isolate->GetCurrentContext(), key).ToLocalChecked(); + + //v8::String::Utf8Value utf8_key(Nan::GetCurrentContext, key); + //v8::String::Utf8Value utf8_value(isolate, value); + Nan::MaybeLocal mlv = Nan::Get(property_names.ToLocalChecked(), i); + Nan::Utf8String name(mlv.ToLocalChecked()); + ACE_DEBUG((LM_DEBUG, "DataWriterQos property name: %C\n", *name)); + } NodeValueReader nvr(dwqos_lv->ToObject(Nan::GetCurrentContext()).ToLocalChecked()); if (!OpenDDS::DCPS::vread(nvr, dw_qos)) { throw std::runtime_error("Unable to convert datawriter qos policy"); diff --git a/test/test_publisher.js b/test/test_publisher.js index ef1dc10..ec8cafd 100644 --- a/test/test_publisher.js +++ b/test/test_publisher.js @@ -119,12 +119,12 @@ try { } writer = participant.create_datawriter('topic', 'Mod::Sample', { DataWriterQos: { - latency_budget: { sec: 1, nanosec: 0 }, + latency_budget: { duration: { sec: 1, nanosec: 0 } }, liveliness: { lease_duration: { sec: 5, nanosec: 0 } } } }); - setTimeout(function () { doStuff(writer); }, 10000); + setTimeout(function () { doStuff(writer); }, 2000); } catch (e) { console.log(e); From fb050ce0bfcc86faf02aae12de20c38f97392e65 Mon Sep 17 00:00:00 2001 From: Son Dinh Date: Fri, 22 Mar 2024 14:42:03 -0500 Subject: [PATCH 11/23] Update security permission files --- test/security/pub_permissions.xml | 2 +- test/security/pub_permissions_signed.p7s | 87 ++++++++++++------------ test/security/sub_permissions.xml | 2 +- test/security/sub_permissions_signed.p7s | 87 ++++++++++++------------ 4 files changed, 90 insertions(+), 88 deletions(-) diff --git a/test/security/pub_permissions.xml b/test/security/pub_permissions.xml index 25a9b0d..87538e5 100644 --- a/test/security/pub_permissions.xml +++ b/test/security/pub_permissions.xml @@ -3,7 +3,7 @@ xsi:noNamespaceSchemaLocation="http://www.omg.org/spec/DDS-SECURITY/20160303/omg_shared_ca_permissions.xsd"> - C=AU, ST=Some-State, O=Internet Widgits Pty Ltd, CN=Ozzie Ozmann + CN=Ozzie Ozmann, O=Internet Widgits Pty Ltd, ST=Some-State, C=AU 2015-09-15T01:00:00 diff --git a/test/security/pub_permissions_signed.p7s b/test/security/pub_permissions_signed.p7s index 7d4a461..28fe0f7 100644 --- a/test/security/pub_permissions_signed.p7s +++ b/test/security/pub_permissions_signed.p7s @@ -1,9 +1,9 @@ MIME-Version: 1.0 -Content-Type: multipart/signed; protocol="application/x-pkcs7-signature"; micalg="sha-256"; boundary="----744E9A081E9B87E1F69DCC0EC3779E9F" +Content-Type: multipart/signed; protocol="application/x-pkcs7-signature"; micalg="sha-256"; boundary="----3DA4360D7B002A899998944E4A1A5C89" This is an S/MIME signed message -------744E9A081E9B87E1F69DCC0EC3779E9F +------3DA4360D7B002A899998944E4A1A5C89 Content-Type: text/plain @@ -11,7 +11,7 @@ Content-Type: text/plain xsi:noNamespaceSchemaLocation="http://www.omg.org/spec/DDS-SECURITY/20160303/omg_shared_ca_permissions.xsd"> - C=AU, ST=Some-State, O=Internet Widgits Pty Ltd, CN=Ozzie Ozmann + CN=Ozzie Ozmann, O=Internet Widgits Pty Ltd, ST=Some-State, C=AU 2015-09-15T01:00:00 @@ -37,49 +37,50 @@ Content-Type: text/plain -------744E9A081E9B87E1F69DCC0EC3779E9F +------3DA4360D7B002A899998944E4A1A5C89 Content-Type: application/x-pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="smime.p7s" -MIIG/gYJKoZIhvcNAQcCoIIG7zCCBusCAQExDzANBglghkgBZQMEAgEFADALBgkq -hkiG9w0BBwGgggPsMIID6DCCAtACCQCSMMZ5KQ7ffTANBgkqhkiG9w0BAQsFADCB -tTELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAk1PMRQwEgYDVQQHDAtTYWludCBMb3Vp -czEsMCoGA1UECgwjT2JqZWN0IENvbXB1dGluZyAoVGVzdCBJZGVudGl0eSBDQSkx -LDAqBgNVBAMMI09iamVjdCBDb21wdXRpbmcgKFRlc3QgSWRlbnRpdHkgQ0EpMScw -JQYJKoZIhvcNAQkBFhhpbmZvQG9iamVjdGNvbXB1dGluZy5jb20wHhcNMTgwNjEz -MDQxMTAzWhcNMjgwNjEwMDQxMTAzWjCBtTELMAkGA1UEBhMCVVMxCzAJBgNVBAgM -Ak1PMRQwEgYDVQQHDAtTYWludCBMb3VpczEsMCoGA1UECgwjT2JqZWN0IENvbXB1 -dGluZyAoVGVzdCBJZGVudGl0eSBDQSkxLDAqBgNVBAMMI09iamVjdCBDb21wdXRp -bmcgKFRlc3QgSWRlbnRpdHkgQ0EpMScwJQYJKoZIhvcNAQkBFhhpbmZvQG9iamVj -dGNvbXB1dGluZy5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDR -3CBzI5ch2hTdvpFDU3bsa90po9VqyHdT3GTvk0njWD6WUcA2YUptG+i1MX9vwEtj -sxHlwxpMp41J/TNn8kWe770zBW8lhnKfzJfAENnqWso3j01v/CUPERqxms6NYHJQ -ucGZW11Y4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wdXRpbmcgKFRlc3QgUGVybWlzc2lvbnMgQ0EpMScwJQYJKoZI +hvcNAQkBFhhpbmZvQG9iamVjdGNvbXB1dGluZy5jb20CCQCkjopvwK438jANBglg +hkgBZQMEAgEFAKCCARMwGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG +9w0BCQUxDxcNMjQwMzIyMTk0MDM1WjAvBgkqhkiG9w0BCQQxIgQgemm1r7g/fbyT +QE9pvLNFi7DlYvGmX/2uaLCt6OuMkg8wgacGCSqGSIb3DQEJDzGBmTCBljALBglg +hkgBZQMEASowCAYGKoUDAgIJMAoGCCqFAwcBAQICMAoGCCqFAwcBAQIDMAgGBiqF +AwICFTALBglghkgBZQMEARYwCwYJYIZIAWUDBAECMAoGCCqGSIb3DQMHMA4GCCqG +SIb3DQMCAgIAgDANBggqhkiG9w0DAgIBQDAHBgUrDgMCBzANBggqhkiG9w0DAgIB +KDANBgkqhkiG9w0BAQEFAASCAQBHdIo1+gUoBEXzuAWtnQ8JCXzccb5/OoTzR14P +r037tIQZQQ8ltl6oRreF6V817bJZllQRtBN0CdcMSI1GEtt6K/6B/w6ud+g8k3FL +SG9irJ0Znh9sHbQZLSVYUe87tpiEHjEf0ATf1LS9ISeA+IgQg+iWORuvdbvdvqpC +QWjOsYZ57SfCZcvzlh+oxdShCMSuFSfumQMpj+Izi9pxrRIoe5xi5U2jHwN+yD9v +FMW4V+gE98IhS7a70aasOlmeozjjHgZdR5da0ReWpYfmB6/C7jfoLF2EhOJknjo/ +BJzLLb07ssAvU+MnyqmTl5wwnwN3PXHPasjNEWRzURWDPXIY -------744E9A081E9B87E1F69DCC0EC3779E9F-- +------3DA4360D7B002A899998944E4A1A5C89-- diff --git a/test/security/sub_permissions.xml b/test/security/sub_permissions.xml index 392911e..1f63229 100644 --- a/test/security/sub_permissions.xml +++ b/test/security/sub_permissions.xml @@ -3,7 +3,7 @@ xsi:noNamespaceSchemaLocation="http://www.omg.org/spec/DDS-SECURITY/20160303/omg_shared_ca_permissions.xsd"> - C=US, ST=California, O=Super Swanky Ski and Snow Shop, CN=Tahoe Joe + CN=Tahoe Joe, O=Super Swanky Ski and Snow Shop, ST=California, C=US 2015-09-15T01:00:00 diff --git a/test/security/sub_permissions_signed.p7s b/test/security/sub_permissions_signed.p7s index 98b9f23..c634f75 100644 --- a/test/security/sub_permissions_signed.p7s +++ b/test/security/sub_permissions_signed.p7s @@ -1,9 +1,9 @@ MIME-Version: 1.0 -Content-Type: multipart/signed; protocol="application/x-pkcs7-signature"; micalg="sha-256"; boundary="----397E3E837B8546A000015B5FE9020CE6" +Content-Type: multipart/signed; protocol="application/x-pkcs7-signature"; micalg="sha-256"; boundary="----6FE1818A856DB7EB798F1C5C84EF8D48" This is an S/MIME signed message -------397E3E837B8546A000015B5FE9020CE6 +------6FE1818A856DB7EB798F1C5C84EF8D48 Content-Type: text/plain @@ -11,7 +11,7 @@ Content-Type: text/plain xsi:noNamespaceSchemaLocation="http://www.omg.org/spec/DDS-SECURITY/20160303/omg_shared_ca_permissions.xsd"> - C=US, ST=California, O=Super Swanky Ski and Snow Shop, CN=Tahoe Joe + CN=Tahoe Joe, O=Super Swanky Ski and Snow Shop, ST=California, C=US 2015-09-15T01:00:00 @@ -37,49 +37,50 @@ Content-Type: text/plain -------397E3E837B8546A000015B5FE9020CE6 +------6FE1818A856DB7EB798F1C5C84EF8D48 Content-Type: application/x-pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="smime.p7s" -MIIG/gYJKoZIhvcNAQcCoIIG7zCCBusCAQExDzANBglghkgBZQMEAgEFADALBgkq -hkiG9w0BBwGgggPsMIID6DCCAtACCQCSMMZ5KQ7ffTANBgkqhkiG9w0BAQsFADCB -tTELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAk1PMRQwEgYDVQQHDAtTYWludCBMb3Vp -czEsMCoGA1UECgwjT2JqZWN0IENvbXB1dGluZyAoVGVzdCBJZGVudGl0eSBDQSkx -LDA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0DAgIB +KDANBgkqhkiG9w0BAQEFAASCAQCUxluBoJSfpKVikC412pvt+yeQ8ZUkZD/pfocT +TIAk12XtqQ2hDCl3BD0ZQt5eH07kRqpPiSFLW4C3ZceM2jlDPSCQzrNTXuhHo/cG +0bMuvFCapNYVA3njrOriC91SOHiWf/76KvcbfqcQeECE6B+Son6Ya152Op1uGo6P +a+cQWyzGMqJOy8ciAWsu7ULCrkzIsUbjb//FwSkVsMwyuuQQqQ4JY59E0n9CmBN6 +2rsnqCgrIPCT5/Xtwd++kaqjhDCk97aphqdgOGBkn9clFuXO0a19BDNy28w4moV0 +N7Mntv7QrMTRmFlRFg/GnL49gdiGioffeoUIPuoaQ6jA8ws+ -------397E3E837B8546A000015B5FE9020CE6-- +------6FE1818A856DB7EB798F1C5C84EF8D48-- From fd8c895cd1fa83d3f33319bb664f9402863fff3a Mon Sep 17 00:00:00 2001 From: Son Dinh Date: Fri, 22 Mar 2024 14:53:28 -0500 Subject: [PATCH 12/23] Remove log messages --- src/NodeDRListener.cpp | 18 +----------------- src/NodeDRListener.h | 2 -- src/NodeValueReader.cpp | 12 ------------ src/node-opendds.cpp | 13 ------------- 4 files changed, 1 insertion(+), 44 deletions(-) diff --git a/src/NodeDRListener.cpp b/src/NodeDRListener.cpp index 27e3959..8e8379e 100644 --- a/src/NodeDRListener.cpp +++ b/src/NodeDRListener.cpp @@ -46,7 +46,6 @@ NodeDRListener::NodeDRListener(DDS::DomainParticipant* dp, , unsubscribing_(false) , unsubscribed_(false) , receiving_samples_(false) - , count_samples_(0) { uv_async_init(uv_default_loop(), &async_uv_, async_cb); } @@ -121,21 +120,7 @@ void NodeDRListener::reserve(CORBA::ULong) void NodeDRListener::push_back(const DDS::SampleInfo& src, const void* sample) { std::unique_lock lock(mutex_); - ++count_samples_; - ACE_DEBUG((LM_DEBUG, "Receive sample number %u. Data pointer: %@\n", count_samples_, sample)); - ACE_DEBUG((LM_DEBUG, "SampleInfo: {\n")); - ACE_DEBUG((LM_DEBUG, "sample_state: %d\n", src.sample_state)); - ACE_DEBUG((LM_DEBUG, "view_state: %d\n", src.view_state)); - ACE_DEBUG((LM_DEBUG, "instance_state: %d\n", src.instance_state)); - ACE_DEBUG((LM_DEBUG, "instance_handle: %u\n", src.instance_handle)); - ACE_DEBUG((LM_DEBUG, "publication_handle: %u\n", src.publication_handle)); - ACE_DEBUG((LM_DEBUG, "disposed_generation_count: %u\n", src.disposed_generation_count)); - ACE_DEBUG((LM_DEBUG, "no_writers_generation_count: %u\n", src.no_writers_generation_count)); - ACE_DEBUG((LM_DEBUG, "valid_data: %d\n", src.valid_data)); - ACE_DEBUG((LM_DEBUG, "}\n")); - if (unsubscribing_) { - ACE_DEBUG((LM_DEBUG, "unsubscribing_ value: %d\n", unsubscribing_)); return; } @@ -144,9 +129,8 @@ void NodeDRListener::push_back(const DDS::SampleInfo& src, const void* sample) } if (vd_) { - ACE_DEBUG((LM_DEBUG, "Write sample using NodeValueWriter...\n")); if (!vd_->write(nvw_, sample)) { - ACE_ERROR((LM_ERROR, "ERROR: ValueDispatcher write failed\n")); + ACE_ERROR((LM_WARNING, "WARNING: ValueDispatcher write failed\n")); return; } } diff --git a/src/NodeDRListener.h b/src/NodeDRListener.h index 8112637..5110f6e 100644 --- a/src/NodeDRListener.h +++ b/src/NodeDRListener.h @@ -79,8 +79,6 @@ namespace NodeOpenDDS { /// True if Datareader Listener taking samples. bool receiving_samples_; - unsigned long count_samples_; - mutable std::mutex mutex_; }; diff --git a/src/NodeValueReader.cpp b/src/NodeValueReader.cpp index 09dd889..59683e6 100644 --- a/src/NodeValueReader.cpp +++ b/src/NodeValueReader.cpp @@ -39,49 +39,40 @@ NodeValueReader::NodeValueReader(v8::Local obj) bool NodeValueReader::begin_struct(OpenDDS::DCPS::Extensibility /*extensibility*/) { - ACE_DEBUG((LM_DEBUG, "begin_struct\n")); return begin_nested(); } bool NodeValueReader::end_struct() { - ACE_DEBUG((LM_DEBUG, "end_struct\n")); return end_nested(); } bool NodeValueReader::begin_struct_member(OpenDDS::XTypes::MemberId& member_id, const OpenDDS::DCPS::MemberHelper& helper) { - ACE_DEBUG((LM_DEBUG, "begin_struct_member...\n")); while (members_remaining()) { Nan::MaybeLocal mlv = Nan::Get(property_names_.ToLocalChecked(), current_index_); // mlv is not empty at this point. current_property_name_ = mlv.ToLocalChecked(); Nan::Utf8String name(current_property_name_); - ACE_DEBUG((LM_DEBUG, "Member name: %C\n", *name)); if (helper.get_value(member_id, *name)) { return true; } ++current_index_; } - ACE_DEBUG((LM_DEBUG, "No members remaining\n")); return false; } bool NodeValueReader::members_remaining() { - ACE_DEBUG((LM_DEBUG, "members_remaining...\n")); if (!property_names_.IsEmpty()) { while (current_index_ < property_names_.ToLocalChecked()->Length()) { - ACE_DEBUG((LM_DEBUG, "current_index_: %u\n", current_index_)); Nan::MaybeLocal mlv = Nan::Get(property_names_.ToLocalChecked(), current_index_); if (!mlv.IsEmpty()) { - ACE_DEBUG((LM_DEBUG, "Returning true\n")); return true; } ++current_index_; } } - ACE_DEBUG((LM_DEBUG, "Returning false\n")); return false; } @@ -98,7 +89,6 @@ bool NodeValueReader::member_has_value() bool NodeValueReader::end_struct_member() { - ACE_DEBUG((LM_DEBUG, "end_struct_member\n")); ++current_index_; return true; } @@ -425,10 +415,8 @@ bool NodeValueReader::begin_nested() property_names_ = Nan::GetPropertyNames(current_object_); current_property_name_.Clear(); - ACE_DEBUG((LM_DEBUG, "Returning true\n")); return true; } - ACE_DEBUG((LM_DEBUG, "Returning false\n")); return false; } diff --git a/src/node-opendds.cpp b/src/node-opendds.cpp index a666376..4955b88 100644 --- a/src/node-opendds.cpp +++ b/src/node-opendds.cpp @@ -379,19 +379,6 @@ namespace { const Local dwqos_lv = Nan::Get(qos_js, dwqos_lstr).ToLocalChecked(); if (dwqos_lv->IsObject()) { try { - v8::Local tmp = dwqos_lv->ToObject(Nan::GetCurrentContext()).ToLocalChecked(); - //v8::Local property_names = tmp->GetOwnPropertyNames(Nan::GetCurrentContext()).ToLocalChecked(); - v8::MaybeLocal property_names = Nan::GetPropertyNames(tmp); - for (uint32_t i = 0; i < property_names.ToLocalChecked()->Length(); ++i) { - //v8::Local key = property_names->Get(Nan::GetCurrentContext(), i).ToLocalChecked(); - //v8::Local value = obj->Get(isolate->GetCurrentContext(), key).ToLocalChecked(); - - //v8::String::Utf8Value utf8_key(Nan::GetCurrentContext, key); - //v8::String::Utf8Value utf8_value(isolate, value); - Nan::MaybeLocal mlv = Nan::Get(property_names.ToLocalChecked(), i); - Nan::Utf8String name(mlv.ToLocalChecked()); - ACE_DEBUG((LM_DEBUG, "DataWriterQos property name: %C\n", *name)); - } NodeValueReader nvr(dwqos_lv->ToObject(Nan::GetCurrentContext()).ToLocalChecked()); if (!OpenDDS::DCPS::vread(nvr, dw_qos)) { throw std::runtime_error("Unable to convert datawriter qos policy"); From 599688a025a364d779ad03ae2c35c3bab3c58735 Mon Sep 17 00:00:00 2001 From: Son Dinh Date: Fri, 22 Mar 2024 15:40:02 -0500 Subject: [PATCH 13/23] Update signed security docs --- test/security/pub_permissions_signed.p7s | 86 ++++++++++++------------ test/security/sub_permissions_signed.p7s | 86 ++++++++++++------------ 2 files changed, 86 insertions(+), 86 deletions(-) diff --git a/test/security/pub_permissions_signed.p7s b/test/security/pub_permissions_signed.p7s index 28fe0f7..d8d16ec 100644 --- a/test/security/pub_permissions_signed.p7s +++ b/test/security/pub_permissions_signed.p7s @@ -1,9 +1,9 @@ MIME-Version: 1.0 -Content-Type: multipart/signed; protocol="application/x-pkcs7-signature"; micalg="sha-256"; boundary="----3DA4360D7B002A899998944E4A1A5C89" +Content-Type: multipart/signed; protocol="application/x-pkcs7-signature"; micalg="sha-256"; boundary="----DE4BDED2B0DC6F4C85C46AF6C15B08F7" This is an S/MIME signed message -------3DA4360D7B002A899998944E4A1A5C89 +------DE4BDED2B0DC6F4C85C46AF6C15B08F7 Content-Type: text/plain @@ -37,50 +37,50 @@ Content-Type: text/plain -------3DA4360D7B002A899998944E4A1A5C89 +------DE4BDED2B0DC6F4C85C46AF6C15B08F7 Content-Type: application/x-pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="smime.p7s" -MIIHQAYJKoZIhvcNAQcCoIIHMTCCBy0CAQExDzANBglghkgBZQMEAgEFADALBgkq -hkiG9w0BBwGgggP4MIID9DCCAtwCCQCkjopvwK438jANBgkqhkiG9w0BAQsFADCB -uzELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAk1PMRQwEgYDVQQHDAtTYWludCBMb3Vp -czEvMC0GA1UECgwmT2JqZWN0IENvbXB1dGluZyAoVGVzdCBQZXJtaXNzaW9ucyBD -QSkxLzAtBgNVBAMMJk9iamVjdCBDb21wdXRpbmcgKFRlc3QgUGVybWlzc2lvbnMg -Q0EpMScwJQYJKoZIhvcNAQkBFhhpbmZvQG9iamVjdGNvbXB1dGluZy5jb20wHhcN -MTgwNjEzMDQyMDEzWhcNMjgwNjEwMDQyMDEzWjCBuzELMAkGA1UEBhMCVVMxCzAJ -BgNVBAgMAk1PMRQwEgYDVQQHDAtTYWludCBMb3VpczEvMC0GA1UECgwmT2JqZWN0 -IENvbXB1dGluZyAoVGVzdCBQZXJtaXNzaW9ucyBDQSkxLzAtBgNVBAMMJk9iamVj -dCBDb21wdXRpbmcgKFRlc3QgUGVybWlzc2lvbnMgQ0EpMScwJQYJKoZIhvcNAQkB -FhhpbmZvQG9iamVjdGNvbXB1dGluZy5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IB -DwAwggEKAoIBAQCd3osCHskwiWPkgQ+FiUJEPj9lGAV6gqnG9XcTHPzOsv+hrWck -lq4WcTcu5ERxjvwzrfB9MV2Jj1mhnAQfp0sIuTJe4QoXigyf0IyezsSA1oeofkJu -BlA6cR+5ATzfNEcJJG3sVaEaa0L92CXb147LczMMY+6I/jD9H/Kamoph1hCgdh2l -GnYN97ETMxX5qINthO17/qZ55R+H5nE2Op1f4Y0LhjKu3WztEjIZeAJDgAksoYRy -nVhfDssh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1dGluZy5jb20CCQCSMMZ5KQ7ffTANBglghkgBZQMEAgEFAKCCARMwGAYJ +KoZIhvcNAQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMjQwMzIyMjAz +ODIzWjAvBgkqhkiG9w0BCQQxIgQgemm1r7g/fbyTQE9pvLNFi7DlYvGmX/2uaLCt +6OuMkg8wgacGCSqGSIb3DQEJDzGBmTCBljALBglghkgBZQMEASowCAYGKoUDAgIJ +MAoGCCqFAwcBAQICMAoGCCqFAwcBAQIDMAgGBiqFAwICFTALBglghkgBZQMEARYw +CwYJYIZIAWUDBAECMAoGCCqGSIb3DQMHMA4GCCqGSIb3DQMCAgIAgDANBggqhkiG +9w0DAgIBQDAHBgUrDgMCBzANBggqhkiG9w0DAgIBKDANBgkqhkiG9w0BAQEFAASC +AQCyg168OlHJzydEo8UOF4oIrlJAT/d77tYueske1WW492zYuUkLI7VKI8UyXXQ1 +G+2ybmppdZavLzs/XB4fYuoCnRrOt8/WYNK4FNdvszRen/lX8RKA9tGLl44hLhV6 +GG3KZNiQuPJUBRQYDwn4TcwDeAoTOHOfDpxSc06lU5OcsfvGXoRueJOVtr067tCM +6CYF6INxZQTAQGhxKT8jrbY74XyPUB2f0ejsEekT9C64wElFdhkOuAUFXepicJbW +DYauofJkOj8WL/IgJZV5DVHX3QNiWpEr0e/GzjoHxzKcvspcriiLkQQTXKodHxV3 +rQTotWNneq+0y7A+jfSO5xMd -------3DA4360D7B002A899998944E4A1A5C89-- +------DE4BDED2B0DC6F4C85C46AF6C15B08F7-- diff --git a/test/security/sub_permissions_signed.p7s b/test/security/sub_permissions_signed.p7s index c634f75..ced1e81 100644 --- a/test/security/sub_permissions_signed.p7s +++ b/test/security/sub_permissions_signed.p7s @@ -1,9 +1,9 @@ MIME-Version: 1.0 -Content-Type: multipart/signed; protocol="application/x-pkcs7-signature"; micalg="sha-256"; boundary="----6FE1818A856DB7EB798F1C5C84EF8D48" +Content-Type: multipart/signed; protocol="application/x-pkcs7-signature"; micalg="sha-256"; boundary="----1B8F2C237787217A680D2FDA9890F436" This is an S/MIME signed message -------6FE1818A856DB7EB798F1C5C84EF8D48 +------1B8F2C237787217A680D2FDA9890F436 Content-Type: text/plain @@ -37,50 +37,50 @@ Content-Type: text/plain -------6FE1818A856DB7EB798F1C5C84EF8D48 +------1B8F2C237787217A680D2FDA9890F436 Content-Type: application/x-pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="smime.p7s" -MIIHQAYJKoZIhvcNAQcCoIIHMTCCBy0CAQExDzANBglghkgBZQMEAgEFADALBgkq -hkiG9w0BBwGgggP4MIID9DCCAtwCCQCkjopvwK438jANBgkqhkiG9w0BAQsFADCB -uzELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAk1PMRQwEgYDVQQHDAtTYWludCBMb3Vp -czEvMC0GA1UECgwmT2JqZWN0IENvbXB1dGluZyAoVGVzdCBQZXJtaXNzaW9ucyBD -QSkxLzAtBgNVBAMMJk9iamVjdCBDb21wdXRpbmcgKFRlc3QgUGVybWlzc2lvbnMg -Q0EpMScwJQYJKoZIhvcNAQkBFhhpbmZvQG9iamVjdGNvbXB1dGluZy5jb20wHhcN -MTgwNjEzMDQyMDEzWhcNMjgwNjEwMDQyMDEzWjCBuzELMAkGA1UEBhMCVVMxCzAJ -BgNVBAgMAk1PMRQwEgYDVQQHDAtTYWludCBMb3VpczEvMC0GA1UECgwmT2JqZWN0 -IENvbXB1dGluZyAoVGVzdCBQZXJtaXNzaW9ucyBDQSkxLzAtBgNVBAMMJk9iamVj -dCBDb21wdXRpbmcgKFRlc3QgUGVybWlzc2lvbnMgQ0EpMScwJQYJKoZIhvcNAQkB -FhhpbmZvQG9iamVjdGNvbXB1dGluZy5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IB -DwAwggEKAoIBAQCd3osCHskwiWPkgQ+FiUJEPj9lGAV6gqnG9XcTHPzOsv+hrWck -lq4WcTcu5ERxjvwzrfB9MV2J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b3VpczEsMCoGA1UECgwjT2JqZWN0IENvbXB1 +dGluZyAoVGVzdCBJZGVudGl0eSBDQSkxLDAqBgNVBAMMI09iamVjdCBDb21wdXRp +bmcgKFRlc3QgSWRlbnRpdHkgQ0EpMScwJQYJKoZIhvcNAQkBFhhpbmZvQG9iamVj +dGNvbXB1dGluZy5jb20CCQCSMMZ5KQ7ffTANBglghkgBZQMEAgEFAKCCARMwGAYJ +KoZIhvcNAQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMjQwMzIyMjAz +ODM1WjAvBgkqhkiG9w0BCQQxIgQgXqGX24ZXK/ZIaK0m37R9Raw3HsQD3mBTunuU +VV7HG7IwgacGCSqGSIb3DQEJDzGBmTCBljALBglghkgBZQMEASowCAYGKoUDAgIJ +MAoGCCqFAwcBAQICMAoGCCqFAwcBAQIDMAgGBiqFAwICFTALBglghkgBZQMEARYw +CwYJYIZIAWUDBAECMAoGCCqGSIb3DQMHMA4GCCqGSIb3DQMCAgIAgDANBggqhkiG +9w0DAgIBQDAHBgUrDgMCBzANBggqhkiG9w0DAgIBKDANBgkqhkiG9w0BAQEFAASC +AQCafld6hTLwUdVPwqYPYCpfGRKtA7gk+Bg7XNbOaM367s2ZzdDrVOONLLOeVS+f +ahYRXxkWQC2mdlqZAKwVHgsHEW2thBfPpDJBU4qRnj1ux/MpgpUzI/f7JZn6GkEa +oCduw9gzxxcxsA0NgF8NhZ95vxhBaYfGS6U2740u08cRQ4oINH3ir5SIYSJrZbZE +37XfoJQP1VEoKwPybdK7ApCjONANb1dpOLvUr3+7zcMJp9ZihSeJn0icuwoqcRjm +IbIxDn3HdPFQ4kT6pF5z25X/Pkd6eT0Chq4YKXAFKE2hbDmck1yK+gWAFvcRz5Nk +GwJy93tF7gG34AOuT4dHW+ps -------6FE1818A856DB7EB798F1C5C84EF8D48-- +------1B8F2C237787217A680D2FDA9890F436-- From b097e6bfbc8e72e93ef5e274fc0c4f8ea519b258 Mon Sep 17 00:00:00 2001 From: Son Dinh Date: Fri, 22 Mar 2024 17:21:59 -0500 Subject: [PATCH 14/23] Try using newer Nan version --- .github/workflows/build.yml | 2 +- package-lock.json | 2 +- package.json | 2 +- src/NodeDRListener.cpp | 3 +++ 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 80f5856..2ea4c09 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -182,7 +182,7 @@ jobs: npm install ${{ env.ACE_ROOT }}/bin/mwc.pl -type gnuace -exclude ACE_TAO,OpenDDS make -j4 || make - - name: Install gdb + - name: Install gdb (ubuntu) if: ${{ matrix.m.os == 'ubuntu-20.04' }} shell: bash run: | diff --git a/package-lock.json b/package-lock.json index 677f388..9be28a2 100755 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "hasInstallScript": true, "license": "BSD-3-Clause", "dependencies": { - "nan": "^2.17.0" + "nan": "^2.19.0" } }, "node_modules/nan": { diff --git a/package.json b/package.json index dcfcb83..98b9a95 100755 --- a/package.json +++ b/package.json @@ -27,6 +27,6 @@ "license": "BSD-3-Clause", "gypfile": true, "dependencies": { - "nan": "^2.17.0" + "nan": "^2.19.0" } } diff --git a/src/NodeDRListener.cpp b/src/NodeDRListener.cpp index 8e8379e..add11a1 100644 --- a/src/NodeDRListener.cpp +++ b/src/NodeDRListener.cpp @@ -124,6 +124,9 @@ void NodeDRListener::push_back(const DDS::SampleInfo& src, const void* sample) return; } + // TODO: When OpenDDS's vwrite works with key-only samples, e.g. from a dispose or + // unregister_instance call on the writer, this can be removed so that those samples + // can be delivered to the Javascript side. if (!src.valid_data) { return; } From d10bff8ee93a332c35ad67e9d303bd347d3cd088 Mon Sep 17 00:00:00 2001 From: Son Dinh Date: Mon, 25 Mar 2024 10:39:33 -0500 Subject: [PATCH 15/23] Show python versions --- .github/workflows/build.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2ea4c09..48962ca 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -60,6 +60,15 @@ jobs: runs-on: ${{ matrix.m.os }} steps: - uses: actions/checkout@v3 + - name: Check python version + if: ${{ matrix.m.os == 'macos-11' }} + run: |- + echo 'python3 --version' + python3 --version + echo 'ls /bin | grep python' + ls /bin | grep python + echo 'ls /usr/bin | grep python' + ls /usr/bin | grep python - name: 'Checkout MPC' uses: actions/checkout@v3 with: From 6e9a301626a4bc82e51c1070158583f5cb14e464 Mon Sep 17 00:00:00 2001 From: Son Dinh Date: Mon, 25 Mar 2024 11:45:55 -0500 Subject: [PATCH 16/23] Node.js 14 doesn't work with python 3.11 and beyond --- .github/workflows/build.yml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 48962ca..60eadc7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -65,8 +65,12 @@ jobs: run: |- echo 'python3 --version' python3 --version - echo 'ls /bin | grep python' - ls /bin | grep python + #echo 'ls /bin | grep python' + #ls /bin | grep python + echo 'PATH' + echo $PATH + echo 'ls /' + ls / echo 'ls /usr/bin | grep python' ls /usr/bin | grep python - name: 'Checkout MPC' @@ -184,10 +188,17 @@ jobs: cd OpenDDS call setenv.cmd msbuild -p:Configuration=Debug,Platform=x64 -t:${{ env.BUILD_TARGETS }} -m DDS_TAOv2.sln + - name: Use python 3.10 when node 14 is used + if: ${{ matrix.m.os == 'macos-11' && matrix.node_version == 14}} + uses: actions/setup-python@v5 + with: + python-version: '3.10' + run: echo $PATH - name: 'Install (ubuntu / macos)' if: ${{ matrix.m.os == 'ubuntu-20.04' || matrix.m.os == 'macos-11' }} shell: bash run: |- + echo $PATH npm install ${{ env.ACE_ROOT }}/bin/mwc.pl -type gnuace -exclude ACE_TAO,OpenDDS make -j4 || make From 7b9ade7f240b3cf8084292ed2b3f4260a8041499 Mon Sep 17 00:00:00 2001 From: Son Dinh Date: Mon, 25 Mar 2024 11:48:22 -0500 Subject: [PATCH 17/23] Step cannot have both uses and run keys --- .github/workflows/build.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 60eadc7..488591e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -193,7 +193,6 @@ jobs: uses: actions/setup-python@v5 with: python-version: '3.10' - run: echo $PATH - name: 'Install (ubuntu / macos)' if: ${{ matrix.m.os == 'ubuntu-20.04' || matrix.m.os == 'macos-11' }} shell: bash From 4ef9835bdcddb07f3d0db716d96baf1dc498eb23 Mon Sep 17 00:00:00 2001 From: Son Dinh Date: Mon, 25 Mar 2024 13:09:51 -0500 Subject: [PATCH 18/23] Use Python 3.11 for node 16 due to the lack of distutils since Python 3.12 --- .github/workflows/build.yml | 23 +++++++---------------- package.json | 2 +- 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 488591e..28857ff 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -60,19 +60,6 @@ jobs: runs-on: ${{ matrix.m.os }} steps: - uses: actions/checkout@v3 - - name: Check python version - if: ${{ matrix.m.os == 'macos-11' }} - run: |- - echo 'python3 --version' - python3 --version - #echo 'ls /bin | grep python' - #ls /bin | grep python - echo 'PATH' - echo $PATH - echo 'ls /' - ls / - echo 'ls /usr/bin | grep python' - ls /usr/bin | grep python - name: 'Checkout MPC' uses: actions/checkout@v3 with: @@ -188,16 +175,20 @@ jobs: cd OpenDDS call setenv.cmd msbuild -p:Configuration=Debug,Platform=x64 -t:${{ env.BUILD_TARGETS }} -m DDS_TAOv2.sln - - name: Use python 3.10 when node 14 is used - if: ${{ matrix.m.os == 'macos-11' && matrix.node_version == 14}} + - name: Use Python 3.10 for node 14 (macos) + if: ${{ matrix.m.os == 'macos-11' && matrix.node_version == 14 }} uses: actions/setup-python@v5 with: python-version: '3.10' + - name: Use Python 3.11 for node 16 (macos) + if: ${{ matrix.m.os == 'macos-11' && matrix.node_version == 16 }} + uses: actions/setup-python@v5 + with: + python-version: '3.11' - name: 'Install (ubuntu / macos)' if: ${{ matrix.m.os == 'ubuntu-20.04' || matrix.m.os == 'macos-11' }} shell: bash run: |- - echo $PATH npm install ${{ env.ACE_ROOT }}/bin/mwc.pl -type gnuace -exclude ACE_TAO,OpenDDS make -j4 || make diff --git a/package.json b/package.json index 98b9a95..c329203 100755 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ }, "repository": { "type": "git", - "url": "http://github.com/oci-labs/node-opendds.git" + "url": "https://github.com/OpenDDS/node-opendds.git" }, "keywords": [ "dds", From 4045d8ae5213f032aae5ecb2153c1f9e7f0e2370 Mon Sep 17 00:00:00 2001 From: Son Dinh Date: Tue, 26 Mar 2024 12:30:13 -0500 Subject: [PATCH 19/23] Fix CI dependencies --- .github/workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 39fd003..c49811a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -65,17 +65,17 @@ jobs: uses: actions/setup-node@v3 with: node-version: ${{ matrix.node_version }} - - name: 'Install ssl and xerces (ubuntu)' + - name: 'Install xerces (ubuntu)' if: ${{ matrix.m.dds_security == 1 && matrix.m.os == 'ubuntu-22.04' }} run: |- sudo apt-get update - sudo apt-get -y install libssl-dev libxerces-c-dev + sudo apt-get -y install libxerces-c-dev - name: 'Install xerces (macos)' if: ${{ matrix.m.dds_security == 1 && matrix.m.os == 'macos-12' }} run: | brew install xerces-c - name: Setup for run-vcpkg - if: runner.os == 'Windows' + if: ${{ matrix.m.dds_security == 1 && matrix.m.os == 'windows-2022' }} shell: cmd run: | echo { "name": "opendds", "version-string": "github-actions", "dependencies": [ "openssl", "xerces-c" ] } > vcpkg.json From 2ed6af71e4d24d441d9c20fd327c41447a509add Mon Sep 17 00:00:00 2001 From: Son Dinh Date: Tue, 26 Mar 2024 13:48:06 -0500 Subject: [PATCH 20/23] Update path to openssl and xerces for Windows. Remove node 14 and 16 --- .github/workflows/build.yml | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c49811a..b8b62a3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,8 +23,6 @@ jobs: fail-fast: false matrix: node_version: - - 14 - - 16 - 18 - 20 opendds_branch: @@ -128,7 +126,7 @@ jobs: echo "npm_config_devdir=$GITHUB_WORKSPACE\\opendds-node-gyp-devdir" >> $GITHUB_ENV if [ ${{ matrix.m.dds_security }} == 1 ]; then CONFIG_OPTIONS+=" --security" - CONFIG_OPTIONS+=" --xerces3=$VCPKG_ROOT\\installed\\x64-windows --openssl=$VCPKG_ROOT\\installed\\x64-windows" + CONFIG_OPTIONS+=" --xerces3=$VCPKG_INSTALLED_DIR\\x64-windows --openssl=$VCPKG_INSTALLED_DIR\\x64-windows" BUILD_TARGETS+=";OpenDDS_Security" fi echo "CONFIG_OPTIONS=$CONFIG_OPTIONS" >> $GITHUB_ENV @@ -159,16 +157,6 @@ jobs: cd OpenDDS call setenv.cmd msbuild -p:Configuration=Debug,Platform=x64 -t:${{ env.BUILD_TARGETS }} -m DDS_TAOv2.sln - - name: Use Python 3.10 for node 14 (macos) - if: ${{ matrix.m.os == 'macos-12' && matrix.node_version == 14 }} - uses: actions/setup-python@v5 - with: - python-version: '3.10' - - name: Use Python 3.11 for node 16 (macos) - if: ${{ matrix.m.os == 'macos-12' && matrix.node_version == 16 }} - uses: actions/setup-python@v5 - with: - python-version: '3.11' - name: 'Install (ubuntu / macos)' if: ${{ matrix.m.os == 'ubuntu-22.04' || matrix.m.os == 'macos-12' }} shell: bash From 00bfb274a0d30798b5c71ee42f76217ecd52ac94 Mon Sep 17 00:00:00 2001 From: Son Dinh Date: Tue, 26 Mar 2024 13:53:59 -0500 Subject: [PATCH 21/23] Update OpenDDS repo path --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b8b62a3..29fbeb8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -55,7 +55,7 @@ jobs: - name: 'Checkout OpenDDS' uses: actions/checkout@v3 with: - repository: objectcomputing/OpenDDS + repository: OpenDDS/OpenDDS ref: ${{ matrix.opendds_branch }} path: OpenDDS fetch-depth: 1 From 3e8cfeffd70434fdfbd906c7ab519e6af6cf54c6 Mon Sep 17 00:00:00 2001 From: Son Dinh Date: Thu, 28 Mar 2024 13:35:37 -0500 Subject: [PATCH 22/23] From review --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 29fbeb8..69b4b66 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -141,7 +141,7 @@ jobs: ./configure --no-tests ${{ env.CONFIG_OPTIONS }} tools/scripts/show_build_config.pl . setenv.sh - make -j4 ${{ env.BUILD_TARGETS }} + make -j$(getconf _NPROCESSORS_ONLN) ${{ env.BUILD_TARGETS }} - name: 'Configure OpenDDS (windows)' if: ${{ matrix.m.os == 'windows-2022' }} shell: cmd @@ -163,7 +163,7 @@ jobs: run: |- npm install ${{ env.ACE_ROOT }}/bin/mwc.pl -type gnuace -exclude ACE_TAO,OpenDDS - make -j4 || make + make -j$(getconf _NPROCESSORS_ONLN) || make - name: Install gdb (ubuntu) if: ${{ matrix.m.os == 'ubuntu-22.04' }} shell: bash From 84eaad48b12c1158b352fd16d03e486c46288207 Mon Sep 17 00:00:00 2001 From: Son Dinh Date: Mon, 1 Apr 2024 12:42:24 -0500 Subject: [PATCH 23/23] Represent bitmask as array of flags --- src/NodeValueReader.cpp | 29 +++++++---- src/NodeValueWriter.cpp | 109 ++++++++++++++++++++-------------------- src/NodeValueWriter.h | 53 ++++++++++++------- 3 files changed, 110 insertions(+), 81 deletions(-) diff --git a/src/NodeValueReader.cpp b/src/NodeValueReader.cpp index 59683e6..8cf15dc 100644 --- a/src/NodeValueReader.cpp +++ b/src/NodeValueReader.cpp @@ -386,16 +386,27 @@ bool NodeValueReader::read_long_enum(ACE_CDR::Long& value, const OpenDDS::DCPS:: bool NodeValueReader::read_bitmask(ACE_CDR::ULongLong& value, const OpenDDS::DCPS::BitmaskHelper& helper) { Nan::MaybeLocal mlvai = use_name_ ? Nan::Get(current_object_, current_property_name_) : Nan::Get(current_object_, current_index_); - if (!mlvai.IsEmpty()) { - std::string temp; - if (read_string(temp)) { - value = string_to_bitmask(temp, helper); - return true; - } - } + if (!mlvai.IsEmpty() && mlvai.ToLocalChecked()->IsObject()) { + v8::Local array = v8::Local::Cast(mlvai.ToLocalChecked()); + if (!array.IsEmpty()) { + OPENDDS_VECTOR(OpenDDS::DCPS::String) flag_names(array->Length()); + for (uint32_t i = 0; i < array->Length(); ++i) { + Nan::MaybeLocal mlv = Nan::Get(array, i); + if (mlv.IsEmpty()) { + return false; + } + Nan::MaybeLocal mlstr = Nan::To(mlv.ToLocalChecked()); + if (mlstr.IsEmpty()) { + return false; + } + Nan::Utf8String flag(mlstr.ToLocalChecked()); + flag_names[i] = *flag; + } - if (primitive_helper(value, &v8::Value::IsNumber, strtoull)) { - return true; + if (helper.get_value(value, flag_names)) { + return true; + } + } } return false; diff --git a/src/NodeValueWriter.cpp b/src/NodeValueWriter.cpp index 1b828b5..2831409 100644 --- a/src/NodeValueWriter.cpp +++ b/src/NodeValueWriter.cpp @@ -23,8 +23,7 @@ void NodeValueWriter::use_bigint(bool value) bool NodeValueWriter::begin_struct(OpenDDS::DCPS::Extensibility /*extensibility*/) { - object_helper(); - return true; + return object_helper(); } bool NodeValueWriter::end_struct() @@ -49,8 +48,7 @@ bool NodeValueWriter::end_struct_member() bool NodeValueWriter::begin_union(OpenDDS::DCPS::Extensibility /*extensibility*/) { - object_helper(); - return true; + return object_helper(); } bool NodeValueWriter::end_union() @@ -86,8 +84,7 @@ bool NodeValueWriter::end_union_member() bool NodeValueWriter::begin_array(OpenDDS::XTypes::TypeKind /*elem_kind*/) { - object_helper(); - return true; + return object_helper(); } bool NodeValueWriter::end_array() @@ -101,8 +98,7 @@ bool NodeValueWriter::end_array() bool NodeValueWriter::begin_sequence(OpenDDS::XTypes::TypeKind /*elem_kind*/, ACE_CDR::ULong /*length*/) { - object_helper(); - return true; + return object_helper(); } bool NodeValueWriter::end_sequence() @@ -127,121 +123,112 @@ bool NodeValueWriter::end_element() bool NodeValueWriter::write_boolean(ACE_CDR::Boolean value) { - primitive_helper(value); - return true; + return primitive_helper(value); } bool NodeValueWriter::write_byte(ACE_CDR::Octet value) { - primitive_helper(value); - return true; + return primitive_helper(value); } #if OPENDDS_HAS_EXPLICIT_INTS bool NodeValueWriter::write_int8(ACE_CDR::Int8 value) { - primitive_helper(value); - return true; + return primitive_helper(value); } bool NodeValueWriter::write_uint8(ACE_CDR::UInt8 value) { - primitive_helper(value); - return true; + return primitive_helper(value); } #endif bool NodeValueWriter::write_int16(ACE_CDR::Short value) { - primitive_helper(value); - return true; + return primitive_helper(value); } bool NodeValueWriter::write_uint16(ACE_CDR::UShort value) { - primitive_helper(value); - return true; + return primitive_helper(value); } bool NodeValueWriter::write_int32(ACE_CDR::Long value) { - primitive_helper(value); - return true; + return primitive_helper(value); } bool NodeValueWriter::write_uint32(ACE_CDR::ULong value) { - primitive_helper(value); - return true; + return primitive_helper(value); } bool NodeValueWriter::write_int64(ACE_CDR::LongLong value) { if (value <= NODE_MAX_SAFE_INT) { - primitive_helper(value); - return true; + return primitive_helper(value); } + bool ret = true; #ifdef HAS_BIGINT if (use_bigint_) { v8::MaybeLocal v8_value = v8::BigInt::New(v8::Isolate::GetCurrent(), static_cast(value)); - value_helper(v8_value); + ret = value_helper(v8_value); } else { #endif char buff[21]; // 2^63 is 19 characters long in decimal representation, plus optional sign, plus null std::sprintf(buff, ACE_INT64_FORMAT_SPECIFIER_ASCII, value); v8::MaybeLocal v8_value = Nan::New(buff, std::strlen(buff)); - value_helper(v8_value); + ret = value_helper(v8_value); #ifdef HAS_BIGINT } #endif - return true; + + return ret; } bool NodeValueWriter::write_uint64(ACE_CDR::ULongLong value) { if (value <= static_cast(NODE_MAX_SAFE_INT)) { - primitive_helper(value); - return true; + return primitive_helper(value); } + bool ret = true; #ifdef HAS_BIGINT if (use_bigint_) { v8::MaybeLocal v8_value = v8::BigInt::NewFromUnsigned(v8::Isolate::GetCurrent(), static_cast(value)); - value_helper(v8_value); + ret = value_helper(v8_value); } else { #endif char buff[21]; // 2^64 is 20 characters long in decimal representation, plus null std::sprintf(buff, ACE_UINT64_FORMAT_SPECIFIER_ASCII, value); v8::MaybeLocal v8_value = Nan::New(buff, std::strlen(buff)); - value_helper(v8_value); + ret = value_helper(v8_value); #ifdef HAS_BIGINT } #endif - return true; + + return ret; } bool NodeValueWriter::write_float32(ACE_CDR::Float value) { - primitive_helper(value); - return true; + return primitive_helper(value); } bool NodeValueWriter::write_float64(ACE_CDR::Double value) { - primitive_helper(value); - return true; + return primitive_helper(value); } bool NodeValueWriter::write_float128(ACE_CDR::LongDouble value) { #if ACE_SIZEOF_LONG_DOUBLE == 16 - primitive_helper(value); + return primitive_helper(value); #else - primitive_helper(value); + return primitive_helper(value); #endif - return true; } bool NodeValueWriter::write_fixed(const ACE_CDR::Fixed& /*value*/) @@ -252,23 +239,20 @@ bool NodeValueWriter::write_fixed(const ACE_CDR::Fixed& /*value*/) bool NodeValueWriter::write_char8(ACE_CDR::Char value) { v8::MaybeLocal v8_value = Nan::New(&value, 1); - value_helper(v8_value); - return true; + return value_helper(v8_value); } bool NodeValueWriter::write_char16(ACE_CDR::WChar value) { const uint16_t c = static_cast(value); v8::MaybeLocal v8_value = Nan::New(&c, 1); - value_helper(v8_value); - return true; + return value_helper(v8_value); } bool NodeValueWriter::write_string(const ACE_CDR::Char* value, size_t length) { v8::MaybeLocal v8_value = Nan::New(value, length); - value_helper(v8_value); - return true; + return value_helper(v8_value); } bool NodeValueWriter::write_wstring(const ACE_CDR::WChar* value, size_t length) @@ -278,9 +262,8 @@ bool NodeValueWriter::write_wstring(const ACE_CDR::WChar* value, size_t length) str[i] = static_cast(value[i]); } v8::MaybeLocal v8_value = Nan::New(str, length); - value_helper(v8_value); delete [] str; - return true; + return value_helper(v8_value); } bool NodeValueWriter::write_enum(ACE_CDR::Long value, const OpenDDS::DCPS::EnumHelper& helper) @@ -290,15 +273,33 @@ bool NodeValueWriter::write_enum(ACE_CDR::Long value, const OpenDDS::DCPS::EnumH return false; } v8::MaybeLocal v8_value = Nan::New(name); - value_helper(v8_value); - return true; + return value_helper(v8_value); } bool NodeValueWriter::write_bitmask(ACE_CDR::ULongLong value, const OpenDDS::DCPS::BitmaskHelper& helper) { - const OpenDDS::DCPS::String flags = bitmask_to_string(value, helper); - v8::MaybeLocal v8_value = Nan::New(flags.c_str()); - value_helper(v8_value); + OPENDDS_VECTOR(OpenDDS::DCPS::String) flags; + helper.get_names(flags, value); + v8::MaybeLocal array = Nan::New(); + if (array.IsEmpty()) { + return false; + } + + uint32_t i = 0; + for (OPENDDS_VECTOR(OpenDDS::DCPS::String)::const_iterator it = flags.begin(); + it != flags.end(); ++it, ++i) { + v8::MaybeLocal flag = Nan::New(*it); + if (flag.IsEmpty()) { + return false; + } + Nan::Set(array.ToLocalChecked(), i, flag.ToLocalChecked()); + } + + if (object_stack_.empty()) { + return false; + } + + insert_object(array); return true; } diff --git a/src/NodeValueWriter.h b/src/NodeValueWriter.h index 99909e7..79828e2 100644 --- a/src/NodeValueWriter.h +++ b/src/NodeValueWriter.h @@ -61,14 +61,14 @@ class NodeValueWriter : public OpenDDS::DCPS::ValueWriter { bool write_absent_value(); template - void value_helper(v8::MaybeLocal& v8_value) + bool value_helper(v8::MaybeLocal& v8_value) { if (v8_value.IsEmpty()) { - return; + return false; } if (object_stack_.empty()) { - return; + return false; } if (object_stack_.back()->IsArray()) { @@ -76,42 +76,59 @@ class NodeValueWriter : public OpenDDS::DCPS::ValueWriter { Nan::Set(object_stack_.back(), next_index, v8_value.ToLocalChecked()); } else { v8::MaybeLocal key = Nan::New(next_key_.c_str()); - if (!key.IsEmpty()) { - Nan::Set(object_stack_.back(), key.ToLocalChecked(), v8_value.ToLocalChecked()); + if (key.IsEmpty()) { + return false; } + Nan::Set(object_stack_.back(), key.ToLocalChecked(), v8_value.ToLocalChecked()); } + return true; } template - void primitive_helper(T value) + bool primitive_helper(T value) { v8::MaybeLocal v8_value = Nan::New(value); - value_helper(v8_value); + return value_helper(v8_value); + } + + bool insert_object(v8::MaybeLocal& obj) + { + if (object_stack_.back()->IsArray()) { + uint32_t next_index = static_cast(next_index_); + Nan::Set(object_stack_.back(), next_index, obj.ToLocalChecked()); + } else { + v8::MaybeLocal key = Nan::New(next_key_.c_str()); + if (key.IsEmpty()) { + return false; + } + Nan::Set(object_stack_.back(), key.ToLocalChecked(), obj.ToLocalChecked()); + } + return true; } template - void object_helper() + bool object_helper() { v8::MaybeLocal temp = Nan::New(); if (temp.IsEmpty()) { - return; + return false; } if (!object_stack_.empty()) { - if (object_stack_.back()->IsArray()) { - uint32_t next_index = static_cast(next_index_); - Nan::Set(object_stack_.back(), next_index, temp.ToLocalChecked()); - } else { - v8::MaybeLocal key = Nan::New(next_key_.c_str()); - if (!key.IsEmpty()) { - Nan::Set(object_stack_.back(), key.ToLocalChecked(), temp.ToLocalChecked()); - } + if (!insert_object(temp)) { + return false; } } object_stack_.push_back(temp.ToLocalChecked()); + return true; } - v8::Local get_result() { v8::Local result = result_; result_.Clear(); return result; } + v8::Local get_result() + { + v8::Local result = result_; + result_.Clear(); + return result; + } private: