diff --git a/.gitmodules b/.gitmodules index 557bbbb..0a2d772 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,8 +1,9 @@ -[submodule "libs/protobuf/third_party/googletest"] - path = libs/protobuf/third_party/googletest - url = https://github.com/google/googletest.git - ignore = dirty - -[submodule "libs/protobuf/third_party/benchmark"] - path = libs/protobuf/third_party/benchmark - url = https://github.com/google/benchmark.git +[submodule "protobuf"] + path = libs/protobuf + url = https://github.com/protocolbuffers/protobuf.git +[submodule "libs/libzmq"] + path = libs/libzmq + url = https://github.com/zeromq/libzmq.git +[submodule "libs/cppzmq"] + path = libs/cppzmq + url = https://github.com/zeromq/cppzmq.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 9917cf8..ef9ee21 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,11 +25,13 @@ IF(NOT TARGET cppzmq) ENDIF() - +IF(NOT TARGET protobuf) +set(ABSL_PROPAGATE_CXX_STD ON CACHE INTERNAL "") set(protobuf_BUILD_TESTS OFF CACHE INTERNAL "") set(protobuf_BUILD_EXAMPLES OFF CACHE INTERNAL "") add_subdirectory(libs/protobuf ) include(protobuf) +ENDIF() protobuf_generate_cpp(PROTO_PATH include/WHISPER/Messages/Protos/ CPP_PATH include/WHISPER/Messages/Protos HPP_PATH include/WHISPER/Messages/Protos) diff --git a/include/WHISPER/Messages/Protos/join.pb.cc b/include/WHISPER/Messages/Protos/join.pb.cc index 2abbb8b..de0a927 100644 --- a/include/WHISPER/Messages/Protos/join.pb.cc +++ b/include/WHISPER/Messages/Protos/join.pb.cc @@ -4,274 +4,300 @@ #include "join.pb.h" #include - -#include -#include -#include -#include -#include -#include -#include +#include "google/protobuf/io/coded_stream.h" +#include "google/protobuf/extension_set.h" +#include "google/protobuf/wire_format_lite.h" +#include "google/protobuf/descriptor.h" +#include "google/protobuf/generated_message_reflection.h" +#include "google/protobuf/reflection_ops.h" +#include "google/protobuf/wire_format.h" +#include "google/protobuf/generated_message_tctable_impl.h" // @@protoc_insertion_point(includes) -#include +// Must be included last. +#include "google/protobuf/port_def.inc" PROTOBUF_PRAGMA_INIT_SEG - -namespace _pb = ::PROTOBUF_NAMESPACE_ID; -namespace _pbi = _pb::internal; - +namespace _pb = ::google::protobuf; +namespace _pbi = ::google::protobuf::internal; +namespace _fl = ::google::protobuf::internal::field_layout; namespace messages { namespace join { -PROTOBUF_CONSTEXPR Join::Join( - ::_pbi::ConstantInitialized): _impl_{ - /*decltype(_impl_.srcaddress_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}} - , /*decltype(_impl_.port_)*/0u - , /*decltype(_impl_._cached_size_)*/{}} {} + +inline constexpr Join::Impl_::Impl_( + ::_pbi::ConstantInitialized) noexcept + : srcaddress_( + &::google::protobuf::internal::fixed_address_empty_string, + ::_pbi::ConstantInitialized()), + port_{0u}, + _cached_size_{0} {} + +template +PROTOBUF_CONSTEXPR Join::Join(::_pbi::ConstantInitialized) + : _impl_(::_pbi::ConstantInitialized()) {} struct JoinDefaultTypeInternal { - PROTOBUF_CONSTEXPR JoinDefaultTypeInternal() - : _instance(::_pbi::ConstantInitialized{}) {} + PROTOBUF_CONSTEXPR JoinDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} ~JoinDefaultTypeInternal() {} union { Join _instance; }; }; -PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 JoinDefaultTypeInternal _Join_default_instance_; + +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 JoinDefaultTypeInternal _Join_default_instance_; } // namespace join } // namespace messages static ::_pb::Metadata file_level_metadata_join_2eproto[1]; -static constexpr ::_pb::EnumDescriptor const** file_level_enum_descriptors_join_2eproto = nullptr; -static constexpr ::_pb::ServiceDescriptor const** file_level_service_descriptors_join_2eproto = nullptr; - -const uint32_t TableStruct_join_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { - ~0u, // no _has_bits_ - PROTOBUF_FIELD_OFFSET(::messages::join::Join, _internal_metadata_), - ~0u, // no _extensions_ - ~0u, // no _oneof_case_ - ~0u, // no _weak_field_map_ - ~0u, // no _inlined_string_donated_ - PROTOBUF_FIELD_OFFSET(::messages::join::Join, _impl_.port_), - PROTOBUF_FIELD_OFFSET(::messages::join::Join, _impl_.srcaddress_), +static constexpr const ::_pb::EnumDescriptor** + file_level_enum_descriptors_join_2eproto = nullptr; +static constexpr const ::_pb::ServiceDescriptor** + file_level_service_descriptors_join_2eproto = nullptr; +const ::uint32_t + TableStruct_join_2eproto::offsets[] ABSL_ATTRIBUTE_SECTION_VARIABLE( + protodesc_cold) = { + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::messages::join::Join, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) + PROTOBUF_FIELD_OFFSET(::messages::join::Join, _impl_.port_), + PROTOBUF_FIELD_OFFSET(::messages::join::Join, _impl_.srcaddress_), }; -static const ::_pbi::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { - { 0, -1, -1, sizeof(::messages::join::Join)}, + +static const ::_pbi::MigrationSchema + schemas[] ABSL_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { + {0, -1, -1, sizeof(::messages::join::Join)}, }; static const ::_pb::Message* const file_default_instances[] = { - &::messages::join::_Join_default_instance_._instance, + &::messages::join::_Join_default_instance_._instance, }; - -const char descriptor_table_protodef_join_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = - "\n\njoin.proto\022\rmessages.join\"(\n\004Join\022\014\n\004p" - "ort\030\001 \001(\r\022\022\n\nsrcAddress\030\002 \001(\tb\006proto3" - ; -static ::_pbi::once_flag descriptor_table_join_2eproto_once; +const char descriptor_table_protodef_join_2eproto[] ABSL_ATTRIBUTE_SECTION_VARIABLE( + protodesc_cold) = { + "\n\njoin.proto\022\rmessages.join\"(\n\004Join\022\014\n\004p" + "ort\030\001 \001(\r\022\022\n\nsrcAddress\030\002 \001(\tb\006proto3" +}; +static ::absl::once_flag descriptor_table_join_2eproto_once; const ::_pbi::DescriptorTable descriptor_table_join_2eproto = { - false, false, 77, descriptor_table_protodef_join_2eproto, + false, + false, + 77, + descriptor_table_protodef_join_2eproto, "join.proto", - &descriptor_table_join_2eproto_once, nullptr, 0, 1, - schemas, file_default_instances, TableStruct_join_2eproto::offsets, - file_level_metadata_join_2eproto, file_level_enum_descriptors_join_2eproto, + &descriptor_table_join_2eproto_once, + nullptr, + 0, + 1, + schemas, + file_default_instances, + TableStruct_join_2eproto::offsets, + file_level_metadata_join_2eproto, + file_level_enum_descriptors_join_2eproto, file_level_service_descriptors_join_2eproto, }; + +// This function exists to be marked as weak. +// It can significantly speed up compilation by breaking up LLVM's SCC +// in the .pb.cc translation units. Large translation units see a +// reduction of more than 35% of walltime for optimized builds. Without +// the weak attribute all the messages in the file, including all the +// vtables and everything they use become part of the same SCC through +// a cycle like: +// GetMetadata -> descriptor table -> default instances -> +// vtables -> GetMetadata +// By adding a weak function here we break the connection from the +// individual vtables back into the descriptor table. PROTOBUF_ATTRIBUTE_WEAK const ::_pbi::DescriptorTable* descriptor_table_join_2eproto_getter() { return &descriptor_table_join_2eproto; } - // Force running AddDescriptors() at dynamic initialization time. -PROTOBUF_ATTRIBUTE_INIT_PRIORITY2 static ::_pbi::AddDescriptorsRunner dynamic_init_dummy_join_2eproto(&descriptor_table_join_2eproto); +PROTOBUF_ATTRIBUTE_INIT_PRIORITY2 +static ::_pbi::AddDescriptorsRunner dynamic_init_dummy_join_2eproto(&descriptor_table_join_2eproto); namespace messages { namespace join { - // =================================================================== class Join::_Internal { public: }; -Join::Join(::PROTOBUF_NAMESPACE_ID::Arena* arena, - bool is_message_owned) - : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { - SharedCtor(arena, is_message_owned); +Join::Join(::google::protobuf::Arena* arena) + : ::google::protobuf::Message(arena) { + SharedCtor(arena); // @@protoc_insertion_point(arena_constructor:messages.join.Join) } -Join::Join(const Join& from) - : ::PROTOBUF_NAMESPACE_ID::Message() { - Join* const _this = this; (void)_this; - new (&_impl_) Impl_{ - decltype(_impl_.srcaddress_){} - , decltype(_impl_.port_){} - , /*decltype(_impl_._cached_size_)*/{}}; +inline PROTOBUF_NDEBUG_INLINE Join::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, + const Impl_& from) + : srcaddress_(arena, from.srcaddress_), + _cached_size_{0} {} + +Join::Join( + ::google::protobuf::Arena* arena, + const Join& from) + : ::google::protobuf::Message(arena) { + Join* const _this = this; + (void)_this; + _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( + from._internal_metadata_); + new (&_impl_) Impl_(internal_visibility(), arena, from._impl_); + _impl_.port_ = from._impl_.port_; - _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); - _impl_.srcaddress_.InitDefault(); - #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - _impl_.srcaddress_.Set("", GetArenaForAllocation()); - #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (!from._internal_srcaddress().empty()) { - _this->_impl_.srcaddress_.Set(from._internal_srcaddress(), - _this->GetArenaForAllocation()); - } - _this->_impl_.port_ = from._impl_.port_; // @@protoc_insertion_point(copy_constructor:messages.join.Join) } +inline PROTOBUF_NDEBUG_INLINE Join::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* arena) + : srcaddress_(arena), + _cached_size_{0} {} -inline void Join::SharedCtor( - ::_pb::Arena* arena, bool is_message_owned) { - (void)arena; - (void)is_message_owned; - new (&_impl_) Impl_{ - decltype(_impl_.srcaddress_){} - , decltype(_impl_.port_){0u} - , /*decltype(_impl_._cached_size_)*/{} - }; - _impl_.srcaddress_.InitDefault(); - #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - _impl_.srcaddress_.Set("", GetArenaForAllocation()); - #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +inline void Join::SharedCtor(::_pb::Arena* arena) { + new (&_impl_) Impl_(internal_visibility(), arena); + _impl_.port_ = {}; } - Join::~Join() { // @@protoc_insertion_point(destructor:messages.join.Join) - if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) { - (void)arena; - return; - } + _internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>(); SharedDtor(); } - inline void Join::SharedDtor() { - GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + ABSL_DCHECK(GetArena() == nullptr); _impl_.srcaddress_.Destroy(); + _impl_.~Impl_(); } -void Join::SetCachedSize(int size) const { - _impl_._cached_size_.Set(size); +const ::google::protobuf::MessageLite::ClassData* +Join::GetClassData() const { + PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite::ClassData + _data_ = { + Join::MergeImpl, + nullptr, // OnDemandRegisterArenaDtor + &::google::protobuf::Message::kDescriptorMethods, + PROTOBUF_FIELD_OFFSET(Join, _impl_._cached_size_), + }; + return &_data_; } - -void Join::Clear() { +PROTOBUF_NOINLINE void Join::Clear() { // @@protoc_insertion_point(message_clear_start:messages.join.Join) - uint32_t cached_has_bits = 0; + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + ::uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; _impl_.srcaddress_.ClearToEmpty(); _impl_.port_ = 0u; - _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); } -const char* Join::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) { -#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure - while (!ctx->Done(&ptr)) { - uint32_t tag; - ptr = ::_pbi::ReadTag(ptr, &tag); - switch (tag >> 3) { - // uint32 port = 1; - case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { - _impl_.port_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); - CHK_(ptr); - } else - goto handle_unusual; - continue; - // string srcAddress = 2; - case 2: - if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 18)) { - auto str = _internal_mutable_srcaddress(); - ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx); - CHK_(ptr); - CHK_(::_pbi::VerifyUTF8(str, "messages.join.Join.srcAddress")); - } else - goto handle_unusual; - continue; - default: - goto handle_unusual; - } // switch - handle_unusual: - if ((tag == 0) || ((tag & 7) == 4)) { - CHK_(ptr); - ctx->SetLastTag(tag); - goto message_done; - } - ptr = UnknownFieldParse( - tag, - _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), - ptr, ctx); - CHK_(ptr != nullptr); - } // while -message_done: +const char* Join::_InternalParse( + const char* ptr, ::_pbi::ParseContext* ctx) { + ptr = ::_pbi::TcParser::ParseLoop(this, ptr, ctx, &_table_.header); return ptr; -failure: - ptr = nullptr; - goto message_done; -#undef CHK_ } -uint8_t* Join::_InternalSerialize( - uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + +PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 +const ::_pbi::TcParseTable<1, 2, 0, 37, 2> Join::_table_ = { + { + 0, // no _has_bits_ + 0, // no _extensions_ + 2, 8, // max_field_number, fast_idx_mask + offsetof(decltype(_table_), field_lookup_table), + 4294967292, // skipmap + offsetof(decltype(_table_), field_entries), + 2, // num_field_entries + 0, // num_aux_entries + offsetof(decltype(_table_), field_names), // no aux_entries + &_Join_default_instance_._instance, + ::_pbi::TcParser::GenericFallback, // fallback + }, {{ + // string srcAddress = 2; + {::_pbi::TcParser::FastUS1, + {18, 63, 0, PROTOBUF_FIELD_OFFSET(Join, _impl_.srcaddress_)}}, + // uint32 port = 1; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(Join, _impl_.port_), 63>(), + {8, 63, 0, PROTOBUF_FIELD_OFFSET(Join, _impl_.port_)}}, + }}, {{ + 65535, 65535 + }}, {{ + // uint32 port = 1; + {PROTOBUF_FIELD_OFFSET(Join, _impl_.port_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kUInt32)}, + // string srcAddress = 2; + {PROTOBUF_FIELD_OFFSET(Join, _impl_.srcaddress_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + }}, + // no aux_entries + {{ + "\22\0\12\0\0\0\0\0" + "messages.join.Join" + "srcAddress" + }}, +}; + +::uint8_t* Join::_InternalSerialize( + ::uint8_t* target, + ::google::protobuf::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:messages.join.Join) - uint32_t cached_has_bits = 0; - (void) cached_has_bits; + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; // uint32 port = 1; if (this->_internal_port() != 0) { target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteUInt32ToArray(1, this->_internal_port(), target); + target = ::_pbi::WireFormatLite::WriteUInt32ToArray( + 1, this->_internal_port(), target); } // string srcAddress = 2; if (!this->_internal_srcaddress().empty()) { - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( - this->_internal_srcaddress().data(), static_cast(this->_internal_srcaddress().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, - "messages.join.Join.srcAddress"); - target = stream->WriteStringMaybeAliased( - 2, this->_internal_srcaddress(), target); + const std::string& _s = this->_internal_srcaddress(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "messages.join.Join.srcAddress"); + target = stream->WriteStringMaybeAliased(2, _s, target); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); } // @@protoc_insertion_point(serialize_to_array_end:messages.join.Join) return target; } -size_t Join::ByteSizeLong() const { +::size_t Join::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:messages.join.Join) - size_t total_size = 0; + ::size_t total_size = 0; - uint32_t cached_has_bits = 0; + ::uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; // string srcAddress = 2; if (!this->_internal_srcaddress().empty()) { - total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( - this->_internal_srcaddress()); + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this->_internal_srcaddress()); } // uint32 port = 1; if (this->_internal_port() != 0) { - total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_port()); + total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne( + this->_internal_port()); } return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } -const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Join::_class_data_ = { - ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck, - Join::MergeImpl -}; -const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*Join::GetClassData() const { return &_class_data_; } - -void Join::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) { +void Join::MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg) { auto* const _this = static_cast(&to_msg); auto& from = static_cast(from_msg); // @@protoc_insertion_point(class_specific_merge_from_start:messages.join.Join) - GOOGLE_DCHECK_NE(&from, _this); - uint32_t cached_has_bits = 0; + ABSL_DCHECK_NE(&from, _this); + ::uint32_t cached_has_bits = 0; (void) cached_has_bits; if (!from._internal_srcaddress().empty()) { @@ -280,7 +306,7 @@ void Join::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_ if (from._internal_port() != 0) { _this->_internal_set_port(from._internal_port()); } - _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } void Join::CopyFrom(const Join& from) { @@ -290,37 +316,30 @@ void Join::CopyFrom(const Join& from) { MergeFrom(from); } -bool Join::IsInitialized() const { +PROTOBUF_NOINLINE bool Join::IsInitialized() const { return true; } -void Join::InternalSwap(Join* other) { +void Join::InternalSwap(Join* PROTOBUF_RESTRICT other) { using std::swap; - auto* lhs_arena = GetArenaForAllocation(); - auto* rhs_arena = other->GetArenaForAllocation(); + auto* arena = GetArena(); + ABSL_DCHECK_EQ(arena, other->GetArena()); _internal_metadata_.InternalSwap(&other->_internal_metadata_); - ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( - &_impl_.srcaddress_, lhs_arena, - &other->_impl_.srcaddress_, rhs_arena - ); - swap(_impl_.port_, other->_impl_.port_); + ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.srcaddress_, &other->_impl_.srcaddress_, arena); + swap(_impl_.port_, other->_impl_.port_); } -::PROTOBUF_NAMESPACE_ID::Metadata Join::GetMetadata() const { +::google::protobuf::Metadata Join::GetMetadata() const { return ::_pbi::AssignDescriptors( &descriptor_table_join_2eproto_getter, &descriptor_table_join_2eproto_once, file_level_metadata_join_2eproto[0]); } - // @@protoc_insertion_point(namespace_scope) } // namespace join } // namespace messages -PROTOBUF_NAMESPACE_OPEN -template<> PROTOBUF_NOINLINE ::messages::join::Join* -Arena::CreateMaybeMessage< ::messages::join::Join >(Arena* arena) { - return Arena::CreateMessageInternal< ::messages::join::Join >(arena); -} -PROTOBUF_NAMESPACE_CLOSE - +namespace google { +namespace protobuf { +} // namespace protobuf +} // namespace google // @@protoc_insertion_point(global_scope) -#include +#include "google/protobuf/port_undef.inc" diff --git a/include/WHISPER/Messages/Protos/join.pb.h b/include/WHISPER/Messages/Protos/join.pb.h index 4ca2e52..264485b 100644 --- a/include/WHISPER/Messages/Protos/join.pb.h +++ b/include/WHISPER/Messages/Protos/join.pb.h @@ -1,49 +1,60 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: join.proto +// Protobuf C++ Version: 4.24.0-main -#ifndef GOOGLE_PROTOBUF_INCLUDED_join_2eproto -#define GOOGLE_PROTOBUF_INCLUDED_join_2eproto +#ifndef GOOGLE_PROTOBUF_INCLUDED_join_2eproto_2epb_2eh +#define GOOGLE_PROTOBUF_INCLUDED_join_2eproto_2epb_2eh #include #include +#include +#include -#include -#if PROTOBUF_VERSION < 3021000 -#error This file was generated by a newer version of protoc which is -#error incompatible with your Protocol Buffer headers. Please update -#error your headers. -#endif -#if 3021012 < PROTOBUF_MIN_PROTOC_VERSION -#error This file was generated by an older version of protoc which is -#error incompatible with your Protocol Buffer headers. Please -#error regenerate this file with a newer version of protoc. -#endif +#include "google/protobuf/port_def.inc" +#if PROTOBUF_VERSION < 4025000 +#error "This file was generated by a newer version of protoc which is" +#error "incompatible with your Protocol Buffer headers. Please update" +#error "your headers." +#endif // PROTOBUF_VERSION -#include -#include -#include -#include -#include -#include -#include -#include -#include // IWYU pragma: export -#include // IWYU pragma: export -#include +#if 4025000 < PROTOBUF_MIN_PROTOC_VERSION +#error "This file was generated by an older version of protoc which is" +#error "incompatible with your Protocol Buffer headers. Please" +#error "regenerate this file with a newer version of protoc." +#endif // PROTOBUF_MIN_PROTOC_VERSION +#include "google/protobuf/port_undef.inc" +#include "google/protobuf/io/coded_stream.h" +#include "google/protobuf/arena.h" +#include "google/protobuf/arenastring.h" +#include "google/protobuf/generated_message_tctable_decl.h" +#include "google/protobuf/generated_message_util.h" +#include "google/protobuf/metadata_lite.h" +#include "google/protobuf/generated_message_reflection.h" +#include "google/protobuf/message.h" +#include "google/protobuf/repeated_field.h" // IWYU pragma: export +#include "google/protobuf/extension_set.h" // IWYU pragma: export +#include "google/protobuf/unknown_field_set.h" // @@protoc_insertion_point(includes) -#include + +// Must be included last. +#include "google/protobuf/port_def.inc" + #define PROTOBUF_INTERNAL_EXPORT_join_2eproto -PROTOBUF_NAMESPACE_OPEN + +namespace google { +namespace protobuf { namespace internal { class AnyMetadata; } // namespace internal -PROTOBUF_NAMESPACE_CLOSE +} // namespace protobuf +} // namespace google // Internal implementation detail -- do not use these members. struct TableStruct_join_2eproto { - static const uint32_t offsets[]; + static const ::uint32_t offsets[]; }; -extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_join_2eproto; +extern const ::google::protobuf::internal::DescriptorTable + descriptor_table_join_2eproto; namespace messages { namespace join { class Join; @@ -51,22 +62,29 @@ struct JoinDefaultTypeInternal; extern JoinDefaultTypeInternal _Join_default_instance_; } // namespace join } // namespace messages -PROTOBUF_NAMESPACE_OPEN -template<> ::messages::join::Join* Arena::CreateMaybeMessage<::messages::join::Join>(Arena*); -PROTOBUF_NAMESPACE_CLOSE +namespace google { +namespace protobuf { +} // namespace protobuf +} // namespace google + namespace messages { namespace join { // =================================================================== + +// ------------------------------------------------------------------- + class Join final : - public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:messages.join.Join) */ { + public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:messages.join.Join) */ { public: inline Join() : Join(nullptr) {} ~Join() override; - explicit PROTOBUF_CONSTEXPR Join(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + template + explicit PROTOBUF_CONSTEXPR Join(::google::protobuf::internal::ConstantInitialized); - Join(const Join& from); + inline Join(const Join& from) + : Join(nullptr, from) {} Join(Join&& from) noexcept : Join() { *this = ::std::move(from); @@ -78,9 +96,9 @@ class Join final : } inline Join& operator=(Join&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena() + if (GetArena() == from.GetArena() #ifdef PROTOBUF_FORCE_COPY_IN_MOVE - && GetOwningArena() != nullptr + && GetArena() != nullptr #endif // !PROTOBUF_FORCE_COPY_IN_MOVE ) { InternalSwap(&from); @@ -90,13 +108,22 @@ class Join final : return *this; } - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const + ABSL_ATTRIBUTE_LIFETIME_BOUND { + return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); + } + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + ABSL_ATTRIBUTE_LIFETIME_BOUND { + return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); + } + + static const ::google::protobuf::Descriptor* descriptor() { return GetDescriptor(); } - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* GetReflection() { return default_instance().GetMetadata().reflection; } static const Join& default_instance() { @@ -115,65 +142,62 @@ class Join final : inline void Swap(Join* other) { if (other == this) return; #ifdef PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() != nullptr && - GetOwningArena() == other->GetOwningArena()) { + if (GetArena() != nullptr && + GetArena() == other->GetArena()) { #else // PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() == other->GetOwningArena()) { + if (GetArena() == other->GetArena()) { #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { - ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + ::google::protobuf::internal::GenericSwap(this, other); } } void UnsafeArenaSwap(Join* other) { if (other == this) return; - GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); } // implements Message ---------------------------------------------- - Join* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + Join* New(::google::protobuf::Arena* arena = nullptr) const final { return CreateMaybeMessage(arena); } - using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + using ::google::protobuf::Message::CopyFrom; void CopyFrom(const Join& from); - using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + using ::google::protobuf::Message::MergeFrom; void MergeFrom( const Join& from) { Join::MergeImpl(*this, from); } private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); + static void MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg); public: - PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + ABSL_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; - size_t ByteSizeLong() const final; - const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - uint8_t* _InternalSerialize( - uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; - int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + ::size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::google::protobuf::internal::ParseContext* ctx) final; + ::uint8_t* _InternalSerialize( + ::uint8_t* target, ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedCtor(::google::protobuf::Arena* arena); void SharedDtor(); - void SetCachedSize(int size) const final; void InternalSwap(Join* other); private: - friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; - static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + friend class ::google::protobuf::internal::AnyMetadata; + static ::absl::string_view FullMessageName() { return "messages.join.Join"; } protected: - explicit Join(::PROTOBUF_NAMESPACE_ID::Arena* arena, - bool is_message_owned = false); + explicit Join(::google::protobuf::Arena* arena); + Join(::google::protobuf::Arena* arena, const Join& from); + const ::google::protobuf::MessageLite::ClassData* GetClassData() const final; public: - static const ClassData _class_data_; - const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; - - ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + ::google::protobuf::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- @@ -184,134 +208,166 @@ class Join final : kPortFieldNumber = 1, }; // string srcAddress = 2; - void clear_srcaddress(); + void clear_srcaddress() ; const std::string& srcaddress() const; - template - void set_srcaddress(ArgT0&& arg0, ArgT... args); + template + void set_srcaddress(Arg_&& arg, Args_... args); std::string* mutable_srcaddress(); PROTOBUF_NODISCARD std::string* release_srcaddress(); - void set_allocated_srcaddress(std::string* srcaddress); + void set_allocated_srcaddress(std::string* value); + private: const std::string& _internal_srcaddress() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_srcaddress(const std::string& value); + inline PROTOBUF_ALWAYS_INLINE void _internal_set_srcaddress( + const std::string& value); std::string* _internal_mutable_srcaddress(); - public: + public: // uint32 port = 1; - void clear_port(); - uint32_t port() const; - void set_port(uint32_t value); - private: - uint32_t _internal_port() const; - void _internal_set_port(uint32_t value); - public: + void clear_port() ; + ::uint32_t port() const; + void set_port(::uint32_t value); + private: + ::uint32_t _internal_port() const; + void _internal_set_port(::uint32_t value); + + public: // @@protoc_insertion_point(class_scope:messages.join.Join) private: class _Internal; - template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; - typedef void InternalArenaConstructable_; - typedef void DestructorSkippable_; + friend class ::google::protobuf::internal::TcParser; + static const ::google::protobuf::internal::TcParseTable< + 1, 2, 0, + 37, 2> + _table_; + friend class ::google::protobuf::MessageLite; + friend class ::google::protobuf::Arena; + template + friend class ::google::protobuf::Arena::InternalHelper; + using InternalArenaConstructable_ = void; + using DestructorSkippable_ = void; struct Impl_ { - ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr srcaddress_; - uint32_t port_; - mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + + inline explicit constexpr Impl_( + ::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* arena); + inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* arena, const Impl_& from); + ::google::protobuf::internal::ArenaStringPtr srcaddress_; + ::uint32_t port_; + mutable ::google::protobuf::internal::CachedSize _cached_size_; + PROTOBUF_TSAN_DECLARE_MEMBER }; union { Impl_ _impl_; }; friend struct ::TableStruct_join_2eproto; }; + // =================================================================== + + // =================================================================== + #ifdef __GNUC__ - #pragma GCC diagnostic push - #pragma GCC diagnostic ignored "-Wstrict-aliasing" +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wstrict-aliasing" #endif // __GNUC__ +// ------------------------------------------------------------------- + // Join // uint32 port = 1; inline void Join::clear_port() { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); _impl_.port_ = 0u; } -inline uint32_t Join::_internal_port() const { - return _impl_.port_; -} -inline uint32_t Join::port() const { +inline ::uint32_t Join::port() const { // @@protoc_insertion_point(field_get:messages.join.Join.port) return _internal_port(); } -inline void Join::_internal_set_port(uint32_t value) { - - _impl_.port_ = value; -} -inline void Join::set_port(uint32_t value) { +inline void Join::set_port(::uint32_t value) { _internal_set_port(value); // @@protoc_insertion_point(field_set:messages.join.Join.port) } +inline ::uint32_t Join::_internal_port() const { + PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race); + return _impl_.port_; +} +inline void Join::_internal_set_port(::uint32_t value) { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + ; + _impl_.port_ = value; +} // string srcAddress = 2; inline void Join::clear_srcaddress() { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); _impl_.srcaddress_.ClearToEmpty(); } -inline const std::string& Join::srcaddress() const { +inline const std::string& Join::srcaddress() const + ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_get:messages.join.Join.srcAddress) return _internal_srcaddress(); } -template -inline PROTOBUF_ALWAYS_INLINE -void Join::set_srcaddress(ArgT0&& arg0, ArgT... args) { - - _impl_.srcaddress_.Set(static_cast(arg0), args..., GetArenaForAllocation()); +template +inline PROTOBUF_ALWAYS_INLINE void Join::set_srcaddress(Arg_&& arg, + Args_... args) { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + ; + _impl_.srcaddress_.Set(static_cast(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:messages.join.Join.srcAddress) } -inline std::string* Join::mutable_srcaddress() { +inline std::string* Join::mutable_srcaddress() ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_srcaddress(); // @@protoc_insertion_point(field_mutable:messages.join.Join.srcAddress) return _s; } inline const std::string& Join::_internal_srcaddress() const { + PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race); return _impl_.srcaddress_.Get(); } inline void Join::_internal_set_srcaddress(const std::string& value) { - - _impl_.srcaddress_.Set(value, GetArenaForAllocation()); + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + ; + _impl_.srcaddress_.Set(value, GetArena()); } inline std::string* Join::_internal_mutable_srcaddress() { - - return _impl_.srcaddress_.Mutable(GetArenaForAllocation()); + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + ; + return _impl_.srcaddress_.Mutable( GetArena()); } inline std::string* Join::release_srcaddress() { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); // @@protoc_insertion_point(field_release:messages.join.Join.srcAddress) return _impl_.srcaddress_.Release(); } -inline void Join::set_allocated_srcaddress(std::string* srcaddress) { - if (srcaddress != nullptr) { - - } else { - - } - _impl_.srcaddress_.SetAllocated(srcaddress, GetArenaForAllocation()); -#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (_impl_.srcaddress_.IsDefault()) { - _impl_.srcaddress_.Set("", GetArenaForAllocation()); - } -#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +inline void Join::set_allocated_srcaddress(std::string* value) { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + _impl_.srcaddress_.SetAllocated(value, GetArena()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.srcaddress_.IsDefault()) { + _impl_.srcaddress_.Set("", GetArena()); + } + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:messages.join.Join.srcAddress) } #ifdef __GNUC__ - #pragma GCC diagnostic pop +#pragma GCC diagnostic pop #endif // __GNUC__ // @@protoc_insertion_point(namespace_scope) - } // namespace join } // namespace messages + // @@protoc_insertion_point(global_scope) -#include -#endif // GOOGLE_PROTOBUF_INCLUDED_GOOGLE_PROTOBUF_INCLUDED_join_2eproto +#include "google/protobuf/port_undef.inc" + +#endif // GOOGLE_PROTOBUF_INCLUDED_join_2eproto_2epb_2eh diff --git a/include/WHISPER/Messages/Protos/leave.pb.cc b/include/WHISPER/Messages/Protos/leave.pb.cc index 9c650d8..2447cd9 100644 --- a/include/WHISPER/Messages/Protos/leave.pb.cc +++ b/include/WHISPER/Messages/Protos/leave.pb.cc @@ -4,274 +4,300 @@ #include "leave.pb.h" #include - -#include -#include -#include -#include -#include -#include -#include +#include "google/protobuf/io/coded_stream.h" +#include "google/protobuf/extension_set.h" +#include "google/protobuf/wire_format_lite.h" +#include "google/protobuf/descriptor.h" +#include "google/protobuf/generated_message_reflection.h" +#include "google/protobuf/reflection_ops.h" +#include "google/protobuf/wire_format.h" +#include "google/protobuf/generated_message_tctable_impl.h" // @@protoc_insertion_point(includes) -#include +// Must be included last. +#include "google/protobuf/port_def.inc" PROTOBUF_PRAGMA_INIT_SEG - -namespace _pb = ::PROTOBUF_NAMESPACE_ID; -namespace _pbi = _pb::internal; - +namespace _pb = ::google::protobuf; +namespace _pbi = ::google::protobuf::internal; +namespace _fl = ::google::protobuf::internal::field_layout; namespace messages { namespace leave { -PROTOBUF_CONSTEXPR Leave::Leave( - ::_pbi::ConstantInitialized): _impl_{ - /*decltype(_impl_.srcaddress_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}} - , /*decltype(_impl_.port_)*/0u - , /*decltype(_impl_._cached_size_)*/{}} {} + +inline constexpr Leave::Impl_::Impl_( + ::_pbi::ConstantInitialized) noexcept + : srcaddress_( + &::google::protobuf::internal::fixed_address_empty_string, + ::_pbi::ConstantInitialized()), + port_{0u}, + _cached_size_{0} {} + +template +PROTOBUF_CONSTEXPR Leave::Leave(::_pbi::ConstantInitialized) + : _impl_(::_pbi::ConstantInitialized()) {} struct LeaveDefaultTypeInternal { - PROTOBUF_CONSTEXPR LeaveDefaultTypeInternal() - : _instance(::_pbi::ConstantInitialized{}) {} + PROTOBUF_CONSTEXPR LeaveDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} ~LeaveDefaultTypeInternal() {} union { Leave _instance; }; }; -PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 LeaveDefaultTypeInternal _Leave_default_instance_; + +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 LeaveDefaultTypeInternal _Leave_default_instance_; } // namespace leave } // namespace messages static ::_pb::Metadata file_level_metadata_leave_2eproto[1]; -static constexpr ::_pb::EnumDescriptor const** file_level_enum_descriptors_leave_2eproto = nullptr; -static constexpr ::_pb::ServiceDescriptor const** file_level_service_descriptors_leave_2eproto = nullptr; - -const uint32_t TableStruct_leave_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { - ~0u, // no _has_bits_ - PROTOBUF_FIELD_OFFSET(::messages::leave::Leave, _internal_metadata_), - ~0u, // no _extensions_ - ~0u, // no _oneof_case_ - ~0u, // no _weak_field_map_ - ~0u, // no _inlined_string_donated_ - PROTOBUF_FIELD_OFFSET(::messages::leave::Leave, _impl_.port_), - PROTOBUF_FIELD_OFFSET(::messages::leave::Leave, _impl_.srcaddress_), +static constexpr const ::_pb::EnumDescriptor** + file_level_enum_descriptors_leave_2eproto = nullptr; +static constexpr const ::_pb::ServiceDescriptor** + file_level_service_descriptors_leave_2eproto = nullptr; +const ::uint32_t + TableStruct_leave_2eproto::offsets[] ABSL_ATTRIBUTE_SECTION_VARIABLE( + protodesc_cold) = { + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::messages::leave::Leave, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) + PROTOBUF_FIELD_OFFSET(::messages::leave::Leave, _impl_.port_), + PROTOBUF_FIELD_OFFSET(::messages::leave::Leave, _impl_.srcaddress_), }; -static const ::_pbi::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { - { 0, -1, -1, sizeof(::messages::leave::Leave)}, + +static const ::_pbi::MigrationSchema + schemas[] ABSL_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { + {0, -1, -1, sizeof(::messages::leave::Leave)}, }; static const ::_pb::Message* const file_default_instances[] = { - &::messages::leave::_Leave_default_instance_._instance, + &::messages::leave::_Leave_default_instance_._instance, }; - -const char descriptor_table_protodef_leave_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = - "\n\013leave.proto\022\016messages.leave\")\n\005Leave\022\014" - "\n\004port\030\001 \001(\r\022\022\n\nsrcAddress\030\002 \001(\tb\006proto3" - ; -static ::_pbi::once_flag descriptor_table_leave_2eproto_once; +const char descriptor_table_protodef_leave_2eproto[] ABSL_ATTRIBUTE_SECTION_VARIABLE( + protodesc_cold) = { + "\n\013leave.proto\022\016messages.leave\")\n\005Leave\022\014" + "\n\004port\030\001 \001(\r\022\022\n\nsrcAddress\030\002 \001(\tb\006proto3" +}; +static ::absl::once_flag descriptor_table_leave_2eproto_once; const ::_pbi::DescriptorTable descriptor_table_leave_2eproto = { - false, false, 80, descriptor_table_protodef_leave_2eproto, + false, + false, + 80, + descriptor_table_protodef_leave_2eproto, "leave.proto", - &descriptor_table_leave_2eproto_once, nullptr, 0, 1, - schemas, file_default_instances, TableStruct_leave_2eproto::offsets, - file_level_metadata_leave_2eproto, file_level_enum_descriptors_leave_2eproto, + &descriptor_table_leave_2eproto_once, + nullptr, + 0, + 1, + schemas, + file_default_instances, + TableStruct_leave_2eproto::offsets, + file_level_metadata_leave_2eproto, + file_level_enum_descriptors_leave_2eproto, file_level_service_descriptors_leave_2eproto, }; + +// This function exists to be marked as weak. +// It can significantly speed up compilation by breaking up LLVM's SCC +// in the .pb.cc translation units. Large translation units see a +// reduction of more than 35% of walltime for optimized builds. Without +// the weak attribute all the messages in the file, including all the +// vtables and everything they use become part of the same SCC through +// a cycle like: +// GetMetadata -> descriptor table -> default instances -> +// vtables -> GetMetadata +// By adding a weak function here we break the connection from the +// individual vtables back into the descriptor table. PROTOBUF_ATTRIBUTE_WEAK const ::_pbi::DescriptorTable* descriptor_table_leave_2eproto_getter() { return &descriptor_table_leave_2eproto; } - // Force running AddDescriptors() at dynamic initialization time. -PROTOBUF_ATTRIBUTE_INIT_PRIORITY2 static ::_pbi::AddDescriptorsRunner dynamic_init_dummy_leave_2eproto(&descriptor_table_leave_2eproto); +PROTOBUF_ATTRIBUTE_INIT_PRIORITY2 +static ::_pbi::AddDescriptorsRunner dynamic_init_dummy_leave_2eproto(&descriptor_table_leave_2eproto); namespace messages { namespace leave { - // =================================================================== class Leave::_Internal { public: }; -Leave::Leave(::PROTOBUF_NAMESPACE_ID::Arena* arena, - bool is_message_owned) - : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { - SharedCtor(arena, is_message_owned); +Leave::Leave(::google::protobuf::Arena* arena) + : ::google::protobuf::Message(arena) { + SharedCtor(arena); // @@protoc_insertion_point(arena_constructor:messages.leave.Leave) } -Leave::Leave(const Leave& from) - : ::PROTOBUF_NAMESPACE_ID::Message() { - Leave* const _this = this; (void)_this; - new (&_impl_) Impl_{ - decltype(_impl_.srcaddress_){} - , decltype(_impl_.port_){} - , /*decltype(_impl_._cached_size_)*/{}}; +inline PROTOBUF_NDEBUG_INLINE Leave::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, + const Impl_& from) + : srcaddress_(arena, from.srcaddress_), + _cached_size_{0} {} + +Leave::Leave( + ::google::protobuf::Arena* arena, + const Leave& from) + : ::google::protobuf::Message(arena) { + Leave* const _this = this; + (void)_this; + _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( + from._internal_metadata_); + new (&_impl_) Impl_(internal_visibility(), arena, from._impl_); + _impl_.port_ = from._impl_.port_; - _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); - _impl_.srcaddress_.InitDefault(); - #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - _impl_.srcaddress_.Set("", GetArenaForAllocation()); - #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (!from._internal_srcaddress().empty()) { - _this->_impl_.srcaddress_.Set(from._internal_srcaddress(), - _this->GetArenaForAllocation()); - } - _this->_impl_.port_ = from._impl_.port_; // @@protoc_insertion_point(copy_constructor:messages.leave.Leave) } +inline PROTOBUF_NDEBUG_INLINE Leave::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* arena) + : srcaddress_(arena), + _cached_size_{0} {} -inline void Leave::SharedCtor( - ::_pb::Arena* arena, bool is_message_owned) { - (void)arena; - (void)is_message_owned; - new (&_impl_) Impl_{ - decltype(_impl_.srcaddress_){} - , decltype(_impl_.port_){0u} - , /*decltype(_impl_._cached_size_)*/{} - }; - _impl_.srcaddress_.InitDefault(); - #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - _impl_.srcaddress_.Set("", GetArenaForAllocation()); - #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +inline void Leave::SharedCtor(::_pb::Arena* arena) { + new (&_impl_) Impl_(internal_visibility(), arena); + _impl_.port_ = {}; } - Leave::~Leave() { // @@protoc_insertion_point(destructor:messages.leave.Leave) - if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) { - (void)arena; - return; - } + _internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>(); SharedDtor(); } - inline void Leave::SharedDtor() { - GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + ABSL_DCHECK(GetArena() == nullptr); _impl_.srcaddress_.Destroy(); + _impl_.~Impl_(); } -void Leave::SetCachedSize(int size) const { - _impl_._cached_size_.Set(size); +const ::google::protobuf::MessageLite::ClassData* +Leave::GetClassData() const { + PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite::ClassData + _data_ = { + Leave::MergeImpl, + nullptr, // OnDemandRegisterArenaDtor + &::google::protobuf::Message::kDescriptorMethods, + PROTOBUF_FIELD_OFFSET(Leave, _impl_._cached_size_), + }; + return &_data_; } - -void Leave::Clear() { +PROTOBUF_NOINLINE void Leave::Clear() { // @@protoc_insertion_point(message_clear_start:messages.leave.Leave) - uint32_t cached_has_bits = 0; + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + ::uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; _impl_.srcaddress_.ClearToEmpty(); _impl_.port_ = 0u; - _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); } -const char* Leave::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) { -#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure - while (!ctx->Done(&ptr)) { - uint32_t tag; - ptr = ::_pbi::ReadTag(ptr, &tag); - switch (tag >> 3) { - // uint32 port = 1; - case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { - _impl_.port_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); - CHK_(ptr); - } else - goto handle_unusual; - continue; - // string srcAddress = 2; - case 2: - if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 18)) { - auto str = _internal_mutable_srcaddress(); - ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx); - CHK_(ptr); - CHK_(::_pbi::VerifyUTF8(str, "messages.leave.Leave.srcAddress")); - } else - goto handle_unusual; - continue; - default: - goto handle_unusual; - } // switch - handle_unusual: - if ((tag == 0) || ((tag & 7) == 4)) { - CHK_(ptr); - ctx->SetLastTag(tag); - goto message_done; - } - ptr = UnknownFieldParse( - tag, - _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), - ptr, ctx); - CHK_(ptr != nullptr); - } // while -message_done: +const char* Leave::_InternalParse( + const char* ptr, ::_pbi::ParseContext* ctx) { + ptr = ::_pbi::TcParser::ParseLoop(this, ptr, ctx, &_table_.header); return ptr; -failure: - ptr = nullptr; - goto message_done; -#undef CHK_ } -uint8_t* Leave::_InternalSerialize( - uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + +PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 +const ::_pbi::TcParseTable<1, 2, 0, 39, 2> Leave::_table_ = { + { + 0, // no _has_bits_ + 0, // no _extensions_ + 2, 8, // max_field_number, fast_idx_mask + offsetof(decltype(_table_), field_lookup_table), + 4294967292, // skipmap + offsetof(decltype(_table_), field_entries), + 2, // num_field_entries + 0, // num_aux_entries + offsetof(decltype(_table_), field_names), // no aux_entries + &_Leave_default_instance_._instance, + ::_pbi::TcParser::GenericFallback, // fallback + }, {{ + // string srcAddress = 2; + {::_pbi::TcParser::FastUS1, + {18, 63, 0, PROTOBUF_FIELD_OFFSET(Leave, _impl_.srcaddress_)}}, + // uint32 port = 1; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(Leave, _impl_.port_), 63>(), + {8, 63, 0, PROTOBUF_FIELD_OFFSET(Leave, _impl_.port_)}}, + }}, {{ + 65535, 65535 + }}, {{ + // uint32 port = 1; + {PROTOBUF_FIELD_OFFSET(Leave, _impl_.port_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kUInt32)}, + // string srcAddress = 2; + {PROTOBUF_FIELD_OFFSET(Leave, _impl_.srcaddress_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + }}, + // no aux_entries + {{ + "\24\0\12\0\0\0\0\0" + "messages.leave.Leave" + "srcAddress" + }}, +}; + +::uint8_t* Leave::_InternalSerialize( + ::uint8_t* target, + ::google::protobuf::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:messages.leave.Leave) - uint32_t cached_has_bits = 0; - (void) cached_has_bits; + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; // uint32 port = 1; if (this->_internal_port() != 0) { target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteUInt32ToArray(1, this->_internal_port(), target); + target = ::_pbi::WireFormatLite::WriteUInt32ToArray( + 1, this->_internal_port(), target); } // string srcAddress = 2; if (!this->_internal_srcaddress().empty()) { - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( - this->_internal_srcaddress().data(), static_cast(this->_internal_srcaddress().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, - "messages.leave.Leave.srcAddress"); - target = stream->WriteStringMaybeAliased( - 2, this->_internal_srcaddress(), target); + const std::string& _s = this->_internal_srcaddress(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "messages.leave.Leave.srcAddress"); + target = stream->WriteStringMaybeAliased(2, _s, target); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); } // @@protoc_insertion_point(serialize_to_array_end:messages.leave.Leave) return target; } -size_t Leave::ByteSizeLong() const { +::size_t Leave::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:messages.leave.Leave) - size_t total_size = 0; + ::size_t total_size = 0; - uint32_t cached_has_bits = 0; + ::uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; // string srcAddress = 2; if (!this->_internal_srcaddress().empty()) { - total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( - this->_internal_srcaddress()); + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this->_internal_srcaddress()); } // uint32 port = 1; if (this->_internal_port() != 0) { - total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_port()); + total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne( + this->_internal_port()); } return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } -const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Leave::_class_data_ = { - ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck, - Leave::MergeImpl -}; -const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*Leave::GetClassData() const { return &_class_data_; } - -void Leave::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) { +void Leave::MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg) { auto* const _this = static_cast(&to_msg); auto& from = static_cast(from_msg); // @@protoc_insertion_point(class_specific_merge_from_start:messages.leave.Leave) - GOOGLE_DCHECK_NE(&from, _this); - uint32_t cached_has_bits = 0; + ABSL_DCHECK_NE(&from, _this); + ::uint32_t cached_has_bits = 0; (void) cached_has_bits; if (!from._internal_srcaddress().empty()) { @@ -280,7 +306,7 @@ void Leave::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF if (from._internal_port() != 0) { _this->_internal_set_port(from._internal_port()); } - _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } void Leave::CopyFrom(const Leave& from) { @@ -290,37 +316,30 @@ void Leave::CopyFrom(const Leave& from) { MergeFrom(from); } -bool Leave::IsInitialized() const { +PROTOBUF_NOINLINE bool Leave::IsInitialized() const { return true; } -void Leave::InternalSwap(Leave* other) { +void Leave::InternalSwap(Leave* PROTOBUF_RESTRICT other) { using std::swap; - auto* lhs_arena = GetArenaForAllocation(); - auto* rhs_arena = other->GetArenaForAllocation(); + auto* arena = GetArena(); + ABSL_DCHECK_EQ(arena, other->GetArena()); _internal_metadata_.InternalSwap(&other->_internal_metadata_); - ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( - &_impl_.srcaddress_, lhs_arena, - &other->_impl_.srcaddress_, rhs_arena - ); - swap(_impl_.port_, other->_impl_.port_); + ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.srcaddress_, &other->_impl_.srcaddress_, arena); + swap(_impl_.port_, other->_impl_.port_); } -::PROTOBUF_NAMESPACE_ID::Metadata Leave::GetMetadata() const { +::google::protobuf::Metadata Leave::GetMetadata() const { return ::_pbi::AssignDescriptors( &descriptor_table_leave_2eproto_getter, &descriptor_table_leave_2eproto_once, file_level_metadata_leave_2eproto[0]); } - // @@protoc_insertion_point(namespace_scope) } // namespace leave } // namespace messages -PROTOBUF_NAMESPACE_OPEN -template<> PROTOBUF_NOINLINE ::messages::leave::Leave* -Arena::CreateMaybeMessage< ::messages::leave::Leave >(Arena* arena) { - return Arena::CreateMessageInternal< ::messages::leave::Leave >(arena); -} -PROTOBUF_NAMESPACE_CLOSE - +namespace google { +namespace protobuf { +} // namespace protobuf +} // namespace google // @@protoc_insertion_point(global_scope) -#include +#include "google/protobuf/port_undef.inc" diff --git a/include/WHISPER/Messages/Protos/leave.pb.h b/include/WHISPER/Messages/Protos/leave.pb.h index 607b435..04769a9 100644 --- a/include/WHISPER/Messages/Protos/leave.pb.h +++ b/include/WHISPER/Messages/Protos/leave.pb.h @@ -1,49 +1,60 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: leave.proto +// Protobuf C++ Version: 4.24.0-main -#ifndef GOOGLE_PROTOBUF_INCLUDED_leave_2eproto -#define GOOGLE_PROTOBUF_INCLUDED_leave_2eproto +#ifndef GOOGLE_PROTOBUF_INCLUDED_leave_2eproto_2epb_2eh +#define GOOGLE_PROTOBUF_INCLUDED_leave_2eproto_2epb_2eh #include #include +#include +#include -#include -#if PROTOBUF_VERSION < 3021000 -#error This file was generated by a newer version of protoc which is -#error incompatible with your Protocol Buffer headers. Please update -#error your headers. -#endif -#if 3021012 < PROTOBUF_MIN_PROTOC_VERSION -#error This file was generated by an older version of protoc which is -#error incompatible with your Protocol Buffer headers. Please -#error regenerate this file with a newer version of protoc. -#endif +#include "google/protobuf/port_def.inc" +#if PROTOBUF_VERSION < 4025000 +#error "This file was generated by a newer version of protoc which is" +#error "incompatible with your Protocol Buffer headers. Please update" +#error "your headers." +#endif // PROTOBUF_VERSION -#include -#include -#include -#include -#include -#include -#include -#include -#include // IWYU pragma: export -#include // IWYU pragma: export -#include +#if 4025000 < PROTOBUF_MIN_PROTOC_VERSION +#error "This file was generated by an older version of protoc which is" +#error "incompatible with your Protocol Buffer headers. Please" +#error "regenerate this file with a newer version of protoc." +#endif // PROTOBUF_MIN_PROTOC_VERSION +#include "google/protobuf/port_undef.inc" +#include "google/protobuf/io/coded_stream.h" +#include "google/protobuf/arena.h" +#include "google/protobuf/arenastring.h" +#include "google/protobuf/generated_message_tctable_decl.h" +#include "google/protobuf/generated_message_util.h" +#include "google/protobuf/metadata_lite.h" +#include "google/protobuf/generated_message_reflection.h" +#include "google/protobuf/message.h" +#include "google/protobuf/repeated_field.h" // IWYU pragma: export +#include "google/protobuf/extension_set.h" // IWYU pragma: export +#include "google/protobuf/unknown_field_set.h" // @@protoc_insertion_point(includes) -#include + +// Must be included last. +#include "google/protobuf/port_def.inc" + #define PROTOBUF_INTERNAL_EXPORT_leave_2eproto -PROTOBUF_NAMESPACE_OPEN + +namespace google { +namespace protobuf { namespace internal { class AnyMetadata; } // namespace internal -PROTOBUF_NAMESPACE_CLOSE +} // namespace protobuf +} // namespace google // Internal implementation detail -- do not use these members. struct TableStruct_leave_2eproto { - static const uint32_t offsets[]; + static const ::uint32_t offsets[]; }; -extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_leave_2eproto; +extern const ::google::protobuf::internal::DescriptorTable + descriptor_table_leave_2eproto; namespace messages { namespace leave { class Leave; @@ -51,22 +62,29 @@ struct LeaveDefaultTypeInternal; extern LeaveDefaultTypeInternal _Leave_default_instance_; } // namespace leave } // namespace messages -PROTOBUF_NAMESPACE_OPEN -template<> ::messages::leave::Leave* Arena::CreateMaybeMessage<::messages::leave::Leave>(Arena*); -PROTOBUF_NAMESPACE_CLOSE +namespace google { +namespace protobuf { +} // namespace protobuf +} // namespace google + namespace messages { namespace leave { // =================================================================== + +// ------------------------------------------------------------------- + class Leave final : - public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:messages.leave.Leave) */ { + public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:messages.leave.Leave) */ { public: inline Leave() : Leave(nullptr) {} ~Leave() override; - explicit PROTOBUF_CONSTEXPR Leave(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + template + explicit PROTOBUF_CONSTEXPR Leave(::google::protobuf::internal::ConstantInitialized); - Leave(const Leave& from); + inline Leave(const Leave& from) + : Leave(nullptr, from) {} Leave(Leave&& from) noexcept : Leave() { *this = ::std::move(from); @@ -78,9 +96,9 @@ class Leave final : } inline Leave& operator=(Leave&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena() + if (GetArena() == from.GetArena() #ifdef PROTOBUF_FORCE_COPY_IN_MOVE - && GetOwningArena() != nullptr + && GetArena() != nullptr #endif // !PROTOBUF_FORCE_COPY_IN_MOVE ) { InternalSwap(&from); @@ -90,13 +108,22 @@ class Leave final : return *this; } - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const + ABSL_ATTRIBUTE_LIFETIME_BOUND { + return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); + } + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + ABSL_ATTRIBUTE_LIFETIME_BOUND { + return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); + } + + static const ::google::protobuf::Descriptor* descriptor() { return GetDescriptor(); } - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* GetReflection() { return default_instance().GetMetadata().reflection; } static const Leave& default_instance() { @@ -115,65 +142,62 @@ class Leave final : inline void Swap(Leave* other) { if (other == this) return; #ifdef PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() != nullptr && - GetOwningArena() == other->GetOwningArena()) { + if (GetArena() != nullptr && + GetArena() == other->GetArena()) { #else // PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() == other->GetOwningArena()) { + if (GetArena() == other->GetArena()) { #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { - ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + ::google::protobuf::internal::GenericSwap(this, other); } } void UnsafeArenaSwap(Leave* other) { if (other == this) return; - GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); } // implements Message ---------------------------------------------- - Leave* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + Leave* New(::google::protobuf::Arena* arena = nullptr) const final { return CreateMaybeMessage(arena); } - using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + using ::google::protobuf::Message::CopyFrom; void CopyFrom(const Leave& from); - using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + using ::google::protobuf::Message::MergeFrom; void MergeFrom( const Leave& from) { Leave::MergeImpl(*this, from); } private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); + static void MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg); public: - PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + ABSL_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; - size_t ByteSizeLong() const final; - const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - uint8_t* _InternalSerialize( - uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; - int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + ::size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::google::protobuf::internal::ParseContext* ctx) final; + ::uint8_t* _InternalSerialize( + ::uint8_t* target, ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedCtor(::google::protobuf::Arena* arena); void SharedDtor(); - void SetCachedSize(int size) const final; void InternalSwap(Leave* other); private: - friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; - static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + friend class ::google::protobuf::internal::AnyMetadata; + static ::absl::string_view FullMessageName() { return "messages.leave.Leave"; } protected: - explicit Leave(::PROTOBUF_NAMESPACE_ID::Arena* arena, - bool is_message_owned = false); + explicit Leave(::google::protobuf::Arena* arena); + Leave(::google::protobuf::Arena* arena, const Leave& from); + const ::google::protobuf::MessageLite::ClassData* GetClassData() const final; public: - static const ClassData _class_data_; - const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; - - ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + ::google::protobuf::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- @@ -184,134 +208,166 @@ class Leave final : kPortFieldNumber = 1, }; // string srcAddress = 2; - void clear_srcaddress(); + void clear_srcaddress() ; const std::string& srcaddress() const; - template - void set_srcaddress(ArgT0&& arg0, ArgT... args); + template + void set_srcaddress(Arg_&& arg, Args_... args); std::string* mutable_srcaddress(); PROTOBUF_NODISCARD std::string* release_srcaddress(); - void set_allocated_srcaddress(std::string* srcaddress); + void set_allocated_srcaddress(std::string* value); + private: const std::string& _internal_srcaddress() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_srcaddress(const std::string& value); + inline PROTOBUF_ALWAYS_INLINE void _internal_set_srcaddress( + const std::string& value); std::string* _internal_mutable_srcaddress(); - public: + public: // uint32 port = 1; - void clear_port(); - uint32_t port() const; - void set_port(uint32_t value); - private: - uint32_t _internal_port() const; - void _internal_set_port(uint32_t value); - public: + void clear_port() ; + ::uint32_t port() const; + void set_port(::uint32_t value); + private: + ::uint32_t _internal_port() const; + void _internal_set_port(::uint32_t value); + + public: // @@protoc_insertion_point(class_scope:messages.leave.Leave) private: class _Internal; - template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; - typedef void InternalArenaConstructable_; - typedef void DestructorSkippable_; + friend class ::google::protobuf::internal::TcParser; + static const ::google::protobuf::internal::TcParseTable< + 1, 2, 0, + 39, 2> + _table_; + friend class ::google::protobuf::MessageLite; + friend class ::google::protobuf::Arena; + template + friend class ::google::protobuf::Arena::InternalHelper; + using InternalArenaConstructable_ = void; + using DestructorSkippable_ = void; struct Impl_ { - ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr srcaddress_; - uint32_t port_; - mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + + inline explicit constexpr Impl_( + ::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* arena); + inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* arena, const Impl_& from); + ::google::protobuf::internal::ArenaStringPtr srcaddress_; + ::uint32_t port_; + mutable ::google::protobuf::internal::CachedSize _cached_size_; + PROTOBUF_TSAN_DECLARE_MEMBER }; union { Impl_ _impl_; }; friend struct ::TableStruct_leave_2eproto; }; + // =================================================================== + + // =================================================================== + #ifdef __GNUC__ - #pragma GCC diagnostic push - #pragma GCC diagnostic ignored "-Wstrict-aliasing" +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wstrict-aliasing" #endif // __GNUC__ +// ------------------------------------------------------------------- + // Leave // uint32 port = 1; inline void Leave::clear_port() { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); _impl_.port_ = 0u; } -inline uint32_t Leave::_internal_port() const { - return _impl_.port_; -} -inline uint32_t Leave::port() const { +inline ::uint32_t Leave::port() const { // @@protoc_insertion_point(field_get:messages.leave.Leave.port) return _internal_port(); } -inline void Leave::_internal_set_port(uint32_t value) { - - _impl_.port_ = value; -} -inline void Leave::set_port(uint32_t value) { +inline void Leave::set_port(::uint32_t value) { _internal_set_port(value); // @@protoc_insertion_point(field_set:messages.leave.Leave.port) } +inline ::uint32_t Leave::_internal_port() const { + PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race); + return _impl_.port_; +} +inline void Leave::_internal_set_port(::uint32_t value) { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + ; + _impl_.port_ = value; +} // string srcAddress = 2; inline void Leave::clear_srcaddress() { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); _impl_.srcaddress_.ClearToEmpty(); } -inline const std::string& Leave::srcaddress() const { +inline const std::string& Leave::srcaddress() const + ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_get:messages.leave.Leave.srcAddress) return _internal_srcaddress(); } -template -inline PROTOBUF_ALWAYS_INLINE -void Leave::set_srcaddress(ArgT0&& arg0, ArgT... args) { - - _impl_.srcaddress_.Set(static_cast(arg0), args..., GetArenaForAllocation()); +template +inline PROTOBUF_ALWAYS_INLINE void Leave::set_srcaddress(Arg_&& arg, + Args_... args) { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + ; + _impl_.srcaddress_.Set(static_cast(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:messages.leave.Leave.srcAddress) } -inline std::string* Leave::mutable_srcaddress() { +inline std::string* Leave::mutable_srcaddress() ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_srcaddress(); // @@protoc_insertion_point(field_mutable:messages.leave.Leave.srcAddress) return _s; } inline const std::string& Leave::_internal_srcaddress() const { + PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race); return _impl_.srcaddress_.Get(); } inline void Leave::_internal_set_srcaddress(const std::string& value) { - - _impl_.srcaddress_.Set(value, GetArenaForAllocation()); + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + ; + _impl_.srcaddress_.Set(value, GetArena()); } inline std::string* Leave::_internal_mutable_srcaddress() { - - return _impl_.srcaddress_.Mutable(GetArenaForAllocation()); + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + ; + return _impl_.srcaddress_.Mutable( GetArena()); } inline std::string* Leave::release_srcaddress() { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); // @@protoc_insertion_point(field_release:messages.leave.Leave.srcAddress) return _impl_.srcaddress_.Release(); } -inline void Leave::set_allocated_srcaddress(std::string* srcaddress) { - if (srcaddress != nullptr) { - - } else { - - } - _impl_.srcaddress_.SetAllocated(srcaddress, GetArenaForAllocation()); -#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (_impl_.srcaddress_.IsDefault()) { - _impl_.srcaddress_.Set("", GetArenaForAllocation()); - } -#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +inline void Leave::set_allocated_srcaddress(std::string* value) { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + _impl_.srcaddress_.SetAllocated(value, GetArena()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.srcaddress_.IsDefault()) { + _impl_.srcaddress_.Set("", GetArena()); + } + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:messages.leave.Leave.srcAddress) } #ifdef __GNUC__ - #pragma GCC diagnostic pop +#pragma GCC diagnostic pop #endif // __GNUC__ // @@protoc_insertion_point(namespace_scope) - } // namespace leave } // namespace messages + // @@protoc_insertion_point(global_scope) -#include -#endif // GOOGLE_PROTOBUF_INCLUDED_GOOGLE_PROTOBUF_INCLUDED_leave_2eproto +#include "google/protobuf/port_undef.inc" + +#endif // GOOGLE_PROTOBUF_INCLUDED_leave_2eproto_2epb_2eh diff --git a/include/WHISPER/Messages/Protos/message.pb.cc b/include/WHISPER/Messages/Protos/message.pb.cc index e21df8d..8bd7769 100644 --- a/include/WHISPER/Messages/Protos/message.pb.cc +++ b/include/WHISPER/Messages/Protos/message.pb.cc @@ -4,359 +4,406 @@ #include "message.pb.h" #include - -#include -#include -#include -#include -#include -#include -#include +#include "google/protobuf/io/coded_stream.h" +#include "google/protobuf/extension_set.h" +#include "google/protobuf/wire_format_lite.h" +#include "google/protobuf/descriptor.h" +#include "google/protobuf/generated_message_reflection.h" +#include "google/protobuf/reflection_ops.h" +#include "google/protobuf/wire_format.h" +#include "google/protobuf/generated_message_tctable_impl.h" // @@protoc_insertion_point(includes) -#include +// Must be included last. +#include "google/protobuf/port_def.inc" PROTOBUF_PRAGMA_INIT_SEG - -namespace _pb = ::PROTOBUF_NAMESPACE_ID; -namespace _pbi = _pb::internal; - +namespace _pb = ::google::protobuf; +namespace _pbi = ::google::protobuf::internal; +namespace _fl = ::google::protobuf::internal::field_layout; namespace messages { namespace header { -PROTOBUF_CONSTEXPR Message::Message( - ::_pbi::ConstantInitialized): _impl_{ - /*decltype(_impl_.senderuuid_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}} - , /*decltype(_impl_.payload_)*/nullptr - , /*decltype(_impl_.topic_)*/0u - , /*decltype(_impl_.msgtype_)*/0u - , /*decltype(_impl_._cached_size_)*/{}} {} + +inline constexpr Message::Impl_::Impl_( + ::_pbi::ConstantInitialized) noexcept + : _cached_size_{0}, + senderuuid_( + &::google::protobuf::internal::fixed_address_empty_string, + ::_pbi::ConstantInitialized()), + payload_{nullptr}, + topic_{0u}, + msgtype_{0u} {} + +template +PROTOBUF_CONSTEXPR Message::Message(::_pbi::ConstantInitialized) + : _impl_(::_pbi::ConstantInitialized()) {} struct MessageDefaultTypeInternal { - PROTOBUF_CONSTEXPR MessageDefaultTypeInternal() - : _instance(::_pbi::ConstantInitialized{}) {} + PROTOBUF_CONSTEXPR MessageDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} ~MessageDefaultTypeInternal() {} union { Message _instance; }; }; -PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 MessageDefaultTypeInternal _Message_default_instance_; + +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 MessageDefaultTypeInternal _Message_default_instance_; } // namespace header } // namespace messages static ::_pb::Metadata file_level_metadata_message_2eproto[1]; -static constexpr ::_pb::EnumDescriptor const** file_level_enum_descriptors_message_2eproto = nullptr; -static constexpr ::_pb::ServiceDescriptor const** file_level_service_descriptors_message_2eproto = nullptr; - -const uint32_t TableStruct_message_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { - ~0u, // no _has_bits_ - PROTOBUF_FIELD_OFFSET(::messages::header::Message, _internal_metadata_), - ~0u, // no _extensions_ - ~0u, // no _oneof_case_ - ~0u, // no _weak_field_map_ - ~0u, // no _inlined_string_donated_ - PROTOBUF_FIELD_OFFSET(::messages::header::Message, _impl_.topic_), - PROTOBUF_FIELD_OFFSET(::messages::header::Message, _impl_.msgtype_), - PROTOBUF_FIELD_OFFSET(::messages::header::Message, _impl_.senderuuid_), - PROTOBUF_FIELD_OFFSET(::messages::header::Message, _impl_.payload_), +static constexpr const ::_pb::EnumDescriptor** + file_level_enum_descriptors_message_2eproto = nullptr; +static constexpr const ::_pb::ServiceDescriptor** + file_level_service_descriptors_message_2eproto = nullptr; +const ::uint32_t + TableStruct_message_2eproto::offsets[] ABSL_ATTRIBUTE_SECTION_VARIABLE( + protodesc_cold) = { + PROTOBUF_FIELD_OFFSET(::messages::header::Message, _impl_._has_bits_), + PROTOBUF_FIELD_OFFSET(::messages::header::Message, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) + PROTOBUF_FIELD_OFFSET(::messages::header::Message, _impl_.topic_), + PROTOBUF_FIELD_OFFSET(::messages::header::Message, _impl_.msgtype_), + PROTOBUF_FIELD_OFFSET(::messages::header::Message, _impl_.senderuuid_), + PROTOBUF_FIELD_OFFSET(::messages::header::Message, _impl_.payload_), + ~0u, + ~0u, + ~0u, + 0, }; -static const ::_pbi::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { - { 0, -1, -1, sizeof(::messages::header::Message)}, + +static const ::_pbi::MigrationSchema + schemas[] ABSL_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { + {0, 12, -1, sizeof(::messages::header::Message)}, }; static const ::_pb::Message* const file_default_instances[] = { - &::messages::header::_Message_default_instance_._instance, + &::messages::header::_Message_default_instance_._instance, }; - -const char descriptor_table_protodef_message_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = - "\n\rmessage.proto\022\017messages.header\032\031google" - "/protobuf/any.proto\"d\n\007Message\022\r\n\005topic\030" - "\001 \001(\r\022\017\n\007msgType\030\002 \001(\r\022\022\n\nsenderUUID\030\003 \001" - "(\t\022%\n\007payload\030\005 \001(\0132\024.google.protobuf.An" - "yb\006proto3" - ; -static const ::_pbi::DescriptorTable* const descriptor_table_message_2eproto_deps[1] = { - &::descriptor_table_google_2fprotobuf_2fany_2eproto, +const char descriptor_table_protodef_message_2eproto[] ABSL_ATTRIBUTE_SECTION_VARIABLE( + protodesc_cold) = { + "\n\rmessage.proto\022\017messages.header\032\031google" + "/protobuf/any.proto\"d\n\007Message\022\r\n\005topic\030" + "\001 \001(\r\022\017\n\007msgType\030\002 \001(\r\022\022\n\nsenderUUID\030\003 \001" + "(\t\022%\n\007payload\030\005 \001(\0132\024.google.protobuf.An" + "yb\006proto3" }; -static ::_pbi::once_flag descriptor_table_message_2eproto_once; +static const ::_pbi::DescriptorTable* const descriptor_table_message_2eproto_deps[1] = + { + &::descriptor_table_google_2fprotobuf_2fany_2eproto, +}; +static ::absl::once_flag descriptor_table_message_2eproto_once; const ::_pbi::DescriptorTable descriptor_table_message_2eproto = { - false, false, 169, descriptor_table_protodef_message_2eproto, + false, + false, + 169, + descriptor_table_protodef_message_2eproto, "message.proto", - &descriptor_table_message_2eproto_once, descriptor_table_message_2eproto_deps, 1, 1, - schemas, file_default_instances, TableStruct_message_2eproto::offsets, - file_level_metadata_message_2eproto, file_level_enum_descriptors_message_2eproto, + &descriptor_table_message_2eproto_once, + descriptor_table_message_2eproto_deps, + 1, + 1, + schemas, + file_default_instances, + TableStruct_message_2eproto::offsets, + file_level_metadata_message_2eproto, + file_level_enum_descriptors_message_2eproto, file_level_service_descriptors_message_2eproto, }; + +// This function exists to be marked as weak. +// It can significantly speed up compilation by breaking up LLVM's SCC +// in the .pb.cc translation units. Large translation units see a +// reduction of more than 35% of walltime for optimized builds. Without +// the weak attribute all the messages in the file, including all the +// vtables and everything they use become part of the same SCC through +// a cycle like: +// GetMetadata -> descriptor table -> default instances -> +// vtables -> GetMetadata +// By adding a weak function here we break the connection from the +// individual vtables back into the descriptor table. PROTOBUF_ATTRIBUTE_WEAK const ::_pbi::DescriptorTable* descriptor_table_message_2eproto_getter() { return &descriptor_table_message_2eproto; } - // Force running AddDescriptors() at dynamic initialization time. -PROTOBUF_ATTRIBUTE_INIT_PRIORITY2 static ::_pbi::AddDescriptorsRunner dynamic_init_dummy_message_2eproto(&descriptor_table_message_2eproto); +PROTOBUF_ATTRIBUTE_INIT_PRIORITY2 +static ::_pbi::AddDescriptorsRunner dynamic_init_dummy_message_2eproto(&descriptor_table_message_2eproto); namespace messages { namespace header { - // =================================================================== class Message::_Internal { public: - static const ::PROTOBUF_NAMESPACE_ID::Any& payload(const Message* msg); + using HasBits = decltype(std::declval()._impl_._has_bits_); + static constexpr ::int32_t kHasBitsOffset = + 8 * PROTOBUF_FIELD_OFFSET(Message, _impl_._has_bits_); + static const ::google::protobuf::Any& payload(const Message* msg); + static void set_has_payload(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } }; -const ::PROTOBUF_NAMESPACE_ID::Any& -Message::_Internal::payload(const Message* msg) { +const ::google::protobuf::Any& Message::_Internal::payload(const Message* msg) { return *msg->_impl_.payload_; } void Message::clear_payload() { - if (GetArenaForAllocation() == nullptr && _impl_.payload_ != nullptr) { - delete _impl_.payload_; - } - _impl_.payload_ = nullptr; + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + if (_impl_.payload_ != nullptr) _impl_.payload_->Clear(); + _impl_._has_bits_[0] &= ~0x00000001u; } -Message::Message(::PROTOBUF_NAMESPACE_ID::Arena* arena, - bool is_message_owned) - : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { - SharedCtor(arena, is_message_owned); +Message::Message(::google::protobuf::Arena* arena) + : ::google::protobuf::Message(arena) { + SharedCtor(arena); // @@protoc_insertion_point(arena_constructor:messages.header.Message) } -Message::Message(const Message& from) - : ::PROTOBUF_NAMESPACE_ID::Message() { - Message* const _this = this; (void)_this; - new (&_impl_) Impl_{ - decltype(_impl_.senderuuid_){} - , decltype(_impl_.payload_){nullptr} - , decltype(_impl_.topic_){} - , decltype(_impl_.msgtype_){} - , /*decltype(_impl_._cached_size_)*/{}}; +inline PROTOBUF_NDEBUG_INLINE Message::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, + const Impl_& from) + : _has_bits_{from._has_bits_}, + _cached_size_{0}, + senderuuid_(arena, from.senderuuid_) {} + +Message::Message( + ::google::protobuf::Arena* arena, + const Message& from) + : ::google::protobuf::Message(arena) { + Message* const _this = this; + (void)_this; + _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( + from._internal_metadata_); + new (&_impl_) Impl_(internal_visibility(), arena, from._impl_); + ::uint32_t cached_has_bits = _impl_._has_bits_[0]; + _impl_.payload_ = (cached_has_bits & 0x00000001u) + ? CreateMaybeMessage<::google::protobuf::Any>(arena, *from._impl_.payload_) + : nullptr; + ::memcpy(reinterpret_cast(&_impl_) + + offsetof(Impl_, topic_), + reinterpret_cast(&from._impl_) + + offsetof(Impl_, topic_), + offsetof(Impl_, msgtype_) - + offsetof(Impl_, topic_) + + sizeof(Impl_::msgtype_)); - _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); - _impl_.senderuuid_.InitDefault(); - #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - _impl_.senderuuid_.Set("", GetArenaForAllocation()); - #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (!from._internal_senderuuid().empty()) { - _this->_impl_.senderuuid_.Set(from._internal_senderuuid(), - _this->GetArenaForAllocation()); - } - if (from._internal_has_payload()) { - _this->_impl_.payload_ = new ::PROTOBUF_NAMESPACE_ID::Any(*from._impl_.payload_); - } - ::memcpy(&_impl_.topic_, &from._impl_.topic_, - static_cast(reinterpret_cast(&_impl_.msgtype_) - - reinterpret_cast(&_impl_.topic_)) + sizeof(_impl_.msgtype_)); // @@protoc_insertion_point(copy_constructor:messages.header.Message) } +inline PROTOBUF_NDEBUG_INLINE Message::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* arena) + : _cached_size_{0}, + senderuuid_(arena) {} -inline void Message::SharedCtor( - ::_pb::Arena* arena, bool is_message_owned) { - (void)arena; - (void)is_message_owned; - new (&_impl_) Impl_{ - decltype(_impl_.senderuuid_){} - , decltype(_impl_.payload_){nullptr} - , decltype(_impl_.topic_){0u} - , decltype(_impl_.msgtype_){0u} - , /*decltype(_impl_._cached_size_)*/{} - }; - _impl_.senderuuid_.InitDefault(); - #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - _impl_.senderuuid_.Set("", GetArenaForAllocation()); - #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +inline void Message::SharedCtor(::_pb::Arena* arena) { + new (&_impl_) Impl_(internal_visibility(), arena); + ::memset(reinterpret_cast(&_impl_) + + offsetof(Impl_, payload_), + 0, + offsetof(Impl_, msgtype_) - + offsetof(Impl_, payload_) + + sizeof(Impl_::msgtype_)); } - Message::~Message() { // @@protoc_insertion_point(destructor:messages.header.Message) - if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) { - (void)arena; - return; - } + _internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>(); SharedDtor(); } - inline void Message::SharedDtor() { - GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + ABSL_DCHECK(GetArena() == nullptr); _impl_.senderuuid_.Destroy(); - if (this != internal_default_instance()) delete _impl_.payload_; + delete _impl_.payload_; + _impl_.~Impl_(); } -void Message::SetCachedSize(int size) const { - _impl_._cached_size_.Set(size); +const ::google::protobuf::MessageLite::ClassData* +Message::GetClassData() const { + PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite::ClassData + _data_ = { + Message::MergeImpl, + nullptr, // OnDemandRegisterArenaDtor + &::google::protobuf::Message::kDescriptorMethods, + PROTOBUF_FIELD_OFFSET(Message, _impl_._cached_size_), + }; + return &_data_; } - -void Message::Clear() { +PROTOBUF_NOINLINE void Message::Clear() { // @@protoc_insertion_point(message_clear_start:messages.header.Message) - uint32_t cached_has_bits = 0; + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + ::uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; _impl_.senderuuid_.ClearToEmpty(); - if (GetArenaForAllocation() == nullptr && _impl_.payload_ != nullptr) { - delete _impl_.payload_; + cached_has_bits = _impl_._has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + ABSL_DCHECK(_impl_.payload_ != nullptr); + _impl_.payload_->Clear(); } - _impl_.payload_ = nullptr; - ::memset(&_impl_.topic_, 0, static_cast( + ::memset(&_impl_.topic_, 0, static_cast<::size_t>( reinterpret_cast(&_impl_.msgtype_) - reinterpret_cast(&_impl_.topic_)) + sizeof(_impl_.msgtype_)); - _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + _impl_._has_bits_.Clear(); + _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); } -const char* Message::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) { -#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure - while (!ctx->Done(&ptr)) { - uint32_t tag; - ptr = ::_pbi::ReadTag(ptr, &tag); - switch (tag >> 3) { - // uint32 topic = 1; - case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { - _impl_.topic_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); - CHK_(ptr); - } else - goto handle_unusual; - continue; - // uint32 msgType = 2; - case 2: - if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) { - _impl_.msgtype_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); - CHK_(ptr); - } else - goto handle_unusual; - continue; - // string senderUUID = 3; - case 3: - if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 26)) { - auto str = _internal_mutable_senderuuid(); - ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx); - CHK_(ptr); - CHK_(::_pbi::VerifyUTF8(str, "messages.header.Message.senderUUID")); - } else - goto handle_unusual; - continue; - // .google.protobuf.Any payload = 5; - case 5: - if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 42)) { - ptr = ctx->ParseMessage(_internal_mutable_payload(), ptr); - CHK_(ptr); - } else - goto handle_unusual; - continue; - default: - goto handle_unusual; - } // switch - handle_unusual: - if ((tag == 0) || ((tag & 7) == 4)) { - CHK_(ptr); - ctx->SetLastTag(tag); - goto message_done; - } - ptr = UnknownFieldParse( - tag, - _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), - ptr, ctx); - CHK_(ptr != nullptr); - } // while -message_done: +const char* Message::_InternalParse( + const char* ptr, ::_pbi::ParseContext* ctx) { + ptr = ::_pbi::TcParser::ParseLoop(this, ptr, ctx, &_table_.header); return ptr; -failure: - ptr = nullptr; - goto message_done; -#undef CHK_ } -uint8_t* Message::_InternalSerialize( - uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + +PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 +const ::_pbi::TcParseTable<3, 4, 1, 42, 2> Message::_table_ = { + { + PROTOBUF_FIELD_OFFSET(Message, _impl_._has_bits_), + 0, // no _extensions_ + 5, 56, // max_field_number, fast_idx_mask + offsetof(decltype(_table_), field_lookup_table), + 4294967272, // skipmap + offsetof(decltype(_table_), field_entries), + 4, // num_field_entries + 1, // num_aux_entries + offsetof(decltype(_table_), aux_entries), + &_Message_default_instance_._instance, + ::_pbi::TcParser::GenericFallback, // fallback + }, {{ + {::_pbi::TcParser::MiniParse, {}}, + // uint32 topic = 1; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(Message, _impl_.topic_), 63>(), + {8, 63, 0, PROTOBUF_FIELD_OFFSET(Message, _impl_.topic_)}}, + // uint32 msgType = 2; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(Message, _impl_.msgtype_), 63>(), + {16, 63, 0, PROTOBUF_FIELD_OFFSET(Message, _impl_.msgtype_)}}, + // string senderUUID = 3; + {::_pbi::TcParser::FastUS1, + {26, 63, 0, PROTOBUF_FIELD_OFFSET(Message, _impl_.senderuuid_)}}, + {::_pbi::TcParser::MiniParse, {}}, + // .google.protobuf.Any payload = 5; + {::_pbi::TcParser::FastMtS1, + {42, 0, 0, PROTOBUF_FIELD_OFFSET(Message, _impl_.payload_)}}, + {::_pbi::TcParser::MiniParse, {}}, + {::_pbi::TcParser::MiniParse, {}}, + }}, {{ + 65535, 65535 + }}, {{ + // uint32 topic = 1; + {PROTOBUF_FIELD_OFFSET(Message, _impl_.topic_), -1, 0, + (0 | ::_fl::kFcSingular | ::_fl::kUInt32)}, + // uint32 msgType = 2; + {PROTOBUF_FIELD_OFFSET(Message, _impl_.msgtype_), -1, 0, + (0 | ::_fl::kFcSingular | ::_fl::kUInt32)}, + // string senderUUID = 3; + {PROTOBUF_FIELD_OFFSET(Message, _impl_.senderuuid_), -1, 0, + (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + // .google.protobuf.Any payload = 5; + {PROTOBUF_FIELD_OFFSET(Message, _impl_.payload_), _Internal::kHasBitsOffset + 0, 0, + (0 | ::_fl::kFcOptional | ::_fl::kMessage | ::_fl::kTvTable)}, + }}, {{ + {::_pbi::TcParser::GetTable<::google::protobuf::Any>()}, + }}, {{ + "\27\0\0\12\0\0\0\0" + "messages.header.Message" + "senderUUID" + }}, +}; + +::uint8_t* Message::_InternalSerialize( + ::uint8_t* target, + ::google::protobuf::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:messages.header.Message) - uint32_t cached_has_bits = 0; - (void) cached_has_bits; + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; // uint32 topic = 1; if (this->_internal_topic() != 0) { target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteUInt32ToArray(1, this->_internal_topic(), target); + target = ::_pbi::WireFormatLite::WriteUInt32ToArray( + 1, this->_internal_topic(), target); } // uint32 msgType = 2; if (this->_internal_msgtype() != 0) { target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteUInt32ToArray(2, this->_internal_msgtype(), target); + target = ::_pbi::WireFormatLite::WriteUInt32ToArray( + 2, this->_internal_msgtype(), target); } // string senderUUID = 3; if (!this->_internal_senderuuid().empty()) { - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( - this->_internal_senderuuid().data(), static_cast(this->_internal_senderuuid().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, - "messages.header.Message.senderUUID"); - target = stream->WriteStringMaybeAliased( - 3, this->_internal_senderuuid(), target); + const std::string& _s = this->_internal_senderuuid(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "messages.header.Message.senderUUID"); + target = stream->WriteStringMaybeAliased(3, _s, target); } + cached_has_bits = _impl_._has_bits_[0]; // .google.protobuf.Any payload = 5; - if (this->_internal_has_payload()) { - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: - InternalWriteMessage(5, _Internal::payload(this), + if (cached_has_bits & 0x00000001u) { + target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 5, _Internal::payload(this), _Internal::payload(this).GetCachedSize(), target, stream); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); } // @@protoc_insertion_point(serialize_to_array_end:messages.header.Message) return target; } -size_t Message::ByteSizeLong() const { +::size_t Message::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:messages.header.Message) - size_t total_size = 0; + ::size_t total_size = 0; - uint32_t cached_has_bits = 0; + ::uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; // string senderUUID = 3; if (!this->_internal_senderuuid().empty()) { - total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( - this->_internal_senderuuid()); + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this->_internal_senderuuid()); } // .google.protobuf.Any payload = 5; - if (this->_internal_has_payload()) { - total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( - *_impl_.payload_); + cached_has_bits = _impl_._has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + total_size += + 1 + ::google::protobuf::internal::WireFormatLite::MessageSize(*_impl_.payload_); } // uint32 topic = 1; if (this->_internal_topic() != 0) { - total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_topic()); + total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne( + this->_internal_topic()); } // uint32 msgType = 2; if (this->_internal_msgtype() != 0) { - total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_msgtype()); + total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne( + this->_internal_msgtype()); } return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } -const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Message::_class_data_ = { - ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck, - Message::MergeImpl -}; -const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*Message::GetClassData() const { return &_class_data_; } - -void Message::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) { +void Message::MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg) { auto* const _this = static_cast(&to_msg); auto& from = static_cast(from_msg); // @@protoc_insertion_point(class_specific_merge_from_start:messages.header.Message) - GOOGLE_DCHECK_NE(&from, _this); - uint32_t cached_has_bits = 0; + ABSL_DCHECK_NE(&from, _this); + ::uint32_t cached_has_bits = 0; (void) cached_has_bits; if (!from._internal_senderuuid().empty()) { _this->_internal_set_senderuuid(from._internal_senderuuid()); } - if (from._internal_has_payload()) { - _this->_internal_mutable_payload()->::PROTOBUF_NAMESPACE_ID::Any::MergeFrom( + if ((from._impl_._has_bits_[0] & 0x00000001u) != 0) { + _this->_internal_mutable_payload()->::google::protobuf::Any::MergeFrom( from._internal_payload()); } if (from._internal_topic() != 0) { @@ -365,7 +412,7 @@ void Message::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOB if (from._internal_msgtype() != 0) { _this->_internal_set_msgtype(from._internal_msgtype()); } - _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } void Message::CopyFrom(const Message& from) { @@ -375,20 +422,18 @@ void Message::CopyFrom(const Message& from) { MergeFrom(from); } -bool Message::IsInitialized() const { +PROTOBUF_NOINLINE bool Message::IsInitialized() const { return true; } -void Message::InternalSwap(Message* other) { +void Message::InternalSwap(Message* PROTOBUF_RESTRICT other) { using std::swap; - auto* lhs_arena = GetArenaForAllocation(); - auto* rhs_arena = other->GetArenaForAllocation(); + auto* arena = GetArena(); + ABSL_DCHECK_EQ(arena, other->GetArena()); _internal_metadata_.InternalSwap(&other->_internal_metadata_); - ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( - &_impl_.senderuuid_, lhs_arena, - &other->_impl_.senderuuid_, rhs_arena - ); - ::PROTOBUF_NAMESPACE_ID::internal::memswap< + swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); + ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.senderuuid_, &other->_impl_.senderuuid_, arena); + ::google::protobuf::internal::memswap< PROTOBUF_FIELD_OFFSET(Message, _impl_.msgtype_) + sizeof(Message::_impl_.msgtype_) - PROTOBUF_FIELD_OFFSET(Message, _impl_.payload_)>( @@ -396,21 +441,17 @@ void Message::InternalSwap(Message* other) { reinterpret_cast(&other->_impl_.payload_)); } -::PROTOBUF_NAMESPACE_ID::Metadata Message::GetMetadata() const { +::google::protobuf::Metadata Message::GetMetadata() const { return ::_pbi::AssignDescriptors( &descriptor_table_message_2eproto_getter, &descriptor_table_message_2eproto_once, file_level_metadata_message_2eproto[0]); } - // @@protoc_insertion_point(namespace_scope) } // namespace header } // namespace messages -PROTOBUF_NAMESPACE_OPEN -template<> PROTOBUF_NOINLINE ::messages::header::Message* -Arena::CreateMaybeMessage< ::messages::header::Message >(Arena* arena) { - return Arena::CreateMessageInternal< ::messages::header::Message >(arena); -} -PROTOBUF_NAMESPACE_CLOSE - +namespace google { +namespace protobuf { +} // namespace protobuf +} // namespace google // @@protoc_insertion_point(global_scope) -#include +#include "google/protobuf/port_undef.inc" diff --git a/include/WHISPER/Messages/Protos/message.pb.h b/include/WHISPER/Messages/Protos/message.pb.h index ff8e939..e59d181 100644 --- a/include/WHISPER/Messages/Protos/message.pb.h +++ b/include/WHISPER/Messages/Protos/message.pb.h @@ -1,50 +1,61 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: message.proto +// Protobuf C++ Version: 4.24.0-main -#ifndef GOOGLE_PROTOBUF_INCLUDED_message_2eproto -#define GOOGLE_PROTOBUF_INCLUDED_message_2eproto +#ifndef GOOGLE_PROTOBUF_INCLUDED_message_2eproto_2epb_2eh +#define GOOGLE_PROTOBUF_INCLUDED_message_2eproto_2epb_2eh #include #include +#include +#include -#include -#if PROTOBUF_VERSION < 3021000 -#error This file was generated by a newer version of protoc which is -#error incompatible with your Protocol Buffer headers. Please update -#error your headers. -#endif -#if 3021012 < PROTOBUF_MIN_PROTOC_VERSION -#error This file was generated by an older version of protoc which is -#error incompatible with your Protocol Buffer headers. Please -#error regenerate this file with a newer version of protoc. -#endif +#include "google/protobuf/port_def.inc" +#if PROTOBUF_VERSION < 4025000 +#error "This file was generated by a newer version of protoc which is" +#error "incompatible with your Protocol Buffer headers. Please update" +#error "your headers." +#endif // PROTOBUF_VERSION -#include -#include -#include -#include -#include -#include -#include -#include -#include // IWYU pragma: export -#include // IWYU pragma: export -#include -#include +#if 4025000 < PROTOBUF_MIN_PROTOC_VERSION +#error "This file was generated by an older version of protoc which is" +#error "incompatible with your Protocol Buffer headers. Please" +#error "regenerate this file with a newer version of protoc." +#endif // PROTOBUF_MIN_PROTOC_VERSION +#include "google/protobuf/port_undef.inc" +#include "google/protobuf/io/coded_stream.h" +#include "google/protobuf/arena.h" +#include "google/protobuf/arenastring.h" +#include "google/protobuf/generated_message_tctable_decl.h" +#include "google/protobuf/generated_message_util.h" +#include "google/protobuf/metadata_lite.h" +#include "google/protobuf/generated_message_reflection.h" +#include "google/protobuf/message.h" +#include "google/protobuf/repeated_field.h" // IWYU pragma: export +#include "google/protobuf/extension_set.h" // IWYU pragma: export +#include "google/protobuf/unknown_field_set.h" +#include "google/protobuf/any.pb.h" // @@protoc_insertion_point(includes) -#include + +// Must be included last. +#include "google/protobuf/port_def.inc" + #define PROTOBUF_INTERNAL_EXPORT_message_2eproto -PROTOBUF_NAMESPACE_OPEN + +namespace google { +namespace protobuf { namespace internal { class AnyMetadata; } // namespace internal -PROTOBUF_NAMESPACE_CLOSE +} // namespace protobuf +} // namespace google // Internal implementation detail -- do not use these members. struct TableStruct_message_2eproto { - static const uint32_t offsets[]; + static const ::uint32_t offsets[]; }; -extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_message_2eproto; +extern const ::google::protobuf::internal::DescriptorTable + descriptor_table_message_2eproto; namespace messages { namespace header { class Message; @@ -52,22 +63,29 @@ struct MessageDefaultTypeInternal; extern MessageDefaultTypeInternal _Message_default_instance_; } // namespace header } // namespace messages -PROTOBUF_NAMESPACE_OPEN -template<> ::messages::header::Message* Arena::CreateMaybeMessage<::messages::header::Message>(Arena*); -PROTOBUF_NAMESPACE_CLOSE +namespace google { +namespace protobuf { +} // namespace protobuf +} // namespace google + namespace messages { namespace header { // =================================================================== + +// ------------------------------------------------------------------- + class Message final : - public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:messages.header.Message) */ { + public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:messages.header.Message) */ { public: inline Message() : Message(nullptr) {} ~Message() override; - explicit PROTOBUF_CONSTEXPR Message(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + template + explicit PROTOBUF_CONSTEXPR Message(::google::protobuf::internal::ConstantInitialized); - Message(const Message& from); + inline Message(const Message& from) + : Message(nullptr, from) {} Message(Message&& from) noexcept : Message() { *this = ::std::move(from); @@ -79,9 +97,9 @@ class Message final : } inline Message& operator=(Message&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena() + if (GetArena() == from.GetArena() #ifdef PROTOBUF_FORCE_COPY_IN_MOVE - && GetOwningArena() != nullptr + && GetArena() != nullptr #endif // !PROTOBUF_FORCE_COPY_IN_MOVE ) { InternalSwap(&from); @@ -91,13 +109,22 @@ class Message final : return *this; } - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const + ABSL_ATTRIBUTE_LIFETIME_BOUND { + return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); + } + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + ABSL_ATTRIBUTE_LIFETIME_BOUND { + return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); + } + + static const ::google::protobuf::Descriptor* descriptor() { return GetDescriptor(); } - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* GetReflection() { return default_instance().GetMetadata().reflection; } static const Message& default_instance() { @@ -116,65 +143,62 @@ class Message final : inline void Swap(Message* other) { if (other == this) return; #ifdef PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() != nullptr && - GetOwningArena() == other->GetOwningArena()) { + if (GetArena() != nullptr && + GetArena() == other->GetArena()) { #else // PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() == other->GetOwningArena()) { + if (GetArena() == other->GetArena()) { #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { - ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + ::google::protobuf::internal::GenericSwap(this, other); } } void UnsafeArenaSwap(Message* other) { if (other == this) return; - GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); } // implements Message ---------------------------------------------- - Message* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + Message* New(::google::protobuf::Arena* arena = nullptr) const final { return CreateMaybeMessage(arena); } - using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + using ::google::protobuf::Message::CopyFrom; void CopyFrom(const Message& from); - using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + using ::google::protobuf::Message::MergeFrom; void MergeFrom( const Message& from) { Message::MergeImpl(*this, from); } private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); + static void MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg); public: - PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + ABSL_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; - size_t ByteSizeLong() const final; - const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - uint8_t* _InternalSerialize( - uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; - int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + ::size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::google::protobuf::internal::ParseContext* ctx) final; + ::uint8_t* _InternalSerialize( + ::uint8_t* target, ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedCtor(::google::protobuf::Arena* arena); void SharedDtor(); - void SetCachedSize(int size) const final; void InternalSwap(Message* other); private: - friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; - static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + friend class ::google::protobuf::internal::AnyMetadata; + static ::absl::string_view FullMessageName() { return "messages.header.Message"; } protected: - explicit Message(::PROTOBUF_NAMESPACE_ID::Arena* arena, - bool is_message_owned = false); + explicit Message(::google::protobuf::Arena* arena); + Message(::google::protobuf::Arena* arena, const Message& from); + const ::google::protobuf::MessageLite::ClassData* GetClassData() const final; public: - static const ClassData _class_data_; - const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; - - ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + ::google::protobuf::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- @@ -187,268 +211,308 @@ class Message final : kMsgTypeFieldNumber = 2, }; // string senderUUID = 3; - void clear_senderuuid(); + void clear_senderuuid() ; const std::string& senderuuid() const; - template - void set_senderuuid(ArgT0&& arg0, ArgT... args); + template + void set_senderuuid(Arg_&& arg, Args_... args); std::string* mutable_senderuuid(); PROTOBUF_NODISCARD std::string* release_senderuuid(); - void set_allocated_senderuuid(std::string* senderuuid); + void set_allocated_senderuuid(std::string* value); + private: const std::string& _internal_senderuuid() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_senderuuid(const std::string& value); + inline PROTOBUF_ALWAYS_INLINE void _internal_set_senderuuid( + const std::string& value); std::string* _internal_mutable_senderuuid(); - public: + public: // .google.protobuf.Any payload = 5; bool has_payload() const; - private: - bool _internal_has_payload() const; - public: - void clear_payload(); - const ::PROTOBUF_NAMESPACE_ID::Any& payload() const; - PROTOBUF_NODISCARD ::PROTOBUF_NAMESPACE_ID::Any* release_payload(); - ::PROTOBUF_NAMESPACE_ID::Any* mutable_payload(); - void set_allocated_payload(::PROTOBUF_NAMESPACE_ID::Any* payload); - private: - const ::PROTOBUF_NAMESPACE_ID::Any& _internal_payload() const; - ::PROTOBUF_NAMESPACE_ID::Any* _internal_mutable_payload(); - public: - void unsafe_arena_set_allocated_payload( - ::PROTOBUF_NAMESPACE_ID::Any* payload); - ::PROTOBUF_NAMESPACE_ID::Any* unsafe_arena_release_payload(); + void clear_payload() ; + const ::google::protobuf::Any& payload() const; + PROTOBUF_NODISCARD ::google::protobuf::Any* release_payload(); + ::google::protobuf::Any* mutable_payload(); + void set_allocated_payload(::google::protobuf::Any* value); + void unsafe_arena_set_allocated_payload(::google::protobuf::Any* value); + ::google::protobuf::Any* unsafe_arena_release_payload(); + private: + const ::google::protobuf::Any& _internal_payload() const; + ::google::protobuf::Any* _internal_mutable_payload(); + + public: // uint32 topic = 1; - void clear_topic(); - uint32_t topic() const; - void set_topic(uint32_t value); - private: - uint32_t _internal_topic() const; - void _internal_set_topic(uint32_t value); - public: + void clear_topic() ; + ::uint32_t topic() const; + void set_topic(::uint32_t value); + private: + ::uint32_t _internal_topic() const; + void _internal_set_topic(::uint32_t value); + + public: // uint32 msgType = 2; - void clear_msgtype(); - uint32_t msgtype() const; - void set_msgtype(uint32_t value); - private: - uint32_t _internal_msgtype() const; - void _internal_set_msgtype(uint32_t value); - public: + void clear_msgtype() ; + ::uint32_t msgtype() const; + void set_msgtype(::uint32_t value); + private: + ::uint32_t _internal_msgtype() const; + void _internal_set_msgtype(::uint32_t value); + + public: // @@protoc_insertion_point(class_scope:messages.header.Message) private: class _Internal; - template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; - typedef void InternalArenaConstructable_; - typedef void DestructorSkippable_; + friend class ::google::protobuf::internal::TcParser; + static const ::google::protobuf::internal::TcParseTable< + 3, 4, 1, + 42, 2> + _table_; + friend class ::google::protobuf::MessageLite; + friend class ::google::protobuf::Arena; + template + friend class ::google::protobuf::Arena::InternalHelper; + using InternalArenaConstructable_ = void; + using DestructorSkippable_ = void; struct Impl_ { - ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr senderuuid_; - ::PROTOBUF_NAMESPACE_ID::Any* payload_; - uint32_t topic_; - uint32_t msgtype_; - mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + + inline explicit constexpr Impl_( + ::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* arena); + inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* arena, const Impl_& from); + ::google::protobuf::internal::HasBits<1> _has_bits_; + mutable ::google::protobuf::internal::CachedSize _cached_size_; + ::google::protobuf::internal::ArenaStringPtr senderuuid_; + ::google::protobuf::Any* payload_; + ::uint32_t topic_; + ::uint32_t msgtype_; + PROTOBUF_TSAN_DECLARE_MEMBER }; union { Impl_ _impl_; }; friend struct ::TableStruct_message_2eproto; }; + // =================================================================== + + // =================================================================== + #ifdef __GNUC__ - #pragma GCC diagnostic push - #pragma GCC diagnostic ignored "-Wstrict-aliasing" +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wstrict-aliasing" #endif // __GNUC__ +// ------------------------------------------------------------------- + // Message // uint32 topic = 1; inline void Message::clear_topic() { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); _impl_.topic_ = 0u; } -inline uint32_t Message::_internal_topic() const { - return _impl_.topic_; -} -inline uint32_t Message::topic() const { +inline ::uint32_t Message::topic() const { // @@protoc_insertion_point(field_get:messages.header.Message.topic) return _internal_topic(); } -inline void Message::_internal_set_topic(uint32_t value) { - - _impl_.topic_ = value; -} -inline void Message::set_topic(uint32_t value) { +inline void Message::set_topic(::uint32_t value) { _internal_set_topic(value); // @@protoc_insertion_point(field_set:messages.header.Message.topic) } +inline ::uint32_t Message::_internal_topic() const { + PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race); + return _impl_.topic_; +} +inline void Message::_internal_set_topic(::uint32_t value) { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + ; + _impl_.topic_ = value; +} // uint32 msgType = 2; inline void Message::clear_msgtype() { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); _impl_.msgtype_ = 0u; } -inline uint32_t Message::_internal_msgtype() const { - return _impl_.msgtype_; -} -inline uint32_t Message::msgtype() const { +inline ::uint32_t Message::msgtype() const { // @@protoc_insertion_point(field_get:messages.header.Message.msgType) return _internal_msgtype(); } -inline void Message::_internal_set_msgtype(uint32_t value) { - - _impl_.msgtype_ = value; -} -inline void Message::set_msgtype(uint32_t value) { +inline void Message::set_msgtype(::uint32_t value) { _internal_set_msgtype(value); // @@protoc_insertion_point(field_set:messages.header.Message.msgType) } +inline ::uint32_t Message::_internal_msgtype() const { + PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race); + return _impl_.msgtype_; +} +inline void Message::_internal_set_msgtype(::uint32_t value) { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + ; + _impl_.msgtype_ = value; +} // string senderUUID = 3; inline void Message::clear_senderuuid() { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); _impl_.senderuuid_.ClearToEmpty(); } -inline const std::string& Message::senderuuid() const { +inline const std::string& Message::senderuuid() const + ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_get:messages.header.Message.senderUUID) return _internal_senderuuid(); } -template -inline PROTOBUF_ALWAYS_INLINE -void Message::set_senderuuid(ArgT0&& arg0, ArgT... args) { - - _impl_.senderuuid_.Set(static_cast(arg0), args..., GetArenaForAllocation()); +template +inline PROTOBUF_ALWAYS_INLINE void Message::set_senderuuid(Arg_&& arg, + Args_... args) { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + ; + _impl_.senderuuid_.Set(static_cast(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:messages.header.Message.senderUUID) } -inline std::string* Message::mutable_senderuuid() { +inline std::string* Message::mutable_senderuuid() ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_senderuuid(); // @@protoc_insertion_point(field_mutable:messages.header.Message.senderUUID) return _s; } inline const std::string& Message::_internal_senderuuid() const { + PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race); return _impl_.senderuuid_.Get(); } inline void Message::_internal_set_senderuuid(const std::string& value) { - - _impl_.senderuuid_.Set(value, GetArenaForAllocation()); + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + ; + _impl_.senderuuid_.Set(value, GetArena()); } inline std::string* Message::_internal_mutable_senderuuid() { - - return _impl_.senderuuid_.Mutable(GetArenaForAllocation()); + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + ; + return _impl_.senderuuid_.Mutable( GetArena()); } inline std::string* Message::release_senderuuid() { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); // @@protoc_insertion_point(field_release:messages.header.Message.senderUUID) return _impl_.senderuuid_.Release(); } -inline void Message::set_allocated_senderuuid(std::string* senderuuid) { - if (senderuuid != nullptr) { - - } else { - - } - _impl_.senderuuid_.SetAllocated(senderuuid, GetArenaForAllocation()); -#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (_impl_.senderuuid_.IsDefault()) { - _impl_.senderuuid_.Set("", GetArenaForAllocation()); - } -#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +inline void Message::set_allocated_senderuuid(std::string* value) { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + _impl_.senderuuid_.SetAllocated(value, GetArena()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.senderuuid_.IsDefault()) { + _impl_.senderuuid_.Set("", GetArena()); + } + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:messages.header.Message.senderUUID) } // .google.protobuf.Any payload = 5; -inline bool Message::_internal_has_payload() const { - return this != internal_default_instance() && _impl_.payload_ != nullptr; -} inline bool Message::has_payload() const { - return _internal_has_payload(); + bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; + PROTOBUF_ASSUME(!value || _impl_.payload_ != nullptr); + return value; } -inline const ::PROTOBUF_NAMESPACE_ID::Any& Message::_internal_payload() const { - const ::PROTOBUF_NAMESPACE_ID::Any* p = _impl_.payload_; - return p != nullptr ? *p : reinterpret_cast( - ::PROTOBUF_NAMESPACE_ID::_Any_default_instance_); +inline const ::google::protobuf::Any& Message::_internal_payload() const { + PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race); + const ::google::protobuf::Any* p = _impl_.payload_; + return p != nullptr ? *p : reinterpret_cast(::google::protobuf::_Any_default_instance_); } -inline const ::PROTOBUF_NAMESPACE_ID::Any& Message::payload() const { +inline const ::google::protobuf::Any& Message::payload() const ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_get:messages.header.Message.payload) return _internal_payload(); } -inline void Message::unsafe_arena_set_allocated_payload( - ::PROTOBUF_NAMESPACE_ID::Any* payload) { - if (GetArenaForAllocation() == nullptr) { - delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.payload_); +inline void Message::unsafe_arena_set_allocated_payload(::google::protobuf::Any* value) { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + if (GetArena() == nullptr) { + delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.payload_); } - _impl_.payload_ = payload; - if (payload) { - + _impl_.payload_ = reinterpret_cast<::google::protobuf::Any*>(value); + if (value != nullptr) { + _impl_._has_bits_[0] |= 0x00000001u; } else { - + _impl_._has_bits_[0] &= ~0x00000001u; } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:messages.header.Message.payload) } -inline ::PROTOBUF_NAMESPACE_ID::Any* Message::release_payload() { - - ::PROTOBUF_NAMESPACE_ID::Any* temp = _impl_.payload_; +inline ::google::protobuf::Any* Message::release_payload() { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + + _impl_._has_bits_[0] &= ~0x00000001u; + ::google::protobuf::Any* released = _impl_.payload_; _impl_.payload_ = nullptr; #ifdef PROTOBUF_FORCE_COPY_IN_RELEASE - auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); - temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); - if (GetArenaForAllocation() == nullptr) { delete old; } -#else // PROTOBUF_FORCE_COPY_IN_RELEASE - if (GetArenaForAllocation() != nullptr) { - temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + auto* old = reinterpret_cast<::google::protobuf::MessageLite*>(released); + released = ::google::protobuf::internal::DuplicateIfNonNull(released); + if (GetArena() == nullptr) { + delete old; + } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArena() != nullptr) { + released = ::google::protobuf::internal::DuplicateIfNonNull(released); } #endif // !PROTOBUF_FORCE_COPY_IN_RELEASE - return temp; + return released; } -inline ::PROTOBUF_NAMESPACE_ID::Any* Message::unsafe_arena_release_payload() { +inline ::google::protobuf::Any* Message::unsafe_arena_release_payload() { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); // @@protoc_insertion_point(field_release:messages.header.Message.payload) - - ::PROTOBUF_NAMESPACE_ID::Any* temp = _impl_.payload_; + + _impl_._has_bits_[0] &= ~0x00000001u; + ::google::protobuf::Any* temp = _impl_.payload_; _impl_.payload_ = nullptr; return temp; } -inline ::PROTOBUF_NAMESPACE_ID::Any* Message::_internal_mutable_payload() { - +inline ::google::protobuf::Any* Message::_internal_mutable_payload() { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + _impl_._has_bits_[0] |= 0x00000001u; if (_impl_.payload_ == nullptr) { - auto* p = CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::Any>(GetArenaForAllocation()); - _impl_.payload_ = p; + auto* p = CreateMaybeMessage<::google::protobuf::Any>(GetArena()); + _impl_.payload_ = reinterpret_cast<::google::protobuf::Any*>(p); } return _impl_.payload_; } -inline ::PROTOBUF_NAMESPACE_ID::Any* Message::mutable_payload() { - ::PROTOBUF_NAMESPACE_ID::Any* _msg = _internal_mutable_payload(); +inline ::google::protobuf::Any* Message::mutable_payload() ABSL_ATTRIBUTE_LIFETIME_BOUND { + ::google::protobuf::Any* _msg = _internal_mutable_payload(); // @@protoc_insertion_point(field_mutable:messages.header.Message.payload) return _msg; } -inline void Message::set_allocated_payload(::PROTOBUF_NAMESPACE_ID::Any* payload) { - ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); +inline void Message::set_allocated_payload(::google::protobuf::Any* value) { + ::google::protobuf::Arena* message_arena = GetArena(); + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); if (message_arena == nullptr) { - delete reinterpret_cast< ::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.payload_); + delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.payload_); } - if (payload) { - ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = - ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena( - reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(payload)); + + if (value != nullptr) { + ::google::protobuf::Arena* submessage_arena = reinterpret_cast<::google::protobuf::MessageLite*>(value)->GetArena(); if (message_arena != submessage_arena) { - payload = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( - message_arena, payload, submessage_arena); + value = ::google::protobuf::internal::GetOwnedMessage(message_arena, value, submessage_arena); } - + _impl_._has_bits_[0] |= 0x00000001u; } else { - + _impl_._has_bits_[0] &= ~0x00000001u; } - _impl_.payload_ = payload; + + _impl_.payload_ = reinterpret_cast<::google::protobuf::Any*>(value); // @@protoc_insertion_point(field_set_allocated:messages.header.Message.payload) } #ifdef __GNUC__ - #pragma GCC diagnostic pop +#pragma GCC diagnostic pop #endif // __GNUC__ // @@protoc_insertion_point(namespace_scope) - } // namespace header } // namespace messages + // @@protoc_insertion_point(global_scope) -#include -#endif // GOOGLE_PROTOBUF_INCLUDED_GOOGLE_PROTOBUF_INCLUDED_message_2eproto +#include "google/protobuf/port_undef.inc" + +#endif // GOOGLE_PROTOBUF_INCLUDED_message_2eproto_2epb_2eh diff --git a/include/WHISPER/Messages/Protos/ping.pb.cc b/include/WHISPER/Messages/Protos/ping.pb.cc index 0c4f38b..b12e529 100644 --- a/include/WHISPER/Messages/Protos/ping.pb.cc +++ b/include/WHISPER/Messages/Protos/ping.pb.cc @@ -4,235 +4,262 @@ #include "ping.pb.h" #include - -#include -#include -#include -#include -#include -#include -#include +#include "google/protobuf/io/coded_stream.h" +#include "google/protobuf/extension_set.h" +#include "google/protobuf/wire_format_lite.h" +#include "google/protobuf/descriptor.h" +#include "google/protobuf/generated_message_reflection.h" +#include "google/protobuf/reflection_ops.h" +#include "google/protobuf/wire_format.h" +#include "google/protobuf/generated_message_tctable_impl.h" // @@protoc_insertion_point(includes) -#include +// Must be included last. +#include "google/protobuf/port_def.inc" PROTOBUF_PRAGMA_INIT_SEG - -namespace _pb = ::PROTOBUF_NAMESPACE_ID; -namespace _pbi = _pb::internal; - +namespace _pb = ::google::protobuf; +namespace _pbi = ::google::protobuf::internal; +namespace _fl = ::google::protobuf::internal::field_layout; namespace messages { namespace ping { -PROTOBUF_CONSTEXPR Ping::Ping( - ::_pbi::ConstantInitialized): _impl_{ - /*decltype(_impl_.port_)*/0u - , /*decltype(_impl_._cached_size_)*/{}} {} + +inline constexpr Ping::Impl_::Impl_( + ::_pbi::ConstantInitialized) noexcept + : port_{0u}, + _cached_size_{0} {} + +template +PROTOBUF_CONSTEXPR Ping::Ping(::_pbi::ConstantInitialized) + : _impl_(::_pbi::ConstantInitialized()) {} struct PingDefaultTypeInternal { - PROTOBUF_CONSTEXPR PingDefaultTypeInternal() - : _instance(::_pbi::ConstantInitialized{}) {} + PROTOBUF_CONSTEXPR PingDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} ~PingDefaultTypeInternal() {} union { Ping _instance; }; }; -PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 PingDefaultTypeInternal _Ping_default_instance_; + +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 PingDefaultTypeInternal _Ping_default_instance_; } // namespace ping } // namespace messages static ::_pb::Metadata file_level_metadata_ping_2eproto[1]; -static constexpr ::_pb::EnumDescriptor const** file_level_enum_descriptors_ping_2eproto = nullptr; -static constexpr ::_pb::ServiceDescriptor const** file_level_service_descriptors_ping_2eproto = nullptr; - -const uint32_t TableStruct_ping_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { - ~0u, // no _has_bits_ - PROTOBUF_FIELD_OFFSET(::messages::ping::Ping, _internal_metadata_), - ~0u, // no _extensions_ - ~0u, // no _oneof_case_ - ~0u, // no _weak_field_map_ - ~0u, // no _inlined_string_donated_ - PROTOBUF_FIELD_OFFSET(::messages::ping::Ping, _impl_.port_), +static constexpr const ::_pb::EnumDescriptor** + file_level_enum_descriptors_ping_2eproto = nullptr; +static constexpr const ::_pb::ServiceDescriptor** + file_level_service_descriptors_ping_2eproto = nullptr; +const ::uint32_t + TableStruct_ping_2eproto::offsets[] ABSL_ATTRIBUTE_SECTION_VARIABLE( + protodesc_cold) = { + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::messages::ping::Ping, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) + PROTOBUF_FIELD_OFFSET(::messages::ping::Ping, _impl_.port_), }; -static const ::_pbi::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { - { 0, -1, -1, sizeof(::messages::ping::Ping)}, + +static const ::_pbi::MigrationSchema + schemas[] ABSL_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { + {0, -1, -1, sizeof(::messages::ping::Ping)}, }; static const ::_pb::Message* const file_default_instances[] = { - &::messages::ping::_Ping_default_instance_._instance, + &::messages::ping::_Ping_default_instance_._instance, }; - -const char descriptor_table_protodef_ping_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = - "\n\nping.proto\022\rmessages.ping\"\024\n\004Ping\022\014\n\004p" - "ort\030\002 \001(\rb\006proto3" - ; -static ::_pbi::once_flag descriptor_table_ping_2eproto_once; +const char descriptor_table_protodef_ping_2eproto[] ABSL_ATTRIBUTE_SECTION_VARIABLE( + protodesc_cold) = { + "\n\nping.proto\022\rmessages.ping\"\024\n\004Ping\022\014\n\004p" + "ort\030\002 \001(\rb\006proto3" +}; +static ::absl::once_flag descriptor_table_ping_2eproto_once; const ::_pbi::DescriptorTable descriptor_table_ping_2eproto = { - false, false, 57, descriptor_table_protodef_ping_2eproto, + false, + false, + 57, + descriptor_table_protodef_ping_2eproto, "ping.proto", - &descriptor_table_ping_2eproto_once, nullptr, 0, 1, - schemas, file_default_instances, TableStruct_ping_2eproto::offsets, - file_level_metadata_ping_2eproto, file_level_enum_descriptors_ping_2eproto, + &descriptor_table_ping_2eproto_once, + nullptr, + 0, + 1, + schemas, + file_default_instances, + TableStruct_ping_2eproto::offsets, + file_level_metadata_ping_2eproto, + file_level_enum_descriptors_ping_2eproto, file_level_service_descriptors_ping_2eproto, }; + +// This function exists to be marked as weak. +// It can significantly speed up compilation by breaking up LLVM's SCC +// in the .pb.cc translation units. Large translation units see a +// reduction of more than 35% of walltime for optimized builds. Without +// the weak attribute all the messages in the file, including all the +// vtables and everything they use become part of the same SCC through +// a cycle like: +// GetMetadata -> descriptor table -> default instances -> +// vtables -> GetMetadata +// By adding a weak function here we break the connection from the +// individual vtables back into the descriptor table. PROTOBUF_ATTRIBUTE_WEAK const ::_pbi::DescriptorTable* descriptor_table_ping_2eproto_getter() { return &descriptor_table_ping_2eproto; } - // Force running AddDescriptors() at dynamic initialization time. -PROTOBUF_ATTRIBUTE_INIT_PRIORITY2 static ::_pbi::AddDescriptorsRunner dynamic_init_dummy_ping_2eproto(&descriptor_table_ping_2eproto); +PROTOBUF_ATTRIBUTE_INIT_PRIORITY2 +static ::_pbi::AddDescriptorsRunner dynamic_init_dummy_ping_2eproto(&descriptor_table_ping_2eproto); namespace messages { namespace ping { - // =================================================================== class Ping::_Internal { public: }; -Ping::Ping(::PROTOBUF_NAMESPACE_ID::Arena* arena, - bool is_message_owned) - : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { - SharedCtor(arena, is_message_owned); +Ping::Ping(::google::protobuf::Arena* arena) + : ::google::protobuf::Message(arena) { + SharedCtor(arena); // @@protoc_insertion_point(arena_constructor:messages.ping.Ping) } -Ping::Ping(const Ping& from) - : ::PROTOBUF_NAMESPACE_ID::Message() { - Ping* const _this = this; (void)_this; - new (&_impl_) Impl_{ - decltype(_impl_.port_){} - , /*decltype(_impl_._cached_size_)*/{}}; - - _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); - _this->_impl_.port_ = from._impl_.port_; - // @@protoc_insertion_point(copy_constructor:messages.ping.Ping) +Ping::Ping( + ::google::protobuf::Arena* arena, const Ping& from) + : Ping(arena) { + MergeFrom(from); } +inline PROTOBUF_NDEBUG_INLINE Ping::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* arena) + : _cached_size_{0} {} -inline void Ping::SharedCtor( - ::_pb::Arena* arena, bool is_message_owned) { - (void)arena; - (void)is_message_owned; - new (&_impl_) Impl_{ - decltype(_impl_.port_){0u} - , /*decltype(_impl_._cached_size_)*/{} - }; +inline void Ping::SharedCtor(::_pb::Arena* arena) { + new (&_impl_) Impl_(internal_visibility(), arena); + _impl_.port_ = {}; } - Ping::~Ping() { // @@protoc_insertion_point(destructor:messages.ping.Ping) - if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) { - (void)arena; - return; - } + _internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>(); SharedDtor(); } - inline void Ping::SharedDtor() { - GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + ABSL_DCHECK(GetArena() == nullptr); + _impl_.~Impl_(); } -void Ping::SetCachedSize(int size) const { - _impl_._cached_size_.Set(size); +const ::google::protobuf::MessageLite::ClassData* +Ping::GetClassData() const { + PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite::ClassData + _data_ = { + Ping::MergeImpl, + nullptr, // OnDemandRegisterArenaDtor + &::google::protobuf::Message::kDescriptorMethods, + PROTOBUF_FIELD_OFFSET(Ping, _impl_._cached_size_), + }; + return &_data_; } - -void Ping::Clear() { +PROTOBUF_NOINLINE void Ping::Clear() { // @@protoc_insertion_point(message_clear_start:messages.ping.Ping) - uint32_t cached_has_bits = 0; + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + ::uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; _impl_.port_ = 0u; - _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); } -const char* Ping::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) { -#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure - while (!ctx->Done(&ptr)) { - uint32_t tag; - ptr = ::_pbi::ReadTag(ptr, &tag); - switch (tag >> 3) { - // uint32 port = 2; - case 2: - if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) { - _impl_.port_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); - CHK_(ptr); - } else - goto handle_unusual; - continue; - default: - goto handle_unusual; - } // switch - handle_unusual: - if ((tag == 0) || ((tag & 7) == 4)) { - CHK_(ptr); - ctx->SetLastTag(tag); - goto message_done; - } - ptr = UnknownFieldParse( - tag, - _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), - ptr, ctx); - CHK_(ptr != nullptr); - } // while -message_done: +const char* Ping::_InternalParse( + const char* ptr, ::_pbi::ParseContext* ctx) { + ptr = ::_pbi::TcParser::ParseLoop(this, ptr, ctx, &_table_.header); return ptr; -failure: - ptr = nullptr; - goto message_done; -#undef CHK_ } -uint8_t* Ping::_InternalSerialize( - uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + +PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 +const ::_pbi::TcParseTable<0, 1, 0, 0, 2> Ping::_table_ = { + { + 0, // no _has_bits_ + 0, // no _extensions_ + 2, 0, // max_field_number, fast_idx_mask + offsetof(decltype(_table_), field_lookup_table), + 4294967293, // skipmap + offsetof(decltype(_table_), field_entries), + 1, // num_field_entries + 0, // num_aux_entries + offsetof(decltype(_table_), field_names), // no aux_entries + &_Ping_default_instance_._instance, + ::_pbi::TcParser::GenericFallback, // fallback + }, {{ + // uint32 port = 2; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(Ping, _impl_.port_), 63>(), + {16, 63, 0, PROTOBUF_FIELD_OFFSET(Ping, _impl_.port_)}}, + }}, {{ + 65535, 65535 + }}, {{ + // uint32 port = 2; + {PROTOBUF_FIELD_OFFSET(Ping, _impl_.port_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kUInt32)}, + }}, + // no aux_entries + {{ + }}, +}; + +::uint8_t* Ping::_InternalSerialize( + ::uint8_t* target, + ::google::protobuf::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:messages.ping.Ping) - uint32_t cached_has_bits = 0; - (void) cached_has_bits; + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; // uint32 port = 2; if (this->_internal_port() != 0) { target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteUInt32ToArray(2, this->_internal_port(), target); + target = ::_pbi::WireFormatLite::WriteUInt32ToArray( + 2, this->_internal_port(), target); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); } // @@protoc_insertion_point(serialize_to_array_end:messages.ping.Ping) return target; } -size_t Ping::ByteSizeLong() const { +::size_t Ping::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:messages.ping.Ping) - size_t total_size = 0; + ::size_t total_size = 0; - uint32_t cached_has_bits = 0; + ::uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; // uint32 port = 2; if (this->_internal_port() != 0) { - total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_port()); + total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne( + this->_internal_port()); } return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } -const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Ping::_class_data_ = { - ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck, - Ping::MergeImpl -}; -const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*Ping::GetClassData() const { return &_class_data_; } - -void Ping::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) { +void Ping::MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg) { auto* const _this = static_cast(&to_msg); auto& from = static_cast(from_msg); // @@protoc_insertion_point(class_specific_merge_from_start:messages.ping.Ping) - GOOGLE_DCHECK_NE(&from, _this); - uint32_t cached_has_bits = 0; + ABSL_DCHECK_NE(&from, _this); + ::uint32_t cached_has_bits = 0; (void) cached_has_bits; if (from._internal_port() != 0) { _this->_internal_set_port(from._internal_port()); } - _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } void Ping::CopyFrom(const Ping& from) { @@ -242,31 +269,27 @@ void Ping::CopyFrom(const Ping& from) { MergeFrom(from); } -bool Ping::IsInitialized() const { +PROTOBUF_NOINLINE bool Ping::IsInitialized() const { return true; } -void Ping::InternalSwap(Ping* other) { +void Ping::InternalSwap(Ping* PROTOBUF_RESTRICT other) { using std::swap; _internal_metadata_.InternalSwap(&other->_internal_metadata_); - swap(_impl_.port_, other->_impl_.port_); + swap(_impl_.port_, other->_impl_.port_); } -::PROTOBUF_NAMESPACE_ID::Metadata Ping::GetMetadata() const { +::google::protobuf::Metadata Ping::GetMetadata() const { return ::_pbi::AssignDescriptors( &descriptor_table_ping_2eproto_getter, &descriptor_table_ping_2eproto_once, file_level_metadata_ping_2eproto[0]); } - // @@protoc_insertion_point(namespace_scope) } // namespace ping } // namespace messages -PROTOBUF_NAMESPACE_OPEN -template<> PROTOBUF_NOINLINE ::messages::ping::Ping* -Arena::CreateMaybeMessage< ::messages::ping::Ping >(Arena* arena) { - return Arena::CreateMessageInternal< ::messages::ping::Ping >(arena); -} -PROTOBUF_NAMESPACE_CLOSE - +namespace google { +namespace protobuf { +} // namespace protobuf +} // namespace google // @@protoc_insertion_point(global_scope) -#include +#include "google/protobuf/port_undef.inc" diff --git a/include/WHISPER/Messages/Protos/ping.pb.h b/include/WHISPER/Messages/Protos/ping.pb.h index 839c30c..feac500 100644 --- a/include/WHISPER/Messages/Protos/ping.pb.h +++ b/include/WHISPER/Messages/Protos/ping.pb.h @@ -1,49 +1,60 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: ping.proto +// Protobuf C++ Version: 4.24.0-main -#ifndef GOOGLE_PROTOBUF_INCLUDED_ping_2eproto -#define GOOGLE_PROTOBUF_INCLUDED_ping_2eproto +#ifndef GOOGLE_PROTOBUF_INCLUDED_ping_2eproto_2epb_2eh +#define GOOGLE_PROTOBUF_INCLUDED_ping_2eproto_2epb_2eh #include #include +#include +#include -#include -#if PROTOBUF_VERSION < 3021000 -#error This file was generated by a newer version of protoc which is -#error incompatible with your Protocol Buffer headers. Please update -#error your headers. -#endif -#if 3021012 < PROTOBUF_MIN_PROTOC_VERSION -#error This file was generated by an older version of protoc which is -#error incompatible with your Protocol Buffer headers. Please -#error regenerate this file with a newer version of protoc. -#endif +#include "google/protobuf/port_def.inc" +#if PROTOBUF_VERSION < 4025000 +#error "This file was generated by a newer version of protoc which is" +#error "incompatible with your Protocol Buffer headers. Please update" +#error "your headers." +#endif // PROTOBUF_VERSION -#include -#include -#include -#include -#include -#include -#include -#include -#include // IWYU pragma: export -#include // IWYU pragma: export -#include +#if 4025000 < PROTOBUF_MIN_PROTOC_VERSION +#error "This file was generated by an older version of protoc which is" +#error "incompatible with your Protocol Buffer headers. Please" +#error "regenerate this file with a newer version of protoc." +#endif // PROTOBUF_MIN_PROTOC_VERSION +#include "google/protobuf/port_undef.inc" +#include "google/protobuf/io/coded_stream.h" +#include "google/protobuf/arena.h" +#include "google/protobuf/arenastring.h" +#include "google/protobuf/generated_message_tctable_decl.h" +#include "google/protobuf/generated_message_util.h" +#include "google/protobuf/metadata_lite.h" +#include "google/protobuf/generated_message_reflection.h" +#include "google/protobuf/message.h" +#include "google/protobuf/repeated_field.h" // IWYU pragma: export +#include "google/protobuf/extension_set.h" // IWYU pragma: export +#include "google/protobuf/unknown_field_set.h" // @@protoc_insertion_point(includes) -#include + +// Must be included last. +#include "google/protobuf/port_def.inc" + #define PROTOBUF_INTERNAL_EXPORT_ping_2eproto -PROTOBUF_NAMESPACE_OPEN + +namespace google { +namespace protobuf { namespace internal { class AnyMetadata; } // namespace internal -PROTOBUF_NAMESPACE_CLOSE +} // namespace protobuf +} // namespace google // Internal implementation detail -- do not use these members. struct TableStruct_ping_2eproto { - static const uint32_t offsets[]; + static const ::uint32_t offsets[]; }; -extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_ping_2eproto; +extern const ::google::protobuf::internal::DescriptorTable + descriptor_table_ping_2eproto; namespace messages { namespace ping { class Ping; @@ -51,22 +62,29 @@ struct PingDefaultTypeInternal; extern PingDefaultTypeInternal _Ping_default_instance_; } // namespace ping } // namespace messages -PROTOBUF_NAMESPACE_OPEN -template<> ::messages::ping::Ping* Arena::CreateMaybeMessage<::messages::ping::Ping>(Arena*); -PROTOBUF_NAMESPACE_CLOSE +namespace google { +namespace protobuf { +} // namespace protobuf +} // namespace google + namespace messages { namespace ping { // =================================================================== + +// ------------------------------------------------------------------- + class Ping final : - public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:messages.ping.Ping) */ { + public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:messages.ping.Ping) */ { public: inline Ping() : Ping(nullptr) {} ~Ping() override; - explicit PROTOBUF_CONSTEXPR Ping(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + template + explicit PROTOBUF_CONSTEXPR Ping(::google::protobuf::internal::ConstantInitialized); - Ping(const Ping& from); + inline Ping(const Ping& from) + : Ping(nullptr, from) {} Ping(Ping&& from) noexcept : Ping() { *this = ::std::move(from); @@ -78,9 +96,9 @@ class Ping final : } inline Ping& operator=(Ping&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena() + if (GetArena() == from.GetArena() #ifdef PROTOBUF_FORCE_COPY_IN_MOVE - && GetOwningArena() != nullptr + && GetArena() != nullptr #endif // !PROTOBUF_FORCE_COPY_IN_MOVE ) { InternalSwap(&from); @@ -90,13 +108,22 @@ class Ping final : return *this; } - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const + ABSL_ATTRIBUTE_LIFETIME_BOUND { + return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); + } + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + ABSL_ATTRIBUTE_LIFETIME_BOUND { + return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); + } + + static const ::google::protobuf::Descriptor* descriptor() { return GetDescriptor(); } - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* GetReflection() { return default_instance().GetMetadata().reflection; } static const Ping& default_instance() { @@ -115,65 +142,62 @@ class Ping final : inline void Swap(Ping* other) { if (other == this) return; #ifdef PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() != nullptr && - GetOwningArena() == other->GetOwningArena()) { + if (GetArena() != nullptr && + GetArena() == other->GetArena()) { #else // PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() == other->GetOwningArena()) { + if (GetArena() == other->GetArena()) { #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { - ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + ::google::protobuf::internal::GenericSwap(this, other); } } void UnsafeArenaSwap(Ping* other) { if (other == this) return; - GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); } // implements Message ---------------------------------------------- - Ping* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + Ping* New(::google::protobuf::Arena* arena = nullptr) const final { return CreateMaybeMessage(arena); } - using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + using ::google::protobuf::Message::CopyFrom; void CopyFrom(const Ping& from); - using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + using ::google::protobuf::Message::MergeFrom; void MergeFrom( const Ping& from) { Ping::MergeImpl(*this, from); } private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); + static void MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg); public: - PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + ABSL_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; - size_t ByteSizeLong() const final; - const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - uint8_t* _InternalSerialize( - uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; - int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + ::size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::google::protobuf::internal::ParseContext* ctx) final; + ::uint8_t* _InternalSerialize( + ::uint8_t* target, ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedCtor(::google::protobuf::Arena* arena); void SharedDtor(); - void SetCachedSize(int size) const final; void InternalSwap(Ping* other); private: - friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; - static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + friend class ::google::protobuf::internal::AnyMetadata; + static ::absl::string_view FullMessageName() { return "messages.ping.Ping"; } protected: - explicit Ping(::PROTOBUF_NAMESPACE_ID::Arena* arena, - bool is_message_owned = false); + explicit Ping(::google::protobuf::Arena* arena); + Ping(::google::protobuf::Arena* arena, const Ping& from); + const ::google::protobuf::MessageLite::ClassData* GetClassData() const final; public: - static const ClassData _class_data_; - const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; - - ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + ::google::protobuf::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- @@ -183,69 +207,96 @@ class Ping final : kPortFieldNumber = 2, }; // uint32 port = 2; - void clear_port(); - uint32_t port() const; - void set_port(uint32_t value); - private: - uint32_t _internal_port() const; - void _internal_set_port(uint32_t value); - public: + void clear_port() ; + ::uint32_t port() const; + void set_port(::uint32_t value); + private: + ::uint32_t _internal_port() const; + void _internal_set_port(::uint32_t value); + + public: // @@protoc_insertion_point(class_scope:messages.ping.Ping) private: class _Internal; - template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; - typedef void InternalArenaConstructable_; - typedef void DestructorSkippable_; + friend class ::google::protobuf::internal::TcParser; + static const ::google::protobuf::internal::TcParseTable< + 0, 1, 0, + 0, 2> + _table_; + friend class ::google::protobuf::MessageLite; + friend class ::google::protobuf::Arena; + template + friend class ::google::protobuf::Arena::InternalHelper; + using InternalArenaConstructable_ = void; + using DestructorSkippable_ = void; struct Impl_ { - uint32_t port_; - mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + + inline explicit constexpr Impl_( + ::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* arena); + inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* arena, const Impl_& from); + ::uint32_t port_; + mutable ::google::protobuf::internal::CachedSize _cached_size_; + PROTOBUF_TSAN_DECLARE_MEMBER }; union { Impl_ _impl_; }; friend struct ::TableStruct_ping_2eproto; }; + // =================================================================== + + // =================================================================== + #ifdef __GNUC__ - #pragma GCC diagnostic push - #pragma GCC diagnostic ignored "-Wstrict-aliasing" +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wstrict-aliasing" #endif // __GNUC__ +// ------------------------------------------------------------------- + // Ping // uint32 port = 2; inline void Ping::clear_port() { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); _impl_.port_ = 0u; } -inline uint32_t Ping::_internal_port() const { - return _impl_.port_; -} -inline uint32_t Ping::port() const { +inline ::uint32_t Ping::port() const { // @@protoc_insertion_point(field_get:messages.ping.Ping.port) return _internal_port(); } -inline void Ping::_internal_set_port(uint32_t value) { - - _impl_.port_ = value; -} -inline void Ping::set_port(uint32_t value) { +inline void Ping::set_port(::uint32_t value) { _internal_set_port(value); // @@protoc_insertion_point(field_set:messages.ping.Ping.port) } +inline ::uint32_t Ping::_internal_port() const { + PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race); + return _impl_.port_; +} +inline void Ping::_internal_set_port(::uint32_t value) { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + ; + _impl_.port_ = value; +} #ifdef __GNUC__ - #pragma GCC diagnostic pop +#pragma GCC diagnostic pop #endif // __GNUC__ // @@protoc_insertion_point(namespace_scope) - } // namespace ping } // namespace messages + // @@protoc_insertion_point(global_scope) -#include -#endif // GOOGLE_PROTOBUF_INCLUDED_GOOGLE_PROTOBUF_INCLUDED_ping_2eproto +#include "google/protobuf/port_undef.inc" + +#endif // GOOGLE_PROTOBUF_INCLUDED_ping_2eproto_2epb_2eh diff --git a/include/WHISPER/Messages/Protos/pong.pb.cc b/include/WHISPER/Messages/Protos/pong.pb.cc index 3186398..3310e9c 100644 --- a/include/WHISPER/Messages/Protos/pong.pb.cc +++ b/include/WHISPER/Messages/Protos/pong.pb.cc @@ -4,235 +4,262 @@ #include "pong.pb.h" #include - -#include -#include -#include -#include -#include -#include -#include +#include "google/protobuf/io/coded_stream.h" +#include "google/protobuf/extension_set.h" +#include "google/protobuf/wire_format_lite.h" +#include "google/protobuf/descriptor.h" +#include "google/protobuf/generated_message_reflection.h" +#include "google/protobuf/reflection_ops.h" +#include "google/protobuf/wire_format.h" +#include "google/protobuf/generated_message_tctable_impl.h" // @@protoc_insertion_point(includes) -#include +// Must be included last. +#include "google/protobuf/port_def.inc" PROTOBUF_PRAGMA_INIT_SEG - -namespace _pb = ::PROTOBUF_NAMESPACE_ID; -namespace _pbi = _pb::internal; - +namespace _pb = ::google::protobuf; +namespace _pbi = ::google::protobuf::internal; +namespace _fl = ::google::protobuf::internal::field_layout; namespace messages { namespace pong { -PROTOBUF_CONSTEXPR Pong::Pong( - ::_pbi::ConstantInitialized): _impl_{ - /*decltype(_impl_.port_)*/0u - , /*decltype(_impl_._cached_size_)*/{}} {} + +inline constexpr Pong::Impl_::Impl_( + ::_pbi::ConstantInitialized) noexcept + : port_{0u}, + _cached_size_{0} {} + +template +PROTOBUF_CONSTEXPR Pong::Pong(::_pbi::ConstantInitialized) + : _impl_(::_pbi::ConstantInitialized()) {} struct PongDefaultTypeInternal { - PROTOBUF_CONSTEXPR PongDefaultTypeInternal() - : _instance(::_pbi::ConstantInitialized{}) {} + PROTOBUF_CONSTEXPR PongDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} ~PongDefaultTypeInternal() {} union { Pong _instance; }; }; -PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 PongDefaultTypeInternal _Pong_default_instance_; + +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 PongDefaultTypeInternal _Pong_default_instance_; } // namespace pong } // namespace messages static ::_pb::Metadata file_level_metadata_pong_2eproto[1]; -static constexpr ::_pb::EnumDescriptor const** file_level_enum_descriptors_pong_2eproto = nullptr; -static constexpr ::_pb::ServiceDescriptor const** file_level_service_descriptors_pong_2eproto = nullptr; - -const uint32_t TableStruct_pong_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { - ~0u, // no _has_bits_ - PROTOBUF_FIELD_OFFSET(::messages::pong::Pong, _internal_metadata_), - ~0u, // no _extensions_ - ~0u, // no _oneof_case_ - ~0u, // no _weak_field_map_ - ~0u, // no _inlined_string_donated_ - PROTOBUF_FIELD_OFFSET(::messages::pong::Pong, _impl_.port_), +static constexpr const ::_pb::EnumDescriptor** + file_level_enum_descriptors_pong_2eproto = nullptr; +static constexpr const ::_pb::ServiceDescriptor** + file_level_service_descriptors_pong_2eproto = nullptr; +const ::uint32_t + TableStruct_pong_2eproto::offsets[] ABSL_ATTRIBUTE_SECTION_VARIABLE( + protodesc_cold) = { + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::messages::pong::Pong, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) + PROTOBUF_FIELD_OFFSET(::messages::pong::Pong, _impl_.port_), }; -static const ::_pbi::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { - { 0, -1, -1, sizeof(::messages::pong::Pong)}, + +static const ::_pbi::MigrationSchema + schemas[] ABSL_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { + {0, -1, -1, sizeof(::messages::pong::Pong)}, }; static const ::_pb::Message* const file_default_instances[] = { - &::messages::pong::_Pong_default_instance_._instance, + &::messages::pong::_Pong_default_instance_._instance, }; - -const char descriptor_table_protodef_pong_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = - "\n\npong.proto\022\rmessages.pong\"\024\n\004Pong\022\014\n\004p" - "ort\030\001 \001(\rb\006proto3" - ; -static ::_pbi::once_flag descriptor_table_pong_2eproto_once; +const char descriptor_table_protodef_pong_2eproto[] ABSL_ATTRIBUTE_SECTION_VARIABLE( + protodesc_cold) = { + "\n\npong.proto\022\rmessages.pong\"\024\n\004Pong\022\014\n\004p" + "ort\030\001 \001(\rb\006proto3" +}; +static ::absl::once_flag descriptor_table_pong_2eproto_once; const ::_pbi::DescriptorTable descriptor_table_pong_2eproto = { - false, false, 57, descriptor_table_protodef_pong_2eproto, + false, + false, + 57, + descriptor_table_protodef_pong_2eproto, "pong.proto", - &descriptor_table_pong_2eproto_once, nullptr, 0, 1, - schemas, file_default_instances, TableStruct_pong_2eproto::offsets, - file_level_metadata_pong_2eproto, file_level_enum_descriptors_pong_2eproto, + &descriptor_table_pong_2eproto_once, + nullptr, + 0, + 1, + schemas, + file_default_instances, + TableStruct_pong_2eproto::offsets, + file_level_metadata_pong_2eproto, + file_level_enum_descriptors_pong_2eproto, file_level_service_descriptors_pong_2eproto, }; + +// This function exists to be marked as weak. +// It can significantly speed up compilation by breaking up LLVM's SCC +// in the .pb.cc translation units. Large translation units see a +// reduction of more than 35% of walltime for optimized builds. Without +// the weak attribute all the messages in the file, including all the +// vtables and everything they use become part of the same SCC through +// a cycle like: +// GetMetadata -> descriptor table -> default instances -> +// vtables -> GetMetadata +// By adding a weak function here we break the connection from the +// individual vtables back into the descriptor table. PROTOBUF_ATTRIBUTE_WEAK const ::_pbi::DescriptorTable* descriptor_table_pong_2eproto_getter() { return &descriptor_table_pong_2eproto; } - // Force running AddDescriptors() at dynamic initialization time. -PROTOBUF_ATTRIBUTE_INIT_PRIORITY2 static ::_pbi::AddDescriptorsRunner dynamic_init_dummy_pong_2eproto(&descriptor_table_pong_2eproto); +PROTOBUF_ATTRIBUTE_INIT_PRIORITY2 +static ::_pbi::AddDescriptorsRunner dynamic_init_dummy_pong_2eproto(&descriptor_table_pong_2eproto); namespace messages { namespace pong { - // =================================================================== class Pong::_Internal { public: }; -Pong::Pong(::PROTOBUF_NAMESPACE_ID::Arena* arena, - bool is_message_owned) - : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { - SharedCtor(arena, is_message_owned); +Pong::Pong(::google::protobuf::Arena* arena) + : ::google::protobuf::Message(arena) { + SharedCtor(arena); // @@protoc_insertion_point(arena_constructor:messages.pong.Pong) } -Pong::Pong(const Pong& from) - : ::PROTOBUF_NAMESPACE_ID::Message() { - Pong* const _this = this; (void)_this; - new (&_impl_) Impl_{ - decltype(_impl_.port_){} - , /*decltype(_impl_._cached_size_)*/{}}; - - _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); - _this->_impl_.port_ = from._impl_.port_; - // @@protoc_insertion_point(copy_constructor:messages.pong.Pong) +Pong::Pong( + ::google::protobuf::Arena* arena, const Pong& from) + : Pong(arena) { + MergeFrom(from); } +inline PROTOBUF_NDEBUG_INLINE Pong::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* arena) + : _cached_size_{0} {} -inline void Pong::SharedCtor( - ::_pb::Arena* arena, bool is_message_owned) { - (void)arena; - (void)is_message_owned; - new (&_impl_) Impl_{ - decltype(_impl_.port_){0u} - , /*decltype(_impl_._cached_size_)*/{} - }; +inline void Pong::SharedCtor(::_pb::Arena* arena) { + new (&_impl_) Impl_(internal_visibility(), arena); + _impl_.port_ = {}; } - Pong::~Pong() { // @@protoc_insertion_point(destructor:messages.pong.Pong) - if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) { - (void)arena; - return; - } + _internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>(); SharedDtor(); } - inline void Pong::SharedDtor() { - GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + ABSL_DCHECK(GetArena() == nullptr); + _impl_.~Impl_(); } -void Pong::SetCachedSize(int size) const { - _impl_._cached_size_.Set(size); +const ::google::protobuf::MessageLite::ClassData* +Pong::GetClassData() const { + PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite::ClassData + _data_ = { + Pong::MergeImpl, + nullptr, // OnDemandRegisterArenaDtor + &::google::protobuf::Message::kDescriptorMethods, + PROTOBUF_FIELD_OFFSET(Pong, _impl_._cached_size_), + }; + return &_data_; } - -void Pong::Clear() { +PROTOBUF_NOINLINE void Pong::Clear() { // @@protoc_insertion_point(message_clear_start:messages.pong.Pong) - uint32_t cached_has_bits = 0; + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + ::uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; _impl_.port_ = 0u; - _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); } -const char* Pong::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) { -#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure - while (!ctx->Done(&ptr)) { - uint32_t tag; - ptr = ::_pbi::ReadTag(ptr, &tag); - switch (tag >> 3) { - // uint32 port = 1; - case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { - _impl_.port_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); - CHK_(ptr); - } else - goto handle_unusual; - continue; - default: - goto handle_unusual; - } // switch - handle_unusual: - if ((tag == 0) || ((tag & 7) == 4)) { - CHK_(ptr); - ctx->SetLastTag(tag); - goto message_done; - } - ptr = UnknownFieldParse( - tag, - _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), - ptr, ctx); - CHK_(ptr != nullptr); - } // while -message_done: +const char* Pong::_InternalParse( + const char* ptr, ::_pbi::ParseContext* ctx) { + ptr = ::_pbi::TcParser::ParseLoop(this, ptr, ctx, &_table_.header); return ptr; -failure: - ptr = nullptr; - goto message_done; -#undef CHK_ } -uint8_t* Pong::_InternalSerialize( - uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + +PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 +const ::_pbi::TcParseTable<0, 1, 0, 0, 2> Pong::_table_ = { + { + 0, // no _has_bits_ + 0, // no _extensions_ + 1, 0, // max_field_number, fast_idx_mask + offsetof(decltype(_table_), field_lookup_table), + 4294967294, // skipmap + offsetof(decltype(_table_), field_entries), + 1, // num_field_entries + 0, // num_aux_entries + offsetof(decltype(_table_), field_names), // no aux_entries + &_Pong_default_instance_._instance, + ::_pbi::TcParser::GenericFallback, // fallback + }, {{ + // uint32 port = 1; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(Pong, _impl_.port_), 63>(), + {8, 63, 0, PROTOBUF_FIELD_OFFSET(Pong, _impl_.port_)}}, + }}, {{ + 65535, 65535 + }}, {{ + // uint32 port = 1; + {PROTOBUF_FIELD_OFFSET(Pong, _impl_.port_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kUInt32)}, + }}, + // no aux_entries + {{ + }}, +}; + +::uint8_t* Pong::_InternalSerialize( + ::uint8_t* target, + ::google::protobuf::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:messages.pong.Pong) - uint32_t cached_has_bits = 0; - (void) cached_has_bits; + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; // uint32 port = 1; if (this->_internal_port() != 0) { target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteUInt32ToArray(1, this->_internal_port(), target); + target = ::_pbi::WireFormatLite::WriteUInt32ToArray( + 1, this->_internal_port(), target); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); } // @@protoc_insertion_point(serialize_to_array_end:messages.pong.Pong) return target; } -size_t Pong::ByteSizeLong() const { +::size_t Pong::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:messages.pong.Pong) - size_t total_size = 0; + ::size_t total_size = 0; - uint32_t cached_has_bits = 0; + ::uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; // uint32 port = 1; if (this->_internal_port() != 0) { - total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_port()); + total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne( + this->_internal_port()); } return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } -const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Pong::_class_data_ = { - ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck, - Pong::MergeImpl -}; -const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*Pong::GetClassData() const { return &_class_data_; } - -void Pong::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) { +void Pong::MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg) { auto* const _this = static_cast(&to_msg); auto& from = static_cast(from_msg); // @@protoc_insertion_point(class_specific_merge_from_start:messages.pong.Pong) - GOOGLE_DCHECK_NE(&from, _this); - uint32_t cached_has_bits = 0; + ABSL_DCHECK_NE(&from, _this); + ::uint32_t cached_has_bits = 0; (void) cached_has_bits; if (from._internal_port() != 0) { _this->_internal_set_port(from._internal_port()); } - _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } void Pong::CopyFrom(const Pong& from) { @@ -242,31 +269,27 @@ void Pong::CopyFrom(const Pong& from) { MergeFrom(from); } -bool Pong::IsInitialized() const { +PROTOBUF_NOINLINE bool Pong::IsInitialized() const { return true; } -void Pong::InternalSwap(Pong* other) { +void Pong::InternalSwap(Pong* PROTOBUF_RESTRICT other) { using std::swap; _internal_metadata_.InternalSwap(&other->_internal_metadata_); - swap(_impl_.port_, other->_impl_.port_); + swap(_impl_.port_, other->_impl_.port_); } -::PROTOBUF_NAMESPACE_ID::Metadata Pong::GetMetadata() const { +::google::protobuf::Metadata Pong::GetMetadata() const { return ::_pbi::AssignDescriptors( &descriptor_table_pong_2eproto_getter, &descriptor_table_pong_2eproto_once, file_level_metadata_pong_2eproto[0]); } - // @@protoc_insertion_point(namespace_scope) } // namespace pong } // namespace messages -PROTOBUF_NAMESPACE_OPEN -template<> PROTOBUF_NOINLINE ::messages::pong::Pong* -Arena::CreateMaybeMessage< ::messages::pong::Pong >(Arena* arena) { - return Arena::CreateMessageInternal< ::messages::pong::Pong >(arena); -} -PROTOBUF_NAMESPACE_CLOSE - +namespace google { +namespace protobuf { +} // namespace protobuf +} // namespace google // @@protoc_insertion_point(global_scope) -#include +#include "google/protobuf/port_undef.inc" diff --git a/include/WHISPER/Messages/Protos/pong.pb.h b/include/WHISPER/Messages/Protos/pong.pb.h index 7978ec4..1f29fea 100644 --- a/include/WHISPER/Messages/Protos/pong.pb.h +++ b/include/WHISPER/Messages/Protos/pong.pb.h @@ -1,49 +1,60 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: pong.proto +// Protobuf C++ Version: 4.24.0-main -#ifndef GOOGLE_PROTOBUF_INCLUDED_pong_2eproto -#define GOOGLE_PROTOBUF_INCLUDED_pong_2eproto +#ifndef GOOGLE_PROTOBUF_INCLUDED_pong_2eproto_2epb_2eh +#define GOOGLE_PROTOBUF_INCLUDED_pong_2eproto_2epb_2eh #include #include +#include +#include -#include -#if PROTOBUF_VERSION < 3021000 -#error This file was generated by a newer version of protoc which is -#error incompatible with your Protocol Buffer headers. Please update -#error your headers. -#endif -#if 3021012 < PROTOBUF_MIN_PROTOC_VERSION -#error This file was generated by an older version of protoc which is -#error incompatible with your Protocol Buffer headers. Please -#error regenerate this file with a newer version of protoc. -#endif +#include "google/protobuf/port_def.inc" +#if PROTOBUF_VERSION < 4025000 +#error "This file was generated by a newer version of protoc which is" +#error "incompatible with your Protocol Buffer headers. Please update" +#error "your headers." +#endif // PROTOBUF_VERSION -#include -#include -#include -#include -#include -#include -#include -#include -#include // IWYU pragma: export -#include // IWYU pragma: export -#include +#if 4025000 < PROTOBUF_MIN_PROTOC_VERSION +#error "This file was generated by an older version of protoc which is" +#error "incompatible with your Protocol Buffer headers. Please" +#error "regenerate this file with a newer version of protoc." +#endif // PROTOBUF_MIN_PROTOC_VERSION +#include "google/protobuf/port_undef.inc" +#include "google/protobuf/io/coded_stream.h" +#include "google/protobuf/arena.h" +#include "google/protobuf/arenastring.h" +#include "google/protobuf/generated_message_tctable_decl.h" +#include "google/protobuf/generated_message_util.h" +#include "google/protobuf/metadata_lite.h" +#include "google/protobuf/generated_message_reflection.h" +#include "google/protobuf/message.h" +#include "google/protobuf/repeated_field.h" // IWYU pragma: export +#include "google/protobuf/extension_set.h" // IWYU pragma: export +#include "google/protobuf/unknown_field_set.h" // @@protoc_insertion_point(includes) -#include + +// Must be included last. +#include "google/protobuf/port_def.inc" + #define PROTOBUF_INTERNAL_EXPORT_pong_2eproto -PROTOBUF_NAMESPACE_OPEN + +namespace google { +namespace protobuf { namespace internal { class AnyMetadata; } // namespace internal -PROTOBUF_NAMESPACE_CLOSE +} // namespace protobuf +} // namespace google // Internal implementation detail -- do not use these members. struct TableStruct_pong_2eproto { - static const uint32_t offsets[]; + static const ::uint32_t offsets[]; }; -extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_pong_2eproto; +extern const ::google::protobuf::internal::DescriptorTable + descriptor_table_pong_2eproto; namespace messages { namespace pong { class Pong; @@ -51,22 +62,29 @@ struct PongDefaultTypeInternal; extern PongDefaultTypeInternal _Pong_default_instance_; } // namespace pong } // namespace messages -PROTOBUF_NAMESPACE_OPEN -template<> ::messages::pong::Pong* Arena::CreateMaybeMessage<::messages::pong::Pong>(Arena*); -PROTOBUF_NAMESPACE_CLOSE +namespace google { +namespace protobuf { +} // namespace protobuf +} // namespace google + namespace messages { namespace pong { // =================================================================== + +// ------------------------------------------------------------------- + class Pong final : - public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:messages.pong.Pong) */ { + public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:messages.pong.Pong) */ { public: inline Pong() : Pong(nullptr) {} ~Pong() override; - explicit PROTOBUF_CONSTEXPR Pong(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + template + explicit PROTOBUF_CONSTEXPR Pong(::google::protobuf::internal::ConstantInitialized); - Pong(const Pong& from); + inline Pong(const Pong& from) + : Pong(nullptr, from) {} Pong(Pong&& from) noexcept : Pong() { *this = ::std::move(from); @@ -78,9 +96,9 @@ class Pong final : } inline Pong& operator=(Pong&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena() + if (GetArena() == from.GetArena() #ifdef PROTOBUF_FORCE_COPY_IN_MOVE - && GetOwningArena() != nullptr + && GetArena() != nullptr #endif // !PROTOBUF_FORCE_COPY_IN_MOVE ) { InternalSwap(&from); @@ -90,13 +108,22 @@ class Pong final : return *this; } - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const + ABSL_ATTRIBUTE_LIFETIME_BOUND { + return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); + } + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + ABSL_ATTRIBUTE_LIFETIME_BOUND { + return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); + } + + static const ::google::protobuf::Descriptor* descriptor() { return GetDescriptor(); } - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* GetReflection() { return default_instance().GetMetadata().reflection; } static const Pong& default_instance() { @@ -115,65 +142,62 @@ class Pong final : inline void Swap(Pong* other) { if (other == this) return; #ifdef PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() != nullptr && - GetOwningArena() == other->GetOwningArena()) { + if (GetArena() != nullptr && + GetArena() == other->GetArena()) { #else // PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() == other->GetOwningArena()) { + if (GetArena() == other->GetArena()) { #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { - ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + ::google::protobuf::internal::GenericSwap(this, other); } } void UnsafeArenaSwap(Pong* other) { if (other == this) return; - GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); } // implements Message ---------------------------------------------- - Pong* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + Pong* New(::google::protobuf::Arena* arena = nullptr) const final { return CreateMaybeMessage(arena); } - using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + using ::google::protobuf::Message::CopyFrom; void CopyFrom(const Pong& from); - using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + using ::google::protobuf::Message::MergeFrom; void MergeFrom( const Pong& from) { Pong::MergeImpl(*this, from); } private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); + static void MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg); public: - PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + ABSL_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; - size_t ByteSizeLong() const final; - const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - uint8_t* _InternalSerialize( - uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; - int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + ::size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::google::protobuf::internal::ParseContext* ctx) final; + ::uint8_t* _InternalSerialize( + ::uint8_t* target, ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedCtor(::google::protobuf::Arena* arena); void SharedDtor(); - void SetCachedSize(int size) const final; void InternalSwap(Pong* other); private: - friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; - static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + friend class ::google::protobuf::internal::AnyMetadata; + static ::absl::string_view FullMessageName() { return "messages.pong.Pong"; } protected: - explicit Pong(::PROTOBUF_NAMESPACE_ID::Arena* arena, - bool is_message_owned = false); + explicit Pong(::google::protobuf::Arena* arena); + Pong(::google::protobuf::Arena* arena, const Pong& from); + const ::google::protobuf::MessageLite::ClassData* GetClassData() const final; public: - static const ClassData _class_data_; - const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; - - ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + ::google::protobuf::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- @@ -183,69 +207,96 @@ class Pong final : kPortFieldNumber = 1, }; // uint32 port = 1; - void clear_port(); - uint32_t port() const; - void set_port(uint32_t value); - private: - uint32_t _internal_port() const; - void _internal_set_port(uint32_t value); - public: + void clear_port() ; + ::uint32_t port() const; + void set_port(::uint32_t value); + private: + ::uint32_t _internal_port() const; + void _internal_set_port(::uint32_t value); + + public: // @@protoc_insertion_point(class_scope:messages.pong.Pong) private: class _Internal; - template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; - typedef void InternalArenaConstructable_; - typedef void DestructorSkippable_; + friend class ::google::protobuf::internal::TcParser; + static const ::google::protobuf::internal::TcParseTable< + 0, 1, 0, + 0, 2> + _table_; + friend class ::google::protobuf::MessageLite; + friend class ::google::protobuf::Arena; + template + friend class ::google::protobuf::Arena::InternalHelper; + using InternalArenaConstructable_ = void; + using DestructorSkippable_ = void; struct Impl_ { - uint32_t port_; - mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + + inline explicit constexpr Impl_( + ::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* arena); + inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* arena, const Impl_& from); + ::uint32_t port_; + mutable ::google::protobuf::internal::CachedSize _cached_size_; + PROTOBUF_TSAN_DECLARE_MEMBER }; union { Impl_ _impl_; }; friend struct ::TableStruct_pong_2eproto; }; + // =================================================================== + + // =================================================================== + #ifdef __GNUC__ - #pragma GCC diagnostic push - #pragma GCC diagnostic ignored "-Wstrict-aliasing" +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wstrict-aliasing" #endif // __GNUC__ +// ------------------------------------------------------------------- + // Pong // uint32 port = 1; inline void Pong::clear_port() { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); _impl_.port_ = 0u; } -inline uint32_t Pong::_internal_port() const { - return _impl_.port_; -} -inline uint32_t Pong::port() const { +inline ::uint32_t Pong::port() const { // @@protoc_insertion_point(field_get:messages.pong.Pong.port) return _internal_port(); } -inline void Pong::_internal_set_port(uint32_t value) { - - _impl_.port_ = value; -} -inline void Pong::set_port(uint32_t value) { +inline void Pong::set_port(::uint32_t value) { _internal_set_port(value); // @@protoc_insertion_point(field_set:messages.pong.Pong.port) } +inline ::uint32_t Pong::_internal_port() const { + PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race); + return _impl_.port_; +} +inline void Pong::_internal_set_port(::uint32_t value) { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + ; + _impl_.port_ = value; +} #ifdef __GNUC__ - #pragma GCC diagnostic pop +#pragma GCC diagnostic pop #endif // __GNUC__ // @@protoc_insertion_point(namespace_scope) - } // namespace pong } // namespace messages + // @@protoc_insertion_point(global_scope) -#include -#endif // GOOGLE_PROTOBUF_INCLUDED_GOOGLE_PROTOBUF_INCLUDED_pong_2eproto +#include "google/protobuf/port_undef.inc" + +#endif // GOOGLE_PROTOBUF_INCLUDED_pong_2eproto_2epb_2eh diff --git a/include/WHISPER/Messages/Protos/stringData.pb.cc b/include/WHISPER/Messages/Protos/stringData.pb.cc index ee72686..bbfbf0a 100644 --- a/include/WHISPER/Messages/Protos/stringData.pb.cc +++ b/include/WHISPER/Messages/Protos/stringData.pb.cc @@ -4,255 +4,282 @@ #include "stringData.pb.h" #include - -#include -#include -#include -#include -#include -#include -#include +#include "google/protobuf/io/coded_stream.h" +#include "google/protobuf/extension_set.h" +#include "google/protobuf/wire_format_lite.h" +#include "google/protobuf/descriptor.h" +#include "google/protobuf/generated_message_reflection.h" +#include "google/protobuf/reflection_ops.h" +#include "google/protobuf/wire_format.h" +#include "google/protobuf/generated_message_tctable_impl.h" // @@protoc_insertion_point(includes) -#include +// Must be included last. +#include "google/protobuf/port_def.inc" PROTOBUF_PRAGMA_INIT_SEG - -namespace _pb = ::PROTOBUF_NAMESPACE_ID; -namespace _pbi = _pb::internal; - +namespace _pb = ::google::protobuf; +namespace _pbi = ::google::protobuf::internal; +namespace _fl = ::google::protobuf::internal::field_layout; namespace messages { namespace stringData { -PROTOBUF_CONSTEXPR StringData::StringData( - ::_pbi::ConstantInitialized): _impl_{ - /*decltype(_impl_.data_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}} - , /*decltype(_impl_._cached_size_)*/{}} {} + +inline constexpr StringData::Impl_::Impl_( + ::_pbi::ConstantInitialized) noexcept + : data_( + &::google::protobuf::internal::fixed_address_empty_string, + ::_pbi::ConstantInitialized()), + _cached_size_{0} {} + +template +PROTOBUF_CONSTEXPR StringData::StringData(::_pbi::ConstantInitialized) + : _impl_(::_pbi::ConstantInitialized()) {} struct StringDataDefaultTypeInternal { - PROTOBUF_CONSTEXPR StringDataDefaultTypeInternal() - : _instance(::_pbi::ConstantInitialized{}) {} + PROTOBUF_CONSTEXPR StringDataDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} ~StringDataDefaultTypeInternal() {} union { StringData _instance; }; }; -PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 StringDataDefaultTypeInternal _StringData_default_instance_; + +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 StringDataDefaultTypeInternal _StringData_default_instance_; } // namespace stringData } // namespace messages static ::_pb::Metadata file_level_metadata_stringData_2eproto[1]; -static constexpr ::_pb::EnumDescriptor const** file_level_enum_descriptors_stringData_2eproto = nullptr; -static constexpr ::_pb::ServiceDescriptor const** file_level_service_descriptors_stringData_2eproto = nullptr; - -const uint32_t TableStruct_stringData_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { - ~0u, // no _has_bits_ - PROTOBUF_FIELD_OFFSET(::messages::stringData::StringData, _internal_metadata_), - ~0u, // no _extensions_ - ~0u, // no _oneof_case_ - ~0u, // no _weak_field_map_ - ~0u, // no _inlined_string_donated_ - PROTOBUF_FIELD_OFFSET(::messages::stringData::StringData, _impl_.data_), +static constexpr const ::_pb::EnumDescriptor** + file_level_enum_descriptors_stringData_2eproto = nullptr; +static constexpr const ::_pb::ServiceDescriptor** + file_level_service_descriptors_stringData_2eproto = nullptr; +const ::uint32_t + TableStruct_stringData_2eproto::offsets[] ABSL_ATTRIBUTE_SECTION_VARIABLE( + protodesc_cold) = { + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::messages::stringData::StringData, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) + PROTOBUF_FIELD_OFFSET(::messages::stringData::StringData, _impl_.data_), }; -static const ::_pbi::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { - { 0, -1, -1, sizeof(::messages::stringData::StringData)}, + +static const ::_pbi::MigrationSchema + schemas[] ABSL_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { + {0, -1, -1, sizeof(::messages::stringData::StringData)}, }; static const ::_pb::Message* const file_default_instances[] = { - &::messages::stringData::_StringData_default_instance_._instance, + &::messages::stringData::_StringData_default_instance_._instance, }; - -const char descriptor_table_protodef_stringData_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = - "\n\020stringData.proto\022\023messages.stringData\"" - "\032\n\nStringData\022\014\n\004data\030\001 \001(\tb\006proto3" - ; -static ::_pbi::once_flag descriptor_table_stringData_2eproto_once; +const char descriptor_table_protodef_stringData_2eproto[] ABSL_ATTRIBUTE_SECTION_VARIABLE( + protodesc_cold) = { + "\n\020stringData.proto\022\023messages.stringData\"" + "\032\n\nStringData\022\014\n\004data\030\001 \001(\tb\006proto3" +}; +static ::absl::once_flag descriptor_table_stringData_2eproto_once; const ::_pbi::DescriptorTable descriptor_table_stringData_2eproto = { - false, false, 75, descriptor_table_protodef_stringData_2eproto, + false, + false, + 75, + descriptor_table_protodef_stringData_2eproto, "stringData.proto", - &descriptor_table_stringData_2eproto_once, nullptr, 0, 1, - schemas, file_default_instances, TableStruct_stringData_2eproto::offsets, - file_level_metadata_stringData_2eproto, file_level_enum_descriptors_stringData_2eproto, + &descriptor_table_stringData_2eproto_once, + nullptr, + 0, + 1, + schemas, + file_default_instances, + TableStruct_stringData_2eproto::offsets, + file_level_metadata_stringData_2eproto, + file_level_enum_descriptors_stringData_2eproto, file_level_service_descriptors_stringData_2eproto, }; + +// This function exists to be marked as weak. +// It can significantly speed up compilation by breaking up LLVM's SCC +// in the .pb.cc translation units. Large translation units see a +// reduction of more than 35% of walltime for optimized builds. Without +// the weak attribute all the messages in the file, including all the +// vtables and everything they use become part of the same SCC through +// a cycle like: +// GetMetadata -> descriptor table -> default instances -> +// vtables -> GetMetadata +// By adding a weak function here we break the connection from the +// individual vtables back into the descriptor table. PROTOBUF_ATTRIBUTE_WEAK const ::_pbi::DescriptorTable* descriptor_table_stringData_2eproto_getter() { return &descriptor_table_stringData_2eproto; } - // Force running AddDescriptors() at dynamic initialization time. -PROTOBUF_ATTRIBUTE_INIT_PRIORITY2 static ::_pbi::AddDescriptorsRunner dynamic_init_dummy_stringData_2eproto(&descriptor_table_stringData_2eproto); +PROTOBUF_ATTRIBUTE_INIT_PRIORITY2 +static ::_pbi::AddDescriptorsRunner dynamic_init_dummy_stringData_2eproto(&descriptor_table_stringData_2eproto); namespace messages { namespace stringData { - // =================================================================== class StringData::_Internal { public: }; -StringData::StringData(::PROTOBUF_NAMESPACE_ID::Arena* arena, - bool is_message_owned) - : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { - SharedCtor(arena, is_message_owned); +StringData::StringData(::google::protobuf::Arena* arena) + : ::google::protobuf::Message(arena) { + SharedCtor(arena); // @@protoc_insertion_point(arena_constructor:messages.stringData.StringData) } -StringData::StringData(const StringData& from) - : ::PROTOBUF_NAMESPACE_ID::Message() { - StringData* const _this = this; (void)_this; - new (&_impl_) Impl_{ - decltype(_impl_.data_){} - , /*decltype(_impl_._cached_size_)*/{}}; +inline PROTOBUF_NDEBUG_INLINE StringData::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, + const Impl_& from) + : data_(arena, from.data_), + _cached_size_{0} {} + +StringData::StringData( + ::google::protobuf::Arena* arena, + const StringData& from) + : ::google::protobuf::Message(arena) { + StringData* const _this = this; + (void)_this; + _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( + from._internal_metadata_); + new (&_impl_) Impl_(internal_visibility(), arena, from._impl_); - _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); - _impl_.data_.InitDefault(); - #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - _impl_.data_.Set("", GetArenaForAllocation()); - #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (!from._internal_data().empty()) { - _this->_impl_.data_.Set(from._internal_data(), - _this->GetArenaForAllocation()); - } // @@protoc_insertion_point(copy_constructor:messages.stringData.StringData) } +inline PROTOBUF_NDEBUG_INLINE StringData::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* arena) + : data_(arena), + _cached_size_{0} {} -inline void StringData::SharedCtor( - ::_pb::Arena* arena, bool is_message_owned) { - (void)arena; - (void)is_message_owned; - new (&_impl_) Impl_{ - decltype(_impl_.data_){} - , /*decltype(_impl_._cached_size_)*/{} - }; - _impl_.data_.InitDefault(); - #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - _impl_.data_.Set("", GetArenaForAllocation()); - #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +inline void StringData::SharedCtor(::_pb::Arena* arena) { + new (&_impl_) Impl_(internal_visibility(), arena); } - StringData::~StringData() { // @@protoc_insertion_point(destructor:messages.stringData.StringData) - if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) { - (void)arena; - return; - } + _internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>(); SharedDtor(); } - inline void StringData::SharedDtor() { - GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + ABSL_DCHECK(GetArena() == nullptr); _impl_.data_.Destroy(); + _impl_.~Impl_(); } -void StringData::SetCachedSize(int size) const { - _impl_._cached_size_.Set(size); +const ::google::protobuf::MessageLite::ClassData* +StringData::GetClassData() const { + PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite::ClassData + _data_ = { + StringData::MergeImpl, + nullptr, // OnDemandRegisterArenaDtor + &::google::protobuf::Message::kDescriptorMethods, + PROTOBUF_FIELD_OFFSET(StringData, _impl_._cached_size_), + }; + return &_data_; } - -void StringData::Clear() { +PROTOBUF_NOINLINE void StringData::Clear() { // @@protoc_insertion_point(message_clear_start:messages.stringData.StringData) - uint32_t cached_has_bits = 0; + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + ::uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; _impl_.data_.ClearToEmpty(); - _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); } -const char* StringData::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) { -#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure - while (!ctx->Done(&ptr)) { - uint32_t tag; - ptr = ::_pbi::ReadTag(ptr, &tag); - switch (tag >> 3) { - // string data = 1; - case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 10)) { - auto str = _internal_mutable_data(); - ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx); - CHK_(ptr); - CHK_(::_pbi::VerifyUTF8(str, "messages.stringData.StringData.data")); - } else - goto handle_unusual; - continue; - default: - goto handle_unusual; - } // switch - handle_unusual: - if ((tag == 0) || ((tag & 7) == 4)) { - CHK_(ptr); - ctx->SetLastTag(tag); - goto message_done; - } - ptr = UnknownFieldParse( - tag, - _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), - ptr, ctx); - CHK_(ptr != nullptr); - } // while -message_done: +const char* StringData::_InternalParse( + const char* ptr, ::_pbi::ParseContext* ctx) { + ptr = ::_pbi::TcParser::ParseLoop(this, ptr, ctx, &_table_.header); return ptr; -failure: - ptr = nullptr; - goto message_done; -#undef CHK_ } -uint8_t* StringData::_InternalSerialize( - uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + +PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 +const ::_pbi::TcParseTable<0, 1, 0, 43, 2> StringData::_table_ = { + { + 0, // no _has_bits_ + 0, // no _extensions_ + 1, 0, // max_field_number, fast_idx_mask + offsetof(decltype(_table_), field_lookup_table), + 4294967294, // skipmap + offsetof(decltype(_table_), field_entries), + 1, // num_field_entries + 0, // num_aux_entries + offsetof(decltype(_table_), field_names), // no aux_entries + &_StringData_default_instance_._instance, + ::_pbi::TcParser::GenericFallback, // fallback + }, {{ + // string data = 1; + {::_pbi::TcParser::FastUS1, + {10, 63, 0, PROTOBUF_FIELD_OFFSET(StringData, _impl_.data_)}}, + }}, {{ + 65535, 65535 + }}, {{ + // string data = 1; + {PROTOBUF_FIELD_OFFSET(StringData, _impl_.data_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + }}, + // no aux_entries + {{ + "\36\4\0\0\0\0\0\0" + "messages.stringData.StringData" + "data" + }}, +}; + +::uint8_t* StringData::_InternalSerialize( + ::uint8_t* target, + ::google::protobuf::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:messages.stringData.StringData) - uint32_t cached_has_bits = 0; - (void) cached_has_bits; + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; // string data = 1; if (!this->_internal_data().empty()) { - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( - this->_internal_data().data(), static_cast(this->_internal_data().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, - "messages.stringData.StringData.data"); - target = stream->WriteStringMaybeAliased( - 1, this->_internal_data(), target); + const std::string& _s = this->_internal_data(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "messages.stringData.StringData.data"); + target = stream->WriteStringMaybeAliased(1, _s, target); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); } // @@protoc_insertion_point(serialize_to_array_end:messages.stringData.StringData) return target; } -size_t StringData::ByteSizeLong() const { +::size_t StringData::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:messages.stringData.StringData) - size_t total_size = 0; + ::size_t total_size = 0; - uint32_t cached_has_bits = 0; + ::uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; // string data = 1; if (!this->_internal_data().empty()) { - total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( - this->_internal_data()); + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this->_internal_data()); } return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } -const ::PROTOBUF_NAMESPACE_ID::Message::ClassData StringData::_class_data_ = { - ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck, - StringData::MergeImpl -}; -const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*StringData::GetClassData() const { return &_class_data_; } - -void StringData::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) { +void StringData::MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg) { auto* const _this = static_cast(&to_msg); auto& from = static_cast(from_msg); // @@protoc_insertion_point(class_specific_merge_from_start:messages.stringData.StringData) - GOOGLE_DCHECK_NE(&from, _this); - uint32_t cached_has_bits = 0; + ABSL_DCHECK_NE(&from, _this); + ::uint32_t cached_has_bits = 0; (void) cached_has_bits; if (!from._internal_data().empty()) { _this->_internal_set_data(from._internal_data()); } - _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } void StringData::CopyFrom(const StringData& from) { @@ -262,36 +289,29 @@ void StringData::CopyFrom(const StringData& from) { MergeFrom(from); } -bool StringData::IsInitialized() const { +PROTOBUF_NOINLINE bool StringData::IsInitialized() const { return true; } -void StringData::InternalSwap(StringData* other) { +void StringData::InternalSwap(StringData* PROTOBUF_RESTRICT other) { using std::swap; - auto* lhs_arena = GetArenaForAllocation(); - auto* rhs_arena = other->GetArenaForAllocation(); + auto* arena = GetArena(); + ABSL_DCHECK_EQ(arena, other->GetArena()); _internal_metadata_.InternalSwap(&other->_internal_metadata_); - ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( - &_impl_.data_, lhs_arena, - &other->_impl_.data_, rhs_arena - ); + ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.data_, &other->_impl_.data_, arena); } -::PROTOBUF_NAMESPACE_ID::Metadata StringData::GetMetadata() const { +::google::protobuf::Metadata StringData::GetMetadata() const { return ::_pbi::AssignDescriptors( &descriptor_table_stringData_2eproto_getter, &descriptor_table_stringData_2eproto_once, file_level_metadata_stringData_2eproto[0]); } - // @@protoc_insertion_point(namespace_scope) } // namespace stringData } // namespace messages -PROTOBUF_NAMESPACE_OPEN -template<> PROTOBUF_NOINLINE ::messages::stringData::StringData* -Arena::CreateMaybeMessage< ::messages::stringData::StringData >(Arena* arena) { - return Arena::CreateMessageInternal< ::messages::stringData::StringData >(arena); -} -PROTOBUF_NAMESPACE_CLOSE - +namespace google { +namespace protobuf { +} // namespace protobuf +} // namespace google // @@protoc_insertion_point(global_scope) -#include +#include "google/protobuf/port_undef.inc" diff --git a/include/WHISPER/Messages/Protos/stringData.pb.h b/include/WHISPER/Messages/Protos/stringData.pb.h index a1c9b01..8049a00 100644 --- a/include/WHISPER/Messages/Protos/stringData.pb.h +++ b/include/WHISPER/Messages/Protos/stringData.pb.h @@ -1,49 +1,60 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: stringData.proto +// Protobuf C++ Version: 4.24.0-main -#ifndef GOOGLE_PROTOBUF_INCLUDED_stringData_2eproto -#define GOOGLE_PROTOBUF_INCLUDED_stringData_2eproto +#ifndef GOOGLE_PROTOBUF_INCLUDED_stringData_2eproto_2epb_2eh +#define GOOGLE_PROTOBUF_INCLUDED_stringData_2eproto_2epb_2eh #include #include +#include +#include -#include -#if PROTOBUF_VERSION < 3021000 -#error This file was generated by a newer version of protoc which is -#error incompatible with your Protocol Buffer headers. Please update -#error your headers. -#endif -#if 3021012 < PROTOBUF_MIN_PROTOC_VERSION -#error This file was generated by an older version of protoc which is -#error incompatible with your Protocol Buffer headers. Please -#error regenerate this file with a newer version of protoc. -#endif +#include "google/protobuf/port_def.inc" +#if PROTOBUF_VERSION < 4025000 +#error "This file was generated by a newer version of protoc which is" +#error "incompatible with your Protocol Buffer headers. Please update" +#error "your headers." +#endif // PROTOBUF_VERSION -#include -#include -#include -#include -#include -#include -#include -#include -#include // IWYU pragma: export -#include // IWYU pragma: export -#include +#if 4025000 < PROTOBUF_MIN_PROTOC_VERSION +#error "This file was generated by an older version of protoc which is" +#error "incompatible with your Protocol Buffer headers. Please" +#error "regenerate this file with a newer version of protoc." +#endif // PROTOBUF_MIN_PROTOC_VERSION +#include "google/protobuf/port_undef.inc" +#include "google/protobuf/io/coded_stream.h" +#include "google/protobuf/arena.h" +#include "google/protobuf/arenastring.h" +#include "google/protobuf/generated_message_tctable_decl.h" +#include "google/protobuf/generated_message_util.h" +#include "google/protobuf/metadata_lite.h" +#include "google/protobuf/generated_message_reflection.h" +#include "google/protobuf/message.h" +#include "google/protobuf/repeated_field.h" // IWYU pragma: export +#include "google/protobuf/extension_set.h" // IWYU pragma: export +#include "google/protobuf/unknown_field_set.h" // @@protoc_insertion_point(includes) -#include + +// Must be included last. +#include "google/protobuf/port_def.inc" + #define PROTOBUF_INTERNAL_EXPORT_stringData_2eproto -PROTOBUF_NAMESPACE_OPEN + +namespace google { +namespace protobuf { namespace internal { class AnyMetadata; } // namespace internal -PROTOBUF_NAMESPACE_CLOSE +} // namespace protobuf +} // namespace google // Internal implementation detail -- do not use these members. struct TableStruct_stringData_2eproto { - static const uint32_t offsets[]; + static const ::uint32_t offsets[]; }; -extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_stringData_2eproto; +extern const ::google::protobuf::internal::DescriptorTable + descriptor_table_stringData_2eproto; namespace messages { namespace stringData { class StringData; @@ -51,22 +62,29 @@ struct StringDataDefaultTypeInternal; extern StringDataDefaultTypeInternal _StringData_default_instance_; } // namespace stringData } // namespace messages -PROTOBUF_NAMESPACE_OPEN -template<> ::messages::stringData::StringData* Arena::CreateMaybeMessage<::messages::stringData::StringData>(Arena*); -PROTOBUF_NAMESPACE_CLOSE +namespace google { +namespace protobuf { +} // namespace protobuf +} // namespace google + namespace messages { namespace stringData { // =================================================================== + +// ------------------------------------------------------------------- + class StringData final : - public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:messages.stringData.StringData) */ { + public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:messages.stringData.StringData) */ { public: inline StringData() : StringData(nullptr) {} ~StringData() override; - explicit PROTOBUF_CONSTEXPR StringData(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + template + explicit PROTOBUF_CONSTEXPR StringData(::google::protobuf::internal::ConstantInitialized); - StringData(const StringData& from); + inline StringData(const StringData& from) + : StringData(nullptr, from) {} StringData(StringData&& from) noexcept : StringData() { *this = ::std::move(from); @@ -78,9 +96,9 @@ class StringData final : } inline StringData& operator=(StringData&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena() + if (GetArena() == from.GetArena() #ifdef PROTOBUF_FORCE_COPY_IN_MOVE - && GetOwningArena() != nullptr + && GetArena() != nullptr #endif // !PROTOBUF_FORCE_COPY_IN_MOVE ) { InternalSwap(&from); @@ -90,13 +108,22 @@ class StringData final : return *this; } - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const + ABSL_ATTRIBUTE_LIFETIME_BOUND { + return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); + } + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + ABSL_ATTRIBUTE_LIFETIME_BOUND { + return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); + } + + static const ::google::protobuf::Descriptor* descriptor() { return GetDescriptor(); } - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* GetReflection() { return default_instance().GetMetadata().reflection; } static const StringData& default_instance() { @@ -115,65 +142,62 @@ class StringData final : inline void Swap(StringData* other) { if (other == this) return; #ifdef PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() != nullptr && - GetOwningArena() == other->GetOwningArena()) { + if (GetArena() != nullptr && + GetArena() == other->GetArena()) { #else // PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() == other->GetOwningArena()) { + if (GetArena() == other->GetArena()) { #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { - ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + ::google::protobuf::internal::GenericSwap(this, other); } } void UnsafeArenaSwap(StringData* other) { if (other == this) return; - GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); } // implements Message ---------------------------------------------- - StringData* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + StringData* New(::google::protobuf::Arena* arena = nullptr) const final { return CreateMaybeMessage(arena); } - using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + using ::google::protobuf::Message::CopyFrom; void CopyFrom(const StringData& from); - using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + using ::google::protobuf::Message::MergeFrom; void MergeFrom( const StringData& from) { StringData::MergeImpl(*this, from); } private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); + static void MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg); public: - PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + ABSL_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; - size_t ByteSizeLong() const final; - const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - uint8_t* _InternalSerialize( - uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; - int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + ::size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::google::protobuf::internal::ParseContext* ctx) final; + ::uint8_t* _InternalSerialize( + ::uint8_t* target, ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedCtor(::google::protobuf::Arena* arena); void SharedDtor(); - void SetCachedSize(int size) const final; void InternalSwap(StringData* other); private: - friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; - static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + friend class ::google::protobuf::internal::AnyMetadata; + static ::absl::string_view FullMessageName() { return "messages.stringData.StringData"; } protected: - explicit StringData(::PROTOBUF_NAMESPACE_ID::Arena* arena, - bool is_message_owned = false); + explicit StringData(::google::protobuf::Arena* arena); + StringData(::google::protobuf::Arena* arena, const StringData& from); + const ::google::protobuf::MessageLite::ClassData* GetClassData() const final; public: - static const ClassData _class_data_; - const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; - - ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + ::google::protobuf::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- @@ -183,104 +207,132 @@ class StringData final : kDataFieldNumber = 1, }; // string data = 1; - void clear_data(); + void clear_data() ; const std::string& data() const; - template - void set_data(ArgT0&& arg0, ArgT... args); + template + void set_data(Arg_&& arg, Args_... args); std::string* mutable_data(); PROTOBUF_NODISCARD std::string* release_data(); - void set_allocated_data(std::string* data); + void set_allocated_data(std::string* value); + private: const std::string& _internal_data() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_data(const std::string& value); + inline PROTOBUF_ALWAYS_INLINE void _internal_set_data( + const std::string& value); std::string* _internal_mutable_data(); - public: + public: // @@protoc_insertion_point(class_scope:messages.stringData.StringData) private: class _Internal; - template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; - typedef void InternalArenaConstructable_; - typedef void DestructorSkippable_; + friend class ::google::protobuf::internal::TcParser; + static const ::google::protobuf::internal::TcParseTable< + 0, 1, 0, + 43, 2> + _table_; + friend class ::google::protobuf::MessageLite; + friend class ::google::protobuf::Arena; + template + friend class ::google::protobuf::Arena::InternalHelper; + using InternalArenaConstructable_ = void; + using DestructorSkippable_ = void; struct Impl_ { - ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr data_; - mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + + inline explicit constexpr Impl_( + ::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* arena); + inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* arena, const Impl_& from); + ::google::protobuf::internal::ArenaStringPtr data_; + mutable ::google::protobuf::internal::CachedSize _cached_size_; + PROTOBUF_TSAN_DECLARE_MEMBER }; union { Impl_ _impl_; }; friend struct ::TableStruct_stringData_2eproto; }; + // =================================================================== + + // =================================================================== + #ifdef __GNUC__ - #pragma GCC diagnostic push - #pragma GCC diagnostic ignored "-Wstrict-aliasing" +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wstrict-aliasing" #endif // __GNUC__ +// ------------------------------------------------------------------- + // StringData // string data = 1; inline void StringData::clear_data() { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); _impl_.data_.ClearToEmpty(); } -inline const std::string& StringData::data() const { +inline const std::string& StringData::data() const + ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_get:messages.stringData.StringData.data) return _internal_data(); } -template -inline PROTOBUF_ALWAYS_INLINE -void StringData::set_data(ArgT0&& arg0, ArgT... args) { - - _impl_.data_.Set(static_cast(arg0), args..., GetArenaForAllocation()); +template +inline PROTOBUF_ALWAYS_INLINE void StringData::set_data(Arg_&& arg, + Args_... args) { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + ; + _impl_.data_.Set(static_cast(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:messages.stringData.StringData.data) } -inline std::string* StringData::mutable_data() { +inline std::string* StringData::mutable_data() ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_data(); // @@protoc_insertion_point(field_mutable:messages.stringData.StringData.data) return _s; } inline const std::string& StringData::_internal_data() const { + PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race); return _impl_.data_.Get(); } inline void StringData::_internal_set_data(const std::string& value) { - - _impl_.data_.Set(value, GetArenaForAllocation()); + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + ; + _impl_.data_.Set(value, GetArena()); } inline std::string* StringData::_internal_mutable_data() { - - return _impl_.data_.Mutable(GetArenaForAllocation()); + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + ; + return _impl_.data_.Mutable( GetArena()); } inline std::string* StringData::release_data() { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); // @@protoc_insertion_point(field_release:messages.stringData.StringData.data) return _impl_.data_.Release(); } -inline void StringData::set_allocated_data(std::string* data) { - if (data != nullptr) { - - } else { - - } - _impl_.data_.SetAllocated(data, GetArenaForAllocation()); -#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (_impl_.data_.IsDefault()) { - _impl_.data_.Set("", GetArenaForAllocation()); - } -#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +inline void StringData::set_allocated_data(std::string* value) { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + _impl_.data_.SetAllocated(value, GetArena()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.data_.IsDefault()) { + _impl_.data_.Set("", GetArena()); + } + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:messages.stringData.StringData.data) } #ifdef __GNUC__ - #pragma GCC diagnostic pop +#pragma GCC diagnostic pop #endif // __GNUC__ // @@protoc_insertion_point(namespace_scope) - } // namespace stringData } // namespace messages + // @@protoc_insertion_point(global_scope) -#include -#endif // GOOGLE_PROTOBUF_INCLUDED_GOOGLE_PROTOBUF_INCLUDED_stringData_2eproto +#include "google/protobuf/port_undef.inc" + +#endif // GOOGLE_PROTOBUF_INCLUDED_stringData_2eproto_2epb_2eh diff --git a/libs/cppzmq b/libs/cppzmq new file mode 160000 index 0000000..6164cf7 --- /dev/null +++ b/libs/cppzmq @@ -0,0 +1 @@ +Subproject commit 6164cf7dbc1df6d1bd8e4c6c5f8e52d7dea63aa7 diff --git a/libs/cppzmq/.clang-format b/libs/cppzmq/.clang-format deleted file mode 100644 index 28f3353..0000000 --- a/libs/cppzmq/.clang-format +++ /dev/null @@ -1,53 +0,0 @@ -BasedOnStyle: LLVM -IndentWidth: 4 -UseTab: Never -BreakBeforeBraces: Custom -BraceWrapping: - AfterClass: true - AfterControlStatement: false - AfterEnum: true - AfterFunction: true - AfterNamespace: true - AfterObjCDeclaration: true - AfterStruct: true - AfterUnion: true - BeforeCatch: true - BeforeElse: false - IndentBraces: false - -AlignConsecutiveAssignments: false -AlignConsecutiveDeclarations: false -AllowShortIfStatementsOnASingleLine: false -IndentCaseLabels: true -BinPackArguments: true -BinPackParameters: false -AlignTrailingComments: true -AllowShortBlocksOnASingleLine: false -AllowAllParametersOfDeclarationOnNextLine: true -AllowShortFunctionsOnASingleLine: InlineOnly -AlwaysBreakTemplateDeclarations: false -ColumnLimit: 85 -MaxEmptyLinesToKeep: 2 -KeepEmptyLinesAtTheStartOfBlocks: false -ContinuationIndentWidth: 2 -PointerAlignment: Right -ReflowComments: false -SpaceBeforeAssignmentOperators: true -SpaceBeforeParens: ControlStatements -SpaceInEmptyParentheses: false -SpacesInAngles: false -SpacesInParentheses: false -SpacesInSquareBrackets: false -Standard: Cpp11 - -SortIncludes: false - -FixNamespaceComments: false -BreakBeforeBinaryOperators: NonAssignment -SpaceAfterTemplateKeyword: false -AlignAfterOpenBracket: Align -AlignOperands: true -BreakConstructorInitializers: AfterColon -ConstructorInitializerAllOnOneLineOrOnePerLine: true -SpaceAfterCStyleCast: true -BreakBeforeTernaryOperators: true diff --git a/libs/cppzmq/.github/workflows/ci.yml b/libs/cppzmq/.github/workflows/ci.yml deleted file mode 100644 index ccceb96..0000000 --- a/libs/cppzmq/.github/workflows/ci.yml +++ /dev/null @@ -1,195 +0,0 @@ -name: CI - -on: [push, pull_request] - -defaults: - run: - shell: bash - -jobs: - tests: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: ["ubuntu-latest"] - cppstd: ["98", "11", "20"] - cc: ["gcc-10"] - cxx: ["g++-10"] - drafts: ["ON"] - libzmq: ["4.3.4"] - libzmqbuild: ["cmake"] - include: - # older libzmq and gcc without draft - - os: "ubuntu-18.04" - cppstd: "11" - cc: "gcc-7" - cxx: "g++-7" - drafts: "OFF" - libzmq: "4.2.0" - libzmqbuild: "pkgconfig" - # gcc 4.8 - - os: "ubuntu-18.04" - cppstd: "11" - cc: "gcc-4.8" - cxx: "g++-4.8" - drafts: "ON" - libzmq: "4.3.4" - libzmqbuild: "cmake" - aptinstall: "gcc-4.8 g++-4.8" - # gcc 5 - - os: "ubuntu-18.04" - cppstd: "11" - cc: "gcc-5" - cxx: "g++-5" - drafts: "ON" - libzmq: "4.3.4" - libzmqbuild: "cmake" - aptinstall: "gcc-5 g++-5" - # without draft - - os: "ubuntu-latest" - cppstd: "20" - cc: "gcc-10" - cxx: "g++-10" - drafts: "OFF" - libzmq: "4.3.4" - libzmqbuild: "cmake" - # coverage (gcc version should match gcov version) - - os: "ubuntu-latest" - cppstd: "17" - cc: "gcc-9" - cxx: "g++-9" - drafts: "ON" - libzmq: "4.3.4" - libzmqbuild: "cmake" - coverage: "-DCOVERAGE=ON" - aptinstall: "lcov" - # clang - - os: "ubuntu-latest" - cppstd: "17" - cc: "clang-12" - cxx: "clang++-12" - drafts: "ON" - libzmq: "4.3.4" - libzmqbuild: "cmake" - # macos - - os: "macos-latest" - cppstd: "17" - cc: "clang" - cxx: "clang++" - drafts: "OFF" - libzmq: "4.3.4" - libzmqbuild: false - brewinstall: "zeromq" - # windows - - os: "windows-2019" - cppstd: "14" - cc: "msbuild" - cxx: "msbuild" - drafts: "ON" - libzmq: "4.3.4" - libzmqbuild: "cmake" - platform: "-Ax64" - - os: "windows-latest" - cppstd: "20" - cc: "msbuild" - cxx: "msbuild" - drafts: "ON" - libzmq: "4.3.4" - libzmqbuild: "cmake" - platform: "-Ax64" - - env: - CC: ${{ matrix.cc }} - CXX: ${{ matrix.cxx }} - VERBOSE: 1 - THREADS: 2 - BUILDTYPE: "Debug" - - steps: - - uses: actions/checkout@v2 - - - name: install_deps - run: | - if [ ! -z "${{ matrix.aptinstall }}" ]; then - sudo apt install -y ${{ matrix.aptinstall }} - fi - if [ ! -z "${{ matrix.brewinstall }}" ]; then - brew install ${{ matrix.brewinstall }} - fi - - - name: get_libzmq - run: | - curl -L https://github.com/zeromq/libzmq/archive/v${{ matrix.libzmq }}.tar.gz \ - >zeromq.tar.gz - tar -xvzf zeromq.tar.gz - - - name: build_libzmq_cmake - if: ${{ matrix.libzmqbuild == 'cmake' }} - run: | - cmake -Hlibzmq-${{ matrix.libzmq }} -Blibzmq-build ${{ matrix.platform}} \ - -DWITH_PERF_TOOL=OFF \ - -DZMQ_BUILD_TESTS=OFF \ - -DCMAKE_BUILD_TYPE=Release \ - -DENABLE_DRAFTS=${{ matrix.drafts }} - cmake --build libzmq-build --config ${BUILDTYPE} -j ${THREADS} - echo "LIBZMQ=${PWD}/libzmq-build" >> ${GITHUB_ENV} - - - name: build_libzmq_pkgconfig - if: ${{ matrix.libzmqbuild == 'pkgconfig' }} - working-directory: libzmq-${{ matrix.libzmq }} - run: | - ./autogen.sh && - ./configure --prefix=${PWD}/libzmq-build && - make -j ${THREADS} - make install - echo "LIBZMQ=${PWD}/libzmq-build" >> ${GITHUB_ENV} - - - name: build - env: - CMAKE_PREFIX_PATH: ${{ env.LIBZMQ }} - run: | - cmake -H. -Bbuild ${{ matrix.platform}} ${{ matrix.coverage }} \ - -DCMAKE_BUILD_TYPE=${BUILDTYPE} \ - -DENABLE_DRAFTS=${{ matrix.drafts }} \ - -DCMAKE_CXX_STANDARD=${{ matrix.cppstd }} - cmake --build build --config ${BUILDTYPE} -j ${THREADS} - echo "CPPZMQ=${PWD}/build" >> ${GITHUB_ENV} - - - name: test - # for unknown reason no tests are found and run on windows - # could be something to do with catch_discover_tests not working? - run: | - cd ${{ env.CPPZMQ }} - ctest -V -C ${BUILDTYPE} - - - name: demo - # probably need to install libzmq and cppzmq for this to work on windows - if: ${{ matrix.os == 'ubuntu*' }} - env: - CMAKE_PREFIX_PATH: ${{ env.LIBZMQ }}:${{ env.CPPZMQ }} - run: | - cd demo - cmake -H. -Bbuild ${{ matrix.platform}} \ - -DCMAKE_BUILD_TYPE=${BUILDTYPE} \ - -DCMAKE_CXX_STANDARD=${{ matrix.cppstd }} - cmake --build build --config ${BUILDTYPE} - cd build - ctest -V -C ${BUILDTYPE} - - - name: lcov - if: ${{ matrix.coverage && success() }} - run: | - lcov --capture --directory . --output-file coverage.info - lcov --remove coverage.info -o coverage_filtered.info \ - '/usr/include/*' \ - '/usr/local/include/*' \ - ${PWD}'/tests/*' \ - ${PWD}'/build/*' - # to generate local html: genhtml coverage_filtered.info --output-directory . - - - name: coveralls_upload - if: ${{ matrix.coverage && success() }} - uses: coverallsapp/github-action@master - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - path-to-lcov: ./coverage_filtered.info diff --git a/libs/cppzmq/.gitignore b/libs/cppzmq/.gitignore deleted file mode 100644 index cb4c751..0000000 --- a/libs/cppzmq/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -# Vim tmp files -*.swp - -# Build directory -*build/ diff --git a/libs/cppzmq/CMakeLists.txt b/libs/cppzmq/CMakeLists.txt deleted file mode 100644 index 05001ad..0000000 --- a/libs/cppzmq/CMakeLists.txt +++ /dev/null @@ -1,112 +0,0 @@ -cmake_minimum_required(VERSION 3.11) - -list (APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") - -include (DetectCPPZMQVersion) - -project(cppzmq VERSION ${DETECTED_CPPZMQ_VERSION}) - -if (NOT TARGET libzmq AND NOT TARGET libzmq-static) - find_package(ZeroMQ QUIET) - - # libzmq autotools install: fallback to pkg-config - if(NOT ZeroMQ_FOUND) - message(STATUS "CMake libzmq package not found, trying again with pkg-config (normal install of zeromq)") - list (APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/libzmq-pkg-config) - find_package(ZeroMQ REQUIRED) - endif() - - # TODO "REQUIRED" above should already cause a fatal failure if not found, but this doesn't seem to work - if(NOT ZeroMQ_FOUND) - message(FATAL_ERROR "ZeroMQ was not found, neither as a CMake package nor via pkg-config") - endif() - - if (ZeroMQ_FOUND AND NOT (TARGET libzmq OR TARGET libzmq-static)) - message(FATAL_ERROR "ZeroMQ version not supported!") - endif() -endif() - -if (EXISTS "${CMAKE_SOURCE_DIR}/.git") - OPTION (ENABLE_DRAFTS "Build and install draft classes and methods" ON) -else () - OPTION (ENABLE_DRAFTS "Build and install draft classes and methods" OFF) -endif () -if (ENABLE_DRAFTS) - ADD_DEFINITIONS (-DZMQ_BUILD_DRAFT_API) - set (pkg_config_defines "-DZMQ_BUILD_DRAFT_API=1") -else (ENABLE_DRAFTS) - set (pkg_config_defines "") -endif (ENABLE_DRAFTS) - -message(STATUS "cppzmq v${cppzmq_VERSION}") - -set(CPPZMQ_HEADERS - zmq.hpp - zmq_addon.hpp -) - -foreach (target cppzmq cppzmq-static) - add_library(${target} INTERFACE) - target_include_directories(${target} INTERFACE $ - $) -endforeach() - -target_link_libraries(cppzmq INTERFACE libzmq) -target_link_libraries(cppzmq-static INTERFACE libzmq-static) - -include(GNUInstallDirs) -include(CMakePackageConfigHelpers) - -install(TARGETS cppzmq cppzmq-static - EXPORT ${PROJECT_NAME}-targets) - -install(FILES ${CPPZMQ_HEADERS} - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) - -# GNUInstallDirs "DATADIR" wrong here; CMake search path wants "share". -set(CPPZMQ_CMAKECONFIG_INSTALL_DIR "share/cmake/${PROJECT_NAME}" CACHE STRING "install path for cppzmqConfig.cmake") - -configure_file(libzmq-pkg-config/FindZeroMQ.cmake - libzmq-pkg-config/FindZeroMQ.cmake - COPYONLY) - -export(EXPORT ${PROJECT_NAME}-targets - FILE "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Targets.cmake") -configure_package_config_file(${PROJECT_NAME}Config.cmake.in - "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" - INSTALL_DESTINATION ${CPPZMQ_CMAKECONFIG_INSTALL_DIR}) -# Workaround until ARCH_INDEPENDENT flag can be used with cmake 3.14. -# The ConigVersion.cmake file contains checks for the architecture is was -# generated on, which can cause problems for header only libraries -# used with e.g. the Conan package manager. Since it is header only we -# can/should omit those checks. -set(CPPZMQ_SIZEOF_VOID_P ${CMAKE_SIZEOF_VOID_P}) -set(CMAKE_SIZEOF_VOID_P "") # a simple unset is not sufficient -write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake - VERSION ${CPPZMQ_VERSION} - COMPATIBILITY AnyNewerVersion) -set(CMAKE_SIZEOF_VOID_P ${CPPZMQ_SIZEOF_VOID_P}) - -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cppzmq.pc.in - ${CMAKE_CURRENT_BINARY_DIR}/cppzmq.pc @ONLY) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/cppzmq.pc - DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) - -install(EXPORT ${PROJECT_NAME}-targets - FILE ${PROJECT_NAME}Targets.cmake - DESTINATION ${CPPZMQ_CMAKECONFIG_INSTALL_DIR}) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake - ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake - DESTINATION ${CPPZMQ_CMAKECONFIG_INSTALL_DIR}) -install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/libzmq-pkg-config/FindZeroMQ.cmake - DESTINATION ${CPPZMQ_CMAKECONFIG_INSTALL_DIR}/libzmq-pkg-config) - -option(CPPZMQ_BUILD_TESTS "Whether or not to build the tests" ON) - -if (CPPZMQ_BUILD_TESTS) - enable_testing() - add_subdirectory(tests) - if (CMAKE_CXX_STANDARD AND NOT CMAKE_CXX_STANDARD EQUAL 98 AND CMAKE_CXX_STANDARD GREATER_EQUAL 11) - add_subdirectory(examples) - endif() -endif() diff --git a/libs/cppzmq/LICENSE b/libs/cppzmq/LICENSE deleted file mode 100644 index ae98bd8..0000000 --- a/libs/cppzmq/LICENSE +++ /dev/null @@ -1,17 +0,0 @@ - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to - deal in the Software without restriction, including without limitation the - rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - sell copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - IN THE SOFTWARE. diff --git a/libs/cppzmq/README.md b/libs/cppzmq/README.md deleted file mode 100644 index e2bea0b..0000000 --- a/libs/cppzmq/README.md +++ /dev/null @@ -1,196 +0,0 @@ -[![CI](https://github.com/zeromq/cppzmq/actions/workflows/ci.yml/badge.svg)](https://github.com/zeromq/cppzmq/actions) -[![Coverage Status](https://coveralls.io/repos/github/zeromq/cppzmq/badge.svg?branch=master)](https://coveralls.io/github/zeromq/cppzmq?branch=master) -[![License](https://img.shields.io/github/license/zeromq/cppzmq.svg)](https://github.com/zeromq/cppzmq/blob/master/LICENSE) - -Introduction & Design Goals -=========================== - -cppzmq is a C++ binding for libzmq. It has the following design goals: - - cppzmq maps the libzmq C API to C++ concepts. In particular: - - it is type-safe (the libzmq C API exposes various class-like concepts as void*) - - it provides exception-based error handling (the libzmq C API provides errno-based error handling) - - it provides RAII-style classes that automate resource management (the libzmq C API requires the user to take care to free resources explicitly) - - cppzmq is a light-weight, header-only binding. You only need to include the header file zmq.hpp (and maybe zmq_addon.hpp) to use it. - - zmq.hpp is meant to contain direct mappings of the abstractions provided by the libzmq C API, while zmq_addon.hpp provides additional higher-level abstractions. - -There are other C++ bindings for ZeroMQ with different design goals. In particular, none of the following bindings are header-only: - - [zmqpp](https://github.com/zeromq/zmqpp) is a high-level binding to libzmq. - - [czmqpp](https://github.com/zeromq/czmqpp) is a binding based on the high-level czmq API. - - [fbzmq](https://github.com/facebook/fbzmq) is a binding that integrates with Apache Thrift and provides higher-level abstractions in addition. It requires C++14. - -Supported platforms -=================== - - - Only a subset of the platforms that are supported by libzmq itself are supported. Some features already require a compiler supporting C++11. In the future, probably all features will require C++11. To build and run the tests, CMake and Catch are required. - - Any libzmq 4.x version is expected to work. DRAFT features may only work for the most recent tested version. Currently explicitly tested libzmq versions are - - 4.2.0 (without DRAFT API) - - 4.3.4 (with and without DRAFT API) - - Platforms with full support (i.e. CI executing build and tests) - - Ubuntu 18.04 x64 (with gcc 4.8.5, 5.5.0, 7.5.0) - - Ubuntu 20.04 x64 (with gcc 9.3.0, 10.3.0 and clang 12) - - Visual Studio 2017 x64 - - Visual Studio 2019 x64 - - macOS 10.15 (with clang 12, without DRAFT API) - - Additional platforms that are known to work: - - We have no current reports on additional platforms that are known to work yet. Please add your platform here. If CI can be provided for them with a cloud-based CI service working with GitHub, you are invited to add CI, and make it possible to be included in the list above. - - Additional platforms that probably work: - - Any platform supported by libzmq that provides a sufficiently recent gcc (4.8.1 or newer) or clang (3.4.1 or newer) - - Visual Studio 2012+ x86/x64 - -Examples -======== -These examples require at least C++11. -```c++ -#include - -int main() -{ - zmq::context_t ctx; - zmq::socket_t sock(ctx, zmq::socket_type::push); - sock.bind("inproc://test"); - sock.send(zmq::str_buffer("Hello, world"), zmq::send_flags::dontwait); -} -``` -This a more complex example where we send and receive multi-part messages over TCP with a wildcard port. -```c++ -#include -#include - -int main() -{ - zmq::context_t ctx; - zmq::socket_t sock1(ctx, zmq::socket_type::push); - zmq::socket_t sock2(ctx, zmq::socket_type::pull); - sock1.bind("tcp://127.0.0.1:*"); - const std::string last_endpoint = - sock1.get(zmq::sockopt::last_endpoint); - std::cout << "Connecting to " - << last_endpoint << std::endl; - sock2.connect(last_endpoint); - - std::array send_msgs = { - zmq::str_buffer("foo"), - zmq::str_buffer("bar!") - }; - if (!zmq::send_multipart(sock1, send_msgs)) - return 1; - - std::vector recv_msgs; - const auto ret = zmq::recv_multipart( - sock2, std::back_inserter(recv_msgs)); - if (!ret) - return 1; - std::cout << "Got " << *ret - << " messages" << std::endl; - return 0; -} -``` - -See the `examples` directory for more examples. When the project is compiled with tests enabled, each example gets compiled to an executable. - - -API Overview -============ - -For an extensive overview of the `zmq.hpp` API in use, see this [Tour of CPPZMQ by @brettviren](https://brettviren.github.io/cppzmq-tour/index.html). - -Bindings for libzmq in `zmq.hpp`: - -Types: -* class `zmq::context_t` -* enum `zmq::ctxopt` -* class `zmq::socket_t` -* class `zmq::socket_ref` -* enum `zmq::socket_type` -* enum `zmq::sockopt` -* enum `zmq::send_flags` -* enum `zmq::recv_flags` -* class `zmq::message_t` -* class `zmq::const_buffer` -* class `zmq::mutable_buffer` -* struct `zmq::recv_buffer_size` -* alias `zmq::send_result_t` -* alias `zmq::recv_result_t` -* alias `zmq::recv_buffer_result_t` -* class `zmq::error_t` -* class `zmq::monitor_t` -* struct `zmq_event_t`, -* alias `zmq::free_fn`, -* alias `zmq::pollitem_t`, -* alias `zmq::fd_t` -* class `zmq::poller_t` DRAFT -* enum `zmq::event_flags` DRAFT -* enum `zmq::poller_event` DRAFT - -Functions: -* `zmq::version` -* `zmq::poll` -* `zmq::proxy` -* `zmq::proxy_steerable` -* `zmq::buffer` -* `zmq::str_buffer` - -Extra high-level types and functions `zmq_addon.hpp`: - -Types: -* class `zmq::multipart_t` -* class `zmq::active_poller_t` DRAFT - -Functions: -* `zmq::recv_multipart` -* `zmq::send_multipart` -* `zmq::send_multipart_n` -* `zmq::encode` -* `zmq::decode` - -Compatibility Guidelines -======================== - -The users of cppzmq are expected to follow the guidelines below to ensure not to break when upgrading cppzmq to newer versions (non-exhaustive list): - -* Do not depend on any macros defined in cppzmq unless explicitly declared public here. - -The following macros may be used by consumers of cppzmq: `CPPZMQ_VERSION`, `CPPZMQ_VERSION_MAJOR`, `CPPZMQ_VERSION_MINOR`, `CPPZMQ_VERSION_PATCH`. - -Contribution policy -=================== - -The contribution policy is at: http://rfc.zeromq.org/spec:22 - -Build instructions -================== - -Build steps: - -1. Build [libzmq](https://github.com/zeromq/libzmq) via cmake. This does an out of source build and installs the build files - - download and unzip the lib, cd to directory - - mkdir build - - cd build - - cmake .. - - sudo make -j4 install - -2. Build cppzmq via cmake. This does an out of source build and installs the build files - - download and unzip the lib, cd to directory - - mkdir build - - cd build - - cmake .. - - sudo make -j4 install - -3. Build cppzmq via [vcpkg](https://github.com/Microsoft/vcpkg/). This does an out of source build and installs the build files - - git clone https://github.com/Microsoft/vcpkg.git - - cd vcpkg - - ./bootstrap-vcpkg.sh # bootstrap-vcpkg.bat for Powershell - - ./vcpkg integrate install - - ./vcpkg install cppzmq - -Using this: - -A cmake find package scripts is provided for you to easily include this library. -Add these lines in your CMakeLists.txt to include the headers and library files of -cpp zmq (which will also include libzmq for you). - -``` -#find cppzmq wrapper, installed by make of cppzmq -find_package(cppzmq) -target_link_libraries(*Your Project Name* cppzmq) -``` diff --git a/libs/cppzmq/cmake/DetectCPPZMQVersion.cmake b/libs/cppzmq/cmake/DetectCPPZMQVersion.cmake deleted file mode 100644 index 99ed9bf..0000000 --- a/libs/cppzmq/cmake/DetectCPPZMQVersion.cmake +++ /dev/null @@ -1,8 +0,0 @@ - -file(READ "${CMAKE_CURRENT_SOURCE_DIR}/zmq.hpp" _CPPZMQ_H_CONTENTS) -string(REGEX REPLACE ".*#define CPPZMQ_VERSION_MAJOR ([0-9]+).*" "\\1" DETECTED_CPPZMQ_VERSION_MAJOR "${_CPPZMQ_H_CONTENTS}") -string(REGEX REPLACE ".*#define CPPZMQ_VERSION_MINOR ([0-9]+).*" "\\1" DETECTED_CPPZMQ_VERSION_MINOR "${_CPPZMQ_H_CONTENTS}") -string(REGEX REPLACE ".*#define CPPZMQ_VERSION_PATCH ([0-9]+).*" "\\1" DETECTED_CPPZMQ_VERSION_PATCH "${_CPPZMQ_H_CONTENTS}") -set(DETECTED_CPPZMQ_VERSION "${DETECTED_CPPZMQ_VERSION_MAJOR}.${DETECTED_CPPZMQ_VERSION_MINOR}.${DETECTED_CPPZMQ_VERSION_PATCH}") - -message(STATUS "Detected CPPZMQ Version - ${DETECTED_CPPZMQ_VERSION}") diff --git a/libs/cppzmq/cppzmq.pc.in b/libs/cppzmq/cppzmq.pc.in deleted file mode 100644 index 3dc945d..0000000 --- a/libs/cppzmq/cppzmq.pc.in +++ /dev/null @@ -1,9 +0,0 @@ -prefix="@CMAKE_INSTALL_PREFIX@" -includedir="@CMAKE_INSTALL_FULL_INCLUDEDIR@" - -Name: @PROJECT_NAME@ -Description: C++ binding for libzmq -URL: https://github.com/zeromq/cppzmq -Version: @PROJECT_VERSION@ -Requires: libzmq -Cflags: -I"${includedir}" @pkg_config_defines@ diff --git a/libs/cppzmq/cppzmqConfig.cmake.in b/libs/cppzmq/cppzmqConfig.cmake.in deleted file mode 100644 index f596517..0000000 --- a/libs/cppzmq/cppzmqConfig.cmake.in +++ /dev/null @@ -1,36 +0,0 @@ -# cppzmq cmake module -# -# The following import targets are created -# -# :: -# -# cppzmq-static -# cppzmq -# -# This module sets the following variables in your project:: -# -# cppzmq_FOUND - true if cppzmq found on the system -# cppzmq_INCLUDE_DIR - the directory containing cppzmq headers -# cppzmq_LIBRARY - the ZeroMQ library for dynamic linking -# cppzmq_STATIC_LIBRARY - the ZeroMQ library for static linking - -@PACKAGE_INIT@ - -include(CMakeFindDependencyMacro) -find_package(ZeroMQ QUIET) - -# libzmq autotools install: fallback to pkg-config -if(NOT ZeroMQ_FOUND) - list (APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/libzmq-pkg-config) - find_package(ZeroMQ REQUIRED) -endif() - -if(NOT ZeroMQ_FOUND) - message(FATAL_ERROR "ZeroMQ was NOT found!") -endif() - -if(NOT TARGET @PROJECT_NAME@) - include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake") - get_target_property(@PROJECT_NAME@_INCLUDE_DIR cppzmq INTERFACE_INCLUDE_DIRECTORIES) -endif() - diff --git a/libs/cppzmq/demo/CMakeLists.txt b/libs/cppzmq/demo/CMakeLists.txt deleted file mode 100644 index 1c90825..0000000 --- a/libs/cppzmq/demo/CMakeLists.txt +++ /dev/null @@ -1,23 +0,0 @@ -cmake_minimum_required(VERSION 3.0 FATAL_ERROR) - -project(cppzmq-demo CXX) - -find_package(cppzmq) - -enable_testing() -add_executable( - demo - main.cpp - ) - -target_link_libraries( - demo - cppzmq - ) - -add_test( - NAME - demo - COMMAND - ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/demo - ) diff --git a/libs/cppzmq/demo/main.cpp b/libs/cppzmq/demo/main.cpp deleted file mode 100644 index 077fc98..0000000 --- a/libs/cppzmq/demo/main.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include - -int main(int argc, char **argv) -{ - zmq::context_t context; - return 0; -} diff --git a/libs/cppzmq/examples/CMakeLists.txt b/libs/cppzmq/examples/CMakeLists.txt deleted file mode 100644 index 1b47e03..0000000 --- a/libs/cppzmq/examples/CMakeLists.txt +++ /dev/null @@ -1,40 +0,0 @@ -cmake_minimum_required(VERSION 3.0 FATAL_ERROR) - -project(cppzmq-examples CXX) - -# place binaries and libraries according to GNU standards - -include(GNUInstallDirs) -set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}) -set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}) -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}) - -find_package(Threads) -find_package(cppzmq) - -add_executable( - pubsub_multithread_inproc - pubsub_multithread_inproc.cpp -) -target_link_libraries( - pubsub_multithread_inproc - PRIVATE cppzmq ${CMAKE_THREAD_LIBS_INIT} -) - -add_executable( - hello_world - hello_world.cpp -) -target_link_libraries( - hello_world - PRIVATE cppzmq ${CMAKE_THREAD_LIBS_INIT} -) - -add_executable( - multipart_messages - multipart_messages.cpp -) -target_link_libraries( - multipart_messages - PRIVATE cppzmq ${CMAKE_THREAD_LIBS_INIT} -) diff --git a/libs/cppzmq/examples/hello_world.cpp b/libs/cppzmq/examples/hello_world.cpp deleted file mode 100644 index 8719448..0000000 --- a/libs/cppzmq/examples/hello_world.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include - -int main() -{ - zmq::context_t ctx; - zmq::socket_t sock(ctx, zmq::socket_type::push); - sock.bind("inproc://test"); - sock.send(zmq::str_buffer("Hello, world"), zmq::send_flags::dontwait); -} diff --git a/libs/cppzmq/examples/multipart_messages.cpp b/libs/cppzmq/examples/multipart_messages.cpp deleted file mode 100644 index 1af8f8f..0000000 --- a/libs/cppzmq/examples/multipart_messages.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include -#include - -int main() -{ - zmq::context_t ctx; - zmq::socket_t sock1(ctx, zmq::socket_type::push); - zmq::socket_t sock2(ctx, zmq::socket_type::pull); - sock1.bind("tcp://127.0.0.1:*"); - const std::string last_endpoint = - sock1.get(zmq::sockopt::last_endpoint); - std::cout << "Connecting to " - << last_endpoint << std::endl; - sock2.connect(last_endpoint); - - std::array send_msgs = { - zmq::str_buffer("foo"), - zmq::str_buffer("bar!") - }; - if (!zmq::send_multipart(sock1, send_msgs)) - return 1; - - std::vector recv_msgs; - const auto ret = zmq::recv_multipart( - sock2, std::back_inserter(recv_msgs)); - if (!ret) - return 1; - std::cout << "Got " << *ret - << " messages" << std::endl; - return 0; -} diff --git a/libs/cppzmq/examples/pubsub_multithread_inproc.cpp b/libs/cppzmq/examples/pubsub_multithread_inproc.cpp deleted file mode 100644 index 2727f7b..0000000 --- a/libs/cppzmq/examples/pubsub_multithread_inproc.cpp +++ /dev/null @@ -1,102 +0,0 @@ -#include -#include -#include -#include - -#include "zmq.hpp" -#include "zmq_addon.hpp" - -void PublisherThread(zmq::context_t *ctx) { - // Prepare publisher - zmq::socket_t publisher(*ctx, zmq::socket_type::pub); - publisher.bind("inproc://#1"); - - // Give the subscribers a chance to connect, so they don't lose any messages - std::this_thread::sleep_for(std::chrono::milliseconds(20)); - - while (true) { - // Write three messages, each with an envelope and content - publisher.send(zmq::str_buffer("A"), zmq::send_flags::sndmore); - publisher.send(zmq::str_buffer("Message in A envelope")); - publisher.send(zmq::str_buffer("B"), zmq::send_flags::sndmore); - publisher.send(zmq::str_buffer("Message in B envelope")); - publisher.send(zmq::str_buffer("C"), zmq::send_flags::sndmore); - publisher.send(zmq::str_buffer("Message in C envelope")); - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - } -} - -void SubscriberThread1(zmq::context_t *ctx) { - // Prepare subscriber - zmq::socket_t subscriber(*ctx, zmq::socket_type::sub); - subscriber.connect("inproc://#1"); - - // Thread2 opens "A" and "B" envelopes - subscriber.set(zmq::sockopt::subscribe, "A"); - subscriber.set(zmq::sockopt::subscribe, "B"); - - while (1) { - // Receive all parts of the message - std::vector recv_msgs; - zmq::recv_result_t result = - zmq::recv_multipart(subscriber, std::back_inserter(recv_msgs)); - assert(result && "recv failed"); - assert(*result == 2); - - std::cout << "Thread2: [" << recv_msgs[0].to_string() << "] " - << recv_msgs[1].to_string() << std::endl; - } -} - -void SubscriberThread2(zmq::context_t *ctx) { - // Prepare our context and subscriber - zmq::socket_t subscriber(*ctx, zmq::socket_type::sub); - subscriber.connect("inproc://#1"); - - // Thread3 opens ALL envelopes - subscriber.set(zmq::sockopt::subscribe, ""); - - while (1) { - // Receive all parts of the message - std::vector recv_msgs; - zmq::recv_result_t result = - zmq::recv_multipart(subscriber, std::back_inserter(recv_msgs)); - assert(result && "recv failed"); - assert(*result == 2); - - std::cout << "Thread3: [" << recv_msgs[0].to_string() << "] " - << recv_msgs[1].to_string() << std::endl; - } -} - -int main() { - /* - * No I/O threads are involved in passing messages using the inproc transport. - * Therefore, if you are using a ØMQ context for in-process messaging only you - * can initialise the context with zero I/O threads. - * - * Source: http://api.zeromq.org/4-3:zmq-inproc - */ - zmq::context_t ctx(0); - - auto thread1 = std::async(std::launch::async, PublisherThread, &ctx); - - // Give the publisher a chance to bind, since inproc requires it - std::this_thread::sleep_for(std::chrono::milliseconds(10)); - - auto thread2 = std::async(std::launch::async, SubscriberThread1, &ctx); - auto thread3 = std::async(std::launch::async, SubscriberThread2, &ctx); - thread1.wait(); - thread2.wait(); - thread3.wait(); - - /* - * Output: - * An infinite loop of a mix of: - * Thread2: [A] Message in A envelope - * Thread2: [B] Message in B envelope - * Thread3: [A] Message in A envelope - * Thread3: [B] Message in B envelope - * Thread3: [C] Message in C envelope - */ -} diff --git a/libs/cppzmq/libzmq-pkg-config/FindZeroMQ.cmake b/libs/cppzmq/libzmq-pkg-config/FindZeroMQ.cmake deleted file mode 100644 index c07c0f6..0000000 --- a/libs/cppzmq/libzmq-pkg-config/FindZeroMQ.cmake +++ /dev/null @@ -1,34 +0,0 @@ -set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH ON) -find_package(PkgConfig) -pkg_check_modules(PC_LIBZMQ QUIET libzmq) - -set(ZeroMQ_VERSION ${PC_LIBZMQ_VERSION}) - -find_path(ZeroMQ_INCLUDE_DIR zmq.h - PATHS ${ZeroMQ_DIR}/include - ${PC_LIBZMQ_INCLUDE_DIRS}) - -find_library(ZeroMQ_LIBRARY - NAMES zmq - PATHS ${ZeroMQ_DIR}/lib - ${PC_LIBZMQ_LIBDIR} - ${PC_LIBZMQ_LIBRARY_DIRS}) - -if(ZeroMQ_LIBRARY) - set(ZeroMQ_FOUND ON) -endif() - -set ( ZeroMQ_LIBRARIES ${ZeroMQ_LIBRARY} ) -set ( ZeroMQ_INCLUDE_DIRS ${ZeroMQ_INCLUDE_DIR} ) - -if(NOT TARGET libzmq) - add_library(libzmq UNKNOWN IMPORTED) - set_target_properties(libzmq PROPERTIES - IMPORTED_LOCATION ${ZeroMQ_LIBRARIES} - INTERFACE_INCLUDE_DIRECTORIES ${ZeroMQ_INCLUDE_DIRS}) -endif() - -include ( FindPackageHandleStandardArgs ) -# handle the QUIETLY and REQUIRED arguments and set ZMQ_FOUND to TRUE -# if all listed variables are TRUE -find_package_handle_standard_args ( ZeroMQ DEFAULT_MSG ZeroMQ_LIBRARIES ZeroMQ_INCLUDE_DIRS ) \ No newline at end of file diff --git a/libs/cppzmq/tests/CMakeLists.txt b/libs/cppzmq/tests/CMakeLists.txt deleted file mode 100644 index 6075df8..0000000 --- a/libs/cppzmq/tests/CMakeLists.txt +++ /dev/null @@ -1,53 +0,0 @@ -find_package(Threads) - -find_package(Catch2 QUIET) - -if (NOT Catch2_FOUND) - include(FetchContent) - - FetchContent_Declare( - Catch2 - GIT_REPOSITORY https://github.com/catchorg/Catch2.git - GIT_TAG v2.13.9) - - FetchContent_MakeAvailable(Catch2) - - list(APPEND CMAKE_MODULE_PATH ${catch2_SOURCE_DIR}/contrib) -endif() - -add_executable( - unit_tests - buffer.cpp - message.cpp - context.cpp - socket.cpp - socket_ref.cpp - poller.cpp - active_poller.cpp - multipart.cpp - recv_multipart.cpp - send_multipart.cpp - codec_multipart.cpp - monitor.cpp - utilities.cpp -) - -target_include_directories(unit_tests PUBLIC ${CATCH_MODULE_PATH}) -target_link_libraries( - unit_tests - PRIVATE Catch2::Catch2 - PRIVATE cppzmq - PRIVATE ${CMAKE_THREAD_LIBS_INIT} -) - -OPTION (COVERAGE "Enable gcda file generation needed by lcov" OFF) - -if (COVERAGE) - target_compile_options(unit_tests PRIVATE --coverage) - target_link_options(unit_tests PRIVATE --coverage) - message(STATUS "Coverage enabled") -endif() - -include(CTest) -include(Catch) -catch_discover_tests(unit_tests) diff --git a/libs/cppzmq/tests/active_poller.cpp b/libs/cppzmq/tests/active_poller.cpp deleted file mode 100644 index 224b371..0000000 --- a/libs/cppzmq/tests/active_poller.cpp +++ /dev/null @@ -1,446 +0,0 @@ -#include - -#include "testutil.hpp" - -#if defined(ZMQ_CPP11) && !defined(ZMQ_CPP11_PARTIAL) && defined(ZMQ_BUILD_DRAFT_API) - -#include -#include - -TEST_CASE("create destroy", "[active_poller]") -{ - zmq::active_poller_t active_poller; - CHECK(active_poller.empty()); -} - -static_assert(!std::is_copy_constructible::value, - "active_poller_t should not be copy-constructible"); -static_assert(!std::is_copy_assignable::value, - "active_poller_t should not be copy-assignable"); - -static const zmq::active_poller_t::handler_type no_op_handler = - [](zmq::event_flags) {}; - -TEST_CASE("move construct empty", "[active_poller]") -{ - zmq::active_poller_t a; - CHECK(a.empty()); - zmq::active_poller_t b = std::move(a); - CHECK(b.empty()); - CHECK(0u == a.size()); - CHECK(0u == b.size()); -} - -TEST_CASE("move assign empty", "[active_poller]") -{ - zmq::active_poller_t a; - CHECK(a.empty()); - zmq::active_poller_t b; - CHECK(b.empty()); - b = std::move(a); - CHECK(0u == a.size()); - CHECK(0u == b.size()); - CHECK(a.empty()); - CHECK(b.empty()); -} - -TEST_CASE("move construct non empty", "[active_poller]") -{ - zmq::context_t context; - zmq::socket_t socket{context, zmq::socket_type::router}; - - zmq::active_poller_t a; - a.add(socket, zmq::event_flags::pollin, [](zmq::event_flags) {}); - CHECK_FALSE(a.empty()); - CHECK(1u == a.size()); - zmq::active_poller_t b = std::move(a); - CHECK(a.empty()); - CHECK(0u == a.size()); - CHECK_FALSE(b.empty()); - CHECK(1u == b.size()); -} - -TEST_CASE("move assign non empty", "[active_poller]") -{ - zmq::context_t context; - zmq::socket_t socket{context, zmq::socket_type::router}; - - zmq::active_poller_t a; - a.add(socket, zmq::event_flags::pollin, no_op_handler); - CHECK_FALSE(a.empty()); - CHECK(1u == a.size()); - zmq::active_poller_t b; - b = std::move(a); - CHECK(a.empty()); - CHECK(0u == a.size()); - CHECK_FALSE(b.empty()); - CHECK(1u == b.size()); -} - -TEST_CASE("add handler", "[active_poller]") -{ - zmq::context_t context; - zmq::socket_t socket{context, zmq::socket_type::router}; - zmq::active_poller_t active_poller; - CHECK_NOTHROW( - active_poller.add(socket, zmq::event_flags::pollin, no_op_handler)); -} - -TEST_CASE("add null handler fails", "[active_poller]") -{ - zmq::context_t context; - zmq::socket_t socket{context, zmq::socket_type::router}; - zmq::active_poller_t active_poller; - zmq::active_poller_t::handler_type handler; - CHECK_THROWS_AS(active_poller.add(socket, zmq::event_flags::pollin, handler), - std::invalid_argument); -} - -#if ZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 3, 0) -// this behaviour was added by https://github.com/zeromq/libzmq/pull/3100 -TEST_CASE("add handler invalid events type", "[active_poller]") -{ - zmq::context_t context; - zmq::socket_t socket{context, zmq::socket_type::router}; - zmq::active_poller_t active_poller; - short invalid_events_type = 2 << 10; - CHECK_THROWS_AS( - active_poller.add(socket, static_cast(invalid_events_type), - no_op_handler), - zmq::error_t); - CHECK(active_poller.empty()); - CHECK(0u == active_poller.size()); -} -#endif - -TEST_CASE("add handler twice throws", "[active_poller]") -{ - common_server_client_setup s; - - CHECK(s.client.send(zmq::message_t{}, zmq::send_flags::none)); - - zmq::active_poller_t active_poller; - bool message_received = false; - active_poller.add( - s.server, zmq::event_flags::pollin, - [&message_received](zmq::event_flags) { message_received = true; }); - CHECK_THROWS_ZMQ_ERROR( - EINVAL, active_poller.add(s.server, zmq::event_flags::pollin, no_op_handler)); - CHECK(1 == active_poller.wait(std::chrono::milliseconds{-1})); - CHECK(message_received); // handler unmodified -} - -TEST_CASE("wait with no handlers throws", "[active_poller]") -{ - zmq::active_poller_t active_poller; - CHECK_THROWS_ZMQ_ERROR(EFAULT, - active_poller.wait(std::chrono::milliseconds{10})); -} - -TEST_CASE("remove unregistered throws", "[active_poller]") -{ - zmq::context_t context; - zmq::socket_t socket{context, zmq::socket_type::router}; - zmq::active_poller_t active_poller; - CHECK_THROWS_ZMQ_ERROR(EINVAL, active_poller.remove(socket)); -} - -TEST_CASE("remove registered empty", "[active_poller]") -{ - zmq::context_t context; - zmq::socket_t socket{context, zmq::socket_type::router}; - zmq::active_poller_t active_poller; - active_poller.add(socket, zmq::event_flags::pollin, no_op_handler); - CHECK_NOTHROW(active_poller.remove(socket)); -} - -TEST_CASE("remove registered non empty", "[active_poller]") -{ - zmq::context_t context; - zmq::socket_t socket{context, zmq::socket_type::router}; - zmq::active_poller_t active_poller; - active_poller.add(socket, zmq::event_flags::pollin, no_op_handler); - CHECK_NOTHROW(active_poller.remove(socket)); -} - -namespace -{ -struct server_client_setup : common_server_client_setup -{ - zmq::active_poller_t::handler_type handler = [&](zmq::event_flags e) { - events = e; - }; - - zmq::event_flags events = zmq::event_flags::none; -}; - -const std::string hi_str = "Hi"; - -} - -TEST_CASE("poll basic", "[active_poller]") -{ - server_client_setup s; - - CHECK_NOTHROW(s.client.send(zmq::message_t{hi_str}, zmq::send_flags::none)); - - zmq::active_poller_t active_poller; - bool message_received = false; - zmq::active_poller_t::handler_type handler = - [&message_received](zmq::event_flags events) { - CHECK(zmq::event_flags::none != (events & zmq::event_flags::pollin)); - message_received = true; - }; - CHECK_NOTHROW(active_poller.add(s.server, zmq::event_flags::pollin, handler)); - CHECK(1 == active_poller.wait(std::chrono::milliseconds{-1})); - CHECK(message_received); -} - -/// \todo this contains multiple test cases that should be split up -TEST_CASE("client server", "[active_poller]") -{ - const std::string send_msg = hi_str; - - // Setup server and client - server_client_setup s; - - // Setup active_poller - zmq::active_poller_t active_poller; - zmq::event_flags events; - zmq::active_poller_t::handler_type handler = [&](zmq::event_flags e) { - if (zmq::event_flags::none != (e & zmq::event_flags::pollin)) { - zmq::message_t zmq_msg; - CHECK_NOTHROW(s.server.recv(zmq_msg)); // get message - std::string recv_msg(zmq_msg.data(), zmq_msg.size()); - CHECK(send_msg == recv_msg); - } else if (zmq::event_flags::none != (e & ~zmq::event_flags::pollout)) { - INFO("Unexpected event type " << static_cast(events)); - REQUIRE(false); - } - events = e; - }; - - CHECK_NOTHROW(active_poller.add(s.server, zmq::event_flags::pollin, handler)); - - // client sends message - CHECK_NOTHROW(s.client.send(zmq::message_t{send_msg}, zmq::send_flags::none)); - - CHECK(1 == active_poller.wait(std::chrono::milliseconds{-1})); - CHECK(events == zmq::event_flags::pollin); - - // Re-add server socket with pollout flag - CHECK_NOTHROW(active_poller.remove(s.server)); - CHECK_NOTHROW(active_poller.add( - s.server, zmq::event_flags::pollin | zmq::event_flags::pollout, handler)); - CHECK(1 == active_poller.wait(std::chrono::milliseconds{-1})); - CHECK(events == zmq::event_flags::pollout); -} - -TEST_CASE("add invalid socket throws", "[active_poller]") -{ - zmq::context_t context; - zmq::active_poller_t active_poller; - zmq::socket_t a{context, zmq::socket_type::router}; - zmq::socket_t b{std::move(a)}; - CHECK_THROWS_AS(active_poller.add(a, zmq::event_flags::pollin, no_op_handler), - zmq::error_t); -} - -TEST_CASE("remove invalid socket throws", "[active_poller]") -{ - zmq::context_t context; - zmq::socket_t socket{context, zmq::socket_type::router}; - zmq::active_poller_t active_poller; - CHECK_NOTHROW( - active_poller.add(socket, zmq::event_flags::pollin, no_op_handler)); - CHECK(1u == active_poller.size()); - std::vector sockets; - sockets.emplace_back(std::move(socket)); - CHECK_THROWS_AS(active_poller.remove(socket), zmq::error_t); - CHECK(1u == active_poller.size()); -} - -TEST_CASE("wait on added empty handler", "[active_poller]") -{ - server_client_setup s; - CHECK_NOTHROW(s.client.send(zmq::message_t{hi_str}, zmq::send_flags::none)); - zmq::active_poller_t active_poller; - CHECK_NOTHROW( - active_poller.add(s.server, zmq::event_flags::pollin, no_op_handler)); - CHECK_NOTHROW(active_poller.wait(std::chrono::milliseconds{-1})); -} - -TEST_CASE("modify empty throws", "[active_poller]") -{ - zmq::context_t context; - zmq::socket_t socket{context, zmq::socket_type::push}; - zmq::active_poller_t active_poller; - CHECK_THROWS_AS(active_poller.modify(socket, zmq::event_flags::pollin), - zmq::error_t); -} - -TEST_CASE("modify invalid socket throws", "[active_poller]") -{ - zmq::context_t context; - zmq::socket_t a{context, zmq::socket_type::push}; - zmq::socket_t b{std::move(a)}; - zmq::active_poller_t active_poller; - CHECK_THROWS_AS(active_poller.modify(a, zmq::event_flags::pollin), - zmq::error_t); -} - -TEST_CASE("modify not added throws", "[active_poller]") -{ - zmq::context_t context; - zmq::socket_t a{context, zmq::socket_type::push}; - zmq::socket_t b{context, zmq::socket_type::push}; - zmq::active_poller_t active_poller; - CHECK_NOTHROW(active_poller.add(a, zmq::event_flags::pollin, no_op_handler)); - CHECK_THROWS_AS(active_poller.modify(b, zmq::event_flags::pollin), - zmq::error_t); -} - -TEST_CASE("modify simple", "[active_poller]") -{ - zmq::context_t context; - zmq::socket_t a{context, zmq::socket_type::push}; - zmq::active_poller_t active_poller; - CHECK_NOTHROW(active_poller.add(a, zmq::event_flags::pollin, no_op_handler)); - CHECK_NOTHROW( - active_poller.modify(a, zmq::event_flags::pollin | zmq::event_flags::pollout)); -} - -TEST_CASE("poll client server", "[active_poller]") -{ - // Setup server and client - server_client_setup s; - - // Setup active_poller - zmq::active_poller_t active_poller; - CHECK_NOTHROW(active_poller.add(s.server, zmq::event_flags::pollin, s.handler)); - - // client sends message - CHECK_NOTHROW(s.client.send(zmq::message_t{hi_str}, zmq::send_flags::none)); - - // wait for message and verify events - CHECK_NOTHROW(active_poller.wait(std::chrono::milliseconds{500})); - CHECK(s.events == zmq::event_flags::pollin); - - // Modify server socket with pollout flag - CHECK_NOTHROW(active_poller.modify(s.server, zmq::event_flags::pollin - | zmq::event_flags::pollout)); - CHECK(1 == active_poller.wait(std::chrono::milliseconds{500})); - CHECK(s.events == (zmq::event_flags::pollin | zmq::event_flags::pollout)); -} - -TEST_CASE("wait one return", "[active_poller]") -{ - // Setup server and client - server_client_setup s; - - int count = 0; - - // Setup active_poller - zmq::active_poller_t active_poller; - CHECK_NOTHROW(active_poller.add(s.server, zmq::event_flags::pollin, - [&count](zmq::event_flags) { ++count; })); - - // client sends message - CHECK_NOTHROW(s.client.send(zmq::message_t{hi_str}, zmq::send_flags::none)); - - // wait for message and verify events - CHECK(1 == active_poller.wait(std::chrono::milliseconds{500})); - CHECK(1u == count); -} - -TEST_CASE("wait on move constructed active_poller", "[active_poller]") -{ - server_client_setup s; - CHECK_NOTHROW(s.client.send(zmq::message_t{hi_str}, zmq::send_flags::none)); - zmq::active_poller_t a; - CHECK_NOTHROW(a.add(s.server, zmq::event_flags::pollin, no_op_handler)); - zmq::active_poller_t b{std::move(a)}; - CHECK(1u == b.size()); - CHECK(0u == a.size()); - CHECK_THROWS_ZMQ_ERROR(EFAULT, a.wait(std::chrono::milliseconds{10})); - CHECK(b.wait(std::chrono::milliseconds{-1})); -} - -TEST_CASE("wait on move assigned active_poller", "[active_poller]") -{ - server_client_setup s; - CHECK_NOTHROW(s.client.send(zmq::message_t{hi_str}, zmq::send_flags::none)); - zmq::active_poller_t a; - CHECK_NOTHROW(a.add(s.server, zmq::event_flags::pollin, no_op_handler)); - zmq::active_poller_t b; - b = {std::move(a)}; - CHECK(1u == b.size()); - CHECK(0u == a.size()); - CHECK_THROWS_ZMQ_ERROR(EFAULT, a.wait(std::chrono::milliseconds{10})); - CHECK(b.wait(std::chrono::milliseconds{-1})); -} - -TEST_CASE("received on move constructed active_poller", "[active_poller]") -{ - // Setup server and client - server_client_setup s; - int count = 0; - // Setup active_poller a - zmq::active_poller_t a; - CHECK_NOTHROW(a.add(s.server, zmq::event_flags::pollin, - [&count](zmq::event_flags) { ++count; })); - // client sends message - CHECK_NOTHROW(s.client.send(zmq::message_t{hi_str}, zmq::send_flags::none)); - // wait for message and verify it is received - CHECK(1 == a.wait(std::chrono::milliseconds{500})); - CHECK(1u == count); - // Move construct active_poller b - zmq::active_poller_t b{std::move(a)}; - // client sends message again - CHECK_NOTHROW(s.client.send(zmq::message_t{hi_str}, zmq::send_flags::none)); - // wait for message and verify it is received - CHECK(1 == b.wait(std::chrono::milliseconds{500})); - CHECK(2u == count); -} - - -TEST_CASE("remove from handler", "[active_poller]") -{ - constexpr size_t ITER_NO = 10; - - // Setup servers and clients - std::vector setup_list; - for (size_t i = 0; i < ITER_NO; ++i) - setup_list.emplace_back(server_client_setup{}); - - // Setup active_poller - zmq::active_poller_t active_poller; - int count = 0; - for (size_t i = 0; i < ITER_NO; ++i) { - CHECK_NOTHROW(active_poller.add( - setup_list[i].server, zmq::event_flags::pollin, - [&, i](zmq::event_flags events) { - CHECK(events == zmq::event_flags::pollin); - active_poller.remove(setup_list[ITER_NO - i - 1].server); - CHECK((ITER_NO - i - 1) == active_poller.size()); - })); - ++count; - } - CHECK(ITER_NO == active_poller.size()); - // Clients send messages - for (auto &s : setup_list) { - CHECK_NOTHROW(s.client.send(zmq::message_t{hi_str}, zmq::send_flags::none)); - } - - // Wait for all servers to receive a message - for (auto &s : setup_list) { - zmq::pollitem_t items[] = {{s.server, 0, ZMQ_POLLIN, 0}}; - zmq::poll(&items[0], 1); - } - - // Fire all handlers in one wait - CHECK(ITER_NO == active_poller.wait(std::chrono::milliseconds{-1})); - CHECK(ITER_NO == count); -} - -#endif diff --git a/libs/cppzmq/tests/buffer.cpp b/libs/cppzmq/tests/buffer.cpp deleted file mode 100644 index da8a514..0000000 --- a/libs/cppzmq/tests/buffer.cpp +++ /dev/null @@ -1,306 +0,0 @@ -#include -#include - -#ifdef ZMQ_CPP17 -static_assert(std::is_nothrow_swappable_v); -static_assert(std::is_nothrow_swappable_v); -static_assert(std::is_trivially_copyable_v); -static_assert(std::is_trivially_copyable_v); -#endif - -#ifdef ZMQ_CPP11 - -using BT = int16_t; - -TEST_CASE("buffer default ctor", "[buffer]") -{ - constexpr zmq::mutable_buffer mb; - constexpr zmq::const_buffer cb; - CHECK(mb.size() == 0); - CHECK(mb.data() == nullptr); - CHECK(cb.size() == 0); - CHECK(cb.data() == nullptr); -} - -TEST_CASE("buffer data ctor", "[buffer]") -{ - std::vector v(10); - zmq::const_buffer cb(v.data(), v.size() * sizeof(BT)); - CHECK(cb.size() == v.size() * sizeof(BT)); - CHECK(cb.data() == v.data()); - zmq::mutable_buffer mb(v.data(), v.size() * sizeof(BT)); - CHECK(mb.size() == v.size() * sizeof(BT)); - CHECK(mb.data() == v.data()); - zmq::const_buffer from_mut = mb; - CHECK(mb.size() == from_mut.size()); - CHECK(mb.data() == from_mut.data()); - const auto cmb = mb; - static_assert(std::is_same::value, ""); - - constexpr const void *cp = nullptr; - constexpr void *p = nullptr; - constexpr zmq::const_buffer cecb = zmq::buffer(p, 0); - constexpr zmq::mutable_buffer cemb = zmq::buffer(p, 0); - CHECK(cecb.data() == nullptr); - CHECK(cemb.data() == nullptr); -} - -TEST_CASE("const_buffer operator+", "[buffer]") -{ - std::vector v(10); - zmq::const_buffer cb(v.data(), v.size() * sizeof(BT)); - const size_t shift = 4; - auto shifted = cb + shift; - CHECK(shifted.size() == v.size() * sizeof(BT) - shift); - CHECK(shifted.data() == v.data() + shift / sizeof(BT)); - auto shifted2 = shift + cb; - CHECK(shifted.size() == shifted2.size()); - CHECK(shifted.data() == shifted2.data()); - auto cbinp = cb; - cbinp += shift; - CHECK(shifted.size() == cbinp.size()); - CHECK(shifted.data() == cbinp.data()); -} - -TEST_CASE("mutable_buffer operator+", "[buffer]") -{ - std::vector v(10); - zmq::mutable_buffer mb(v.data(), v.size() * sizeof(BT)); - const size_t shift = 4; - auto shifted = mb + shift; - CHECK(shifted.size() == v.size() * sizeof(BT) - shift); - CHECK(shifted.data() == v.data() + shift / sizeof(BT)); - auto shifted2 = shift + mb; - CHECK(shifted.size() == shifted2.size()); - CHECK(shifted.data() == shifted2.data()); - auto mbinp = mb; - mbinp += shift; - CHECK(shifted.size() == mbinp.size()); - CHECK(shifted.data() == mbinp.data()); -} - -TEST_CASE("mutable_buffer creation basic", "[buffer]") -{ - std::vector v(10); - zmq::mutable_buffer mb(v.data(), v.size() * sizeof(BT)); - zmq::mutable_buffer mb2 = zmq::buffer(v.data(), v.size() * sizeof(BT)); - CHECK(mb.data() == mb2.data()); - CHECK(mb.size() == mb2.size()); - zmq::mutable_buffer mb3 = zmq::buffer(mb); - CHECK(mb.data() == mb3.data()); - CHECK(mb.size() == mb3.size()); - zmq::mutable_buffer mb4 = zmq::buffer(mb, 10 * v.size() * sizeof(BT)); - CHECK(mb.data() == mb4.data()); - CHECK(mb.size() == mb4.size()); - zmq::mutable_buffer mb5 = zmq::buffer(mb, 4); - CHECK(mb.data() == mb5.data()); - CHECK(4 == mb5.size()); -} - -TEST_CASE("const_buffer creation basic", "[buffer]") -{ - const std::vector v(10); - zmq::const_buffer cb(v.data(), v.size() * sizeof(BT)); - zmq::const_buffer cb2 = zmq::buffer(v.data(), v.size() * sizeof(BT)); - CHECK(cb.data() == cb2.data()); - CHECK(cb.size() == cb2.size()); - zmq::const_buffer cb3 = zmq::buffer(cb); - CHECK(cb.data() == cb3.data()); - CHECK(cb.size() == cb3.size()); - zmq::const_buffer cb4 = zmq::buffer(cb, 10 * v.size() * sizeof(BT)); - CHECK(cb.data() == cb4.data()); - CHECK(cb.size() == cb4.size()); - zmq::const_buffer cb5 = zmq::buffer(cb, 4); - CHECK(cb.data() == cb5.data()); - CHECK(4 == cb5.size()); -} - -TEST_CASE("mutable_buffer creation C array", "[buffer]") -{ - BT d[10] = {}; - zmq::mutable_buffer b = zmq::buffer(d); - CHECK(b.size() == 10 * sizeof(BT)); - CHECK(b.data() == static_cast(d)); - zmq::const_buffer b2 = zmq::buffer(d, 4); - CHECK(b2.size() == 4); - CHECK(b2.data() == static_cast(d)); -} - -TEST_CASE("const_buffer creation C array", "[buffer]") -{ - const BT d[10] = {}; - zmq::const_buffer b = zmq::buffer(d); - CHECK(b.size() == 10 * sizeof(BT)); - CHECK(b.data() == static_cast(d)); - zmq::const_buffer b2 = zmq::buffer(d, 4); - CHECK(b2.size() == 4); - CHECK(b2.data() == static_cast(d)); -} - -TEST_CASE("mutable_buffer creation array", "[buffer]") -{ - std::array d = {}; - zmq::mutable_buffer b = zmq::buffer(d); - CHECK(b.size() == d.size() * sizeof(BT)); - CHECK(b.data() == d.data()); - zmq::mutable_buffer b2 = zmq::buffer(d, 4); - CHECK(b2.size() == 4); - CHECK(b2.data() == d.data()); -} - -TEST_CASE("const_buffer creation array", "[buffer]") -{ - const std::array d = {}; - zmq::const_buffer b = zmq::buffer(d); - CHECK(b.size() == d.size() * sizeof(BT)); - CHECK(b.data() == d.data()); - zmq::const_buffer b2 = zmq::buffer(d, 4); - CHECK(b2.size() == 4); - CHECK(b2.data() == d.data()); -} - -TEST_CASE("const_buffer creation array 2", "[buffer]") -{ - std::array d = {{}}; - zmq::const_buffer b = zmq::buffer(d); - CHECK(b.size() == d.size() * sizeof(BT)); - CHECK(b.data() == d.data()); - zmq::const_buffer b2 = zmq::buffer(d, 4); - CHECK(b2.size() == 4); - CHECK(b2.data() == d.data()); -} - -TEST_CASE("mutable_buffer creation vector", "[buffer]") -{ - std::vector d(10); - zmq::mutable_buffer b = zmq::buffer(d); - CHECK(b.size() == d.size() * sizeof(BT)); - CHECK(b.data() == d.data()); - zmq::mutable_buffer b2 = zmq::buffer(d, 4); - CHECK(b2.size() == 4); - CHECK(b2.data() == d.data()); - d.clear(); - b = zmq::buffer(d); - CHECK(b.size() == 0); - CHECK(b.data() == nullptr); -} - -TEST_CASE("const_buffer creation vector", "[buffer]") -{ - std::vector d(10); - zmq::const_buffer b = zmq::buffer(static_cast &>(d)); - CHECK(b.size() == d.size() * sizeof(BT)); - CHECK(b.data() == d.data()); - zmq::const_buffer b2 = zmq::buffer(static_cast &>(d), 4); - CHECK(b2.size() == 4); - CHECK(b2.data() == d.data()); - d.clear(); - b = zmq::buffer(static_cast &>(d)); - CHECK(b.size() == 0); - CHECK(b.data() == nullptr); -} - -TEST_CASE("const_buffer creation string", "[buffer]") -{ - const std::wstring d(10, L'a'); - zmq::const_buffer b = zmq::buffer(d); - CHECK(b.size() == d.size() * sizeof(wchar_t)); - CHECK(b.data() == d.data()); - zmq::const_buffer b2 = zmq::buffer(d, 4); - CHECK(b2.size() == 4); - CHECK(b2.data() == d.data()); -} - -TEST_CASE("mutable_buffer creation string", "[buffer]") -{ - std::wstring d(10, L'a'); - zmq::mutable_buffer b = zmq::buffer(d); - CHECK(b.size() == d.size() * sizeof(wchar_t)); - CHECK(b.data() == d.data()); - zmq::mutable_buffer b2 = zmq::buffer(d, 4); - CHECK(b2.size() == 4); - CHECK(b2.data() == d.data()); -} - -#if CPPZMQ_HAS_STRING_VIEW -TEST_CASE("const_buffer creation string_view", "[buffer]") -{ - std::wstring dstr(10, L'a'); - std::wstring_view d = dstr; - zmq::const_buffer b = zmq::buffer(d); - CHECK(b.size() == d.size() * sizeof(wchar_t)); - CHECK(b.data() == d.data()); - zmq::const_buffer b2 = zmq::buffer(d, 4); - CHECK(b2.size() == 4); - CHECK(b2.data() == d.data()); -} -#endif - -TEST_CASE("const_buffer creation with str_buffer", "[buffer]") -{ - const wchar_t wd[10] = {}; - zmq::const_buffer b = zmq::str_buffer(wd); - CHECK(b.size() == 9 * sizeof(wchar_t)); - CHECK(b.data() == static_cast(wd)); - - zmq::const_buffer b2_null = zmq::buffer("hello"); - constexpr zmq::const_buffer b2 = zmq::str_buffer("hello"); - CHECK(b2_null.size() == 6); - CHECK(b2.size() == 5); - CHECK(std::string(static_cast(b2.data()), b2.size()) == "hello"); -} - -TEST_CASE("const_buffer creation with zbuf string literal char", "[buffer]") -{ - using namespace zmq::literals; - constexpr zmq::const_buffer b = "hello"_zbuf; - CHECK(b.size() == 5); - CHECK(std::memcmp(b.data(), "hello", b.size()) == 0); -} - -TEST_CASE("const_buffer creation with zbuf string literal wchar_t", "[buffer]") -{ - using namespace zmq::literals; - constexpr zmq::const_buffer b = L"hello"_zbuf; - CHECK(b.size() == 5 * sizeof(wchar_t)); - CHECK(std::memcmp(b.data(), L"hello", b.size()) == 0); -} - -TEST_CASE("const_buffer creation with zbuf string literal char16_t", "[buffer]") -{ - using namespace zmq::literals; - constexpr zmq::const_buffer b = u"hello"_zbuf; - CHECK(b.size() == 5 * sizeof(char16_t)); - CHECK(std::memcmp(b.data(), u"hello", b.size()) == 0); -} - -TEST_CASE("const_buffer creation with zbuf string literal char32_t", "[buffer]") -{ - using namespace zmq::literals; - constexpr zmq::const_buffer b = U"hello"_zbuf; - CHECK(b.size() == 5 * sizeof(char32_t)); - CHECK(std::memcmp(b.data(), U"hello", b.size()) == 0); -} - -TEST_CASE("buffer of structs", "[buffer]") -{ - struct some_pod - { - int64_t val; - char arr[8]; - }; - struct some_non_pod - { - int64_t val; - char arr[8]; - std::vector s; // not trivially copyable - }; - static_assert(zmq::detail::is_pod_like::value, ""); - static_assert(!zmq::detail::is_pod_like::value, ""); - std::array d; - zmq::mutable_buffer b = zmq::buffer(d); - CHECK(b.size() == d.size() * sizeof(some_pod)); - CHECK(b.data() == d.data()); -} - -#endif diff --git a/libs/cppzmq/tests/codec_multipart.cpp b/libs/cppzmq/tests/codec_multipart.cpp deleted file mode 100644 index a5cb1e8..0000000 --- a/libs/cppzmq/tests/codec_multipart.cpp +++ /dev/null @@ -1,210 +0,0 @@ -#include -#include - -#ifdef ZMQ_CPP11 - -TEST_CASE("multipart codec empty", "[codec_multipart]") -{ - using namespace zmq; - - multipart_t mmsg; - message_t msg = mmsg.encode(); - CHECK(msg.size() == 0); - - multipart_t mmsg2; - mmsg2.decode_append(msg); - CHECK(mmsg2.size() == 0); - -} - -TEST_CASE("multipart codec small", "[codec_multipart]") -{ - using namespace zmq; - - multipart_t mmsg; - mmsg.addstr("Hello World"); - message_t msg = mmsg.encode(); - CHECK(msg.size() == 1 + 11); // small size packing - - mmsg.addstr("Second frame"); - msg = mmsg.encode(); - CHECK(msg.size() == 1 + 11 + 1 + 12); - - multipart_t mmsg2; - mmsg2.decode_append(msg); - CHECK(mmsg2.size() == 2); - std::string part0 = mmsg2[0].to_string(); - CHECK(part0 == "Hello World"); - CHECK(mmsg2[1].to_string() == "Second frame"); -} - -TEST_CASE("multipart codec big", "[codec_multipart]") -{ - using namespace zmq; - - message_t big(495); // large size packing - big.data()[0] = 'X'; - - multipart_t mmsg; - mmsg.pushmem(big.data(), big.size()); - message_t msg = mmsg.encode(); - CHECK(msg.size() == 5 + 495); - CHECK(msg.data()[0] == std::numeric_limits::max()); - CHECK(msg.data()[5] == 'X'); - - CHECK(mmsg.size() == 1); - mmsg.decode_append(msg); - CHECK(mmsg.size() == 2); - CHECK(mmsg[0].data()[0] == 'X'); -} - -TEST_CASE("multipart codec decode bad data overflow", "[codec_multipart]") -{ - using namespace zmq; - - char bad_data[3] = {5, 'h', 'i'}; - message_t wrong_size(bad_data, 3); - CHECK(wrong_size.size() == 3); - CHECK(wrong_size.data()[0] == 5); - - CHECK_THROWS_AS( - multipart_t::decode(wrong_size), - std::out_of_range); -} - -TEST_CASE("multipart codec decode bad data extra data", "[codec_multipart]") -{ - using namespace zmq; - - char bad_data[3] = {1, 'h', 'i'}; - message_t wrong_size(bad_data, 3); - CHECK(wrong_size.size() == 3); - CHECK(wrong_size.data()[0] == 1); - - CHECK_THROWS_AS( - multipart_t::decode(wrong_size), - std::out_of_range); -} - - -// After exercising it, this test is disabled over concern of running -// on hosts which lack enough free memory to allow the absurdly large -// message part to be allocated. -#if 0 -TEST_CASE("multipart codec encode too big", "[codec_multipart]") -{ - using namespace zmq; - - const size_t too_big_size = 1L + std::numeric_limits::max(); - CHECK(too_big_size > std::numeric_limits::max()); - char* too_big_data = new char[too_big_size]; - multipart_t mmsg(too_big_data, too_big_size); - delete [] too_big_data; - - CHECK(mmsg.size() == 1); - CHECK(mmsg[0].size() > std::numeric_limits::max()); - - CHECK_THROWS_AS( - mmsg.encode(), - std::range_error); -} -#endif - -TEST_CASE("multipart codec free function with vector of message_t", "[codec_multipart]") -{ - using namespace zmq; - std::vector parts; - parts.emplace_back("Hello", 5); - parts.emplace_back("World",5); - auto msg = encode(parts); - CHECK(msg.size() == 1 + 5 + 1 + 5 ); - CHECK(msg.data()[0] == 5); - CHECK(msg.data()[1] == 'H'); - CHECK(msg.data()[6] == 5); - CHECK(msg.data()[7] == 'W'); - - std::vector parts2; - decode(msg, std::back_inserter(parts2)); - CHECK(parts.size() == 2); - CHECK(parts[0].size() == 5); - CHECK(parts[1].size() == 5); -} - -TEST_CASE("multipart codec free function with vector of const_buffer", "[codec_multipart]") -{ - using namespace zmq; - std::vector parts; - parts.emplace_back("Hello", 5); - parts.emplace_back("World",5); - auto msg = encode(parts); - CHECK(msg.size() == 1 + 5 + 1 + 5 ); - CHECK(msg.data()[0] == 5); - CHECK(msg.data()[1] == 'H'); - CHECK(msg.data()[6] == 5); - CHECK(msg.data()[7] == 'W'); - - std::vector parts2; - decode(msg, std::back_inserter(parts2)); - CHECK(parts.size() == 2); - CHECK(parts[0].size() == 5); - CHECK(parts[1].size() == 5); -} - -TEST_CASE("multipart codec free function with vector of mutable_buffer", "[codec_multipart]") -{ - using namespace zmq; - std::vector parts; - char hello[6] = "Hello"; - parts.emplace_back(hello, 5); - char world[6] = "World"; - parts.emplace_back(world,5); - auto msg = encode(parts); - CHECK(msg.size() == 1 + 5 + 1 + 5 ); - CHECK(msg.data()[0] == 5); - CHECK(msg.data()[1] == 'H'); - CHECK(msg.data()[6] == 5); - CHECK(msg.data()[7] == 'W'); - - std::vector parts2; - decode(msg, std::back_inserter(parts2)); - CHECK(parts.size() == 2); - CHECK(parts[0].size() == 5); - CHECK(parts[1].size() == 5); -} - -TEST_CASE("multipart codec free function with multipart_t", "[codec_multipart]") -{ - using namespace zmq; - multipart_t mmsg; - mmsg.addstr("Hello"); - mmsg.addstr("World"); - auto msg = encode(mmsg); - CHECK(msg.size() == 1 + 5 + 1 + 5); - CHECK(msg.data()[0] == 5); - CHECK(msg.data()[1] == 'H'); - CHECK(msg.data()[6] == 5); - CHECK(msg.data()[7] == 'W'); - - multipart_t mmsg2; - decode(msg, std::back_inserter(mmsg2)); - CHECK(mmsg2.size() == 2); - CHECK(mmsg2[0].size() == 5); - CHECK(mmsg2[1].size() == 5); -} - -TEST_CASE("multipart codec static method decode to multipart_t", "[codec_multipart]") -{ - using namespace zmq; - multipart_t mmsg; - mmsg.addstr("Hello"); - mmsg.addstr("World"); - auto msg = encode(mmsg); - - auto mmsg2 = multipart_t::decode(msg); - CHECK(mmsg2.size() == 2); - CHECK(mmsg2[0].size() == 5); - CHECK(mmsg2[1].size() == 5); -} - - -#endif diff --git a/libs/cppzmq/tests/context.cpp b/libs/cppzmq/tests/context.cpp deleted file mode 100644 index ade5ade..0000000 --- a/libs/cppzmq/tests/context.cpp +++ /dev/null @@ -1,84 +0,0 @@ -#include -#include - -#if (__cplusplus >= 201703L) -static_assert(std::is_nothrow_swappable::value, - "context_t should be nothrow swappable"); -#endif - -TEST_CASE("context construct default and destroy", "[context]") -{ - zmq::context_t context; -} - -TEST_CASE("context create, close and destroy", "[context]") -{ - zmq::context_t context; - context.close(); - CHECK(NULL == context.handle()); -} - -TEST_CASE("context shutdown", "[context]") -{ - zmq::context_t context; - context.shutdown(); - CHECK(NULL != context.handle()); - context.close(); - CHECK(NULL == context.handle()); -} - -TEST_CASE("context shutdown again", "[context]") -{ - zmq::context_t context; - context.shutdown(); - context.shutdown(); - CHECK(NULL != context.handle()); - context.close(); - CHECK(NULL == context.handle()); -} - -#ifdef ZMQ_CPP11 -TEST_CASE("context swap", "[context]") -{ - zmq::context_t context1; - zmq::context_t context2; - using std::swap; - swap(context1, context2); -} - -TEST_CASE("context - use socket after shutdown", "[context]") -{ - zmq::context_t context; - zmq::socket_t sock(context, zmq::socket_type::rep); - context.shutdown(); - try - { - sock.connect("inproc://test"); - zmq::message_t msg; - (void)sock.recv(msg, zmq::recv_flags::dontwait); - REQUIRE(false); - } - catch (const zmq::error_t& e) - { - REQUIRE(e.num() == ETERM); - } -} - -TEST_CASE("context set/get options", "[context]") -{ - zmq::context_t context; -#if defined(ZMQ_BLOCKY) && defined(ZMQ_IO_THREADS) - context.set(zmq::ctxopt::blocky, false); - context.set(zmq::ctxopt::io_threads, 5); - CHECK(context.get(zmq::ctxopt::io_threads) == 5); -#endif - - CHECK_THROWS_AS( - context.set(static_cast(-42), 5), - zmq::error_t); - - CHECK_THROWS_AS( - context.get(static_cast(-42)), - zmq::error_t); -} -#endif diff --git a/libs/cppzmq/tests/message.cpp b/libs/cppzmq/tests/message.cpp deleted file mode 100644 index a841413..0000000 --- a/libs/cppzmq/tests/message.cpp +++ /dev/null @@ -1,246 +0,0 @@ -#define CATCH_CONFIG_MAIN -#include -#include - -#if defined(ZMQ_CPP11) -static_assert(!std::is_copy_constructible::value, - "message_t should not be copy-constructible"); -static_assert(!std::is_copy_assignable::value, - "message_t should not be copy-assignable"); -#endif -#if (__cplusplus >= 201703L) -static_assert(std::is_nothrow_swappable::value, - "message_t should be nothrow swappable"); -#endif - -TEST_CASE("message default constructed", "[message]") -{ - const zmq::message_t message; - CHECK(0u == message.size()); - CHECK(message.empty()); -} - -#ifdef ZMQ_CPP11 -TEST_CASE("message swap", "[message]") -{ - const std::string data = "foo"; - zmq::message_t message1; - zmq::message_t message2(data.data(), data.size()); - using std::swap; - swap(message1, message2); - CHECK(message1.size() == data.size()); - CHECK(message2.size() == 0); - swap(message1, message2); - CHECK(message1.size() == 0); - CHECK(message2.size() == data.size()); -} -#endif - -namespace -{ -const char *const data = "Hi"; -} - -TEST_CASE("message constructor with iterators", "[message]") -{ - const std::string hi(data); - const zmq::message_t hi_msg(hi.begin(), hi.end()); - CHECK(2u == hi_msg.size()); - CHECK(0 == memcmp(data, hi_msg.data(), 2)); -} - -TEST_CASE("message constructor with size", "[message]") -{ - const zmq::message_t msg(5); - CHECK(msg.size() == 5); -} - -TEST_CASE("message constructor with buffer and size", "[message]") -{ - const std::string hi(data); - const zmq::message_t hi_msg(hi.data(), hi.size()); - CHECK(2u == hi_msg.size()); - CHECK(0 == memcmp(data, hi_msg.data(), 2)); -} - -TEST_CASE("message constructor with char array", "[message]") -{ - const zmq::message_t hi_msg(data, strlen(data)); - CHECK(2u == hi_msg.size()); - CHECK(0 == memcmp(data, hi_msg.data(), 2)); -} - -#if defined(ZMQ_CPP11) && !defined(ZMQ_CPP11_PARTIAL) -TEST_CASE("message constructor with container - deprecated", "[message]") -{ - zmq::message_t hi_msg("Hi"); // deprecated - REQUIRE(3u == hi_msg.size()); - CHECK(0 == memcmp(data, hi_msg.data(), 3)); -} - -TEST_CASE("message constructor with container of trivial data", "[message]") -{ - int buf[3] = {1, 2, 3}; - zmq::message_t msg(buf); - REQUIRE(sizeof(buf) == msg.size()); - CHECK(0 == memcmp(buf, msg.data(), msg.size())); -} - -TEST_CASE("message constructor with strings", "[message]") -{ - SECTION("string") - { - const std::string hi(data); - zmq::message_t hi_msg(hi); - CHECK(2u == hi_msg.size()); - CHECK(0 == memcmp(data, hi_msg.data(), 2)); - } -#if CPPZMQ_HAS_STRING_VIEW - SECTION("string_view") - { - const std::string_view hi(data); - zmq::message_t hi_msg(hi); - CHECK(2u == hi_msg.size()); - CHECK(0 == memcmp(data, hi_msg.data(), 2)); - } -#endif -} -#endif - -#ifdef ZMQ_HAS_RVALUE_REFS -TEST_CASE("message move constructor", "[message]") -{ - zmq::message_t hi_msg(zmq::message_t(data, strlen(data))); -} - -TEST_CASE("message assign move empty before", "[message]") -{ - zmq::message_t hi_msg; - hi_msg = zmq::message_t(data, strlen(data)); - CHECK(2u == hi_msg.size()); - CHECK(0 == memcmp(data, hi_msg.data(), 2)); -} - -TEST_CASE("message assign move empty after", "[message]") -{ - zmq::message_t hi_msg(data, strlen(data)); - CHECK(!hi_msg.empty()); - hi_msg = zmq::message_t(); - CHECK(0u == hi_msg.size()); - CHECK(hi_msg.empty()); -} - -TEST_CASE("message assign move empty before and after", "[message]") -{ - zmq::message_t hi_msg; - hi_msg = zmq::message_t(); - CHECK(0u == hi_msg.size()); -} -#endif - -TEST_CASE("message equality self", "[message]") -{ - const zmq::message_t hi_msg(data, strlen(data)); - CHECK(hi_msg == hi_msg); -} - -TEST_CASE("message equality equal", "[message]") -{ - const zmq::message_t hi_msg_a(data, strlen(data)); - const zmq::message_t hi_msg_b(data, strlen(data)); - CHECK(hi_msg_a == hi_msg_b); -} - -TEST_CASE("message equality equal empty", "[message]") -{ - const zmq::message_t msg_a; - const zmq::message_t msg_b; - CHECK(msg_a == msg_b); -} - -TEST_CASE("message equality non equal", "[message]") -{ - const zmq::message_t msg_a("Hi", 2); - const zmq::message_t msg_b("Hello", 5); - CHECK(msg_a != msg_b); -} - -TEST_CASE("message equality non equal rhs empty", "[message]") -{ - const zmq::message_t msg_a("Hi", 2); - const zmq::message_t msg_b; - CHECK(msg_a != msg_b); -} - -TEST_CASE("message equality non equal lhs empty", "[message]") -{ - const zmq::message_t msg_a; - const zmq::message_t msg_b("Hi", 2); - CHECK(msg_a != msg_b); -} - -TEST_CASE("message to string", "[message]") -{ - const zmq::message_t a; - const zmq::message_t b("Foo", 3); - CHECK(a.to_string() == ""); - CHECK(b.to_string() == "Foo"); -#if CPPZMQ_HAS_STRING_VIEW - CHECK(a.to_string_view() == ""); - CHECK(b.to_string_view() == "Foo"); -#endif - -#if defined(ZMQ_CPP11) && !defined(ZMQ_CPP11_PARTIAL) - const zmq::message_t depr("Foo"); // deprecated - CHECK(depr.to_string() != "Foo"); - CHECK(depr.to_string() == std::string("Foo", 4)); -#endif -} - -#if defined(ZMQ_BUILD_DRAFT_API) && ZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 2, 0) -TEST_CASE("message routing id persists", "[message]") -{ - zmq::message_t msg; - msg.set_routing_id(123); - CHECK(123u == msg.routing_id()); -} - -TEST_CASE("message group persists", "[message]") -{ - zmq::message_t msg; - msg.set_group("mygroup"); - CHECK(std::string(msg.group()) == "mygroup"); -} -#endif - -#if ZMQ_VERSION >= ZMQ_MAKE_VERSION(3, 2, 0) -TEST_CASE("message is not shared", "[message]") -{ - zmq::message_t msg; - CHECK(msg.get(ZMQ_SHARED) == 0); -} - -TEST_CASE("message is shared", "[message]") -{ - size_t msg_sz = 1024; // large enough to be a type_lmsg - zmq::message_t msg1(msg_sz); - zmq::message_t msg2; - msg2.copy(msg1); - CHECK(msg1.get(ZMQ_SHARED) == 1); - CHECK(msg2.get(ZMQ_SHARED) == 1); - CHECK(msg1.size() == msg_sz); - CHECK(msg2.size() == msg_sz); -} - -TEST_CASE("message move is not shared", "[message]") -{ - size_t msg_sz = 1024; // large enough to be a type_lmsg - zmq::message_t msg1(msg_sz); - zmq::message_t msg2; - msg2.move(msg1); - CHECK(msg1.get(ZMQ_SHARED) == 0); - CHECK(msg2.get(ZMQ_SHARED) == 0); - CHECK(msg2.size() == msg_sz); - CHECK(msg1.size() == 0); -} -#endif diff --git a/libs/cppzmq/tests/monitor.cpp b/libs/cppzmq/tests/monitor.cpp deleted file mode 100644 index 09d5381..0000000 --- a/libs/cppzmq/tests/monitor.cpp +++ /dev/null @@ -1,152 +0,0 @@ -#include "testutil.hpp" - -#ifdef ZMQ_CPP11 -#include -#include -#include -#include - -class mock_monitor_t : public zmq::monitor_t -{ -public: - - void on_event_connected(const zmq_event_t &, const char *) ZMQ_OVERRIDE - { - ++connected; - ++total; - } - - int total{0}; - int connected{0}; -}; - -#endif - -TEST_CASE("monitor create destroy", "[monitor]") -{ - zmq::monitor_t monitor; -} - -#if defined(ZMQ_CPP11) -TEST_CASE("monitor move construct", "[monitor]") -{ - zmq::context_t ctx; - zmq::socket_t sock(ctx, ZMQ_DEALER); - SECTION("move ctor empty") { - zmq::monitor_t monitor1; - zmq::monitor_t monitor2 = std::move(monitor1); - } - SECTION("move ctor init") { - zmq::monitor_t monitor1; - monitor1.init(sock, "inproc://monitor-client"); - zmq::monitor_t monitor2 = std::move(monitor1); - } -} - -TEST_CASE("monitor move assign", "[monitor]") -{ - zmq::context_t ctx; - zmq::socket_t sock(ctx, ZMQ_DEALER); - SECTION("move assign empty") { - zmq::monitor_t monitor1; - zmq::monitor_t monitor2; - monitor1 = std::move(monitor2); - } - SECTION("move assign init") { - zmq::monitor_t monitor1; - monitor1.init(sock, "inproc://monitor-client"); - zmq::monitor_t monitor2; - monitor2 = std::move(monitor1); - } - SECTION("move assign init both") { - zmq::monitor_t monitor1; - monitor1.init(sock, "inproc://monitor-client"); - zmq::monitor_t monitor2; - zmq::socket_t sock2(ctx, ZMQ_DEALER); - monitor2.init(sock2, "inproc://monitor-client2"); - monitor2 = std::move(monitor1); - } -} - -TEST_CASE("monitor init event count", "[monitor]") -{ - common_server_client_setup s{false}; - mock_monitor_t monitor; - - const int expected_event_count = 1; - monitor.init(s.client, "inproc://foo"); - - CHECK_FALSE(monitor.check_event(0)); - s.init(); - - while (monitor.check_event(1000) && monitor.total < expected_event_count) { - } - CHECK(monitor.connected == 1); - CHECK(monitor.total == expected_event_count); -} - -TEST_CASE("monitor init abort", "[monitor]") -{ - class mock_monitor : public mock_monitor_t - { - public: - mock_monitor(std::function handle_connected) : - handle_connected{std::move(handle_connected)} - { - } - - void on_event_connected(const zmq_event_t &e, const char *m) ZMQ_OVERRIDE - { - mock_monitor_t::on_event_connected(e, m); - handle_connected(); - } - - std::function handle_connected; - }; - - common_server_client_setup s(false); - - std::mutex mutex; - std::condition_variable cond_var; - bool done{false}; - - mock_monitor monitor([&]() - { - std::lock_guard lock(mutex); - done = true; - cond_var.notify_one(); - }); - monitor.init(s.client, "inproc://foo"); - - auto thread = std::thread([&monitor] - { - while (monitor.check_event(-1)) { - } - }); - - s.init(); - { - std::unique_lock lock(mutex); - CHECK(cond_var.wait_for(lock, std::chrono::seconds(1), - [&done] { return done; })); - } - CHECK(monitor.connected == 1); - monitor.abort(); - thread.join(); -} - - -TEST_CASE("monitor from move assigned socket", "[monitor]") -{ - zmq::context_t ctx; - zmq::socket_t sock; - sock = std::move([&ctx] { - zmq::socket_t sock(ctx, ZMQ_DEALER); - return sock; - }()); - zmq::monitor_t monitor1; - monitor1.init(sock, "inproc://monitor-client"); - // On failure, this test might hang indefinitely instead of immediately - // failing -} -#endif diff --git a/libs/cppzmq/tests/multipart.cpp b/libs/cppzmq/tests/multipart.cpp deleted file mode 100644 index 7d92b97..0000000 --- a/libs/cppzmq/tests/multipart.cpp +++ /dev/null @@ -1,212 +0,0 @@ -#include -#include - -#ifdef ZMQ_HAS_RVALUE_REFS - -#ifdef ZMQ_CPP17 -static_assert(std::is_invocable::value, - "Can't multipart_t::send with socket_ref"); -static_assert(std::is_invocable::value, - "Can't multipart_t::recv with socket_ref"); -#endif -static_assert(std::is_constructible::value, - "Can't construct with socket_ref"); - -/// \todo split this up into separate test cases -/// -TEST_CASE("multipart legacy test", "[multipart]") -{ - using namespace zmq; - - bool ok = true; - (void) ok; - float num = 0; - (void) num; - std::string str = ""; - message_t msg; - - // Create two PAIR sockets and connect over inproc - context_t context(1); - socket_t output(context, ZMQ_PAIR); - socket_t input(context, ZMQ_PAIR); - output.bind("inproc://multipart.test"); - input.connect("inproc://multipart.test"); - - // Test send and receive of single-frame message - multipart_t multipart; - assert(multipart.empty()); - - multipart.push(message_t("Hello", 5)); - assert(multipart.size() == 1); - - ok = multipart.send(output); - assert(multipart.empty()); - assert(ok); - - ok = multipart.recv(input); - assert(multipart.size() == 1); - assert(ok); - - msg = multipart.pop(); - assert(multipart.empty()); - assert(std::string(msg.data(), msg.size()) == "Hello"); - - // Test send and receive of multi-frame message - multipart.addstr("A"); - multipart.addstr("BB"); - multipart.addstr("CCC"); - assert(multipart.size() == 3); - - multipart_t copy = multipart.clone(); - assert(copy.size() == 3); - - ok = copy.send(output); - assert(copy.empty()); - assert(ok); - - ok = copy.recv(input); - assert(copy.size() == 3); - assert(ok); - assert(copy.equal(&multipart)); - - // Test equality operators - assert(copy == multipart); - assert(multipart == copy); - - multipart.pop(); - - assert(copy != multipart); - assert(multipart != copy); - - multipart_t emptyMessage1 {}; - multipart_t emptyMessage2 {}; - - assert(emptyMessage1 == emptyMessage2); - assert(emptyMessage2 == emptyMessage1); - - multipart.clear(); - assert(multipart.empty()); - - // Test message frame manipulation - multipart.add(message_t("Frame5", 6)); - multipart.addstr("Frame6"); - multipart.addstr("Frame7"); - multipart.addtyp(8.0f); - multipart.addmem("Frame9", 6); - multipart.push(message_t("Frame4", 6)); - multipart.pushstr("Frame3"); - multipart.pushstr("Frame2"); - multipart.pushtyp(1.0f); - multipart.pushmem("Frame0", 6); - assert(multipart.size() == 10); - - const message_t &front_msg = multipart.front(); - assert(multipart.size() == 10); - assert(std::string(front_msg.data(), front_msg.size()) == "Frame0"); - - const message_t &back_msg = multipart.back(); - assert(multipart.size() == 10); - assert(std::string(back_msg.data(), back_msg.size()) == "Frame9"); - - msg = multipart.remove(); - assert(multipart.size() == 9); - assert(std::string(msg.data(), msg.size()) == "Frame9"); - - msg = multipart.pop(); - assert(multipart.size() == 8); - assert(std::string(msg.data(), msg.size()) == "Frame0"); - - num = multipart.poptyp(); - assert(multipart.size() == 7); - assert(num == 1.0f); - - str = multipart.popstr(); - assert(multipart.size() == 6); - assert(str == "Frame2"); - - str = multipart.popstr(); - assert(multipart.size() == 5); - assert(str == "Frame3"); - - str = multipart.popstr(); - assert(multipart.size() == 4); - assert(str == "Frame4"); - - str = multipart.popstr(); - assert(multipart.size() == 3); - assert(str == "Frame5"); - - str = multipart.popstr(); - assert(multipart.size() == 2); - assert(str == "Frame6"); - - str = multipart.popstr(); - assert(multipart.size() == 1); - assert(str == "Frame7"); - - num = multipart.poptyp(); - assert(multipart.empty()); - assert(num == 8.0f); - - // Test message constructors and concatenation - multipart_t head("One", 3); - head.addstr("Two"); - assert(head.size() == 2); - - multipart_t tail(std::string("One-hundred")); - tail.pushstr("Ninety-nine"); - assert(tail.size() == 2); - - multipart_t tmp(message_t("Fifty", 5)); - assert(tmp.size() == 1); - - multipart_t mid = multipart_t::create(49.0f); - mid.append(std::move(tmp)); - assert(mid.size() == 2); - assert(tmp.empty()); - - multipart_t merged(std::move(mid)); - merged.prepend(std::move(head)); - merged.append(std::move(tail)); - assert(merged.size() == 6); - assert(head.empty()); - assert(tail.empty()); - - ok = merged.send(output); - assert(merged.empty()); - assert(ok); - - multipart_t received(input); - assert(received.size() == 6); - - str = received.popstr(); - assert(received.size() == 5); - assert(str == "One"); - - str = received.popstr(); - assert(received.size() == 4); - assert(str == "Two"); - - num = received.poptyp(); - assert(received.size() == 3); - assert(num == 49.0f); - - str = received.popstr(); - assert(received.size() == 2); - assert(str == "Fifty"); - - str = received.popstr(); - assert(received.size() == 1); - assert(str == "Ninety-nine"); - - str = received.popstr(); - assert(received.empty()); - assert(str == "One-hundred"); -} -#endif diff --git a/libs/cppzmq/tests/poller.cpp b/libs/cppzmq/tests/poller.cpp deleted file mode 100644 index 81c42e6..0000000 --- a/libs/cppzmq/tests/poller.cpp +++ /dev/null @@ -1,356 +0,0 @@ -#include "testutil.hpp" - -#if defined(ZMQ_BUILD_DRAFT_API) && defined(ZMQ_CPP11) && !defined(ZMQ_CPP11_PARTIAL) && defined(ZMQ_HAVE_POLLER) - -#include -#include - -#ifdef ZMQ_CPP17 -static_assert(std::is_nothrow_swappable_v>); -#endif -static_assert(sizeof(zmq_poller_event_t) == sizeof(zmq::poller_event<>), ""); -static_assert(sizeof(zmq_poller_event_t) == sizeof(zmq::poller_event), ""); -static_assert(sizeof(zmq_poller_event_t) == sizeof(zmq::poller_event), ""); -static_assert(alignof(zmq_poller_event_t) == alignof(zmq::poller_event<>), ""); -static_assert(alignof(zmq_poller_event_t) == alignof(zmq::poller_event), ""); - -static_assert(!std::is_copy_constructible>::value, - "poller_t should not be copy-constructible"); -static_assert(!std::is_copy_assignable>::value, - "poller_t should not be copy-assignable"); - -TEST_CASE("event flags", "[poller]") -{ - CHECK((zmq::event_flags::pollin | zmq::event_flags::pollout) - == static_cast(ZMQ_POLLIN | ZMQ_POLLOUT)); - CHECK((zmq::event_flags::pollin & zmq::event_flags::pollout) - == static_cast(ZMQ_POLLIN & ZMQ_POLLOUT)); - CHECK((zmq::event_flags::pollin ^ zmq::event_flags::pollout) - == static_cast(ZMQ_POLLIN ^ ZMQ_POLLOUT)); - CHECK(~zmq::event_flags::pollin == static_cast(~ZMQ_POLLIN)); -} - -TEST_CASE("poller create destroy", "[poller]") -{ - zmq::poller_t<> a; -#ifdef ZMQ_CPP17 // CTAD - zmq::poller_t b; - zmq::poller_event e; -#endif -} - -TEST_CASE("poller move construct empty", "[poller]") -{ - zmq::poller_t<> a; - zmq::poller_t<> b = std::move(a); -} - -TEST_CASE("poller move assign empty", "[poller]") -{ - zmq::poller_t<> a; - zmq::poller_t<> b; - b = std::move(a); -} - -TEST_CASE("poller swap", "[poller]") -{ - zmq::poller_t<> a; - zmq::poller_t<> b; - using std::swap; - swap(a, b); -} - -TEST_CASE("poller move construct non empty", "[poller]") -{ - zmq::context_t context; - zmq::socket_t socket{context, zmq::socket_type::router}; - - zmq::poller_t<> a; - a.add(socket, zmq::event_flags::pollin); - zmq::poller_t<> b = std::move(a); -} - -TEST_CASE("poller move assign non empty", "[poller]") -{ - zmq::context_t context; - zmq::socket_t socket{context, zmq::socket_type::router}; - - zmq::poller_t<> a; - a.add(socket, zmq::event_flags::pollin); - zmq::poller_t<> b; - b = std::move(a); -} - -TEST_CASE("poller add nullptr", "[poller]") -{ - zmq::context_t context; - zmq::socket_t socket{context, zmq::socket_type::router}; - zmq::poller_t poller; - CHECK_NOTHROW(poller.add(socket, zmq::event_flags::pollin, nullptr)); -} - -TEST_CASE("poller add non nullptr", "[poller]") -{ - zmq::context_t context; - zmq::socket_t socket{context, zmq::socket_type::router}; - zmq::poller_t poller; - int i; - CHECK_NOTHROW(poller.add(socket, zmq::event_flags::pollin, &i)); -} - -#if ZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 3, 0) -// this behaviour was added by https://github.com/zeromq/libzmq/pull/3100 -TEST_CASE("poller add handler invalid events type", "[poller]") -{ - zmq::context_t context; - zmq::socket_t socket{context, zmq::socket_type::router}; - zmq::poller_t<> poller; - short invalid_events_type = 2 << 10; - CHECK_THROWS_AS( - poller.add(socket, static_cast(invalid_events_type)), - zmq::error_t); -} -#endif - -TEST_CASE("poller add handler twice throws", "[poller]") -{ - zmq::context_t context; - zmq::socket_t socket{context, zmq::socket_type::router}; - zmq::poller_t<> poller; - poller.add(socket, zmq::event_flags::pollin); - /// \todo the actual error code should be checked - CHECK_THROWS_AS(poller.add(socket, zmq::event_flags::pollin), - zmq::error_t); -} - -TEST_CASE("poller wait with no handlers throws", "[poller]") -{ - zmq::poller_t<> poller; - std::vector> events; - /// \todo the actual error code should be checked - CHECK_THROWS_AS(poller.wait_all(events, std::chrono::milliseconds{10}), - zmq::error_t); -} - -#if ZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 3, 3) -TEST_CASE("poller add/remove size checks", "[poller]") -{ - zmq::context_t context; - zmq::socket_t socket{context, zmq::socket_type::router}; - zmq::poller_t<> poller; - CHECK(poller.size() == 0); - poller.add(socket, zmq::event_flags::pollin); - CHECK(poller.size() == 1); - CHECK_NOTHROW(poller.remove(socket)); - CHECK(poller.size() == 0); -} -#endif - -TEST_CASE("poller remove unregistered throws", "[poller]") -{ - zmq::context_t context; - zmq::socket_t socket{context, zmq::socket_type::router}; - zmq::poller_t<> poller; - /// \todo the actual error code should be checked - CHECK_THROWS_AS(poller.remove(socket), zmq::error_t); -} - -TEST_CASE("poller remove registered empty", "[poller]") -{ - zmq::context_t context; - zmq::socket_t socket{context, zmq::socket_type::router}; - zmq::poller_t<> poller; - poller.add(socket, zmq::event_flags::pollin); - CHECK_NOTHROW(poller.remove(socket)); -} - -TEST_CASE("poller remove registered non empty", "[poller]") -{ - zmq::context_t context; - zmq::socket_t socket{context, zmq::socket_type::router}; - zmq::poller_t poller; - int empty{}; - poller.add(socket, zmq::event_flags::pollin, &empty); - CHECK_NOTHROW(poller.remove(socket)); -} - -const std::string hi_str = "Hi"; - -TEST_CASE("poller poll basic", "[poller]") -{ - common_server_client_setup s; - - CHECK_NOTHROW(s.client.send(zmq::message_t{hi_str}, zmq::send_flags::none)); - - zmq::poller_t poller; - std::vector> events{1}; - int i = 0; - CHECK_NOTHROW(poller.add(s.server, zmq::event_flags::pollin, &i)); - CHECK(1 == poller.wait_all(events, std::chrono::milliseconds{-1})); - CHECK(s.server == events[0].socket); - CHECK(&i == events[0].user_data); -} - -TEST_CASE("poller add invalid socket throws", "[poller]") -{ - zmq::context_t context; - zmq::poller_t<> poller; - zmq::socket_t a{context, zmq::socket_type::router}; - zmq::socket_t b{std::move(a)}; - CHECK_THROWS_AS(poller.add(a, zmq::event_flags::pollin), zmq::error_t); -} - -TEST_CASE("poller remove invalid socket throws", "[poller]") -{ - zmq::context_t context; - zmq::socket_t socket{context, zmq::socket_type::router}; - zmq::poller_t<> poller; - CHECK_NOTHROW(poller.add(socket, zmq::event_flags::pollin)); - std::vector sockets; - sockets.emplace_back(std::move(socket)); - CHECK_THROWS_AS(poller.remove(socket), zmq::error_t); - CHECK_NOTHROW(poller.remove(sockets[0])); -} - -TEST_CASE("poller modify empty throws", "[poller]") -{ - zmq::context_t context; - zmq::socket_t socket{context, zmq::socket_type::push}; - zmq::poller_t<> poller; - CHECK_THROWS_AS(poller.modify(socket, zmq::event_flags::pollin), - zmq::error_t); -} - -TEST_CASE("poller modify invalid socket throws", "[poller]") -{ - zmq::context_t context; - zmq::socket_t a{context, zmq::socket_type::push}; - zmq::socket_t b{std::move(a)}; - zmq::poller_t<> poller; - CHECK_THROWS_AS(poller.modify(a, zmq::event_flags::pollin), zmq::error_t); -} - -TEST_CASE("poller modify not added throws", "[poller]") -{ - zmq::context_t context; - zmq::socket_t a{context, zmq::socket_type::push}; - zmq::socket_t b{context, zmq::socket_type::push}; - zmq::poller_t<> poller; - CHECK_NOTHROW(poller.add(a, zmq::event_flags::pollin)); - CHECK_THROWS_AS(poller.modify(b, zmq::event_flags::pollin), zmq::error_t); -} - -TEST_CASE("poller modify simple", "[poller]") -{ - zmq::context_t context; - zmq::socket_t a{context, zmq::socket_type::push}; - zmq::poller_t<> poller; - CHECK_NOTHROW(poller.add(a, zmq::event_flags::pollin)); - CHECK_NOTHROW( - poller.modify(a, zmq::event_flags::pollin | zmq::event_flags::pollout)); -} - -TEST_CASE("poller poll client server", "[poller]") -{ - // Setup server and client - common_server_client_setup s; - - // Setup poller - zmq::poller_t poller; - CHECK_NOTHROW(poller.add(s.server, zmq::event_flags::pollin, &s.server)); - - // client sends message - CHECK_NOTHROW(s.client.send(zmq::message_t{hi_str}, zmq::send_flags::none)); - - // wait for message and verify events - std::vector> events(1); - CHECK(1 == poller.wait_all(events, std::chrono::milliseconds{500})); - CHECK(zmq::event_flags::pollin == events[0].events); - - // Modify server socket with pollout flag - CHECK_NOTHROW( - poller.modify(s.server, zmq::event_flags::pollin | zmq::event_flags::pollout - )); - CHECK(1 == poller.wait_all(events, std::chrono::milliseconds{500})); - CHECK((zmq::event_flags::pollin | zmq::event_flags::pollout) == events[0].events) - ; -} - -TEST_CASE("poller wait one return", "[poller]") -{ - // Setup server and client - common_server_client_setup s; - - // Setup poller - zmq::poller_t<> poller; - CHECK_NOTHROW(poller.add(s.server, zmq::event_flags::pollin)); - - // client sends message - CHECK_NOTHROW(s.client.send(zmq::message_t{hi_str}, zmq::send_flags::none)); - - // wait for message and verify events - std::vector> events(1); - CHECK(1 == poller.wait_all(events, std::chrono::milliseconds{500})); -} - -TEST_CASE("poller wait on move constructed", "[poller]") -{ - common_server_client_setup s; - CHECK_NOTHROW(s.client.send(zmq::message_t{hi_str}, zmq::send_flags::none)); - zmq::poller_t<> a; - CHECK_NOTHROW(a.add(s.server, zmq::event_flags::pollin)); - zmq::poller_t<> b{std::move(a)}; - std::vector> events(1); - /// \todo the actual error code should be checked - CHECK_THROWS_AS(a.wait_all(events, std::chrono::milliseconds{10}), - zmq::error_t); - CHECK(1 == b.wait_all(events, std::chrono::milliseconds{-1})); -} - -TEST_CASE("poller wait on move assigned", "[poller]") -{ - common_server_client_setup s; - CHECK_NOTHROW(s.client.send(zmq::message_t{hi_str}, zmq::send_flags::none)); - zmq::poller_t<> a; - CHECK_NOTHROW(a.add(s.server, zmq::event_flags::pollin)); - zmq::poller_t<> b; - b = {std::move(a)}; - /// \todo the TEST_CASE error code should be checked - std::vector> events(1); - CHECK_THROWS_AS(a.wait_all(events, std::chrono::milliseconds{10}), - zmq::error_t); - CHECK(1 == b.wait_all(events, std::chrono::milliseconds{-1})); -} - -TEST_CASE("poller remove from handler", "[poller]") -{ - constexpr size_t ITER_NO = 10; - - // Setup servers and clients - std::vector setup_list; - for (size_t i = 0; i < ITER_NO; ++i) - setup_list.emplace_back(common_server_client_setup{}); - - // Setup poller - zmq::poller_t<> poller; - for (size_t i = 0; i < ITER_NO; ++i) { - CHECK_NOTHROW(poller.add(setup_list[i].server, zmq::event_flags::pollin)); - } - // Clients send messages - for (auto &s : setup_list) { - CHECK_NOTHROW(s.client.send(zmq::message_t{hi_str}, zmq::send_flags::none)); - } - - // Wait for all servers to receive a message - for (auto &s : setup_list) { - zmq::pollitem_t items[] = {{s.server, 0, ZMQ_POLLIN, 0}}; - zmq::poll(&items[0], 1); - } - - // Fire all handlers in one wait - std::vector> events(ITER_NO); - CHECK(ITER_NO == poller.wait_all(events, std::chrono::milliseconds{-1})); -} - -#endif diff --git a/libs/cppzmq/tests/recv_multipart.cpp b/libs/cppzmq/tests/recv_multipart.cpp deleted file mode 100644 index cf99855..0000000 --- a/libs/cppzmq/tests/recv_multipart.cpp +++ /dev/null @@ -1,139 +0,0 @@ -#include -#include -#ifdef ZMQ_CPP11 - -TEST_CASE("recv_multipart test", "[recv_multipart]") -{ - zmq::context_t context(1); - zmq::socket_t output(context, ZMQ_PAIR); - zmq::socket_t input(context, ZMQ_PAIR); - output.bind("inproc://multipart.test"); - input.connect("inproc://multipart.test"); - - SECTION("send 1 message") { - input.send(zmq::str_buffer("hello")); - - std::vector msgs; - auto ret = zmq::recv_multipart(output, std::back_inserter(msgs)); - REQUIRE(ret); - CHECK(*ret == 1); - REQUIRE(msgs.size() == 1); - CHECK(msgs[0].size() == 5); - } - SECTION("send 2 messages") { - input.send(zmq::str_buffer("hello"), zmq::send_flags::sndmore); - input.send(zmq::str_buffer("world!")); - - std::vector msgs; - auto ret = zmq::recv_multipart(output, std::back_inserter(msgs)); - REQUIRE(ret); - CHECK(*ret == 2); - REQUIRE(msgs.size() == 2); - CHECK(msgs[0].size() == 5); - CHECK(msgs[1].size() == 6); - } - SECTION("send no messages, dontwait") { - std::vector msgs; - auto ret = zmq::recv_multipart(output, std::back_inserter(msgs), - zmq::recv_flags::dontwait); - CHECK_FALSE(ret); - REQUIRE(msgs.size() == 0); - } - SECTION("send 1 partial message, dontwait") { - input.send(zmq::str_buffer("hello"), zmq::send_flags::sndmore); - - std::vector msgs; - auto ret = zmq::recv_multipart(output, std::back_inserter(msgs), - zmq::recv_flags::dontwait); - CHECK_FALSE(ret); - REQUIRE(msgs.size() == 0); - } - SECTION("recv with invalid socket") { - std::vector msgs; - CHECK_THROWS_AS( - zmq::recv_multipart(zmq::socket_ref(), std::back_inserter(msgs)), - zmq::error_t); - } -} - -TEST_CASE("recv_multipart_n test", "[recv_multipart]") -{ - zmq::context_t context(1); - zmq::socket_t output(context, ZMQ_PAIR); - zmq::socket_t input(context, ZMQ_PAIR); - output.bind("inproc://multipart.test"); - input.connect("inproc://multipart.test"); - - SECTION("send 1 message") { - input.send(zmq::str_buffer("hello")); - - std::array msgs; - auto ret = zmq::recv_multipart_n(output, msgs.data(), msgs.size()); - REQUIRE(ret); - CHECK(*ret == 1); - CHECK(msgs[0].size() == 5); - } - SECTION("send 1 message 2") { - input.send(zmq::str_buffer("hello")); - - std::array msgs; - auto ret = zmq::recv_multipart_n(output, msgs.data(), msgs.size()); - REQUIRE(ret); - CHECK(*ret == 1); - CHECK(msgs[0].size() == 5); - CHECK(msgs[1].size() == 0); - } - SECTION("send 2 messages, recv 1") { - input.send(zmq::str_buffer("hello"), zmq::send_flags::sndmore); - input.send(zmq::str_buffer("world!")); - - std::array msgs; - CHECK_THROWS_AS( - zmq::recv_multipart_n(output, msgs.data(), msgs.size()), - std::runtime_error); - } - SECTION("recv 0") { - input.send(zmq::str_buffer("hello"), zmq::send_flags::sndmore); - input.send(zmq::str_buffer("world!")); - - std::array msgs; - CHECK_THROWS_AS( - zmq::recv_multipart_n(output, msgs.data(), 0), - std::runtime_error); - } - SECTION("send 2 messages") { - input.send(zmq::str_buffer("hello"), zmq::send_flags::sndmore); - input.send(zmq::str_buffer("world!")); - - std::array msgs; - auto ret = zmq::recv_multipart_n(output, msgs.data(), msgs.size()); - REQUIRE(ret); - CHECK(*ret == 2); - CHECK(msgs[0].size() == 5); - CHECK(msgs[1].size() == 6); - } - SECTION("send no messages, dontwait") { - std::array msgs; - auto ret = zmq::recv_multipart_n(output, msgs.data(), msgs.size(), - zmq::recv_flags::dontwait); - CHECK_FALSE(ret); - REQUIRE(msgs[0].size() == 0); - } - SECTION("send 1 partial message, dontwait") { - input.send(zmq::str_buffer("hello"), zmq::send_flags::sndmore); - - std::array msgs; - auto ret = zmq::recv_multipart_n(output, msgs.data(), msgs.size(), - zmq::recv_flags::dontwait); - CHECK_FALSE(ret); - REQUIRE(msgs[0].size() == 0); - } - SECTION("recv with invalid socket") { - std::array msgs; - CHECK_THROWS_AS( - zmq::recv_multipart_n(zmq::socket_ref(), msgs.data(), msgs.size()), - zmq::error_t); - } -} - -#endif diff --git a/libs/cppzmq/tests/send_multipart.cpp b/libs/cppzmq/tests/send_multipart.cpp deleted file mode 100644 index 1f23823..0000000 --- a/libs/cppzmq/tests/send_multipart.cpp +++ /dev/null @@ -1,121 +0,0 @@ -#include -#include -#ifdef ZMQ_CPP11 - -#include - -TEST_CASE("send_multipart test", "[send_multipart]") -{ - zmq::context_t context(1); - zmq::socket_t output(context, ZMQ_PAIR); - zmq::socket_t input(context, ZMQ_PAIR); - output.bind("inproc://multipart.test"); - input.connect("inproc://multipart.test"); - - SECTION("send 0 messages") { - std::vector imsgs; - auto iret = zmq::send_multipart(input, imsgs); - REQUIRE(iret); - CHECK(*iret == 0); - } - SECTION("send 1 message") { - std::array imsgs = {zmq::message_t(3)}; - auto iret = zmq::send_multipart(input, imsgs); - REQUIRE(iret); - CHECK(*iret == 1); - - std::vector omsgs; - auto oret = zmq::recv_multipart(output, std::back_inserter(omsgs)); - REQUIRE(oret); - CHECK(*oret == 1); - REQUIRE(omsgs.size() == 1); - CHECK(omsgs[0].size() == 3); - } - SECTION("send 2 messages") { - std::array imsgs = {zmq::message_t(3), zmq::message_t(4)}; - auto iret = zmq::send_multipart(input, imsgs); - REQUIRE(iret); - CHECK(*iret == 2); - - std::vector omsgs; - auto oret = zmq::recv_multipart(output, std::back_inserter(omsgs)); - REQUIRE(oret); - CHECK(*oret == 2); - REQUIRE(omsgs.size() == 2); - CHECK(omsgs[0].size() == 3); - CHECK(omsgs[1].size() == 4); - } - SECTION("send 2 messages, const_buffer") { - std::array imsgs = {zmq::str_buffer("foo"), - zmq::str_buffer("bar!")}; - auto iret = zmq::send_multipart(input, imsgs); - REQUIRE(iret); - CHECK(*iret == 2); - - std::vector omsgs; - auto oret = zmq::recv_multipart(output, std::back_inserter(omsgs)); - REQUIRE(oret); - CHECK(*oret == 2); - REQUIRE(omsgs.size() == 2); - CHECK(omsgs[0].size() == 3); - CHECK(omsgs[1].size() == 4); - } - SECTION("send 2 messages, mutable_buffer") { - char buf[4] = {}; - std::array imsgs = { - zmq::buffer(buf, 3), zmq::buffer(buf)}; - auto iret = zmq::send_multipart(input, imsgs); - REQUIRE(iret); - CHECK(*iret == 2); - - std::vector omsgs; - auto oret = zmq::recv_multipart(output, std::back_inserter(omsgs)); - REQUIRE(oret); - CHECK(*oret == 2); - REQUIRE(omsgs.size() == 2); - CHECK(omsgs[0].size() == 3); - CHECK(omsgs[1].size() == 4); - } - SECTION("send 2 messages, dontwait") { - zmq::socket_t push(context, ZMQ_PUSH); - push.bind("inproc://multipart.test.push"); - - std::array imsgs = {zmq::message_t(3), zmq::message_t(4)}; - auto iret = zmq::send_multipart(push, imsgs, zmq::send_flags::dontwait); - REQUIRE_FALSE(iret); - } - SECTION("send, misc. containers") { - std::vector msgs_vec; - msgs_vec.emplace_back(3); - msgs_vec.emplace_back(4); - auto iret = zmq::send_multipart(input, msgs_vec); - REQUIRE(iret); - CHECK(*iret == 2); - - std::forward_list msgs_list; - msgs_list.emplace_front(4); - msgs_list.emplace_front(3); - iret = zmq::send_multipart(input, msgs_list); - REQUIRE(iret); - CHECK(*iret == 2); - - // init. list - const auto msgs_il = {zmq::str_buffer("foo"), zmq::str_buffer("bar!")}; - iret = zmq::send_multipart(input, msgs_il); - REQUIRE(iret); - CHECK(*iret == 2); - // rvalue - iret = zmq::send_multipart(input, - std::initializer_list{ - zmq::str_buffer("foo"), - zmq::str_buffer("bar!")}); - REQUIRE(iret); - CHECK(*iret == 2); - } - SECTION("send with invalid socket") { - std::vector msgs(1); - CHECK_THROWS_AS(zmq::send_multipart(zmq::socket_ref(), msgs), - zmq::error_t); - } -} -#endif diff --git a/libs/cppzmq/tests/socket.cpp b/libs/cppzmq/tests/socket.cpp deleted file mode 100644 index cebee4b..0000000 --- a/libs/cppzmq/tests/socket.cpp +++ /dev/null @@ -1,700 +0,0 @@ -#include -#include -#ifdef ZMQ_CPP11 -#include -#endif - -#if (__cplusplus >= 201703L) -static_assert(std::is_nothrow_swappable::value, - "socket_t should be nothrow swappable"); -#endif - -TEST_CASE("socket default ctor", "[socket]") -{ - zmq::socket_t socket; -} - -TEST_CASE("socket create destroy", "[socket]") -{ - zmq::context_t context; - zmq::socket_t socket(context, ZMQ_ROUTER); -} - -#ifdef ZMQ_CPP11 -TEST_CASE("socket create assign", "[socket]") -{ - zmq::context_t context; - zmq::socket_t socket(context, ZMQ_ROUTER); - CHECK(static_cast(socket)); - CHECK(socket.handle() != nullptr); - socket = {}; - CHECK(!static_cast(socket)); - CHECK(socket.handle() == nullptr); -} - -TEST_CASE("socket create by enum and destroy", "[socket]") -{ - zmq::context_t context; - zmq::socket_t socket(context, zmq::socket_type::router); -} - -TEST_CASE("socket swap", "[socket]") -{ - zmq::context_t context; - zmq::socket_t socket1(context, zmq::socket_type::router); - zmq::socket_t socket2(context, zmq::socket_type::dealer); - using std::swap; - swap(socket1, socket2); -} - -#ifdef ZMQ_CPP11 -TEST_CASE("socket options", "[socket]") -{ - zmq::context_t context; - zmq::socket_t socket(context, zmq::socket_type::router); - -#ifdef ZMQ_IMMEDIATE - socket.set(zmq::sockopt::immediate, 0); - socket.set(zmq::sockopt::immediate, false); - CHECK(socket.get(zmq::sockopt::immediate) == false); - // unit out of range - CHECK_THROWS_AS(socket.set(zmq::sockopt::immediate, 80), zmq::error_t); -#endif -#ifdef ZMQ_LINGER - socket.set(zmq::sockopt::linger, 55); - CHECK(socket.get(zmq::sockopt::linger) == 55); -#endif -#ifdef ZMQ_ROUTING_ID - const std::string id = "foobar"; - socket.set(zmq::sockopt::routing_id, "foobar"); - socket.set(zmq::sockopt::routing_id, zmq::buffer(id)); - socket.set(zmq::sockopt::routing_id, id); -#if CPPZMQ_HAS_STRING_VIEW - socket.set(zmq::sockopt::routing_id, std::string_view{id}); -#endif - - std::string id_ret(10, ' '); - auto size = socket.get(zmq::sockopt::routing_id, zmq::buffer(id_ret)); - id_ret.resize(size); - CHECK(id == id_ret); - auto stropt = socket.get(zmq::sockopt::routing_id); - CHECK(id == stropt); - - std::string id_ret_small(3, ' '); - // truncated - CHECK_THROWS_AS(socket.get(zmq::sockopt::routing_id, zmq::buffer(id_ret_small)), - zmq::error_t); -#endif -} - -template -void check_array_opt(T opt, - zmq::socket_t &sock, - std::string info, - bool set_only = false) -{ - const std::string val = "foobar"; - INFO("setting " + info); - sock.set(opt, val); - if (set_only) - return; - - INFO("getting " + info); - auto s = sock.get(opt); - CHECK(s == val); -} - -template -void check_array_opt_get(T opt, zmq::socket_t &sock, std::string info) -{ - INFO("getting " + info); - (void) sock.get(opt); -} - -#if ZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 0, 0) -template void check_bin_z85(T opt, zmq::socket_t &sock, std::string str_val) -{ - std::vector bin_val(32); - const auto dret = zmq_z85_decode(bin_val.data(), str_val.c_str()); - CHECK(dret != nullptr); - - sock.set(opt, str_val); - sock.set(opt, zmq::buffer(bin_val)); - auto sv = sock.get(opt); - CHECK(sv == str_val); - - auto bv = sock.get(opt, 32); - REQUIRE(bv.size() == bin_val.size()); - CHECK(std::memcmp(bv.data(), bin_val.data(), bin_val.size()) == 0); -} -#endif - -TEST_CASE("socket check array options", "[socket]") -{ - zmq::context_t context; - zmq::socket_t router(context, zmq::socket_type::router); - zmq::socket_t xpub(context, zmq::socket_type::xpub); - zmq::socket_t sub(context, zmq::socket_type::sub); - -#ifdef ZMQ_BINDTODEVICE -// requires setting CAP_NET_RAW -//check_array_opt(zmq::sockopt::bindtodevice, router, "bindtodevice"); -#endif -#ifdef ZMQ_CONNECT_ROUTING_ID - check_array_opt(zmq::sockopt::connect_routing_id, router, "connect_routing_id", - true); -#endif -#ifdef ZMQ_LAST_ENDPOINT - check_array_opt_get(zmq::sockopt::last_endpoint, router, "last_endpoint"); -#endif -#ifdef ZMQ_METADATA - router.set(zmq::sockopt::metadata, zmq::str_buffer("X-foo:bar")); -#endif -#ifdef ZMQ_PLAIN_PASSWORD - check_array_opt(zmq::sockopt::plain_password, router, "plain_password"); -#endif -#ifdef ZMQ_PLAIN_USERNAME - check_array_opt(zmq::sockopt::plain_username, router, "plain_username"); -#endif -#ifdef ZMQ_ROUTING_ID - check_array_opt(zmq::sockopt::routing_id, router, "routing_id"); -#endif -#ifdef ZMQ_SOCKS_PROXY - check_array_opt(zmq::sockopt::socks_proxy, router, "socks_proxy"); -#endif -#ifdef ZMQ_SUBSCRIBE - check_array_opt(zmq::sockopt::subscribe, sub, "subscribe", true); -#endif -#ifdef ZMQ_UNSUBSCRIBE - check_array_opt(zmq::sockopt::unsubscribe, sub, "unsubscribe", true); -#endif -#ifdef ZMQ_XPUB_WELCOME_MSG - check_array_opt(zmq::sockopt::xpub_welcome_msg, xpub, "xpub_welcome_msg", true); -#endif -#ifdef ZMQ_ZAP_DOMAIN - check_array_opt(zmq::sockopt::zap_domain, router, "zap_domain"); -#endif - -// curve -#if ZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 0, 0) && defined(ZMQ_HAS_CAPABILITIES) - if (zmq_has("curve") == 1) { - const std::string spk = "rq:rM>}U?@Lns47E1%kR.o@n%FcmmsL/@{H8]yf7"; - const std::string ssk = "JTKVSB%%)wK0E.X)V>+}o?pNmC{O&4W4b!Ni{Lh6"; - const std::string cpk = "Yne@$w-vo= ZMQ_MAKE_VERSION(4, 1, 0) && defined(ZMQ_HAS_CAPABILITIES) - if (zmq_has("gssapi") == 1 && false) // TODO enable - { - zmq::socket_t gss_server(context, zmq::socket_type::router); - gss_server.set(zmq::sockopt::gssapi_server, true); - CHECK(gss_server.get(zmq::sockopt::gssapi_server) == 1); - gss_server.set(zmq::sockopt::gssapi_plaintext, false); - CHECK(gss_server.get(zmq::sockopt::gssapi_plaintext) == 0); - check_array_opt(zmq::sockopt::gssapi_principal, gss_server, - "gssapi_principal"); - - zmq::socket_t gss_client(context, zmq::socket_type::router); - CHECK(gss_client.get(zmq::sockopt::gssapi_server) == 0); - check_array_opt(zmq::sockopt::gssapi_principal, gss_client, - "gssapi_principal"); - check_array_opt(zmq::sockopt::gssapi_service_principal, gss_client, - "gssapi_service_principal"); - } -#endif -} - -template -void check_integral_opt(Opt opt, - zmq::socket_t &sock, - std::string info, - bool set_only = false) -{ - const T val = 1; - INFO("setting " + info); - sock.set(opt, val); - if (set_only) - return; - - INFO("getting " + info); - auto s = sock.get(opt); - CHECK(s == val); -} - -template -void check_integral_opt_get(Opt opt, zmq::socket_t &sock, std::string info) -{ - INFO("getting " + info); - (void) sock.get(opt); -} - -TEST_CASE("socket check integral options", "[socket]") -{ - zmq::context_t context; - zmq::socket_t router(context, zmq::socket_type::router); - zmq::socket_t xpub(context, zmq::socket_type::xpub); - zmq::socket_t req(context, zmq::socket_type::req); -#ifdef ZMQ_STREAM_NOTIFY - zmq::socket_t stream(context, zmq::socket_type::stream); -#endif - -#ifdef ZMQ_AFFINITY - check_integral_opt(zmq::sockopt::affinity, router, "affinity"); -#endif -#ifdef ZMQ_BACKLOG - check_integral_opt(zmq::sockopt::backlog, router, "backlog"); -#endif -#ifdef ZMQ_CONFLATE - check_integral_opt(zmq::sockopt::conflate, router, "conflate"); -#endif -#ifdef ZMQ_CONNECT_TIMEOUT - check_integral_opt(zmq::sockopt::connect_timeout, router, - "connect_timeout"); -#endif -#ifdef ZMQ_EVENTS - check_integral_opt_get(zmq::sockopt::events, router, "events"); -#endif -#ifdef ZMQ_FD - check_integral_opt_get(zmq::sockopt::fd, router, "fd"); -#endif -#ifdef ZMQ_HANDSHAKE_IVL - check_integral_opt(zmq::sockopt::handshake_ivl, router, "handshake_ivl"); -#endif -#ifdef ZMQ_HEARTBEAT_IVL - check_integral_opt(zmq::sockopt::heartbeat_ivl, router, "heartbeat_ivl"); -#endif -#ifdef ZMQ_HEARTBEAT_TIMEOUT - check_integral_opt(zmq::sockopt::heartbeat_timeout, router, - "heartbeat_timeout"); -#endif -#ifdef ZMQ_HEARTBEAT_TTL - router.set(zmq::sockopt::heartbeat_ttl, 100); - CHECK(router.get(zmq::sockopt::heartbeat_ttl) == 100); -#endif -#ifdef ZMQ_IMMEDIATE - check_integral_opt(zmq::sockopt::immediate, router, "immediate"); -#endif -#ifdef ZMQ_INVERT_MATCHING - check_integral_opt(zmq::sockopt::invert_matching, router, - "invert_matching"); -#endif -#ifdef ZMQ_IPV6 - check_integral_opt(zmq::sockopt::ipv6, router, "ipv6"); -#endif -#ifdef ZMQ_LINGER - check_integral_opt(zmq::sockopt::linger, router, "linger"); -#endif -#ifdef ZMQ_MAXMSGSIZE - check_integral_opt(zmq::sockopt::maxmsgsize, router, "maxmsgsize"); -#endif -#ifdef ZMQ_MECHANISM - check_integral_opt_get(zmq::sockopt::mechanism, router, "mechanism"); -#endif -#ifdef ZMQ_MULTICAST_HOPS - check_integral_opt(zmq::sockopt::multicast_hops, router, "multicast_hops"); -#endif -#ifdef ZMQ_MULTICAST_LOOP - check_integral_opt(zmq::sockopt::multicast_loop, router, "multicast_loop"); -#endif -#ifdef ZMQ_MULTICAST_MAXTPDU - check_integral_opt(zmq::sockopt::multicast_maxtpdu, router, - "multicast_maxtpdu"); -#endif -#ifdef ZMQ_PLAIN_SERVER - check_integral_opt(zmq::sockopt::plain_server, router, "plain_server"); -#endif -#ifdef ZMQ_USE_FD - check_integral_opt(zmq::sockopt::use_fd, router, "use_fd"); -#endif -#ifdef ZMQ_PROBE_ROUTER - check_integral_opt(zmq::sockopt::probe_router, router, "probe_router", - true); -#endif -#ifdef ZMQ_RATE - check_integral_opt(zmq::sockopt::rate, router, "rate"); -#endif -#ifdef ZMQ_RCVBUF - check_integral_opt(zmq::sockopt::rcvbuf, router, "rcvbuf"); -#endif -#ifdef ZMQ_RCVHWM - check_integral_opt(zmq::sockopt::rcvhwm, router, "rcvhwm"); -#endif -#ifdef ZMQ_RCVMORE - check_integral_opt_get(zmq::sockopt::rcvmore, router, "rcvmore"); -#endif -#ifdef ZMQ_RCVTIMEO - check_integral_opt(zmq::sockopt::rcvtimeo, router, "rcvtimeo"); -#endif -#ifdef ZMQ_RECONNECT_IVL - check_integral_opt(zmq::sockopt::reconnect_ivl, router, "reconnect_ivl"); -#endif -#ifdef ZMQ_RECONNECT_IVL_MAX - check_integral_opt(zmq::sockopt::reconnect_ivl_max, router, - "reconnect_ivl_max"); -#endif -#ifdef ZMQ_RECOVERY_IVL - check_integral_opt(zmq::sockopt::recovery_ivl, router, "recovery_ivl"); -#endif -#ifdef ZMQ_REQ_CORRELATE - check_integral_opt(zmq::sockopt::req_correlate, req, "req_correlate", true); -#endif -#ifdef ZMQ_REQ_RELAXED - check_integral_opt(zmq::sockopt::req_relaxed, req, "req_relaxed", true); -#endif -#ifdef ZMQ_ROUTER_HANDOVER - check_integral_opt(zmq::sockopt::router_handover, router, "router_handover", - true); -#endif -#ifdef ZMQ_ROUTER_MANDATORY - check_integral_opt(zmq::sockopt::router_mandatory, router, - "router_mandatory", true); -#endif -#ifdef ZMQ_ROUTER_NOTIFY - check_integral_opt(zmq::sockopt::router_notify, router, "router_notify"); -#endif -#ifdef ZMQ_SNDBUF - check_integral_opt(zmq::sockopt::sndbuf, router, "sndbuf"); -#endif -#ifdef ZMQ_SNDHWM - check_integral_opt(zmq::sockopt::sndhwm, router, "sndhwm"); -#endif -#ifdef ZMQ_SNDTIMEO - check_integral_opt(zmq::sockopt::sndtimeo, router, "sndtimeo"); -#endif -#ifdef ZMQ_STREAM_NOTIFY - check_integral_opt(zmq::sockopt::stream_notify, stream, "stream_notify", - true); -#endif -#ifdef ZMQ_TCP_KEEPALIVE - check_integral_opt(zmq::sockopt::tcp_keepalive, router, "tcp_keepalive"); -#endif -#ifdef ZMQ_TCP_KEEPALIVE_CNT - check_integral_opt(zmq::sockopt::tcp_keepalive_cnt, router, - "tcp_keepalive_cnt"); -#endif -#ifdef ZMQ_TCP_KEEPALIVE_IDLE - check_integral_opt(zmq::sockopt::tcp_keepalive_idle, router, - "tcp_keepalive_idle"); -#endif -#ifdef ZMQ_TCP_KEEPALIVE_INTVL - check_integral_opt(zmq::sockopt::tcp_keepalive_intvl, router, - "tcp_keepalive_intvl"); -#endif -#ifdef ZMQ_TCP_MAXRT - check_integral_opt(zmq::sockopt::tcp_maxrt, router, "tcp_maxrt"); -#endif -#ifdef ZMQ_THREAD_SAFE - check_integral_opt_get(zmq::sockopt::thread_safe, router, "thread_safe"); -#endif -#ifdef ZMQ_TOS - check_integral_opt(zmq::sockopt::tos, router, "tos"); -#endif -#ifdef ZMQ_TYPE - check_integral_opt_get(zmq::sockopt::type, router, "type"); -#ifdef ZMQ_CPP11 - check_integral_opt_get(zmq::sockopt::socket_type, router, "socket_type"); -#endif // ZMQ_CPP11 -#endif // ZMQ_TYPE - -#ifdef ZMQ_HAVE_VMCI -#ifdef ZMQ_VMCI_BUFFER_SIZE - check_integral_opt(zmq::sockopt::vmci_buffer_size, router, - "vmci_buffer_size"); -#endif -#ifdef ZMQ_VMCI_BUFFER_MIN_SIZE - check_integral_opt(zmq::sockopt::vmci_buffer_min_size, router, - "vmci_buffer_min_size"); -#endif -#ifdef ZMQ_VMCI_BUFFER_MAX_SIZE - check_integral_opt(zmq::sockopt::vmci_buffer_max_size, router, - "vmci_buffer_max_size"); -#endif -#ifdef ZMQ_VMCI_CONNECT_TIMEOUT - check_integral_opt(zmq::sockopt::vmci_connect_timeout, router, - "vmci_connect_timeout"); -#endif -#endif - -#ifdef ZMQ_XPUB_VERBOSE - check_integral_opt(zmq::sockopt::xpub_verbose, xpub, "xpub_verbose", true); -#endif -#ifdef ZMQ_XPUB_VERBOSER - check_integral_opt(zmq::sockopt::xpub_verboser, xpub, "xpub_verboser", - true); -#endif -#ifdef ZMQ_XPUB_MANUAL - check_integral_opt(zmq::sockopt::xpub_manual, xpub, "xpub_manual", true); -#endif -#ifdef ZMQ_XPUB_NODROP - check_integral_opt(zmq::sockopt::xpub_nodrop, xpub, "xpub_nodrop", true); -#endif -#ifdef ZMQ_ZAP_ENFORCE_DOMAIN - check_integral_opt(zmq::sockopt::zap_enforce_domain, router, - "zap_enforce_domain"); -#endif -} - -#endif - -TEST_CASE("socket flags", "[socket]") -{ - CHECK((zmq::recv_flags::dontwait | zmq::recv_flags::none) - == static_cast(ZMQ_DONTWAIT | 0)); - CHECK((zmq::recv_flags::dontwait & zmq::recv_flags::none) - == static_cast(ZMQ_DONTWAIT & 0)); - CHECK((zmq::recv_flags::dontwait ^ zmq::recv_flags::none) - == static_cast(ZMQ_DONTWAIT ^ 0)); - CHECK(~zmq::recv_flags::dontwait == static_cast(~ZMQ_DONTWAIT)); - - CHECK((zmq::send_flags::dontwait | zmq::send_flags::sndmore) - == static_cast(ZMQ_DONTWAIT | ZMQ_SNDMORE)); - CHECK((zmq::send_flags::dontwait & zmq::send_flags::sndmore) - == static_cast(ZMQ_DONTWAIT & ZMQ_SNDMORE)); - CHECK((zmq::send_flags::dontwait ^ zmq::send_flags::sndmore) - == static_cast(ZMQ_DONTWAIT ^ ZMQ_SNDMORE)); - CHECK(~zmq::send_flags::dontwait == static_cast(~ZMQ_DONTWAIT)); -} - -TEST_CASE("socket readme example", "[socket]") -{ - zmq::context_t ctx; - zmq::socket_t sock(ctx, zmq::socket_type::push); - sock.bind("inproc://test"); - sock.send(zmq::str_buffer("Hello, world"), zmq::send_flags::dontwait); -} -#endif - -TEST_CASE("socket sends and receives const buffer", "[socket]") -{ - zmq::context_t context; - zmq::socket_t sender(context, ZMQ_PAIR); - zmq::socket_t receiver(context, ZMQ_PAIR); - receiver.bind("inproc://test"); - sender.connect("inproc://test"); - const char *str = "Hi"; - -#ifdef ZMQ_CPP11 - CHECK(2 == *sender.send(zmq::buffer(str, 2))); - char buf[2]; - const auto res = receiver.recv(zmq::buffer(buf)); - CHECK(res); - CHECK(!res->truncated()); - CHECK(2 == res->size); -#else - CHECK(2 == sender.send(str, 2)); - char buf[2]; - CHECK(2 == receiver.recv(buf, 2)); -#endif - CHECK(0 == memcmp(buf, str, 2)); -} - -#ifdef ZMQ_CPP11 - -TEST_CASE("socket send none sndmore", "[socket]") -{ - zmq::context_t context; - zmq::socket_t s(context, zmq::socket_type::router); - s.bind("inproc://test"); - - std::vector buf(4); - auto res = s.send(zmq::buffer(buf), zmq::send_flags::sndmore); - CHECK(res); - CHECK(*res == buf.size()); - res = s.send(zmq::buffer(buf)); - CHECK(res); - CHECK(*res == buf.size()); -} - -TEST_CASE("socket send dontwait", "[socket]") -{ - zmq::context_t context; - zmq::socket_t s(context, zmq::socket_type::push); - s.bind("inproc://test"); - - std::vector buf(4); - auto res = s.send(zmq::buffer(buf), zmq::send_flags::dontwait); - CHECK(!res); - res = - s.send(zmq::buffer(buf), zmq::send_flags::dontwait | zmq::send_flags::sndmore); - CHECK(!res); - - zmq::message_t msg; - auto resm = s.send(msg, zmq::send_flags::dontwait); - CHECK(!resm); - CHECK(msg.size() == 0); -} - -TEST_CASE("socket send exception", "[socket]") -{ - zmq::context_t context; - zmq::socket_t s(context, zmq::socket_type::pull); - s.bind("inproc://test"); - - std::vector buf(4); - CHECK_THROWS_AS(s.send(zmq::buffer(buf)), zmq::error_t); -} - -TEST_CASE("socket recv none", "[socket]") -{ - zmq::context_t context; - zmq::socket_t s(context, zmq::socket_type::pair); - zmq::socket_t s2(context, zmq::socket_type::pair); - s2.bind("inproc://test"); - s.connect("inproc://test"); - - std::vector sbuf(4); - const auto res_send = s2.send(zmq::buffer(sbuf)); - CHECK(res_send); - CHECK(res_send.has_value()); - - std::vector buf(2); - const auto res = s.recv(zmq::buffer(buf)); - CHECK(res.has_value()); - CHECK(res->truncated()); - CHECK(res->untruncated_size == sbuf.size()); - CHECK(res->size == buf.size()); - - const auto res_send2 = s2.send(zmq::buffer(sbuf)); - CHECK(res_send2.has_value()); - std::vector buf2(10); - const auto res2 = s.recv(zmq::buffer(buf2)); - CHECK(res2.has_value()); - CHECK(!res2->truncated()); - CHECK(res2->untruncated_size == sbuf.size()); - CHECK(res2->size == sbuf.size()); -} - -TEST_CASE("socket send recv message_t", "[socket]") -{ - zmq::context_t context; - zmq::socket_t s(context, zmq::socket_type::pair); - zmq::socket_t s2(context, zmq::socket_type::pair); - s2.bind("inproc://test"); - s.connect("inproc://test"); - - zmq::message_t smsg(10); - const auto res_send = s2.send(smsg, zmq::send_flags::none); - CHECK(res_send); - CHECK(*res_send == 10); - CHECK(smsg.size() == 0); - - zmq::message_t rmsg; - const auto res = s.recv(rmsg); - CHECK(res); - CHECK(*res == 10); - CHECK(res.value() == 10); - CHECK(rmsg.size() == *res); -} - -TEST_CASE("socket send recv message_t by pointer", "[socket]") -{ - zmq::context_t context; - zmq::socket_t s(context, zmq::socket_type::pair); - zmq::socket_t s2(context, zmq::socket_type::pair); - s2.bind("inproc://test"); - s.connect("inproc://test"); - - zmq::message_t smsg(size_t{10}); - const auto res_send = s2.send(smsg, zmq::send_flags::none); - CHECK(res_send); - CHECK(*res_send == 10); - CHECK(smsg.size() == 0); - - zmq::message_t rmsg; - const bool res = s.recv(&rmsg); - CHECK(res); -} - -TEST_CASE("socket recv dontwait", "[socket]") -{ - zmq::context_t context; - zmq::socket_t s(context, zmq::socket_type::pull); - s.bind("inproc://test"); - - std::vector buf(4); - constexpr auto flags = zmq::recv_flags::none | zmq::recv_flags::dontwait; - auto res = s.recv(zmq::buffer(buf), flags); - CHECK(!res); - - zmq::message_t msg; - auto resm = s.recv(msg, flags); - CHECK(!resm); - CHECK_THROWS_AS(resm.value(), std::exception); - CHECK(msg.size() == 0); -} - -TEST_CASE("socket recv exception", "[socket]") -{ - zmq::context_t context; - zmq::socket_t s(context, zmq::socket_type::push); - s.bind("inproc://test"); - - std::vector buf(4); - CHECK_THROWS_AS(s.recv(zmq::buffer(buf)), zmq::error_t); -} - -TEST_CASE("socket proxy", "[socket]") -{ - zmq::context_t context; - zmq::socket_t front(context, ZMQ_ROUTER); - zmq::socket_t back(context, ZMQ_ROUTER); - zmq::socket_t capture(context, ZMQ_DEALER); - front.bind("inproc://test1"); - back.bind("inproc://test2"); - capture.bind("inproc://test3"); - auto f = std::async(std::launch::async, [&]() { - auto s1 = std::move(front); - auto s2 = std::move(back); - auto s3 = std::move(capture); - try { - zmq::proxy(s1, s2, zmq::socket_ref(s3)); - } - catch (const zmq::error_t &e) { - return e.num() == ETERM; - } - return false; - }); - context.close(); - CHECK(f.get()); -} - -TEST_CASE("socket proxy steerable", "[socket]") -{ - zmq::context_t context; - zmq::socket_t front(context, ZMQ_ROUTER); - zmq::socket_t back(context, ZMQ_ROUTER); - zmq::socket_t control(context, ZMQ_SUB); - front.bind("inproc://test1"); - back.bind("inproc://test2"); - control.connect("inproc://test3"); - auto f = std::async(std::launch::async, [&]() { - auto s1 = std::move(front); - auto s2 = std::move(back); - auto s3 = std::move(control); - try { - zmq::proxy_steerable(s1, s2, zmq::socket_ref(), s3); - } - catch (const zmq::error_t &e) { - return e.num() == ETERM; - } - return false; - }); - context.close(); - CHECK(f.get()); -} -#endif diff --git a/libs/cppzmq/tests/socket_ref.cpp b/libs/cppzmq/tests/socket_ref.cpp deleted file mode 100644 index 7658658..0000000 --- a/libs/cppzmq/tests/socket_ref.cpp +++ /dev/null @@ -1,118 +0,0 @@ -#include -#include -#ifdef ZMQ_CPP11 - -#ifdef ZMQ_CPP17 -static_assert(std::is_nothrow_swappable_v); -#endif -static_assert(sizeof(zmq::socket_ref) == sizeof(void *), "size mismatch"); -static_assert(alignof(zmq::socket_ref) == alignof(void *), "alignment mismatch"); -static_assert(ZMQ_IS_TRIVIALLY_COPYABLE(zmq::socket_ref), - "needs to be trivially copyable"); - -TEST_CASE("socket_ref default init", "[socket_ref]") -{ - zmq::socket_ref sr; - CHECK(!sr); - CHECK(sr == nullptr); - CHECK(nullptr == sr); - CHECK(sr.handle() == nullptr); -} - -TEST_CASE("socket_ref create from nullptr", "[socket_ref]") -{ - zmq::socket_ref sr = nullptr; - CHECK(sr == nullptr); - CHECK(sr.handle() == nullptr); -} - -TEST_CASE("socket_ref create from handle", "[socket_ref]") -{ - void *np = nullptr; - zmq::socket_ref sr{zmq::from_handle, np}; - CHECK(sr == nullptr); - CHECK(sr.handle() == nullptr); -} - -TEST_CASE("socket_ref compare", "[socket_ref]") -{ - zmq::socket_ref sr1; - zmq::socket_ref sr2; - CHECK(sr1 == sr2); - CHECK(!(sr1 != sr2)); -} - -TEST_CASE("socket_ref compare from socket_t", "[socket_ref]") -{ - zmq::context_t context; - zmq::socket_t s1(context, zmq::socket_type::router); - zmq::socket_t s2(context, zmq::socket_type::dealer); - zmq::socket_ref sr1 = s1; - zmq::socket_ref sr2 = s2; - CHECK(sr1); - CHECK(sr2); - CHECK(sr1 == s1); - CHECK(sr2 == s2); - CHECK(sr1.handle() == s1.handle()); - CHECK(sr1 != sr2); - CHECK(sr1.handle() != sr2.handle()); - CHECK(sr1 != nullptr); - CHECK(nullptr != sr1); - CHECK(sr2 != nullptr); - const bool comp1 = (sr1 < sr2) != (sr1 >= sr2); - CHECK(comp1); - const bool comp2 = (sr1 > sr2) != (sr1 <= sr2); - CHECK(comp2); - std::hash hash; - CHECK(hash(sr1) != hash(sr2)); - CHECK(hash(sr1) == hash(s1)); -} - -TEST_CASE("socket_ref assignment", "[socket_ref]") -{ - zmq::context_t context; - zmq::socket_t s1(context, zmq::socket_type::router); - zmq::socket_t s2(context, zmq::socket_type::dealer); - zmq::socket_ref sr1 = s1; - zmq::socket_ref sr2 = s2; - sr1 = s2; - CHECK(sr1 == sr2); - CHECK(sr1.handle() == sr2.handle()); - sr1 = std::move(sr2); - CHECK(sr1 == sr2); - CHECK(sr1.handle() == sr2.handle()); - sr2 = nullptr; - CHECK(sr1 != sr2); - sr1 = nullptr; - CHECK(sr1 == sr2); -} - -TEST_CASE("socket_ref swap", "[socket_ref]") -{ - zmq::socket_ref sr1; - zmq::socket_ref sr2; - using std::swap; - swap(sr1, sr2); -} - -TEST_CASE("socket_ref type punning", "[socket_ref]") -{ - struct SVP - { - void *p; - } svp; - struct SSR - { - zmq::socket_ref sr; - } ssr; - - zmq::context_t context; - zmq::socket_t socket(context, zmq::socket_type::router); - CHECK(socket.handle() != nullptr); - svp.p = socket.handle(); - // static_cast to silence incorrect warning - std::memcpy(static_cast(&ssr), &svp, sizeof(ssr)); - CHECK(ssr.sr == socket); -} - -#endif diff --git a/libs/cppzmq/tests/testutil.hpp b/libs/cppzmq/tests/testutil.hpp deleted file mode 100644 index 6c371de..0000000 --- a/libs/cppzmq/tests/testutil.hpp +++ /dev/null @@ -1,54 +0,0 @@ -#pragma once - -#include -#include - -#if defined(ZMQ_CPP11) - -inline std::string bind_ip4_loopback(zmq::socket_t &socket) -{ - socket.bind("tcp://127.0.0.1:*"); - std::string endpoint(100, ' '); - endpoint.resize(socket.get(zmq::sockopt::last_endpoint, zmq::buffer(endpoint))); - return endpoint; -} - -struct common_server_client_setup -{ - common_server_client_setup(bool initialize = true) - { - if (initialize) - init(); - } - - void init() - { - endpoint = bind_ip4_loopback(server); - REQUIRE_NOTHROW(client.connect(endpoint)); - } - - zmq::context_t context; - zmq::socket_t server{context, zmq::socket_type::pair}; - zmq::socket_t client{context, zmq::socket_type::pair}; - std::string endpoint; -}; -#endif - -#define CHECK_THROWS_ZMQ_ERROR(ecode, expr) \ - do { \ - try { \ - expr; \ - CHECK(false); \ - } \ - catch (const zmq::error_t &ze) { \ - INFO(std::string("Unexpected error code: ") + ze.what()); \ - CHECK(ze.num() == ecode); \ - } \ - catch (const std::exception &ex) { \ - INFO(std::string("Unexpected exception: ") + ex.what()); \ - CHECK(false); \ - } \ - catch (...) { \ - CHECK(false); \ - } \ - } while (false) diff --git a/libs/cppzmq/tests/utilities.cpp b/libs/cppzmq/tests/utilities.cpp deleted file mode 100644 index 30238a6..0000000 --- a/libs/cppzmq/tests/utilities.cpp +++ /dev/null @@ -1,110 +0,0 @@ -#include -#include - -#if defined(ZMQ_CPP11) && !defined(ZMQ_CPP11_PARTIAL) - -namespace test_ns -{ -struct T_nr -{ -}; - -struct T_mr -{ - void *begin() const noexcept { return nullptr; } - void *end() const noexcept { return nullptr; } -}; - -struct T_fr -{ -}; - -inline void *begin(const T_fr &) noexcept -{ - return nullptr; -} - -inline void *end(const T_fr &) noexcept -{ - return nullptr; -} - -struct T_mfr -{ - void *begin() const noexcept { return nullptr; } - void *end() const noexcept { return nullptr; } -}; - -inline void *begin(const T_mfr &) noexcept -{ - return nullptr; -} - -inline void *end(const T_mfr &) noexcept -{ - return nullptr; -} - -// types with associated namespace std -struct T_assoc_ns_nr : std::exception -{ -}; - -struct T_assoc_ns_mr : std::exception -{ - void *begin() const noexcept { return nullptr; } - void *end() const noexcept { return nullptr; } -}; - -struct T_assoc_ns_fr : std::exception -{ -}; - -inline void *begin(const T_assoc_ns_fr &) noexcept -{ - return nullptr; -} - -inline void *end(const T_assoc_ns_fr &) noexcept -{ - return nullptr; -} - -struct T_assoc_ns_mfr : std::exception -{ - void *begin() const noexcept { return nullptr; } - void *end() const noexcept { return nullptr; } -}; - -inline void *begin(const T_assoc_ns_mfr &) noexcept -{ - return nullptr; -} - -inline void *end(const T_assoc_ns_mfr &) noexcept -{ - return nullptr; -} -} // namespace test_ns - -TEST_CASE("range SFINAE", "[utilities]") -{ - CHECK(!zmq::detail::is_range::value); - CHECK(zmq::detail::is_range::value); - CHECK(zmq::detail::is_range::value); - CHECK(zmq::detail::is_range::value); - CHECK(zmq::detail::is_range::value); - CHECK(zmq::detail::is_range>::value); - - CHECK(!zmq::detail::is_range::value); - CHECK(zmq::detail::is_range::value); - CHECK(zmq::detail::is_range::value); - CHECK(zmq::detail::is_range::value); - - CHECK(!zmq::detail::is_range::value); - CHECK(zmq::detail::is_range::value); - CHECK(zmq::detail::is_range::value); - CHECK(zmq::detail::is_range::value); -} - -#endif diff --git a/libs/cppzmq/version.sh b/libs/cppzmq/version.sh deleted file mode 100755 index f7d9eb6..0000000 --- a/libs/cppzmq/version.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh -# -# This script extracts the 0MQ version from zmq.hpp, which is the master -# location for this information. -# -if [ ! -f zmq.hpp ]; then - echo "version.sh: error: zmq.hpp does not exist" 1>&2 - exit 1 -fi -MAJOR=$(grep '^#define CPPZMQ_VERSION_MAJOR \+[0-9]\+' zmq.hpp) -MINOR=$(grep '^#define CPPZMQ_VERSION_MINOR \+[0-9]\+' zmq.hpp) -PATCH=$(grep '^#define CPPZMQ_VERSION_PATCH \+[0-9]\+' zmq.hpp) -if [ -z "$MAJOR" -o -z "$MINOR" -o -z "$PATCH" ]; then - echo "version.sh: error: could not extract version from zmq.hpp" 1>&2 - exit 1 -fi -MAJOR=$(echo $MAJOR | awk '{ print $3 }') -MINOR=$(echo $MINOR | awk '{ print $3 }') -PATCH=$(echo $PATCH | awk '{ print $3 }') -echo $MAJOR.$MINOR.$PATCH | tr -d '\n\r' - diff --git a/libs/cppzmq/zmq.hpp b/libs/cppzmq/zmq.hpp deleted file mode 100644 index 775c6f6..0000000 --- a/libs/cppzmq/zmq.hpp +++ /dev/null @@ -1,2721 +0,0 @@ -/* - Copyright (c) 2016-2017 ZeroMQ community - Copyright (c) 2009-2011 250bpm s.r.o. - Copyright (c) 2011 Botond Ballo - Copyright (c) 2007-2009 iMatix Corporation - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to - deal in the Software without restriction, including without limitation the - rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - sell copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - IN THE SOFTWARE. -*/ - -#ifndef __ZMQ_HPP_INCLUDED__ -#define __ZMQ_HPP_INCLUDED__ - -#ifdef _WIN32 -#ifndef NOMINMAX -#define NOMINMAX -#endif -#endif - -// included here for _HAS_CXX* macros -#include - -#if defined(_MSVC_LANG) -#define CPPZMQ_LANG _MSVC_LANG -#else -#define CPPZMQ_LANG __cplusplus -#endif -// overwrite if specific language macros indicate higher version -#if defined(_HAS_CXX14) && _HAS_CXX14 && CPPZMQ_LANG < 201402L -#undef CPPZMQ_LANG -#define CPPZMQ_LANG 201402L -#endif -#if defined(_HAS_CXX17) && _HAS_CXX17 && CPPZMQ_LANG < 201703L -#undef CPPZMQ_LANG -#define CPPZMQ_LANG 201703L -#endif - -// macros defined if has a specific standard or greater -#if CPPZMQ_LANG >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1900) -#define ZMQ_CPP11 -#endif -#if CPPZMQ_LANG >= 201402L -#define ZMQ_CPP14 -#endif -#if CPPZMQ_LANG >= 201703L -#define ZMQ_CPP17 -#endif - -#if defined(ZMQ_CPP14) && !defined(_MSC_VER) -#define ZMQ_DEPRECATED(msg) [[deprecated(msg)]] -#elif defined(_MSC_VER) -#define ZMQ_DEPRECATED(msg) __declspec(deprecated(msg)) -#elif defined(__GNUC__) -#define ZMQ_DEPRECATED(msg) __attribute__((deprecated(msg))) -#else -#define ZMQ_DEPRECATED(msg) -#endif - -#if defined(ZMQ_CPP17) -#define ZMQ_NODISCARD [[nodiscard]] -#else -#define ZMQ_NODISCARD -#endif - -#if defined(ZMQ_CPP11) -#define ZMQ_NOTHROW noexcept -#define ZMQ_EXPLICIT explicit -#define ZMQ_OVERRIDE override -#define ZMQ_NULLPTR nullptr -#define ZMQ_CONSTEXPR_FN constexpr -#define ZMQ_CONSTEXPR_VAR constexpr -#define ZMQ_CPP11_DEPRECATED(msg) ZMQ_DEPRECATED(msg) -#else -#define ZMQ_NOTHROW throw() -#define ZMQ_EXPLICIT -#define ZMQ_OVERRIDE -#define ZMQ_NULLPTR 0 -#define ZMQ_CONSTEXPR_FN -#define ZMQ_CONSTEXPR_VAR const -#define ZMQ_CPP11_DEPRECATED(msg) -#endif -#if defined(ZMQ_CPP14) && (!defined(_MSC_VER) || _MSC_VER > 1900) && (!defined(__GNUC__) || __GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ > 3)) -#define ZMQ_EXTENDED_CONSTEXPR -#endif -#if defined(ZMQ_CPP17) -#define ZMQ_INLINE_VAR inline -#define ZMQ_CONSTEXPR_IF constexpr -#else -#define ZMQ_INLINE_VAR -#define ZMQ_CONSTEXPR_IF -#endif - -#include -#include - -#include -#include -#include -#include -#include -#include -#ifdef ZMQ_CPP11 -#include -#include -#include -#include -#endif - -#if defined(__has_include) && defined(ZMQ_CPP17) -#define CPPZMQ_HAS_INCLUDE_CPP17(X) __has_include(X) -#else -#define CPPZMQ_HAS_INCLUDE_CPP17(X) 0 -#endif - -#if CPPZMQ_HAS_INCLUDE_CPP17() && !defined(CPPZMQ_HAS_OPTIONAL) -#define CPPZMQ_HAS_OPTIONAL 1 -#endif -#ifndef CPPZMQ_HAS_OPTIONAL -#define CPPZMQ_HAS_OPTIONAL 0 -#elif CPPZMQ_HAS_OPTIONAL -#include -#endif - -#if CPPZMQ_HAS_INCLUDE_CPP17() && !defined(CPPZMQ_HAS_STRING_VIEW) -#define CPPZMQ_HAS_STRING_VIEW 1 -#endif -#ifndef CPPZMQ_HAS_STRING_VIEW -#define CPPZMQ_HAS_STRING_VIEW 0 -#elif CPPZMQ_HAS_STRING_VIEW -#include -#endif - -/* Version macros for compile-time API version detection */ -#define CPPZMQ_VERSION_MAJOR 4 -#define CPPZMQ_VERSION_MINOR 9 -#define CPPZMQ_VERSION_PATCH 0 - -#define CPPZMQ_VERSION \ - ZMQ_MAKE_VERSION(CPPZMQ_VERSION_MAJOR, CPPZMQ_VERSION_MINOR, \ - CPPZMQ_VERSION_PATCH) - -// Detect whether the compiler supports C++11 rvalue references. -#if (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 2)) \ - && defined(__GXX_EXPERIMENTAL_CXX0X__)) -#define ZMQ_HAS_RVALUE_REFS -#define ZMQ_DELETED_FUNCTION = delete -#elif defined(__clang__) -#if __has_feature(cxx_rvalue_references) -#define ZMQ_HAS_RVALUE_REFS -#endif - -#if __has_feature(cxx_deleted_functions) -#define ZMQ_DELETED_FUNCTION = delete -#else -#define ZMQ_DELETED_FUNCTION -#endif -#elif defined(_MSC_VER) && (_MSC_VER >= 1900) -#define ZMQ_HAS_RVALUE_REFS -#define ZMQ_DELETED_FUNCTION = delete -#elif defined(_MSC_VER) && (_MSC_VER >= 1600) -#define ZMQ_HAS_RVALUE_REFS -#define ZMQ_DELETED_FUNCTION -#else -#define ZMQ_DELETED_FUNCTION -#endif - -#if defined(ZMQ_CPP11) && !defined(__llvm__) && !defined(__INTEL_COMPILER) \ - && defined(__GNUC__) && __GNUC__ < 5 -#define ZMQ_CPP11_PARTIAL -#elif defined(__GLIBCXX__) && __GLIBCXX__ < 20160805 -//the date here is the last date of gcc 4.9.4, which -// effectively means libstdc++ from gcc 5.5 and higher won't trigger this branch -#define ZMQ_CPP11_PARTIAL -#endif - -#ifdef ZMQ_CPP11 -#ifdef ZMQ_CPP11_PARTIAL -#define ZMQ_IS_TRIVIALLY_COPYABLE(T) __has_trivial_copy(T) -#else -#include -#define ZMQ_IS_TRIVIALLY_COPYABLE(T) std::is_trivially_copyable::value -#endif -#endif - -#if ZMQ_VERSION >= ZMQ_MAKE_VERSION(3, 3, 0) -#define ZMQ_NEW_MONITOR_EVENT_LAYOUT -#endif - -#if ZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 1, 0) -#define ZMQ_HAS_PROXY_STEERABLE -/* Socket event data */ -typedef struct -{ - uint16_t event; // id of the event as bitfield - int32_t value; // value is either error code, fd or reconnect interval -} zmq_event_t; -#endif - -// Avoid using deprecated message receive function when possible -#if ZMQ_VERSION < ZMQ_MAKE_VERSION(3, 2, 0) -#define zmq_msg_recv(msg, socket, flags) zmq_recvmsg(socket, msg, flags) -#endif - - -// In order to prevent unused variable warnings when building in non-debug -// mode use this macro to make assertions. -#ifndef NDEBUG -#define ZMQ_ASSERT(expression) assert(expression) -#else -#define ZMQ_ASSERT(expression) (void) (expression) -#endif - -namespace zmq -{ -#ifdef ZMQ_CPP11 -namespace detail -{ -namespace ranges -{ -using std::begin; -using std::end; -template auto begin(T &&r) -> decltype(begin(std::forward(r))) -{ - return begin(std::forward(r)); -} -template auto end(T &&r) -> decltype(end(std::forward(r))) -{ - return end(std::forward(r)); -} -} // namespace ranges - -template using void_t = void; - -template -using iter_value_t = typename std::iterator_traits::value_type; - -template -using range_iter_t = decltype( - ranges::begin(std::declval::type &>())); - -template using range_value_t = iter_value_t>; - -template struct is_range : std::false_type -{ -}; - -template -struct is_range< - T, - void_t::type &>()) - == ranges::end(std::declval::type &>()))>> - : std::true_type -{ -}; - -} // namespace detail -#endif - -typedef zmq_free_fn free_fn; -typedef zmq_pollitem_t pollitem_t; - -// duplicate definition from libzmq 4.3.3 -#if defined _WIN32 -#if defined _WIN64 -typedef unsigned __int64 fd_t; -#else -typedef unsigned int fd_t; -#endif -#else -typedef int fd_t; -#endif - -class error_t : public std::exception -{ - public: - error_t() ZMQ_NOTHROW : errnum(zmq_errno()) {} - explicit error_t(int err) ZMQ_NOTHROW : errnum(err) {} - virtual const char *what() const ZMQ_NOTHROW ZMQ_OVERRIDE - { - return zmq_strerror(errnum); - } - int num() const ZMQ_NOTHROW { return errnum; } - - private: - int errnum; -}; - -namespace detail { -inline int poll(zmq_pollitem_t *items_, size_t nitems_, long timeout_) -{ - int rc = zmq_poll(items_, static_cast(nitems_), timeout_); - if (rc < 0) - throw error_t(); - return rc; -} -} - -#ifdef ZMQ_CPP11 -ZMQ_DEPRECATED("from 4.8.0, use poll taking std::chrono::duration instead of long") -inline int poll(zmq_pollitem_t *items_, size_t nitems_, long timeout_) -#else -inline int poll(zmq_pollitem_t *items_, size_t nitems_, long timeout_ = -1) -#endif -{ - return detail::poll(items_, nitems_, timeout_); -} - -ZMQ_DEPRECATED("from 4.3.1, use poll taking non-const items") -inline int poll(zmq_pollitem_t const *items_, size_t nitems_, long timeout_ = -1) -{ - return detail::poll(const_cast(items_), nitems_, timeout_); -} - -#ifdef ZMQ_CPP11 -ZMQ_DEPRECATED("from 4.3.1, use poll taking non-const items") -inline int -poll(zmq_pollitem_t const *items, size_t nitems, std::chrono::milliseconds timeout) -{ - return detail::poll(const_cast(items), nitems, - static_cast(timeout.count())); -} - -ZMQ_DEPRECATED("from 4.3.1, use poll taking non-const items") -inline int poll(std::vector const &items, - std::chrono::milliseconds timeout) -{ - return detail::poll(const_cast(items.data()), items.size(), - static_cast(timeout.count())); -} - -ZMQ_DEPRECATED("from 4.3.1, use poll taking non-const items") -inline int poll(std::vector const &items, long timeout_ = -1) -{ - return detail::poll(const_cast(items.data()), items.size(), timeout_); -} - -inline int -poll(zmq_pollitem_t *items, size_t nitems, std::chrono::milliseconds timeout = std::chrono::milliseconds{-1}) -{ - return detail::poll(items, nitems, static_cast(timeout.count())); -} - -inline int poll(std::vector &items, - std::chrono::milliseconds timeout = std::chrono::milliseconds{-1}) -{ - return detail::poll(items.data(), items.size(), static_cast(timeout.count())); -} - -ZMQ_DEPRECATED("from 4.3.1, use poll taking std::chrono::duration instead of long") -inline int poll(std::vector &items, long timeout_) -{ - return detail::poll(items.data(), items.size(), timeout_); -} - -template -inline int poll(std::array &items, - std::chrono::milliseconds timeout = std::chrono::milliseconds{-1}) -{ - return detail::poll(items.data(), items.size(), static_cast(timeout.count())); -} -#endif - - -inline void version(int *major_, int *minor_, int *patch_) -{ - zmq_version(major_, minor_, patch_); -} - -#ifdef ZMQ_CPP11 -inline std::tuple version() -{ - std::tuple v; - zmq_version(&std::get<0>(v), &std::get<1>(v), &std::get<2>(v)); - return v; -} - -#if !defined(ZMQ_CPP11_PARTIAL) -namespace detail -{ -template struct is_char_type -{ - // true if character type for string literals in C++11 - static constexpr bool value = - std::is_same::value || std::is_same::value - || std::is_same::value || std::is_same::value; -}; -} -#endif - -#endif - -class message_t -{ - public: - message_t() ZMQ_NOTHROW - { - int rc = zmq_msg_init(&msg); - ZMQ_ASSERT(rc == 0); - } - - explicit message_t(size_t size_) - { - int rc = zmq_msg_init_size(&msg, size_); - if (rc != 0) - throw error_t(); - } - - template message_t(ForwardIter first, ForwardIter last) - { - typedef typename std::iterator_traits::value_type value_t; - - assert(std::distance(first, last) >= 0); - size_t const size_ = - static_cast(std::distance(first, last)) * sizeof(value_t); - int const rc = zmq_msg_init_size(&msg, size_); - if (rc != 0) - throw error_t(); - std::copy(first, last, data()); - } - - message_t(const void *data_, size_t size_) - { - int rc = zmq_msg_init_size(&msg, size_); - if (rc != 0) - throw error_t(); - if (size_) { - // this constructor allows (nullptr, 0), - // memcpy with a null pointer is UB - memcpy(data(), data_, size_); - } - } - - message_t(void *data_, size_t size_, free_fn *ffn_, void *hint_ = ZMQ_NULLPTR) - { - int rc = zmq_msg_init_data(&msg, data_, size_, ffn_, hint_); - if (rc != 0) - throw error_t(); - } - - // overload set of string-like types and generic containers -#if defined(ZMQ_CPP11) && !defined(ZMQ_CPP11_PARTIAL) - // NOTE this constructor will include the null terminator - // when called with a string literal. - // An overload taking const char* can not be added because - // it would be preferred over this function and break compatiblity. - template< - class Char, - size_t N, - typename = typename std::enable_if::value>::type> - ZMQ_DEPRECATED("from 4.7.0, use constructors taking iterators, (pointer, size) " - "or strings instead") - explicit message_t(const Char (&data)[N]) : - message_t(detail::ranges::begin(data), detail::ranges::end(data)) - { - } - - template::value - && ZMQ_IS_TRIVIALLY_COPYABLE(detail::range_value_t) - && !detail::is_char_type>::value - && !std::is_same::value>::type> - explicit message_t(const Range &rng) : - message_t(detail::ranges::begin(rng), detail::ranges::end(rng)) - { - } - - explicit message_t(const std::string &str) : message_t(str.data(), str.size()) {} - -#if CPPZMQ_HAS_STRING_VIEW - explicit message_t(std::string_view str) : message_t(str.data(), str.size()) {} -#endif - -#endif - -#ifdef ZMQ_HAS_RVALUE_REFS - message_t(message_t &&rhs) ZMQ_NOTHROW : msg(rhs.msg) - { - int rc = zmq_msg_init(&rhs.msg); - ZMQ_ASSERT(rc == 0); - } - - message_t &operator=(message_t &&rhs) ZMQ_NOTHROW - { - std::swap(msg, rhs.msg); - return *this; - } -#endif - - ~message_t() ZMQ_NOTHROW - { - int rc = zmq_msg_close(&msg); - ZMQ_ASSERT(rc == 0); - } - - void rebuild() - { - int rc = zmq_msg_close(&msg); - if (rc != 0) - throw error_t(); - rc = zmq_msg_init(&msg); - ZMQ_ASSERT(rc == 0); - } - - void rebuild(size_t size_) - { - int rc = zmq_msg_close(&msg); - if (rc != 0) - throw error_t(); - rc = zmq_msg_init_size(&msg, size_); - if (rc != 0) - throw error_t(); - } - - void rebuild(const void *data_, size_t size_) - { - int rc = zmq_msg_close(&msg); - if (rc != 0) - throw error_t(); - rc = zmq_msg_init_size(&msg, size_); - if (rc != 0) - throw error_t(); - memcpy(data(), data_, size_); - } - - void rebuild(const std::string &str) - { - rebuild(str.data(), str.size()); - } - - void rebuild(void *data_, size_t size_, free_fn *ffn_, void *hint_ = ZMQ_NULLPTR) - { - int rc = zmq_msg_close(&msg); - if (rc != 0) - throw error_t(); - rc = zmq_msg_init_data(&msg, data_, size_, ffn_, hint_); - if (rc != 0) - throw error_t(); - } - - ZMQ_DEPRECATED("from 4.3.1, use move taking non-const reference instead") - void move(message_t const *msg_) - { - int rc = zmq_msg_move(&msg, const_cast(msg_->handle())); - if (rc != 0) - throw error_t(); - } - - void move(message_t &msg_) - { - int rc = zmq_msg_move(&msg, msg_.handle()); - if (rc != 0) - throw error_t(); - } - - ZMQ_DEPRECATED("from 4.3.1, use copy taking non-const reference instead") - void copy(message_t const *msg_) - { - int rc = zmq_msg_copy(&msg, const_cast(msg_->handle())); - if (rc != 0) - throw error_t(); - } - - void copy(message_t &msg_) - { - int rc = zmq_msg_copy(&msg, msg_.handle()); - if (rc != 0) - throw error_t(); - } - - bool more() const ZMQ_NOTHROW - { - int rc = zmq_msg_more(const_cast(&msg)); - return rc != 0; - } - - void *data() ZMQ_NOTHROW { return zmq_msg_data(&msg); } - - const void *data() const ZMQ_NOTHROW - { - return zmq_msg_data(const_cast(&msg)); - } - - size_t size() const ZMQ_NOTHROW - { - return zmq_msg_size(const_cast(&msg)); - } - - ZMQ_NODISCARD bool empty() const ZMQ_NOTHROW { return size() == 0u; } - - template T *data() ZMQ_NOTHROW { return static_cast(data()); } - - template T const *data() const ZMQ_NOTHROW - { - return static_cast(data()); - } - - ZMQ_DEPRECATED("from 4.3.0, use operator== instead") - bool equal(const message_t *other) const ZMQ_NOTHROW { return *this == *other; } - - bool operator==(const message_t &other) const ZMQ_NOTHROW - { - const size_t my_size = size(); - return my_size == other.size() && 0 == memcmp(data(), other.data(), my_size); - } - - bool operator!=(const message_t &other) const ZMQ_NOTHROW - { - return !(*this == other); - } - -#if ZMQ_VERSION >= ZMQ_MAKE_VERSION(3, 2, 0) - int get(int property_) - { - int value = zmq_msg_get(&msg, property_); - if (value == -1) - throw error_t(); - return value; - } -#endif - -#if ZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 1, 0) - const char *gets(const char *property_) - { - const char *value = zmq_msg_gets(&msg, property_); - if (value == ZMQ_NULLPTR) - throw error_t(); - return value; - } -#endif - -#if defined(ZMQ_BUILD_DRAFT_API) && ZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 2, 0) - uint32_t routing_id() const - { - return zmq_msg_routing_id(const_cast(&msg)); - } - - void set_routing_id(uint32_t routing_id) - { - int rc = zmq_msg_set_routing_id(&msg, routing_id); - if (rc != 0) - throw error_t(); - } - - const char *group() const - { - return zmq_msg_group(const_cast(&msg)); - } - - void set_group(const char *group) - { - int rc = zmq_msg_set_group(&msg, group); - if (rc != 0) - throw error_t(); - } -#endif - - // interpret message content as a string - std::string to_string() const - { - return std::string(static_cast(data()), size()); - } -#if CPPZMQ_HAS_STRING_VIEW - // interpret message content as a string - std::string_view to_string_view() const noexcept - { - return std::string_view(static_cast(data()), size()); - } -#endif - - /** Dump content to string for debugging. - * Ascii chars are readable, the rest is printed as hex. - * Probably ridiculously slow. - * Use to_string() or to_string_view() for - * interpreting the message as a string. - */ - std::string str() const - { - // Partly mutuated from the same method in zmq::multipart_t - std::stringstream os; - - const unsigned char *msg_data = this->data(); - unsigned char byte; - size_t size = this->size(); - int is_ascii[2] = {0, 0}; - - os << "zmq::message_t [size " << std::dec << std::setw(3) - << std::setfill('0') << size << "] ("; - // Totally arbitrary - if (size >= 1000) { - os << "... too big to print)"; - } else { - while (size--) { - byte = *msg_data++; - - is_ascii[1] = (byte >= 32 && byte < 127); - if (is_ascii[1] != is_ascii[0]) - os << " "; // Separate text/non text - - if (is_ascii[1]) { - os << byte; - } else { - os << std::hex << std::uppercase << std::setw(2) - << std::setfill('0') << static_cast(byte); - } - is_ascii[0] = is_ascii[1]; - } - os << ")"; - } - return os.str(); - } - - void swap(message_t &other) ZMQ_NOTHROW - { - // this assumes zmq::msg_t from libzmq is trivially relocatable - std::swap(msg, other.msg); - } - - ZMQ_NODISCARD zmq_msg_t *handle() ZMQ_NOTHROW { return &msg; } - ZMQ_NODISCARD const zmq_msg_t *handle() const ZMQ_NOTHROW { return &msg; } - - private: - // The underlying message - zmq_msg_t msg; - - // Disable implicit message copying, so that users won't use shared - // messages (less efficient) without being aware of the fact. - message_t(const message_t &) ZMQ_DELETED_FUNCTION; - void operator=(const message_t &) ZMQ_DELETED_FUNCTION; -}; - -inline void swap(message_t &a, message_t &b) ZMQ_NOTHROW -{ - a.swap(b); -} - -#ifdef ZMQ_CPP11 -enum class ctxopt -{ -#ifdef ZMQ_BLOCKY - blocky = ZMQ_BLOCKY, -#endif -#ifdef ZMQ_IO_THREADS - io_threads = ZMQ_IO_THREADS, -#endif -#ifdef ZMQ_THREAD_SCHED_POLICY - thread_sched_policy = ZMQ_THREAD_SCHED_POLICY, -#endif -#ifdef ZMQ_THREAD_PRIORITY - thread_priority = ZMQ_THREAD_PRIORITY, -#endif -#ifdef ZMQ_THREAD_AFFINITY_CPU_ADD - thread_affinity_cpu_add = ZMQ_THREAD_AFFINITY_CPU_ADD, -#endif -#ifdef ZMQ_THREAD_AFFINITY_CPU_REMOVE - thread_affinity_cpu_remove = ZMQ_THREAD_AFFINITY_CPU_REMOVE, -#endif -#ifdef ZMQ_THREAD_NAME_PREFIX - thread_name_prefix = ZMQ_THREAD_NAME_PREFIX, -#endif -#ifdef ZMQ_MAX_MSGSZ - max_msgsz = ZMQ_MAX_MSGSZ, -#endif -#ifdef ZMQ_ZERO_COPY_RECV - zero_copy_recv = ZMQ_ZERO_COPY_RECV, -#endif -#ifdef ZMQ_MAX_SOCKETS - max_sockets = ZMQ_MAX_SOCKETS, -#endif -#ifdef ZMQ_SOCKET_LIMIT - socket_limit = ZMQ_SOCKET_LIMIT, -#endif -#ifdef ZMQ_IPV6 - ipv6 = ZMQ_IPV6, -#endif -#ifdef ZMQ_MSG_T_SIZE - msg_t_size = ZMQ_MSG_T_SIZE -#endif -}; -#endif - -class context_t -{ - public: - context_t() - { - ptr = zmq_ctx_new(); - if (ptr == ZMQ_NULLPTR) - throw error_t(); - } - - - explicit context_t(int io_threads_, int max_sockets_ = ZMQ_MAX_SOCKETS_DFLT) - { - ptr = zmq_ctx_new(); - if (ptr == ZMQ_NULLPTR) - throw error_t(); - - int rc = zmq_ctx_set(ptr, ZMQ_IO_THREADS, io_threads_); - ZMQ_ASSERT(rc == 0); - - rc = zmq_ctx_set(ptr, ZMQ_MAX_SOCKETS, max_sockets_); - ZMQ_ASSERT(rc == 0); - } - -#ifdef ZMQ_HAS_RVALUE_REFS - context_t(context_t &&rhs) ZMQ_NOTHROW : ptr(rhs.ptr) { rhs.ptr = ZMQ_NULLPTR; } - context_t &operator=(context_t &&rhs) ZMQ_NOTHROW - { - close(); - std::swap(ptr, rhs.ptr); - return *this; - } -#endif - - ~context_t() ZMQ_NOTHROW { close(); } - - ZMQ_CPP11_DEPRECATED("from 4.7.0, use set taking zmq::ctxopt instead") - int setctxopt(int option_, int optval_) - { - int rc = zmq_ctx_set(ptr, option_, optval_); - ZMQ_ASSERT(rc == 0); - return rc; - } - - ZMQ_CPP11_DEPRECATED("from 4.7.0, use get taking zmq::ctxopt instead") - int getctxopt(int option_) { return zmq_ctx_get(ptr, option_); } - -#ifdef ZMQ_CPP11 - void set(ctxopt option, int optval) - { - int rc = zmq_ctx_set(ptr, static_cast(option), optval); - if (rc == -1) - throw error_t(); - } - - ZMQ_NODISCARD int get(ctxopt option) - { - int rc = zmq_ctx_get(ptr, static_cast(option)); - // some options have a default value of -1 - // which is unfortunate, and may result in errors - // that don't make sense - if (rc == -1) - throw error_t(); - return rc; - } -#endif - - // Terminates context (see also shutdown()). - void close() ZMQ_NOTHROW - { - if (ptr == ZMQ_NULLPTR) - return; - - int rc; - do { - rc = zmq_ctx_term(ptr); - } while (rc == -1 && errno == EINTR); - - ZMQ_ASSERT(rc == 0); - ptr = ZMQ_NULLPTR; - } - - // Shutdown context in preparation for termination (close()). - // Causes all blocking socket operations and any further - // socket operations to return with ETERM. - void shutdown() ZMQ_NOTHROW - { - if (ptr == ZMQ_NULLPTR) - return; - int rc = zmq_ctx_shutdown(ptr); - ZMQ_ASSERT(rc == 0); - } - - // Be careful with this, it's probably only useful for - // using the C api together with an existing C++ api. - // Normally you should never need to use this. - ZMQ_EXPLICIT operator void *() ZMQ_NOTHROW { return ptr; } - - ZMQ_EXPLICIT operator void const *() const ZMQ_NOTHROW { return ptr; } - - ZMQ_NODISCARD void *handle() ZMQ_NOTHROW { return ptr; } - - ZMQ_DEPRECATED("from 4.7.0, use handle() != nullptr instead") - operator bool() const ZMQ_NOTHROW { return ptr != ZMQ_NULLPTR; } - - void swap(context_t &other) ZMQ_NOTHROW { std::swap(ptr, other.ptr); } - - private: - void *ptr; - - context_t(const context_t &) ZMQ_DELETED_FUNCTION; - void operator=(const context_t &) ZMQ_DELETED_FUNCTION; -}; - -inline void swap(context_t &a, context_t &b) ZMQ_NOTHROW -{ - a.swap(b); -} - -#ifdef ZMQ_CPP11 - -struct recv_buffer_size -{ - size_t size; // number of bytes written to buffer - size_t untruncated_size; // untruncated message size in bytes - - ZMQ_NODISCARD bool truncated() const noexcept - { - return size != untruncated_size; - } -}; - -#if CPPZMQ_HAS_OPTIONAL - -using send_result_t = std::optional; -using recv_result_t = std::optional; -using recv_buffer_result_t = std::optional; - -#else - -namespace detail -{ -// A C++11 type emulating the most basic -// operations of std::optional for trivial types -template class trivial_optional -{ - public: - static_assert(std::is_trivial::value, "T must be trivial"); - using value_type = T; - - trivial_optional() = default; - trivial_optional(T value) noexcept : _value(value), _has_value(true) {} - - const T *operator->() const noexcept - { - assert(_has_value); - return &_value; - } - T *operator->() noexcept - { - assert(_has_value); - return &_value; - } - - const T &operator*() const noexcept - { - assert(_has_value); - return _value; - } - T &operator*() noexcept - { - assert(_has_value); - return _value; - } - - T &value() - { - if (!_has_value) - throw std::exception(); - return _value; - } - const T &value() const - { - if (!_has_value) - throw std::exception(); - return _value; - } - - explicit operator bool() const noexcept { return _has_value; } - bool has_value() const noexcept { return _has_value; } - - private: - T _value{}; - bool _has_value{false}; -}; -} // namespace detail - -using send_result_t = detail::trivial_optional; -using recv_result_t = detail::trivial_optional; -using recv_buffer_result_t = detail::trivial_optional; - -#endif - -namespace detail -{ -template constexpr T enum_bit_or(T a, T b) noexcept -{ - static_assert(std::is_enum::value, "must be enum"); - using U = typename std::underlying_type::type; - return static_cast(static_cast(a) | static_cast(b)); -} -template constexpr T enum_bit_and(T a, T b) noexcept -{ - static_assert(std::is_enum::value, "must be enum"); - using U = typename std::underlying_type::type; - return static_cast(static_cast(a) & static_cast(b)); -} -template constexpr T enum_bit_xor(T a, T b) noexcept -{ - static_assert(std::is_enum::value, "must be enum"); - using U = typename std::underlying_type::type; - return static_cast(static_cast(a) ^ static_cast(b)); -} -template constexpr T enum_bit_not(T a) noexcept -{ - static_assert(std::is_enum::value, "must be enum"); - using U = typename std::underlying_type::type; - return static_cast(~static_cast(a)); -} -} // namespace detail - -// partially satisfies named requirement BitmaskType -enum class send_flags : int -{ - none = 0, - dontwait = ZMQ_DONTWAIT, - sndmore = ZMQ_SNDMORE -}; - -constexpr send_flags operator|(send_flags a, send_flags b) noexcept -{ - return detail::enum_bit_or(a, b); -} -constexpr send_flags operator&(send_flags a, send_flags b) noexcept -{ - return detail::enum_bit_and(a, b); -} -constexpr send_flags operator^(send_flags a, send_flags b) noexcept -{ - return detail::enum_bit_xor(a, b); -} -constexpr send_flags operator~(send_flags a) noexcept -{ - return detail::enum_bit_not(a); -} - -// partially satisfies named requirement BitmaskType -enum class recv_flags : int -{ - none = 0, - dontwait = ZMQ_DONTWAIT -}; - -constexpr recv_flags operator|(recv_flags a, recv_flags b) noexcept -{ - return detail::enum_bit_or(a, b); -} -constexpr recv_flags operator&(recv_flags a, recv_flags b) noexcept -{ - return detail::enum_bit_and(a, b); -} -constexpr recv_flags operator^(recv_flags a, recv_flags b) noexcept -{ - return detail::enum_bit_xor(a, b); -} -constexpr recv_flags operator~(recv_flags a) noexcept -{ - return detail::enum_bit_not(a); -} - - -// mutable_buffer, const_buffer and buffer are based on -// the Networking TS specification, draft: -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/n4771.pdf - -class mutable_buffer -{ - public: - constexpr mutable_buffer() noexcept : _data(nullptr), _size(0) {} - constexpr mutable_buffer(void *p, size_t n) noexcept : _data(p), _size(n) - { -#ifdef ZMQ_EXTENDED_CONSTEXPR - assert(p != nullptr || n == 0); -#endif - } - - constexpr void *data() const noexcept { return _data; } - constexpr size_t size() const noexcept { return _size; } - mutable_buffer &operator+=(size_t n) noexcept - { - // (std::min) is a workaround for when a min macro is defined - const auto shift = (std::min)(n, _size); - _data = static_cast(_data) + shift; - _size -= shift; - return *this; - } - - private: - void *_data; - size_t _size; -}; - -inline mutable_buffer operator+(const mutable_buffer &mb, size_t n) noexcept -{ - return mutable_buffer(static_cast(mb.data()) + (std::min)(n, mb.size()), - mb.size() - (std::min)(n, mb.size())); -} -inline mutable_buffer operator+(size_t n, const mutable_buffer &mb) noexcept -{ - return mb + n; -} - -class const_buffer -{ - public: - constexpr const_buffer() noexcept : _data(nullptr), _size(0) {} - constexpr const_buffer(const void *p, size_t n) noexcept : _data(p), _size(n) - { -#ifdef ZMQ_EXTENDED_CONSTEXPR - assert(p != nullptr || n == 0); -#endif - } - constexpr const_buffer(const mutable_buffer &mb) noexcept : - _data(mb.data()), _size(mb.size()) - { - } - - constexpr const void *data() const noexcept { return _data; } - constexpr size_t size() const noexcept { return _size; } - const_buffer &operator+=(size_t n) noexcept - { - const auto shift = (std::min)(n, _size); - _data = static_cast(_data) + shift; - _size -= shift; - return *this; - } - - private: - const void *_data; - size_t _size; -}; - -inline const_buffer operator+(const const_buffer &cb, size_t n) noexcept -{ - return const_buffer(static_cast(cb.data()) - + (std::min)(n, cb.size()), - cb.size() - (std::min)(n, cb.size())); -} -inline const_buffer operator+(size_t n, const const_buffer &cb) noexcept -{ - return cb + n; -} - -// buffer creation - -constexpr mutable_buffer buffer(void *p, size_t n) noexcept -{ - return mutable_buffer(p, n); -} -constexpr const_buffer buffer(const void *p, size_t n) noexcept -{ - return const_buffer(p, n); -} -constexpr mutable_buffer buffer(const mutable_buffer &mb) noexcept -{ - return mb; -} -inline mutable_buffer buffer(const mutable_buffer &mb, size_t n) noexcept -{ - return mutable_buffer(mb.data(), (std::min)(mb.size(), n)); -} -constexpr const_buffer buffer(const const_buffer &cb) noexcept -{ - return cb; -} -inline const_buffer buffer(const const_buffer &cb, size_t n) noexcept -{ - return const_buffer(cb.data(), (std::min)(cb.size(), n)); -} - -namespace detail -{ -template struct is_buffer -{ - static constexpr bool value = - std::is_same::value || std::is_same::value; -}; - -template struct is_pod_like -{ - // NOTE: The networking draft N4771 section 16.11 requires - // T in the buffer functions below to be - // trivially copyable OR standard layout. - // Here we decide to be conservative and require both. - static constexpr bool value = - ZMQ_IS_TRIVIALLY_COPYABLE(T) && std::is_standard_layout::value; -}; - -template constexpr auto seq_size(const C &c) noexcept -> decltype(c.size()) -{ - return c.size(); -} -template -constexpr size_t seq_size(const T (&/*array*/)[N]) noexcept -{ - return N; -} - -template -auto buffer_contiguous_sequence(Seq &&seq) noexcept - -> decltype(buffer(std::addressof(*std::begin(seq)), size_t{})) -{ - using T = typename std::remove_cv< - typename std::remove_reference::type>::type; - static_assert(detail::is_pod_like::value, "T must be POD"); - - const auto size = seq_size(seq); - return buffer(size != 0u ? std::addressof(*std::begin(seq)) : nullptr, - size * sizeof(T)); -} -template -auto buffer_contiguous_sequence(Seq &&seq, size_t n_bytes) noexcept - -> decltype(buffer_contiguous_sequence(seq)) -{ - using T = typename std::remove_cv< - typename std::remove_reference::type>::type; - static_assert(detail::is_pod_like::value, "T must be POD"); - - const auto size = seq_size(seq); - return buffer(size != 0u ? std::addressof(*std::begin(seq)) : nullptr, - (std::min)(size * sizeof(T), n_bytes)); -} - -} // namespace detail - -// C array -template mutable_buffer buffer(T (&data)[N]) noexcept -{ - return detail::buffer_contiguous_sequence(data); -} -template -mutable_buffer buffer(T (&data)[N], size_t n_bytes) noexcept -{ - return detail::buffer_contiguous_sequence(data, n_bytes); -} -template const_buffer buffer(const T (&data)[N]) noexcept -{ - return detail::buffer_contiguous_sequence(data); -} -template -const_buffer buffer(const T (&data)[N], size_t n_bytes) noexcept -{ - return detail::buffer_contiguous_sequence(data, n_bytes); -} -// std::array -template mutable_buffer buffer(std::array &data) noexcept -{ - return detail::buffer_contiguous_sequence(data); -} -template -mutable_buffer buffer(std::array &data, size_t n_bytes) noexcept -{ - return detail::buffer_contiguous_sequence(data, n_bytes); -} -template -const_buffer buffer(std::array &data) noexcept -{ - return detail::buffer_contiguous_sequence(data); -} -template -const_buffer buffer(std::array &data, size_t n_bytes) noexcept -{ - return detail::buffer_contiguous_sequence(data, n_bytes); -} -template -const_buffer buffer(const std::array &data) noexcept -{ - return detail::buffer_contiguous_sequence(data); -} -template -const_buffer buffer(const std::array &data, size_t n_bytes) noexcept -{ - return detail::buffer_contiguous_sequence(data, n_bytes); -} -// std::vector -template -mutable_buffer buffer(std::vector &data) noexcept -{ - return detail::buffer_contiguous_sequence(data); -} -template -mutable_buffer buffer(std::vector &data, size_t n_bytes) noexcept -{ - return detail::buffer_contiguous_sequence(data, n_bytes); -} -template -const_buffer buffer(const std::vector &data) noexcept -{ - return detail::buffer_contiguous_sequence(data); -} -template -const_buffer buffer(const std::vector &data, size_t n_bytes) noexcept -{ - return detail::buffer_contiguous_sequence(data, n_bytes); -} -// std::basic_string -template -mutable_buffer buffer(std::basic_string &data) noexcept -{ - return detail::buffer_contiguous_sequence(data); -} -template -mutable_buffer buffer(std::basic_string &data, - size_t n_bytes) noexcept -{ - return detail::buffer_contiguous_sequence(data, n_bytes); -} -template -const_buffer buffer(const std::basic_string &data) noexcept -{ - return detail::buffer_contiguous_sequence(data); -} -template -const_buffer buffer(const std::basic_string &data, - size_t n_bytes) noexcept -{ - return detail::buffer_contiguous_sequence(data, n_bytes); -} - -#if CPPZMQ_HAS_STRING_VIEW -// std::basic_string_view -template -const_buffer buffer(std::basic_string_view data) noexcept -{ - return detail::buffer_contiguous_sequence(data); -} -template -const_buffer buffer(std::basic_string_view data, size_t n_bytes) noexcept -{ - return detail::buffer_contiguous_sequence(data, n_bytes); -} -#endif - -// Buffer for a string literal (null terminated) -// where the buffer size excludes the terminating character. -// Equivalent to zmq::buffer(std::string_view("...")). -template -constexpr const_buffer str_buffer(const Char (&data)[N]) noexcept -{ - static_assert(detail::is_pod_like::value, "Char must be POD"); -#ifdef ZMQ_EXTENDED_CONSTEXPR - assert(data[N - 1] == Char{0}); -#endif - return const_buffer(static_cast(data), (N - 1) * sizeof(Char)); -} - -namespace literals -{ -constexpr const_buffer operator"" _zbuf(const char *str, size_t len) noexcept -{ - return const_buffer(str, len * sizeof(char)); -} -constexpr const_buffer operator"" _zbuf(const wchar_t *str, size_t len) noexcept -{ - return const_buffer(str, len * sizeof(wchar_t)); -} -constexpr const_buffer operator"" _zbuf(const char16_t *str, size_t len) noexcept -{ - return const_buffer(str, len * sizeof(char16_t)); -} -constexpr const_buffer operator"" _zbuf(const char32_t *str, size_t len) noexcept -{ - return const_buffer(str, len * sizeof(char32_t)); -} -} - -#ifdef ZMQ_CPP11 -enum class socket_type : int -{ - req = ZMQ_REQ, - rep = ZMQ_REP, - dealer = ZMQ_DEALER, - router = ZMQ_ROUTER, - pub = ZMQ_PUB, - sub = ZMQ_SUB, - xpub = ZMQ_XPUB, - xsub = ZMQ_XSUB, - push = ZMQ_PUSH, - pull = ZMQ_PULL, -#if defined(ZMQ_BUILD_DRAFT_API) && ZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 2, 0) - server = ZMQ_SERVER, - client = ZMQ_CLIENT, - radio = ZMQ_RADIO, - dish = ZMQ_DISH, - gather = ZMQ_GATHER, - scatter = ZMQ_SCATTER, - dgram = ZMQ_DGRAM, -#endif -#if defined(ZMQ_BUILD_DRAFT_API) && ZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 3, 3) - peer = ZMQ_PEER, - channel = ZMQ_CHANNEL, -#endif -#if ZMQ_VERSION_MAJOR >= 4 - stream = ZMQ_STREAM, -#endif - pair = ZMQ_PAIR -}; -#endif - -namespace sockopt -{ -// There are two types of options, -// integral type with known compiler time size (int, bool, int64_t, uint64_t) -// and arrays with dynamic size (strings, binary data). - -// BoolUnit: if true accepts values of type bool (but passed as T into libzmq) -template struct integral_option -{ -}; - -// NullTerm: -// 0: binary data -// 1: null-terminated string (`getsockopt` size includes null) -// 2: binary (size 32) or Z85 encoder string of size 41 (null included) -template struct array_option -{ -}; - -#define ZMQ_DEFINE_INTEGRAL_OPT(OPT, NAME, TYPE) \ - using NAME##_t = integral_option; \ - ZMQ_INLINE_VAR ZMQ_CONSTEXPR_VAR NAME##_t NAME {} -#define ZMQ_DEFINE_INTEGRAL_BOOL_UNIT_OPT(OPT, NAME, TYPE) \ - using NAME##_t = integral_option; \ - ZMQ_INLINE_VAR ZMQ_CONSTEXPR_VAR NAME##_t NAME {} -#define ZMQ_DEFINE_ARRAY_OPT(OPT, NAME) \ - using NAME##_t = array_option; \ - ZMQ_INLINE_VAR ZMQ_CONSTEXPR_VAR NAME##_t NAME {} -#define ZMQ_DEFINE_ARRAY_OPT_BINARY(OPT, NAME) \ - using NAME##_t = array_option; \ - ZMQ_INLINE_VAR ZMQ_CONSTEXPR_VAR NAME##_t NAME {} -#define ZMQ_DEFINE_ARRAY_OPT_BIN_OR_Z85(OPT, NAME) \ - using NAME##_t = array_option; \ - ZMQ_INLINE_VAR ZMQ_CONSTEXPR_VAR NAME##_t NAME {} - -// deprecated, use zmq::fd_t -using cppzmq_fd_t = ::zmq::fd_t; - -#ifdef ZMQ_AFFINITY -ZMQ_DEFINE_INTEGRAL_OPT(ZMQ_AFFINITY, affinity, uint64_t); -#endif -#ifdef ZMQ_BACKLOG -ZMQ_DEFINE_INTEGRAL_OPT(ZMQ_BACKLOG, backlog, int); -#endif -#ifdef ZMQ_BINDTODEVICE -ZMQ_DEFINE_ARRAY_OPT_BINARY(ZMQ_BINDTODEVICE, bindtodevice); -#endif -#ifdef ZMQ_CONFLATE -ZMQ_DEFINE_INTEGRAL_BOOL_UNIT_OPT(ZMQ_CONFLATE, conflate, int); -#endif -#ifdef ZMQ_CONNECT_ROUTING_ID -ZMQ_DEFINE_ARRAY_OPT(ZMQ_CONNECT_ROUTING_ID, connect_routing_id); -#endif -#ifdef ZMQ_CONNECT_TIMEOUT -ZMQ_DEFINE_INTEGRAL_OPT(ZMQ_CONNECT_TIMEOUT, connect_timeout, int); -#endif -#ifdef ZMQ_CURVE_PUBLICKEY -ZMQ_DEFINE_ARRAY_OPT_BIN_OR_Z85(ZMQ_CURVE_PUBLICKEY, curve_publickey); -#endif -#ifdef ZMQ_CURVE_SECRETKEY -ZMQ_DEFINE_ARRAY_OPT_BIN_OR_Z85(ZMQ_CURVE_SECRETKEY, curve_secretkey); -#endif -#ifdef ZMQ_CURVE_SERVER -ZMQ_DEFINE_INTEGRAL_BOOL_UNIT_OPT(ZMQ_CURVE_SERVER, curve_server, int); -#endif -#ifdef ZMQ_CURVE_SERVERKEY -ZMQ_DEFINE_ARRAY_OPT_BIN_OR_Z85(ZMQ_CURVE_SERVERKEY, curve_serverkey); -#endif -#ifdef ZMQ_EVENTS -ZMQ_DEFINE_INTEGRAL_OPT(ZMQ_EVENTS, events, int); -#endif -#ifdef ZMQ_FD -ZMQ_DEFINE_INTEGRAL_OPT(ZMQ_FD, fd, ::zmq::fd_t); -#endif -#ifdef ZMQ_GSSAPI_PLAINTEXT -ZMQ_DEFINE_INTEGRAL_BOOL_UNIT_OPT(ZMQ_GSSAPI_PLAINTEXT, gssapi_plaintext, int); -#endif -#ifdef ZMQ_GSSAPI_SERVER -ZMQ_DEFINE_INTEGRAL_BOOL_UNIT_OPT(ZMQ_GSSAPI_SERVER, gssapi_server, int); -#endif -#ifdef ZMQ_GSSAPI_SERVICE_PRINCIPAL -ZMQ_DEFINE_ARRAY_OPT(ZMQ_GSSAPI_SERVICE_PRINCIPAL, gssapi_service_principal); -#endif -#ifdef ZMQ_GSSAPI_SERVICE_PRINCIPAL_NAMETYPE -ZMQ_DEFINE_INTEGRAL_OPT(ZMQ_GSSAPI_SERVICE_PRINCIPAL_NAMETYPE, - gssapi_service_principal_nametype, - int); -#endif -#ifdef ZMQ_GSSAPI_PRINCIPAL -ZMQ_DEFINE_ARRAY_OPT(ZMQ_GSSAPI_PRINCIPAL, gssapi_principal); -#endif -#ifdef ZMQ_GSSAPI_PRINCIPAL_NAMETYPE -ZMQ_DEFINE_INTEGRAL_OPT(ZMQ_GSSAPI_PRINCIPAL_NAMETYPE, - gssapi_principal_nametype, - int); -#endif -#ifdef ZMQ_HANDSHAKE_IVL -ZMQ_DEFINE_INTEGRAL_OPT(ZMQ_HANDSHAKE_IVL, handshake_ivl, int); -#endif -#ifdef ZMQ_HEARTBEAT_IVL -ZMQ_DEFINE_INTEGRAL_OPT(ZMQ_HEARTBEAT_IVL, heartbeat_ivl, int); -#endif -#ifdef ZMQ_HEARTBEAT_TIMEOUT -ZMQ_DEFINE_INTEGRAL_OPT(ZMQ_HEARTBEAT_TIMEOUT, heartbeat_timeout, int); -#endif -#ifdef ZMQ_HEARTBEAT_TTL -ZMQ_DEFINE_INTEGRAL_OPT(ZMQ_HEARTBEAT_TTL, heartbeat_ttl, int); -#endif -#ifdef ZMQ_IMMEDIATE -ZMQ_DEFINE_INTEGRAL_BOOL_UNIT_OPT(ZMQ_IMMEDIATE, immediate, int); -#endif -#ifdef ZMQ_INVERT_MATCHING -ZMQ_DEFINE_INTEGRAL_BOOL_UNIT_OPT(ZMQ_INVERT_MATCHING, invert_matching, int); -#endif -#ifdef ZMQ_IPV6 -ZMQ_DEFINE_INTEGRAL_BOOL_UNIT_OPT(ZMQ_IPV6, ipv6, int); -#endif -#ifdef ZMQ_LAST_ENDPOINT -ZMQ_DEFINE_ARRAY_OPT(ZMQ_LAST_ENDPOINT, last_endpoint); -#endif -#ifdef ZMQ_LINGER -ZMQ_DEFINE_INTEGRAL_OPT(ZMQ_LINGER, linger, int); -#endif -#ifdef ZMQ_MAXMSGSIZE -ZMQ_DEFINE_INTEGRAL_OPT(ZMQ_MAXMSGSIZE, maxmsgsize, int64_t); -#endif -#ifdef ZMQ_MECHANISM -ZMQ_DEFINE_INTEGRAL_OPT(ZMQ_MECHANISM, mechanism, int); -#endif -#ifdef ZMQ_METADATA -ZMQ_DEFINE_ARRAY_OPT(ZMQ_METADATA, metadata); -#endif -#ifdef ZMQ_MULTICAST_HOPS -ZMQ_DEFINE_INTEGRAL_OPT(ZMQ_MULTICAST_HOPS, multicast_hops, int); -#endif -#ifdef ZMQ_MULTICAST_LOOP -ZMQ_DEFINE_INTEGRAL_BOOL_UNIT_OPT(ZMQ_MULTICAST_LOOP, multicast_loop, int); -#endif -#ifdef ZMQ_MULTICAST_MAXTPDU -ZMQ_DEFINE_INTEGRAL_OPT(ZMQ_MULTICAST_MAXTPDU, multicast_maxtpdu, int); -#endif -#ifdef ZMQ_ONLY_FIRST_SUBSCRIBE -ZMQ_DEFINE_INTEGRAL_BOOL_UNIT_OPT(ZMQ_ONLY_FIRST_SUBSCRIBE, only_first_subscribe, int); -#endif -#ifdef ZMQ_PLAIN_SERVER -ZMQ_DEFINE_INTEGRAL_BOOL_UNIT_OPT(ZMQ_PLAIN_SERVER, plain_server, int); -#endif -#ifdef ZMQ_PLAIN_PASSWORD -ZMQ_DEFINE_ARRAY_OPT(ZMQ_PLAIN_PASSWORD, plain_password); -#endif -#ifdef ZMQ_PLAIN_USERNAME -ZMQ_DEFINE_ARRAY_OPT(ZMQ_PLAIN_USERNAME, plain_username); -#endif -#ifdef ZMQ_USE_FD -ZMQ_DEFINE_INTEGRAL_OPT(ZMQ_USE_FD, use_fd, int); -#endif -#ifdef ZMQ_PROBE_ROUTER -ZMQ_DEFINE_INTEGRAL_BOOL_UNIT_OPT(ZMQ_PROBE_ROUTER, probe_router, int); -#endif -#ifdef ZMQ_RATE -ZMQ_DEFINE_INTEGRAL_OPT(ZMQ_RATE, rate, int); -#endif -#ifdef ZMQ_RCVBUF -ZMQ_DEFINE_INTEGRAL_OPT(ZMQ_RCVBUF, rcvbuf, int); -#endif -#ifdef ZMQ_RCVHWM -ZMQ_DEFINE_INTEGRAL_OPT(ZMQ_RCVHWM, rcvhwm, int); -#endif -#ifdef ZMQ_RCVMORE -ZMQ_DEFINE_INTEGRAL_BOOL_UNIT_OPT(ZMQ_RCVMORE, rcvmore, int); -#endif -#ifdef ZMQ_RCVTIMEO -ZMQ_DEFINE_INTEGRAL_OPT(ZMQ_RCVTIMEO, rcvtimeo, int); -#endif -#ifdef ZMQ_RECONNECT_IVL -ZMQ_DEFINE_INTEGRAL_OPT(ZMQ_RECONNECT_IVL, reconnect_ivl, int); -#endif -#ifdef ZMQ_RECONNECT_IVL_MAX -ZMQ_DEFINE_INTEGRAL_OPT(ZMQ_RECONNECT_IVL_MAX, reconnect_ivl_max, int); -#endif -#ifdef ZMQ_RECOVERY_IVL -ZMQ_DEFINE_INTEGRAL_OPT(ZMQ_RECOVERY_IVL, recovery_ivl, int); -#endif -#ifdef ZMQ_REQ_CORRELATE -ZMQ_DEFINE_INTEGRAL_BOOL_UNIT_OPT(ZMQ_REQ_CORRELATE, req_correlate, int); -#endif -#ifdef ZMQ_REQ_RELAXED -ZMQ_DEFINE_INTEGRAL_BOOL_UNIT_OPT(ZMQ_REQ_RELAXED, req_relaxed, int); -#endif -#ifdef ZMQ_ROUTER_HANDOVER -ZMQ_DEFINE_INTEGRAL_BOOL_UNIT_OPT(ZMQ_ROUTER_HANDOVER, router_handover, int); -#endif -#ifdef ZMQ_ROUTER_MANDATORY -ZMQ_DEFINE_INTEGRAL_BOOL_UNIT_OPT(ZMQ_ROUTER_MANDATORY, router_mandatory, int); -#endif -#ifdef ZMQ_ROUTER_NOTIFY -ZMQ_DEFINE_INTEGRAL_OPT(ZMQ_ROUTER_NOTIFY, router_notify, int); -#endif -#ifdef ZMQ_ROUTING_ID -ZMQ_DEFINE_ARRAY_OPT_BINARY(ZMQ_ROUTING_ID, routing_id); -#endif -#ifdef ZMQ_SNDBUF -ZMQ_DEFINE_INTEGRAL_OPT(ZMQ_SNDBUF, sndbuf, int); -#endif -#ifdef ZMQ_SNDHWM -ZMQ_DEFINE_INTEGRAL_OPT(ZMQ_SNDHWM, sndhwm, int); -#endif -#ifdef ZMQ_SNDTIMEO -ZMQ_DEFINE_INTEGRAL_OPT(ZMQ_SNDTIMEO, sndtimeo, int); -#endif -#ifdef ZMQ_SOCKS_PROXY -ZMQ_DEFINE_ARRAY_OPT(ZMQ_SOCKS_PROXY, socks_proxy); -#endif -#ifdef ZMQ_STREAM_NOTIFY -ZMQ_DEFINE_INTEGRAL_BOOL_UNIT_OPT(ZMQ_STREAM_NOTIFY, stream_notify, int); -#endif -#ifdef ZMQ_SUBSCRIBE -ZMQ_DEFINE_ARRAY_OPT(ZMQ_SUBSCRIBE, subscribe); -#endif -#ifdef ZMQ_TCP_KEEPALIVE -ZMQ_DEFINE_INTEGRAL_OPT(ZMQ_TCP_KEEPALIVE, tcp_keepalive, int); -#endif -#ifdef ZMQ_TCP_KEEPALIVE_CNT -ZMQ_DEFINE_INTEGRAL_OPT(ZMQ_TCP_KEEPALIVE_CNT, tcp_keepalive_cnt, int); -#endif -#ifdef ZMQ_TCP_KEEPALIVE_IDLE -ZMQ_DEFINE_INTEGRAL_OPT(ZMQ_TCP_KEEPALIVE_IDLE, tcp_keepalive_idle, int); -#endif -#ifdef ZMQ_TCP_KEEPALIVE_INTVL -ZMQ_DEFINE_INTEGRAL_OPT(ZMQ_TCP_KEEPALIVE_INTVL, tcp_keepalive_intvl, int); -#endif -#ifdef ZMQ_TCP_MAXRT -ZMQ_DEFINE_INTEGRAL_OPT(ZMQ_TCP_MAXRT, tcp_maxrt, int); -#endif -#ifdef ZMQ_THREAD_SAFE -ZMQ_DEFINE_INTEGRAL_BOOL_UNIT_OPT(ZMQ_THREAD_SAFE, thread_safe, int); -#endif -#ifdef ZMQ_TOS -ZMQ_DEFINE_INTEGRAL_OPT(ZMQ_TOS, tos, int); -#endif -#ifdef ZMQ_TYPE -ZMQ_DEFINE_INTEGRAL_OPT(ZMQ_TYPE, type, int); -#ifdef ZMQ_CPP11 -ZMQ_DEFINE_INTEGRAL_OPT(ZMQ_TYPE, socket_type, socket_type); -#endif // ZMQ_CPP11 -#endif // ZMQ_TYPE -#ifdef ZMQ_UNSUBSCRIBE -ZMQ_DEFINE_ARRAY_OPT(ZMQ_UNSUBSCRIBE, unsubscribe); -#endif -#ifdef ZMQ_VMCI_BUFFER_SIZE -ZMQ_DEFINE_INTEGRAL_OPT(ZMQ_VMCI_BUFFER_SIZE, vmci_buffer_size, uint64_t); -#endif -#ifdef ZMQ_VMCI_BUFFER_MIN_SIZE -ZMQ_DEFINE_INTEGRAL_OPT(ZMQ_VMCI_BUFFER_MIN_SIZE, vmci_buffer_min_size, uint64_t); -#endif -#ifdef ZMQ_VMCI_BUFFER_MAX_SIZE -ZMQ_DEFINE_INTEGRAL_OPT(ZMQ_VMCI_BUFFER_MAX_SIZE, vmci_buffer_max_size, uint64_t); -#endif -#ifdef ZMQ_VMCI_CONNECT_TIMEOUT -ZMQ_DEFINE_INTEGRAL_OPT(ZMQ_VMCI_CONNECT_TIMEOUT, vmci_connect_timeout, int); -#endif -#ifdef ZMQ_XPUB_VERBOSE -ZMQ_DEFINE_INTEGRAL_BOOL_UNIT_OPT(ZMQ_XPUB_VERBOSE, xpub_verbose, int); -#endif -#ifdef ZMQ_XPUB_VERBOSER -ZMQ_DEFINE_INTEGRAL_BOOL_UNIT_OPT(ZMQ_XPUB_VERBOSER, xpub_verboser, int); -#endif -#ifdef ZMQ_XPUB_MANUAL -ZMQ_DEFINE_INTEGRAL_BOOL_UNIT_OPT(ZMQ_XPUB_MANUAL, xpub_manual, int); -#endif -#ifdef ZMQ_XPUB_NODROP -ZMQ_DEFINE_INTEGRAL_BOOL_UNIT_OPT(ZMQ_XPUB_NODROP, xpub_nodrop, int); -#endif -#ifdef ZMQ_XPUB_WELCOME_MSG -ZMQ_DEFINE_ARRAY_OPT(ZMQ_XPUB_WELCOME_MSG, xpub_welcome_msg); -#endif -#ifdef ZMQ_ZAP_ENFORCE_DOMAIN -ZMQ_DEFINE_INTEGRAL_BOOL_UNIT_OPT(ZMQ_ZAP_ENFORCE_DOMAIN, zap_enforce_domain, int); -#endif -#ifdef ZMQ_ZAP_DOMAIN -ZMQ_DEFINE_ARRAY_OPT(ZMQ_ZAP_DOMAIN, zap_domain); -#endif - -} // namespace sockopt -#endif // ZMQ_CPP11 - - -namespace detail -{ -class socket_base -{ - public: - socket_base() ZMQ_NOTHROW : _handle(ZMQ_NULLPTR) {} - ZMQ_EXPLICIT socket_base(void *handle) ZMQ_NOTHROW : _handle(handle) {} - - template - ZMQ_CPP11_DEPRECATED("from 4.7.0, use `set` taking option from zmq::sockopt") - void setsockopt(int option_, T const &optval) - { - setsockopt(option_, &optval, sizeof(T)); - } - - ZMQ_CPP11_DEPRECATED("from 4.7.0, use `set` taking option from zmq::sockopt") - void setsockopt(int option_, const void *optval_, size_t optvallen_) - { - int rc = zmq_setsockopt(_handle, option_, optval_, optvallen_); - if (rc != 0) - throw error_t(); - } - - ZMQ_CPP11_DEPRECATED("from 4.7.0, use `get` taking option from zmq::sockopt") - void getsockopt(int option_, void *optval_, size_t *optvallen_) const - { - int rc = zmq_getsockopt(_handle, option_, optval_, optvallen_); - if (rc != 0) - throw error_t(); - } - - template - ZMQ_CPP11_DEPRECATED("from 4.7.0, use `get` taking option from zmq::sockopt") - T getsockopt(int option_) const - { - T optval; - size_t optlen = sizeof(T); - getsockopt(option_, &optval, &optlen); - return optval; - } - -#ifdef ZMQ_CPP11 - // Set integral socket option, e.g. - // `socket.set(zmq::sockopt::linger, 0)` - template - void set(sockopt::integral_option, const T &val) - { - static_assert(std::is_integral::value, "T must be integral"); - set_option(Opt, &val, sizeof val); - } - - // Set integral socket option from boolean, e.g. - // `socket.set(zmq::sockopt::immediate, false)` - template - void set(sockopt::integral_option, bool val) - { - static_assert(std::is_integral::value, "T must be integral"); - T rep_val = val; - set_option(Opt, &rep_val, sizeof rep_val); - } - - // Set array socket option, e.g. - // `socket.set(zmq::sockopt::plain_username, "foo123")` - template - void set(sockopt::array_option, const char *buf) - { - set_option(Opt, buf, std::strlen(buf)); - } - - // Set array socket option, e.g. - // `socket.set(zmq::sockopt::routing_id, zmq::buffer(id))` - template - void set(sockopt::array_option, const_buffer buf) - { - set_option(Opt, buf.data(), buf.size()); - } - - // Set array socket option, e.g. - // `socket.set(zmq::sockopt::routing_id, id_str)` - template - void set(sockopt::array_option, const std::string &buf) - { - set_option(Opt, buf.data(), buf.size()); - } - -#if CPPZMQ_HAS_STRING_VIEW - // Set array socket option, e.g. - // `socket.set(zmq::sockopt::routing_id, id_str)` - template - void set(sockopt::array_option, std::string_view buf) - { - set_option(Opt, buf.data(), buf.size()); - } -#endif - - // Get scalar socket option, e.g. - // `auto opt = socket.get(zmq::sockopt::linger)` - template - ZMQ_NODISCARD T get(sockopt::integral_option) const - { - static_assert(std::is_scalar::value, "T must be scalar"); - T val; - size_t size = sizeof val; - get_option(Opt, &val, &size); - assert(size == sizeof val); - return val; - } - - // Get array socket option, writes to buf, returns option size in bytes, e.g. - // `size_t optsize = socket.get(zmq::sockopt::routing_id, zmq::buffer(id))` - template - ZMQ_NODISCARD size_t get(sockopt::array_option, - mutable_buffer buf) const - { - size_t size = buf.size(); - get_option(Opt, buf.data(), &size); - return size; - } - - // Get array socket option as string (initializes the string buffer size to init_size) e.g. - // `auto s = socket.get(zmq::sockopt::routing_id)` - // Note: removes the null character from null-terminated string options, - // i.e. the string size excludes the null character. - template - ZMQ_NODISCARD std::string get(sockopt::array_option, - size_t init_size = 1024) const - { - if ZMQ_CONSTEXPR_IF (NullTerm == 2) { - if (init_size == 1024) { - init_size = 41; // get as Z85 string - } - } - std::string str(init_size, '\0'); - size_t size = get(sockopt::array_option{}, buffer(str)); - if ZMQ_CONSTEXPR_IF (NullTerm == 1) { - if (size > 0) { - assert(str[size - 1] == '\0'); - --size; - } - } else if ZMQ_CONSTEXPR_IF (NullTerm == 2) { - assert(size == 32 || size == 41); - if (size == 41) { - assert(str[size - 1] == '\0'); - --size; - } - } - str.resize(size); - return str; - } -#endif - - void bind(std::string const &addr) { bind(addr.c_str()); } - - void bind(const char *addr_) - { - int rc = zmq_bind(_handle, addr_); - if (rc != 0) - throw error_t(); - } - - void unbind(std::string const &addr) { unbind(addr.c_str()); } - - void unbind(const char *addr_) - { - int rc = zmq_unbind(_handle, addr_); - if (rc != 0) - throw error_t(); - } - - void connect(std::string const &addr) { connect(addr.c_str()); } - - void connect(const char *addr_) - { - int rc = zmq_connect(_handle, addr_); - if (rc != 0) - throw error_t(); - } - - void disconnect(std::string const &addr) { disconnect(addr.c_str()); } - - void disconnect(const char *addr_) - { - int rc = zmq_disconnect(_handle, addr_); - if (rc != 0) - throw error_t(); - } - - ZMQ_DEPRECATED("from 4.7.1, use handle() != nullptr or operator bool") - bool connected() const ZMQ_NOTHROW { return (_handle != ZMQ_NULLPTR); } - - ZMQ_CPP11_DEPRECATED("from 4.3.1, use send taking a const_buffer and send_flags") - size_t send(const void *buf_, size_t len_, int flags_ = 0) - { - int nbytes = zmq_send(_handle, buf_, len_, flags_); - if (nbytes >= 0) - return static_cast(nbytes); - if (zmq_errno() == EAGAIN) - return 0; - throw error_t(); - } - - ZMQ_CPP11_DEPRECATED("from 4.3.1, use send taking message_t and send_flags") - bool send(message_t &msg_, - int flags_ = 0) // default until removed - { - int nbytes = zmq_msg_send(msg_.handle(), _handle, flags_); - if (nbytes >= 0) - return true; - if (zmq_errno() == EAGAIN) - return false; - throw error_t(); - } - - template - ZMQ_CPP11_DEPRECATED( - "from 4.4.1, use send taking message_t or buffer (for contiguous " - "ranges), and send_flags") - bool send(T first, T last, int flags_ = 0) - { - zmq::message_t msg(first, last); - int nbytes = zmq_msg_send(msg.handle(), _handle, flags_); - if (nbytes >= 0) - return true; - if (zmq_errno() == EAGAIN) - return false; - throw error_t(); - } - -#ifdef ZMQ_HAS_RVALUE_REFS - ZMQ_CPP11_DEPRECATED("from 4.3.1, use send taking message_t and send_flags") - bool send(message_t &&msg_, - int flags_ = 0) // default until removed - { -#ifdef ZMQ_CPP11 - return send(msg_, static_cast(flags_)).has_value(); -#else - return send(msg_, flags_); -#endif - } -#endif - -#ifdef ZMQ_CPP11 - send_result_t send(const_buffer buf, send_flags flags = send_flags::none) - { - const int nbytes = - zmq_send(_handle, buf.data(), buf.size(), static_cast(flags)); - if (nbytes >= 0) - return static_cast(nbytes); - if (zmq_errno() == EAGAIN) - return {}; - throw error_t(); - } - - send_result_t send(message_t &msg, send_flags flags) - { - int nbytes = zmq_msg_send(msg.handle(), _handle, static_cast(flags)); - if (nbytes >= 0) - return static_cast(nbytes); - if (zmq_errno() == EAGAIN) - return {}; - throw error_t(); - } - - send_result_t send(message_t &&msg, send_flags flags) - { - return send(msg, flags); - } -#endif - - ZMQ_CPP11_DEPRECATED( - "from 4.3.1, use recv taking a mutable_buffer and recv_flags") - size_t recv(void *buf_, size_t len_, int flags_ = 0) - { - int nbytes = zmq_recv(_handle, buf_, len_, flags_); - if (nbytes >= 0) - return static_cast(nbytes); - if (zmq_errno() == EAGAIN) - return 0; - throw error_t(); - } - - ZMQ_CPP11_DEPRECATED( - "from 4.3.1, use recv taking a reference to message_t and recv_flags") - bool recv(message_t *msg_, int flags_ = 0) - { - int nbytes = zmq_msg_recv(msg_->handle(), _handle, flags_); - if (nbytes >= 0) - return true; - if (zmq_errno() == EAGAIN) - return false; - throw error_t(); - } - -#ifdef ZMQ_CPP11 - ZMQ_NODISCARD - recv_buffer_result_t recv(mutable_buffer buf, - recv_flags flags = recv_flags::none) - { - const int nbytes = - zmq_recv(_handle, buf.data(), buf.size(), static_cast(flags)); - if (nbytes >= 0) { - return recv_buffer_size{ - (std::min)(static_cast(nbytes), buf.size()), - static_cast(nbytes)}; - } - if (zmq_errno() == EAGAIN) - return {}; - throw error_t(); - } - - ZMQ_NODISCARD - recv_result_t recv(message_t &msg, recv_flags flags = recv_flags::none) - { - const int nbytes = - zmq_msg_recv(msg.handle(), _handle, static_cast(flags)); - if (nbytes >= 0) { - assert(msg.size() == static_cast(nbytes)); - return static_cast(nbytes); - } - if (zmq_errno() == EAGAIN) - return {}; - throw error_t(); - } -#endif - -#if defined(ZMQ_BUILD_DRAFT_API) && ZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 2, 0) - void join(const char *group) - { - int rc = zmq_join(_handle, group); - if (rc != 0) - throw error_t(); - } - - void leave(const char *group) - { - int rc = zmq_leave(_handle, group); - if (rc != 0) - throw error_t(); - } -#endif - - ZMQ_NODISCARD void *handle() ZMQ_NOTHROW { return _handle; } - ZMQ_NODISCARD const void *handle() const ZMQ_NOTHROW { return _handle; } - - ZMQ_EXPLICIT operator bool() const ZMQ_NOTHROW { return _handle != ZMQ_NULLPTR; } - // note: non-const operator bool can be removed once - // operator void* is removed from socket_t - ZMQ_EXPLICIT operator bool() ZMQ_NOTHROW { return _handle != ZMQ_NULLPTR; } - - protected: - void *_handle; - - private: - void set_option(int option_, const void *optval_, size_t optvallen_) - { - int rc = zmq_setsockopt(_handle, option_, optval_, optvallen_); - if (rc != 0) - throw error_t(); - } - - void get_option(int option_, void *optval_, size_t *optvallen_) const - { - int rc = zmq_getsockopt(_handle, option_, optval_, optvallen_); - if (rc != 0) - throw error_t(); - } -}; -} // namespace detail - -struct from_handle_t -{ - struct _private - { - }; // disabling use other than with from_handle - ZMQ_CONSTEXPR_FN ZMQ_EXPLICIT from_handle_t(_private /*p*/) ZMQ_NOTHROW {} -}; - -ZMQ_CONSTEXPR_VAR from_handle_t from_handle = - from_handle_t(from_handle_t::_private()); - -// A non-owning nullable reference to a socket. -// The reference is invalidated on socket close or destruction. -class socket_ref : public detail::socket_base -{ - public: - socket_ref() ZMQ_NOTHROW : detail::socket_base() {} -#ifdef ZMQ_CPP11 - socket_ref(std::nullptr_t) ZMQ_NOTHROW : detail::socket_base() {} -#endif - socket_ref(from_handle_t /*fh*/, void *handle) ZMQ_NOTHROW - : detail::socket_base(handle) - { - } -}; - -#ifdef ZMQ_CPP11 -inline bool operator==(socket_ref sr, std::nullptr_t /*p*/) ZMQ_NOTHROW -{ - return sr.handle() == nullptr; -} -inline bool operator==(std::nullptr_t /*p*/, socket_ref sr) ZMQ_NOTHROW -{ - return sr.handle() == nullptr; -} -inline bool operator!=(socket_ref sr, std::nullptr_t /*p*/) ZMQ_NOTHROW -{ - return !(sr == nullptr); -} -inline bool operator!=(std::nullptr_t /*p*/, socket_ref sr) ZMQ_NOTHROW -{ - return !(sr == nullptr); -} -#endif - -inline bool operator==(const detail::socket_base& a, const detail::socket_base& b) ZMQ_NOTHROW -{ - return std::equal_to()(a.handle(), b.handle()); -} -inline bool operator!=(const detail::socket_base& a, const detail::socket_base& b) ZMQ_NOTHROW -{ - return !(a == b); -} -inline bool operator<(const detail::socket_base& a, const detail::socket_base& b) ZMQ_NOTHROW -{ - return std::less()(a.handle(), b.handle()); -} -inline bool operator>(const detail::socket_base& a, const detail::socket_base& b) ZMQ_NOTHROW -{ - return b < a; -} -inline bool operator<=(const detail::socket_base& a, const detail::socket_base& b) ZMQ_NOTHROW -{ - return !(a > b); -} -inline bool operator>=(const detail::socket_base& a, const detail::socket_base& b) ZMQ_NOTHROW -{ - return !(a < b); -} - -} // namespace zmq - -#ifdef ZMQ_CPP11 -namespace std -{ -template<> struct hash -{ - size_t operator()(zmq::socket_ref sr) const ZMQ_NOTHROW - { - return hash()(sr.handle()); - } -}; -} // namespace std -#endif - -namespace zmq -{ -class socket_t : public detail::socket_base -{ - friend class monitor_t; - - public: - socket_t() ZMQ_NOTHROW : detail::socket_base(ZMQ_NULLPTR), ctxptr(ZMQ_NULLPTR) {} - - socket_t(context_t &context_, int type_) : - detail::socket_base(zmq_socket(context_.handle(), type_)), - ctxptr(context_.handle()) - { - if (_handle == ZMQ_NULLPTR) - throw error_t(); - } - -#ifdef ZMQ_CPP11 - socket_t(context_t &context_, socket_type type_) : - socket_t(context_, static_cast(type_)) - { - } -#endif - -#ifdef ZMQ_HAS_RVALUE_REFS - socket_t(socket_t &&rhs) ZMQ_NOTHROW : detail::socket_base(rhs._handle), - ctxptr(rhs.ctxptr) - { - rhs._handle = ZMQ_NULLPTR; - rhs.ctxptr = ZMQ_NULLPTR; - } - socket_t &operator=(socket_t &&rhs) ZMQ_NOTHROW - { - close(); - std::swap(_handle, rhs._handle); - std::swap(ctxptr, rhs.ctxptr); - return *this; - } -#endif - - ~socket_t() ZMQ_NOTHROW { close(); } - - operator void *() ZMQ_NOTHROW { return _handle; } - - operator void const *() const ZMQ_NOTHROW { return _handle; } - - void close() ZMQ_NOTHROW - { - if (_handle == ZMQ_NULLPTR) - // already closed - return; - int rc = zmq_close(_handle); - ZMQ_ASSERT(rc == 0); - _handle = ZMQ_NULLPTR; - ctxptr = ZMQ_NULLPTR; - } - - void swap(socket_t &other) ZMQ_NOTHROW - { - std::swap(_handle, other._handle); - std::swap(ctxptr, other.ctxptr); - } - - operator socket_ref() ZMQ_NOTHROW { return socket_ref(from_handle, _handle); } - - private: - void *ctxptr; - - socket_t(const socket_t &) ZMQ_DELETED_FUNCTION; - void operator=(const socket_t &) ZMQ_DELETED_FUNCTION; - - // used by monitor_t - socket_t(void *context_, int type_) : - detail::socket_base(zmq_socket(context_, type_)), ctxptr(context_) - { - if (_handle == ZMQ_NULLPTR) - throw error_t(); - if (ctxptr == ZMQ_NULLPTR) - throw error_t(); - } -}; - -inline void swap(socket_t &a, socket_t &b) ZMQ_NOTHROW -{ - a.swap(b); -} - -ZMQ_DEPRECATED("from 4.3.1, use proxy taking socket_t objects") -inline void proxy(void *frontend, void *backend, void *capture) -{ - int rc = zmq_proxy(frontend, backend, capture); - if (rc != 0) - throw error_t(); -} - -inline void -proxy(socket_ref frontend, socket_ref backend, socket_ref capture = socket_ref()) -{ - int rc = zmq_proxy(frontend.handle(), backend.handle(), capture.handle()); - if (rc != 0) - throw error_t(); -} - -#ifdef ZMQ_HAS_PROXY_STEERABLE -ZMQ_DEPRECATED("from 4.3.1, use proxy_steerable taking socket_t objects") -inline void -proxy_steerable(void *frontend, void *backend, void *capture, void *control) -{ - int rc = zmq_proxy_steerable(frontend, backend, capture, control); - if (rc != 0) - throw error_t(); -} - -inline void proxy_steerable(socket_ref frontend, - socket_ref backend, - socket_ref capture, - socket_ref control) -{ - int rc = zmq_proxy_steerable(frontend.handle(), backend.handle(), - capture.handle(), control.handle()); - if (rc != 0) - throw error_t(); -} -#endif - -class monitor_t -{ - public: - monitor_t() : _socket(), _monitor_socket() {} - - virtual ~monitor_t() { close(); } - -#ifdef ZMQ_HAS_RVALUE_REFS - monitor_t(monitor_t &&rhs) ZMQ_NOTHROW : _socket(), _monitor_socket() - { - std::swap(_socket, rhs._socket); - std::swap(_monitor_socket, rhs._monitor_socket); - } - - monitor_t &operator=(monitor_t &&rhs) ZMQ_NOTHROW - { - close(); - _socket = socket_ref(); - std::swap(_socket, rhs._socket); - std::swap(_monitor_socket, rhs._monitor_socket); - return *this; - } -#endif - - - void - monitor(socket_t &socket, std::string const &addr, int events = ZMQ_EVENT_ALL) - { - monitor(socket, addr.c_str(), events); - } - - void monitor(socket_t &socket, const char *addr_, int events = ZMQ_EVENT_ALL) - { - init(socket, addr_, events); - while (true) { - check_event(-1); - } - } - - void init(socket_t &socket, std::string const &addr, int events = ZMQ_EVENT_ALL) - { - init(socket, addr.c_str(), events); - } - - void init(socket_t &socket, const char *addr_, int events = ZMQ_EVENT_ALL) - { - int rc = zmq_socket_monitor(socket.handle(), addr_, events); - if (rc != 0) - throw error_t(); - - _socket = socket; - _monitor_socket = socket_t(socket.ctxptr, ZMQ_PAIR); - _monitor_socket.connect(addr_); - - on_monitor_started(); - } - - bool check_event(int timeout = 0) - { - assert(_monitor_socket); - - zmq::message_t eventMsg; - - zmq::pollitem_t items[] = { - {_monitor_socket.handle(), 0, ZMQ_POLLIN, 0}, - }; - - #ifdef ZMQ_CPP11 - zmq::poll(&items[0], 1, std::chrono::milliseconds(timeout)); - #else - zmq::poll(&items[0], 1, timeout); - #endif - - if (items[0].revents & ZMQ_POLLIN) { - int rc = zmq_msg_recv(eventMsg.handle(), _monitor_socket.handle(), 0); - if (rc == -1 && zmq_errno() == ETERM) - return false; - assert(rc != -1); - - } else { - return false; - } - -#if ZMQ_VERSION_MAJOR >= 4 - const char *data = static_cast(eventMsg.data()); - zmq_event_t msgEvent; - memcpy(&msgEvent.event, data, sizeof(uint16_t)); - data += sizeof(uint16_t); - memcpy(&msgEvent.value, data, sizeof(int32_t)); - zmq_event_t *event = &msgEvent; -#else - zmq_event_t *event = static_cast(eventMsg.data()); -#endif - -#ifdef ZMQ_NEW_MONITOR_EVENT_LAYOUT - zmq::message_t addrMsg; - int rc = zmq_msg_recv(addrMsg.handle(), _monitor_socket.handle(), 0); - if (rc == -1 && zmq_errno() == ETERM) { - return false; - } - - assert(rc != -1); - std::string address = addrMsg.to_string(); -#else - // Bit of a hack, but all events in the zmq_event_t union have the same layout so this will work for all event types. - std::string address = event->data.connected.addr; -#endif - -#ifdef ZMQ_EVENT_MONITOR_STOPPED - if (event->event == ZMQ_EVENT_MONITOR_STOPPED) { - return false; - } - -#endif - - switch (event->event) { - case ZMQ_EVENT_CONNECTED: - on_event_connected(*event, address.c_str()); - break; - case ZMQ_EVENT_CONNECT_DELAYED: - on_event_connect_delayed(*event, address.c_str()); - break; - case ZMQ_EVENT_CONNECT_RETRIED: - on_event_connect_retried(*event, address.c_str()); - break; - case ZMQ_EVENT_LISTENING: - on_event_listening(*event, address.c_str()); - break; - case ZMQ_EVENT_BIND_FAILED: - on_event_bind_failed(*event, address.c_str()); - break; - case ZMQ_EVENT_ACCEPTED: - on_event_accepted(*event, address.c_str()); - break; - case ZMQ_EVENT_ACCEPT_FAILED: - on_event_accept_failed(*event, address.c_str()); - break; - case ZMQ_EVENT_CLOSED: - on_event_closed(*event, address.c_str()); - break; - case ZMQ_EVENT_CLOSE_FAILED: - on_event_close_failed(*event, address.c_str()); - break; - case ZMQ_EVENT_DISCONNECTED: - on_event_disconnected(*event, address.c_str()); - break; -#if ZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 3, 0) || (defined(ZMQ_BUILD_DRAFT_API) && ZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 2, 3)) - case ZMQ_EVENT_HANDSHAKE_FAILED_NO_DETAIL: - on_event_handshake_failed_no_detail(*event, address.c_str()); - break; - case ZMQ_EVENT_HANDSHAKE_FAILED_PROTOCOL: - on_event_handshake_failed_protocol(*event, address.c_str()); - break; - case ZMQ_EVENT_HANDSHAKE_FAILED_AUTH: - on_event_handshake_failed_auth(*event, address.c_str()); - break; - case ZMQ_EVENT_HANDSHAKE_SUCCEEDED: - on_event_handshake_succeeded(*event, address.c_str()); - break; -#elif defined(ZMQ_BUILD_DRAFT_API) && ZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 2, 1) - case ZMQ_EVENT_HANDSHAKE_FAILED: - on_event_handshake_failed(*event, address.c_str()); - break; - case ZMQ_EVENT_HANDSHAKE_SUCCEED: - on_event_handshake_succeed(*event, address.c_str()); - break; -#endif - default: - on_event_unknown(*event, address.c_str()); - break; - } - - return true; - } - -#ifdef ZMQ_EVENT_MONITOR_STOPPED - void abort() - { - if (_socket) - zmq_socket_monitor(_socket.handle(), ZMQ_NULLPTR, 0); - - _socket = socket_ref(); - } -#endif - virtual void on_monitor_started() {} - virtual void on_event_connected(const zmq_event_t &event_, const char *addr_) - { - (void) event_; - (void) addr_; - } - virtual void on_event_connect_delayed(const zmq_event_t &event_, - const char *addr_) - { - (void) event_; - (void) addr_; - } - virtual void on_event_connect_retried(const zmq_event_t &event_, - const char *addr_) - { - (void) event_; - (void) addr_; - } - virtual void on_event_listening(const zmq_event_t &event_, const char *addr_) - { - (void) event_; - (void) addr_; - } - virtual void on_event_bind_failed(const zmq_event_t &event_, const char *addr_) - { - (void) event_; - (void) addr_; - } - virtual void on_event_accepted(const zmq_event_t &event_, const char *addr_) - { - (void) event_; - (void) addr_; - } - virtual void on_event_accept_failed(const zmq_event_t &event_, const char *addr_) - { - (void) event_; - (void) addr_; - } - virtual void on_event_closed(const zmq_event_t &event_, const char *addr_) - { - (void) event_; - (void) addr_; - } - virtual void on_event_close_failed(const zmq_event_t &event_, const char *addr_) - { - (void) event_; - (void) addr_; - } - virtual void on_event_disconnected(const zmq_event_t &event_, const char *addr_) - { - (void) event_; - (void) addr_; - } -#if ZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 2, 3) - virtual void on_event_handshake_failed_no_detail(const zmq_event_t &event_, - const char *addr_) - { - (void) event_; - (void) addr_; - } - virtual void on_event_handshake_failed_protocol(const zmq_event_t &event_, - const char *addr_) - { - (void) event_; - (void) addr_; - } - virtual void on_event_handshake_failed_auth(const zmq_event_t &event_, - const char *addr_) - { - (void) event_; - (void) addr_; - } - virtual void on_event_handshake_succeeded(const zmq_event_t &event_, - const char *addr_) - { - (void) event_; - (void) addr_; - } -#elif ZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 2, 1) - virtual void on_event_handshake_failed(const zmq_event_t &event_, - const char *addr_) - { - (void) event_; - (void) addr_; - } - virtual void on_event_handshake_succeed(const zmq_event_t &event_, - const char *addr_) - { - (void) event_; - (void) addr_; - } -#endif - virtual void on_event_unknown(const zmq_event_t &event_, const char *addr_) - { - (void) event_; - (void) addr_; - } - - private: - monitor_t(const monitor_t &) ZMQ_DELETED_FUNCTION; - void operator=(const monitor_t &) ZMQ_DELETED_FUNCTION; - - socket_ref _socket; - socket_t _monitor_socket; - - void close() ZMQ_NOTHROW - { - if (_socket) - zmq_socket_monitor(_socket.handle(), ZMQ_NULLPTR, 0); - _monitor_socket.close(); - } -}; - -#if defined(ZMQ_BUILD_DRAFT_API) && defined(ZMQ_CPP11) && defined(ZMQ_HAVE_POLLER) - -// polling events -enum class event_flags : short -{ - none = 0, - pollin = ZMQ_POLLIN, - pollout = ZMQ_POLLOUT, - pollerr = ZMQ_POLLERR, - pollpri = ZMQ_POLLPRI -}; - -constexpr event_flags operator|(event_flags a, event_flags b) noexcept -{ - return detail::enum_bit_or(a, b); -} -constexpr event_flags operator&(event_flags a, event_flags b) noexcept -{ - return detail::enum_bit_and(a, b); -} -constexpr event_flags operator^(event_flags a, event_flags b) noexcept -{ - return detail::enum_bit_xor(a, b); -} -constexpr event_flags operator~(event_flags a) noexcept -{ - return detail::enum_bit_not(a); -} - -struct no_user_data; - -// layout compatible with zmq_poller_event_t -template struct poller_event -{ - socket_ref socket; - ::zmq::fd_t fd; - T *user_data; - event_flags events; -}; - -template class poller_t -{ - public: - using event_type = poller_event; - - poller_t() : poller_ptr(zmq_poller_new()) - { - if (!poller_ptr) - throw error_t(); - } - - template< - typename Dummy = void, - typename = - typename std::enable_if::value, Dummy>::type> - void add(zmq::socket_ref socket, event_flags events, T *user_data) - { - add_impl(socket, events, user_data); - } - - void add(zmq::socket_ref socket, event_flags events) - { - add_impl(socket, events, nullptr); - } - - void remove(zmq::socket_ref socket) - { - if (0 != zmq_poller_remove(poller_ptr.get(), socket.handle())) { - throw error_t(); - } - } - - void modify(zmq::socket_ref socket, event_flags events) - { - if (0 - != zmq_poller_modify(poller_ptr.get(), socket.handle(), - static_cast(events))) { - throw error_t(); - } - } - - size_t wait_all(std::vector &poller_events, - const std::chrono::milliseconds timeout) - { - int rc = zmq_poller_wait_all( - poller_ptr.get(), - reinterpret_cast(poller_events.data()), - static_cast(poller_events.size()), - static_cast(timeout.count())); - if (rc > 0) - return static_cast(rc); - -#if ZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 2, 3) - if (zmq_errno() == EAGAIN) -#else - if (zmq_errno() == ETIMEDOUT) -#endif - return 0; - - throw error_t(); - } - -#if ZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 3, 3) - size_t size() const noexcept - { - int rc = zmq_poller_size(const_cast(poller_ptr.get())); - ZMQ_ASSERT(rc >= 0); - return static_cast(std::max(rc, 0)); - } -#endif - - private: - struct destroy_poller_t - { - void operator()(void *ptr) noexcept - { - int rc = zmq_poller_destroy(&ptr); - ZMQ_ASSERT(rc == 0); - } - }; - - std::unique_ptr poller_ptr; - - void add_impl(zmq::socket_ref socket, event_flags events, T *user_data) - { - if (0 - != zmq_poller_add(poller_ptr.get(), socket.handle(), user_data, - static_cast(events))) { - throw error_t(); - } - } -}; -#endif // defined(ZMQ_BUILD_DRAFT_API) && defined(ZMQ_CPP11) && defined(ZMQ_HAVE_POLLER) - -inline std::ostream &operator<<(std::ostream &os, const message_t &msg) -{ - return os << msg.str(); -} - -} // namespace zmq - -#endif // __ZMQ_HPP_INCLUDED__ diff --git a/libs/cppzmq/zmq_addon.hpp b/libs/cppzmq/zmq_addon.hpp deleted file mode 100644 index 958eec5..0000000 --- a/libs/cppzmq/zmq_addon.hpp +++ /dev/null @@ -1,753 +0,0 @@ -/* - Copyright (c) 2016-2017 ZeroMQ community - Copyright (c) 2016 VOCA AS / Harald Nøkland - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to - deal in the Software without restriction, including without limitation the - rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - sell copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - IN THE SOFTWARE. -*/ - -#ifndef __ZMQ_ADDON_HPP_INCLUDED__ -#define __ZMQ_ADDON_HPP_INCLUDED__ - -#include "zmq.hpp" - -#include -#include -#include -#include -#ifdef ZMQ_CPP11 -#include -#include -#include -#endif - -namespace zmq -{ -#ifdef ZMQ_CPP11 - -namespace detail -{ -template -recv_result_t -recv_multipart_n(socket_ref s, OutputIt out, size_t n, recv_flags flags) -{ - size_t msg_count = 0; - message_t msg; - while (true) { - if ZMQ_CONSTEXPR_IF (CheckN) { - if (msg_count >= n) - throw std::runtime_error( - "Too many message parts in recv_multipart_n"); - } - if (!s.recv(msg, flags)) { - // zmq ensures atomic delivery of messages - assert(msg_count == 0); - return {}; - } - ++msg_count; - const bool more = msg.more(); - *out++ = std::move(msg); - if (!more) - break; - } - return msg_count; -} - -inline bool is_little_endian() -{ - const uint16_t i = 0x01; - return *reinterpret_cast(&i) == 0x01; -} - -inline void write_network_order(unsigned char *buf, const uint32_t value) -{ - if (is_little_endian()) { - ZMQ_CONSTEXPR_VAR uint32_t mask = (std::numeric_limits::max)(); - *buf++ = static_cast((value >> 24) & mask); - *buf++ = static_cast((value >> 16) & mask); - *buf++ = static_cast((value >> 8) & mask); - *buf++ = static_cast(value & mask); - } else { - std::memcpy(buf, &value, sizeof(value)); - } -} - -inline uint32_t read_u32_network_order(const unsigned char *buf) -{ - if (is_little_endian()) { - return (static_cast(buf[0]) << 24) - + (static_cast(buf[1]) << 16) - + (static_cast(buf[2]) << 8) - + static_cast(buf[3]); - } else { - uint32_t value; - std::memcpy(&value, buf, sizeof(value)); - return value; - } -} -} // namespace detail - -/* Receive a multipart message. - - Writes the zmq::message_t objects to OutputIterator out. - The out iterator must handle an unspecified number of writes, - e.g. by using std::back_inserter. - - Returns: the number of messages received or nullopt (on EAGAIN). - Throws: if recv throws. Any exceptions thrown - by the out iterator will be propagated and the message - may have been only partially received with pending - message parts. It is adviced to close this socket in that event. -*/ -template -ZMQ_NODISCARD recv_result_t recv_multipart(socket_ref s, - OutputIt out, - recv_flags flags = recv_flags::none) -{ - return detail::recv_multipart_n(s, std::move(out), 0, flags); -} - -/* Receive a multipart message. - - Writes at most n zmq::message_t objects to OutputIterator out. - If the number of message parts of the incoming message exceeds n - then an exception will be thrown. - - Returns: the number of messages received or nullopt (on EAGAIN). - Throws: if recv throws. Throws std::runtime_error if the number - of message parts exceeds n (exactly n messages will have been written - to out). Any exceptions thrown - by the out iterator will be propagated and the message - may have been only partially received with pending - message parts. It is adviced to close this socket in that event. -*/ -template -ZMQ_NODISCARD recv_result_t recv_multipart_n(socket_ref s, - OutputIt out, - size_t n, - recv_flags flags = recv_flags::none) -{ - return detail::recv_multipart_n(s, std::move(out), n, flags); -} - -/* Send a multipart message. - - The range must be a ForwardRange of zmq::message_t, - zmq::const_buffer or zmq::mutable_buffer. - The flags may be zmq::send_flags::sndmore if there are - more message parts to be sent after the call to this function. - - Returns: the number of messages sent (exactly msgs.size()) or nullopt (on EAGAIN). - Throws: if send throws. Any exceptions thrown - by the msgs range will be propagated and the message - may have been only partially sent. It is adviced to close this socket in that event. -*/ -template::value - && (std::is_same, message_t>::value - || detail::is_buffer>::value)>::type -#endif - > -send_result_t -send_multipart(socket_ref s, Range &&msgs, send_flags flags = send_flags::none) -{ - using std::begin; - using std::end; - auto it = begin(msgs); - const auto end_it = end(msgs); - size_t msg_count = 0; - while (it != end_it) { - const auto next = std::next(it); - const auto msg_flags = - flags | (next == end_it ? send_flags::none : send_flags::sndmore); - if (!s.send(*it, msg_flags)) { - // zmq ensures atomic delivery of messages - assert(it == begin(msgs)); - return {}; - } - ++msg_count; - it = next; - } - return msg_count; -} - -/* Encode a multipart message. - - The range must be a ForwardRange of zmq::message_t. A - zmq::multipart_t or STL container may be passed for encoding. - - Returns: a zmq::message_t holding the encoded multipart data. - - Throws: std::range_error is thrown if the size of any single part - can not fit in an unsigned 32 bit integer. - - The encoding is compatible with that used by the CZMQ function - zmsg_encode(), see https://rfc.zeromq.org/spec/50/. - Each part consists of a size followed by the data. - These are placed contiguously into the output message. A part of - size less than 255 bytes will have a single byte size value. - Larger parts will have a five byte size value with the first byte - set to 0xFF and the remaining four bytes holding the size of the - part's data. -*/ -template::value - && (std::is_same, message_t>::value - || detail::is_buffer>::value)>::type -#endif - > -message_t encode(const Range &parts) -{ - size_t mmsg_size = 0; - - // First pass check sizes - for (const auto &part : parts) { - const size_t part_size = part.size(); - if (part_size > (std::numeric_limits::max)()) { - // Size value must fit into uint32_t. - throw std::range_error("Invalid size, message part too large"); - } - const size_t count_size = - part_size < (std::numeric_limits::max)() ? 1 : 5; - mmsg_size += part_size + count_size; - } - - message_t encoded(mmsg_size); - unsigned char *buf = encoded.data(); - for (const auto &part : parts) { - const uint32_t part_size = static_cast(part.size()); - const unsigned char *part_data = - static_cast(part.data()); - - if (part_size < (std::numeric_limits::max)()) { - // small part - *buf++ = (unsigned char) part_size; - } else { - // big part - *buf++ = (std::numeric_limits::max)(); - detail::write_network_order(buf, part_size); - buf += sizeof(part_size); - } - std::memcpy(buf, part_data, part_size); - buf += part_size; - } - - assert(static_cast(buf - encoded.data()) == mmsg_size); - return encoded; -} - -/* Decode an encoded message to multiple parts. - - The given output iterator must be a ForwardIterator to a container - holding zmq::message_t such as a zmq::multipart_t or various STL - containers. - - Returns the ForwardIterator advanced once past the last decoded - part. - - Throws: a std::out_of_range is thrown if the encoded part sizes - lead to exceeding the message data bounds. - - The decoding assumes the message is encoded in the manner - performed by zmq::encode(), see https://rfc.zeromq.org/spec/50/. - */ -template OutputIt decode(const message_t &encoded, OutputIt out) -{ - const unsigned char *source = encoded.data(); - const unsigned char *const limit = source + encoded.size(); - - while (source < limit) { - size_t part_size = *source++; - if (part_size == (std::numeric_limits::max)()) { - if (static_cast(limit - source) < sizeof(uint32_t)) { - throw std::out_of_range( - "Malformed encoding, overflow in reading size"); - } - part_size = detail::read_u32_network_order(source); - // the part size is allowed to be less than 0xFF - source += sizeof(uint32_t); - } - - if (static_cast(limit - source) < part_size) { - throw std::out_of_range("Malformed encoding, overflow in reading part"); - } - *out = message_t(source, part_size); - ++out; - source += part_size; - } - - assert(source == limit); - return out; -} - -#endif - - -#ifdef ZMQ_HAS_RVALUE_REFS - -/* - This class handles multipart messaging. It is the C++ equivalent of zmsg.h, - which is part of CZMQ (the high-level C binding). Furthermore, it is a major - improvement compared to zmsg.hpp, which is part of the examples in the ØMQ - Guide. Unnecessary copying is avoided by using move semantics to efficiently - add/remove parts. -*/ -class multipart_t -{ - private: - std::deque m_parts; - - public: - typedef std::deque::value_type value_type; - - typedef std::deque::iterator iterator; - typedef std::deque::const_iterator const_iterator; - - typedef std::deque::reverse_iterator reverse_iterator; - typedef std::deque::const_reverse_iterator const_reverse_iterator; - - // Default constructor - multipart_t() {} - - // Construct from socket receive - multipart_t(socket_ref socket) { recv(socket); } - - // Construct from memory block - multipart_t(const void *src, size_t size) { addmem(src, size); } - - // Construct from string - multipart_t(const std::string &string) { addstr(string); } - - // Construct from message part - multipart_t(message_t &&message) { add(std::move(message)); } - - // Move constructor - multipart_t(multipart_t &&other) ZMQ_NOTHROW { m_parts = std::move(other.m_parts); } - - // Move assignment operator - multipart_t &operator=(multipart_t &&other) ZMQ_NOTHROW - { - m_parts = std::move(other.m_parts); - return *this; - } - - // Destructor - virtual ~multipart_t() { clear(); } - - message_t &operator[](size_t n) { return m_parts[n]; } - - const message_t &operator[](size_t n) const { return m_parts[n]; } - - message_t &at(size_t n) { return m_parts.at(n); } - - const message_t &at(size_t n) const { return m_parts.at(n); } - - iterator begin() { return m_parts.begin(); } - - const_iterator begin() const { return m_parts.begin(); } - - const_iterator cbegin() const { return m_parts.cbegin(); } - - reverse_iterator rbegin() { return m_parts.rbegin(); } - - const_reverse_iterator rbegin() const { return m_parts.rbegin(); } - - iterator end() { return m_parts.end(); } - - const_iterator end() const { return m_parts.end(); } - - const_iterator cend() const { return m_parts.cend(); } - - reverse_iterator rend() { return m_parts.rend(); } - - const_reverse_iterator rend() const { return m_parts.rend(); } - - // Delete all parts - void clear() { m_parts.clear(); } - - // Get number of parts - size_t size() const { return m_parts.size(); } - - // Check if number of parts is zero - bool empty() const { return m_parts.empty(); } - - // Receive multipart message from socket - bool recv(socket_ref socket, int flags = 0) - { - clear(); - bool more = true; - while (more) { - message_t message; -#ifdef ZMQ_CPP11 - if (!socket.recv(message, static_cast(flags))) - return false; -#else - if (!socket.recv(&message, flags)) - return false; -#endif - more = message.more(); - add(std::move(message)); - } - return true; - } - - // Send multipart message to socket - bool send(socket_ref socket, int flags = 0) - { - flags &= ~(ZMQ_SNDMORE); - bool more = size() > 0; - while (more) { - message_t message = pop(); - more = size() > 0; -#ifdef ZMQ_CPP11 - if (!socket.send(message, static_cast( - (more ? ZMQ_SNDMORE : 0) | flags))) - return false; -#else - if (!socket.send(message, (more ? ZMQ_SNDMORE : 0) | flags)) - return false; -#endif - } - clear(); - return true; - } - - // Concatenate other multipart to front - void prepend(multipart_t &&other) - { - while (!other.empty()) - push(other.remove()); - } - - // Concatenate other multipart to back - void append(multipart_t &&other) - { - while (!other.empty()) - add(other.pop()); - } - - // Push memory block to front - void pushmem(const void *src, size_t size) - { - m_parts.push_front(message_t(src, size)); - } - - // Push memory block to back - void addmem(const void *src, size_t size) - { - m_parts.push_back(message_t(src, size)); - } - - // Push string to front - void pushstr(const std::string &string) - { - m_parts.push_front(message_t(string.data(), string.size())); - } - - // Push string to back - void addstr(const std::string &string) - { - m_parts.push_back(message_t(string.data(), string.size())); - } - - // Push type (fixed-size) to front - template void pushtyp(const T &type) - { - static_assert(!std::is_same::value, - "Use pushstr() instead of pushtyp()"); - m_parts.push_front(message_t(&type, sizeof(type))); - } - - // Push type (fixed-size) to back - template void addtyp(const T &type) - { - static_assert(!std::is_same::value, - "Use addstr() instead of addtyp()"); - m_parts.push_back(message_t(&type, sizeof(type))); - } - - // Push message part to front - void push(message_t &&message) { m_parts.push_front(std::move(message)); } - - // Push message part to back - void add(message_t &&message) { m_parts.push_back(std::move(message)); } - - // Alias to allow std::back_inserter() - void push_back(message_t &&message) { m_parts.push_back(std::move(message)); } - - // Pop string from front - std::string popstr() - { - std::string string(m_parts.front().data(), m_parts.front().size()); - m_parts.pop_front(); - return string; - } - - // Pop type (fixed-size) from front - template T poptyp() - { - static_assert(!std::is_same::value, - "Use popstr() instead of poptyp()"); - if (sizeof(T) != m_parts.front().size()) - throw std::runtime_error( - "Invalid type, size does not match the message size"); - T type = *m_parts.front().data(); - m_parts.pop_front(); - return type; - } - - // Pop message part from front - message_t pop() - { - message_t message = std::move(m_parts.front()); - m_parts.pop_front(); - return message; - } - - // Pop message part from back - message_t remove() - { - message_t message = std::move(m_parts.back()); - m_parts.pop_back(); - return message; - } - - // get message part from front - const message_t &front() { return m_parts.front(); } - - // get message part from back - const message_t &back() { return m_parts.back(); } - - // Get pointer to a specific message part - const message_t *peek(size_t index) const { return &m_parts[index]; } - - // Get a string copy of a specific message part - std::string peekstr(size_t index) const - { - std::string string(m_parts[index].data(), m_parts[index].size()); - return string; - } - - // Peek type (fixed-size) from front - template T peektyp(size_t index) const - { - static_assert(!std::is_same::value, - "Use peekstr() instead of peektyp()"); - if (sizeof(T) != m_parts[index].size()) - throw std::runtime_error( - "Invalid type, size does not match the message size"); - T type = *m_parts[index].data(); - return type; - } - - // Create multipart from type (fixed-size) - template static multipart_t create(const T &type) - { - multipart_t multipart; - multipart.addtyp(type); - return multipart; - } - - // Copy multipart - multipart_t clone() const - { - multipart_t multipart; - for (size_t i = 0; i < size(); i++) - multipart.addmem(m_parts[i].data(), m_parts[i].size()); - return multipart; - } - - // Dump content to string - std::string str() const - { - std::stringstream ss; - for (size_t i = 0; i < m_parts.size(); i++) { - const unsigned char *data = m_parts[i].data(); - size_t size = m_parts[i].size(); - - // Dump the message as text or binary - bool isText = true; - for (size_t j = 0; j < size; j++) { - if (data[j] < 32 || data[j] > 127) { - isText = false; - break; - } - } - ss << "\n[" << std::dec << std::setw(3) << std::setfill('0') << size - << "] "; - if (size >= 1000) { - ss << "... (too big to print)"; - continue; - } - for (size_t j = 0; j < size; j++) { - if (isText) - ss << static_cast(data[j]); - else - ss << std::hex << std::setw(2) << std::setfill('0') - << static_cast(data[j]); - } - } - return ss.str(); - } - - // Check if equal to other multipart - bool equal(const multipart_t *other) const ZMQ_NOTHROW - { - return *this == *other; - } - - bool operator==(const multipart_t &other) const ZMQ_NOTHROW - { - if (size() != other.size()) - return false; - for (size_t i = 0; i < size(); i++) - if (at(i) != other.at(i)) - return false; - return true; - } - - bool operator!=(const multipart_t &other) const ZMQ_NOTHROW - { - return !(*this == other); - } - -#ifdef ZMQ_CPP11 - - // Return single part message_t encoded from this multipart_t. - message_t encode() const { return zmq::encode(*this); } - - // Decode encoded message into multiple parts and append to self. - void decode_append(const message_t &encoded) - { - zmq::decode(encoded, std::back_inserter(*this)); - } - - // Return a new multipart_t containing the decoded message_t. - static multipart_t decode(const message_t &encoded) - { - multipart_t tmp; - zmq::decode(encoded, std::back_inserter(tmp)); - return tmp; - } - -#endif - - private: - // Disable implicit copying (moving is more efficient) - multipart_t(const multipart_t &other) ZMQ_DELETED_FUNCTION; - void operator=(const multipart_t &other) ZMQ_DELETED_FUNCTION; -}; // class multipart_t - -inline std::ostream &operator<<(std::ostream &os, const multipart_t &msg) -{ - return os << msg.str(); -} - -#endif // ZMQ_HAS_RVALUE_REFS - -#if defined(ZMQ_BUILD_DRAFT_API) && defined(ZMQ_CPP11) && defined(ZMQ_HAVE_POLLER) -class active_poller_t -{ - public: - active_poller_t() = default; - ~active_poller_t() = default; - - active_poller_t(const active_poller_t &) = delete; - active_poller_t &operator=(const active_poller_t &) = delete; - - active_poller_t(active_poller_t &&src) = default; - active_poller_t &operator=(active_poller_t &&src) = default; - - using handler_type = std::function; - - void add(zmq::socket_ref socket, event_flags events, handler_type handler) - { - if (!handler) - throw std::invalid_argument("null handler in active_poller_t::add"); - auto ret = handlers.emplace( - socket, std::make_shared(std::move(handler))); - if (!ret.second) - throw error_t(EINVAL); // already added - try { - base_poller.add(socket, events, ret.first->second.get()); - need_rebuild = true; - } - catch (...) { - // rollback - handlers.erase(socket); - throw; - } - } - - void remove(zmq::socket_ref socket) - { - base_poller.remove(socket); - handlers.erase(socket); - need_rebuild = true; - } - - void modify(zmq::socket_ref socket, event_flags events) - { - base_poller.modify(socket, events); - } - - size_t wait(std::chrono::milliseconds timeout) - { - if (need_rebuild) { - poller_events.resize(handlers.size()); - poller_handlers.clear(); - poller_handlers.reserve(handlers.size()); - for (const auto &handler : handlers) { - poller_handlers.push_back(handler.second); - } - need_rebuild = false; - } - const auto count = base_poller.wait_all(poller_events, timeout); - std::for_each(poller_events.begin(), - poller_events.begin() + static_cast(count), - [](decltype(base_poller)::event_type &event) { - assert(event.user_data != nullptr); - (*event.user_data)(event.events); - }); - return count; - } - - ZMQ_NODISCARD bool empty() const noexcept { return handlers.empty(); } - - size_t size() const noexcept { return handlers.size(); } - - private: - bool need_rebuild{false}; - - poller_t base_poller{}; - std::unordered_map> handlers{}; - std::vector poller_events{}; - std::vector> poller_handlers{}; -}; // class active_poller_t -#endif // defined(ZMQ_BUILD_DRAFT_API) && defined(ZMQ_CPP11) && defined(ZMQ_HAVE_POLLER) - - -} // namespace zmq - -#endif // __ZMQ_ADDON_HPP_INCLUDED__ diff --git a/libs/libzmq b/libs/libzmq new file mode 160000 index 0000000..3e08ecc --- /dev/null +++ b/libs/libzmq @@ -0,0 +1 @@ +Subproject commit 3e08ecc0124a130220f4c8c046e5ba7f919b32df diff --git a/libs/libzmq/.clang-format b/libs/libzmq/.clang-format deleted file mode 100644 index 0fc6f89..0000000 --- a/libs/libzmq/.clang-format +++ /dev/null @@ -1,53 +0,0 @@ -BasedOnStyle: LLVM -IndentWidth: 4 -UseTab: Never -BreakBeforeBraces: Custom -BraceWrapping: - AfterClass: true - AfterControlStatement: false - AfterEnum: true - AfterFunction: true - AfterNamespace: true - AfterObjCDeclaration: true - AfterStruct: true - AfterUnion: true - BeforeCatch: true - BeforeElse: false - IndentBraces: false - -AlignConsecutiveAssignments: false -AlignConsecutiveDeclarations: false -AllowShortIfStatementsOnASingleLine: false -IndentCaseLabels: true -BinPackArguments: true -BinPackParameters: false -AlignTrailingComments: true -AllowShortBlocksOnASingleLine: false -AllowAllParametersOfDeclarationOnNextLine: true -AllowShortFunctionsOnASingleLine: InlineOnly -AlwaysBreakTemplateDeclarations: false -ColumnLimit: 80 -MaxEmptyLinesToKeep: 2 -KeepEmptyLinesAtTheStartOfBlocks: false -ContinuationIndentWidth: 2 -PointerAlignment: Right -ReflowComments: false -SpaceBeforeAssignmentOperators: true -SpaceBeforeParens: Always -SpaceInEmptyParentheses: false -SpacesInAngles: false -SpacesInParentheses: false -SpacesInSquareBrackets: false -Standard: Cpp03 - -SortIncludes: false - -FixNamespaceComments: false -BreakBeforeBinaryOperators: NonAssignment -SpaceAfterTemplateKeyword: true -AlignAfterOpenBracket: Align -AlignOperands: true -BreakConstructorInitializers: AfterColon -ConstructorInitializerAllOnOneLineOrOnePerLine: true -SpaceAfterCStyleCast: true -BreakBeforeTernaryOperators: true diff --git a/libs/libzmq/.clang-tidy b/libs/libzmq/.clang-tidy deleted file mode 100755 index 32c6ca4..0000000 --- a/libs/libzmq/.clang-tidy +++ /dev/null @@ -1,429 +0,0 @@ -Checks: "*,\ -# not currently a coding convention, but conceivable,\ --llvm-include-order,\ -# currently the coding convention deliberately produces violations of these,\ -# rules, but it may make sense to reconsider,\ --readability-implicit-bool-conversion,\ --readability-braces-around-statements,\ --readability-named-parameter,\ --fuchsia-default-arguments,\ --google-readability-todo,\ --google-runtime-int,\ --cppcoreguidelines-avoid-goto,\ --hicpp-avoid-goto, \ --cppcoreguidelines-pro-type-member-init,\ --cppcoreguidelines-pro-type-static-cast-downcast,\ --readability-identifier-naming,\ -# not applicable,\ --fuchsia-default-arguments-calls,\ --fuchsia-overloaded-operator,\ --fuchsia-statically-constructed-objects,\ -# not currently a coding convention, C++11-specific, but conceivable,\ --modernize-use-nullptr,\ --modernize-use-equals-default,\ --modernize-deprecated-headers,\ -# not currently a coding convention, C++11-specific and hard to implement,\ --hicpp-no-malloc,\ --hicpp-avoid-c-arrays,\ --modernize-avoid-c-arrays,\ --modernize-pass-by-value,\ --modernize-loop-convert,\ --modernize-use-auto,\ --modernize-use-trailing-return-type,\ --modernize-use-using,\ --modernize-return-braced-init-list,\ --cppcoreguidelines-avoid-c-arrays,\ --cppcoreguidelines-no-malloc,\ --cppcoreguidelines-owning-memory,\ --cppcoreguidelines-pro-type-union-access,\ --cppcoreguidelines-pro-bounds-array-to-pointer-decay,\ --cppcoreguidelines-pro-bounds-constant-array-index,\ --cppcoreguidelines-pro-bounds-pointer-arithmetic,\ -# not easily possible to implement (maybe replace by specific exclusions),\ --cppcoreguidelines-pro-type-vararg,\ --cppcoreguidelines-pro-type-reinterpret-cast,\ --hicpp-signed-bitwise,\ -# duplicates,\ --google-readability-braces-around-statements,\ --cppcoreguidelines-pro-type-cstyle-cast,\ --cppcoreguidelines-avoid-magic-numbers,\ --readability-magic-numbers,\ --hicpp-braces-around-statements,\ --hicpp-use-equals-default,\ --hicpp-deprecated-headers,\ --hicpp-no-assembler,\ --hicpp-vararg,\ --hicpp-use-auto,\ --hicpp-use-nullptr,\ --hicpp-no-array-decay,\ --hicpp-member-init" -WarningsAsErrors: '' -HeaderFilterRegex: '' -# AnalyzeTemporaryDtors: false -CheckOptions: - # - key: cert-dcl59-cpp.HeaderFileExtensions - # value: h,hh,hpp,hxx - # - key: cert-err61-cpp.CheckThrowTemporaries - # value: '1' - # - key: cert-oop11-cpp.IncludeStyle - # value: llvm - # - key: cert-oop11-cpp.UseCERTSemantics - # value: '1' - # - key: cppcoreguidelines-pro-bounds-constant-array-index.GslHeader - # value: '' - # - key: cppcoreguidelines-pro-bounds-constant-array-index.IncludeStyle - # value: '0' - # - key: cppcoreguidelines-pro-type-member-init.IgnoreArrays - # value: '0' - # - key: google-build-namespaces.HeaderFileExtensions - # value: h,hh,hpp,hxx - # - key: google-global-names-in-headers.HeaderFileExtensions - # value: h - # - key: google-readability-braces-around-statements.ShortStatementLines - # value: '1' - # - key: google-readability-function-size.BranchThreshold - # value: '4294967295' - # - key: google-readability-function-size.LineThreshold - # value: '4294967295' - # - key: google-readability-function-size.StatementThreshold - # value: '800' - # - key: google-readability-namespace-comments.ShortNamespaceLines - # value: '10' - # - key: google-readability-namespace-comments.SpacesBeforeComments - # value: '2' - # - key: google-runtime-int.SignedTypePrefix - # value: int - # - key: google-runtime-int.TypeSuffix - # value: '' - # - key: google-runtime-int.UnsignedTypePrefix - # value: uint - # - key: llvm-namespace-comment.ShortNamespaceLines - # value: '1' - # - key: llvm-namespace-comment.SpacesBeforeComments - # value: '1' - # - key: misc-assert-side-effect.AssertMacros - # value: assert - # - key: misc-assert-side-effect.CheckFunctionCalls - # value: '0' - # - key: misc-dangling-handle.HandleClasses - # value: 'std::basic_string_view;std::experimental::basic_string_view' - # - key: misc-definitions-in-headers.HeaderFileExtensions - # value: ',h,hh,hpp,hxx' - # - key: misc-definitions-in-headers.UseHeaderFileExtension - # value: '1' - # - key: misc-misplaced-widening-cast.CheckImplicitCasts - # value: '1' - # - key: misc-move-constructor-init.IncludeStyle - # value: llvm - # - key: misc-move-constructor-init.UseCERTSemantics - # value: '0' - # - key: misc-sizeof-expression.WarnOnSizeOfCompareToConstant - # value: '1' - # - key: misc-sizeof-expression.WarnOnSizeOfConstant - # value: '1' - # - key: misc-sizeof-expression.WarnOnSizeOfThis - # value: '1' - # - key: misc-string-constructor.LargeLengthThreshold - # value: '8388608' - # - key: misc-string-constructor.WarnOnLargeLength - # value: '1' - # - key: misc-suspicious-missing-comma.MaxConcatenatedTokens - # value: '5' - # - key: misc-suspicious-missing-comma.RatioThreshold - # value: '0.200000' - # - key: misc-suspicious-missing-comma.SizeThreshold - # value: '5' - # - key: misc-suspicious-string-compare.StringCompareLikeFunctions - # value: '' - # - key: misc-suspicious-string-compare.WarnOnImplicitComparison - # value: '1' - # - key: misc-suspicious-string-compare.WarnOnLogicalNotComparison - # value: '0' - # - key: misc-throw-by-value-catch-by-reference.CheckThrowTemporaries - # value: '1' - # - key: modernize-loop-convert.MaxCopySize - # value: '16' - # - key: modernize-loop-convert.MinConfidence - # value: reasonable - # - key: modernize-loop-convert.NamingStyle - # value: CamelCase - # - key: modernize-pass-by-value.IncludeStyle - # value: llvm - # - key: modernize-replace-auto-ptr.IncludeStyle - # value: llvm - # - key: modernize-use-nullptr.NullMacros - # value: 'NULL' - # - key: performance-faster-string-find.StringLikeClasses - # value: 'std::basic_string' - # - key: performance-for-range-copy.WarnOnAllAutoCopies - # value: '0' - # - key: readability-braces-around-statements.ShortStatementLines - # value: '1' - # - key: readability-function-size.BranchThreshold - # value: '4294967295' - # - key: readability-function-size.LineThreshold - # value: '4294967295' - # - key: readability-function-size.StatementThreshold - # value: '800' - # - key: readability-identifier-naming.AbstractClassCase - # value: aNy_CasE - # - key: readability-identifier-naming.AbstractClassPrefix - # value: '' - # - key: readability-identifier-naming.AbstractClassSuffix - # value: '' - # - key: readability-identifier-naming.ClassCase - # value: aNy_CasE - # - key: readability-identifier-naming.ClassConstantCase - # value: aNy_CasE - # - key: readability-identifier-naming.ClassConstantPrefix - # value: '' - # - key: readability-identifier-naming.ClassConstantSuffix - # value: '' - # - key: readability-identifier-naming.ClassMemberCase - # value: aNy_CasE - # - key: readability-identifier-naming.ClassMemberPrefix - # value: '' - # - key: readability-identifier-naming.ClassMemberSuffix - # value: '' - # - key: readability-identifier-naming.ClassMethodCase - # value: aNy_CasE - # - key: readability-identifier-naming.ClassMethodPrefix - # value: '' - # - key: readability-identifier-naming.ClassMethodSuffix - # value: '' - # - key: readability-identifier-naming.ClassPrefix - # value: '' - # - key: readability-identifier-naming.ClassSuffix - # value: '' - # - key: readability-identifier-naming.ConstantCase - # value: aNy_CasE - # - key: readability-identifier-naming.ConstantMemberCase - # value: aNy_CasE - # - key: readability-identifier-naming.ConstantMemberPrefix - # value: '' - # - key: readability-identifier-naming.ConstantMemberSuffix - # value: '' - # - key: readability-identifier-naming.ConstantParameterCase - # value: aNy_CasE - # - key: readability-identifier-naming.ConstantParameterPrefix - # value: '' - # - key: readability-identifier-naming.ConstantParameterSuffix - # value: '' - # - key: readability-identifier-naming.ConstantPrefix - # value: '' - # - key: readability-identifier-naming.ConstantSuffix - # value: '' - # - key: readability-identifier-naming.ConstexprFunctionCase - # value: aNy_CasE - # - key: readability-identifier-naming.ConstexprFunctionPrefix - # value: '' - # - key: readability-identifier-naming.ConstexprFunctionSuffix - # value: '' - # - key: readability-identifier-naming.ConstexprMethodCase - # value: aNy_CasE - # - key: readability-identifier-naming.ConstexprMethodPrefix - # value: '' - # - key: readability-identifier-naming.ConstexprMethodSuffix - # value: '' - # - key: readability-identifier-naming.ConstexprVariableCase - # value: aNy_CasE - # - key: readability-identifier-naming.ConstexprVariablePrefix - # value: '' - # - key: readability-identifier-naming.ConstexprVariableSuffix - # value: '' - # - key: readability-identifier-naming.EnumCase - # value: aNy_CasE - # - key: readability-identifier-naming.EnumConstantCase - # value: aNy_CasE - # - key: readability-identifier-naming.EnumConstantPrefix - # value: '' - # - key: readability-identifier-naming.EnumConstantSuffix - # value: '' - # - key: readability-identifier-naming.EnumPrefix - # value: '' - # - key: readability-identifier-naming.EnumSuffix - # value: '' - # - key: readability-identifier-naming.FunctionCase - # value: aNy_CasE - # - key: readability-identifier-naming.FunctionPrefix - # value: '' - # - key: readability-identifier-naming.FunctionSuffix - # value: '' - # - key: readability-identifier-naming.GlobalConstantCase - # value: aNy_CasE - # - key: readability-identifier-naming.GlobalConstantPrefix - # value: '' - # - key: readability-identifier-naming.GlobalConstantSuffix - # value: '' - # - key: readability-identifier-naming.GlobalFunctionCase - # value: aNy_CasE - # - key: readability-identifier-naming.GlobalFunctionPrefix - # value: '' - # - key: readability-identifier-naming.GlobalFunctionSuffix - # value: '' - # - key: readability-identifier-naming.GlobalVariableCase - # value: aNy_CasE - # - key: readability-identifier-naming.GlobalVariablePrefix - # value: '' - # - key: readability-identifier-naming.GlobalVariableSuffix - # value: '' - # - key: readability-identifier-naming.IgnoreFailedSplit - # value: '0' - # - key: readability-identifier-naming.InlineNamespaceCase - # value: aNy_CasE - # - key: readability-identifier-naming.InlineNamespacePrefix - # value: '' - # - key: readability-identifier-naming.InlineNamespaceSuffix - # value: '' - - key: readability-identifier-naming.LocalConstantCase - value: lower_case - - key: readability-identifier-naming.LocalConstantPrefix - value: '' - - key: readability-identifier-naming.LocalConstantSuffix - value: '' - - key: readability-identifier-naming.LocalVariableCase - value: lower_case - - key: readability-identifier-naming.LocalVariablePrefix - value: '' - - key: readability-identifier-naming.LocalVariableSuffix - value: '' - # - key: readability-identifier-naming.MemberCase - # value: lower_case - # - key: readability-identifier-naming.MemberPrefix - # value: '_' - # - key: readability-identifier-naming.MemberSuffix - # value: '' - # - key: readability-identifier-naming.MethodCase - # value: aNy_CasE - # - key: readability-identifier-naming.MethodPrefix - # value: '' - # - key: readability-identifier-naming.MethodSuffix - # value: '' - # - key: readability-identifier-naming.NamespaceCase - # value: aNy_CasE - # - key: readability-identifier-naming.NamespacePrefix - # value: '' - # - key: readability-identifier-naming.NamespaceSuffix - # value: '' - - key: readability-identifier-naming.ParameterCase - value: lower_case - # - key: readability-identifier-naming.ParameterPackCase - # value: aNy_CasE - # - key: readability-identifier-naming.ParameterPackPrefix - # value: '' - # - key: readability-identifier-naming.ParameterPackSuffix - # value: '' - # - key: readability-identifier-naming.ParameterPrefix - # value: '' - - key: readability-identifier-naming.ParameterSuffix - value: '_' - - key: readability-identifier-naming.PrivateMemberCase - value: lower_case - - key: readability-identifier-naming.PrivateMemberPrefix - value: '_' - - key: readability-identifier-naming.PrivateMemberSuffix - value: '' - # - key: readability-identifier-naming.PrivateMethodCase - # value: aNy_CasE - # - key: readability-identifier-naming.PrivateMethodPrefix - # value: '' - # - key: readability-identifier-naming.PrivateMethodSuffix - # value: '' - # - key: readability-identifier-naming.ProtectedMemberCase - # value: aNy_CasE - # - key: readability-identifier-naming.ProtectedMemberPrefix - # value: '' - # - key: readability-identifier-naming.ProtectedMemberSuffix - # value: '' - # - key: readability-identifier-naming.ProtectedMethodCase - # value: aNy_CasE - # - key: readability-identifier-naming.ProtectedMethodPrefix - # value: '' - # - key: readability-identifier-naming.ProtectedMethodSuffix - # value: '' - # - key: readability-identifier-naming.PublicMemberCase - # value: aNy_CasE - # - key: readability-identifier-naming.PublicMemberPrefix - # value: '' - # - key: readability-identifier-naming.PublicMemberSuffix - # value: '' - # - key: readability-identifier-naming.PublicMethodCase - # value: aNy_CasE - # - key: readability-identifier-naming.PublicMethodPrefix - # value: '' - # - key: readability-identifier-naming.PublicMethodSuffix - # value: '' - # - key: readability-identifier-naming.StaticConstantCase - # value: aNy_CasE - # - key: readability-identifier-naming.StaticConstantPrefix - # value: '' - # - key: readability-identifier-naming.StaticConstantSuffix - # value: '' - # - key: readability-identifier-naming.StaticVariableCase - # value: aNy_CasE - # - key: readability-identifier-naming.StaticVariablePrefix - # value: '' - # - key: readability-identifier-naming.StaticVariableSuffix - # value: '' - # - key: readability-identifier-naming.StructCase - # value: aNy_CasE - # - key: readability-identifier-naming.StructPrefix - # value: '' - # - key: readability-identifier-naming.StructSuffix - # value: '' - # - key: readability-identifier-naming.TemplateParameterCase - # value: aNy_CasE - # - key: readability-identifier-naming.TemplateParameterPrefix - # value: '' - # - key: readability-identifier-naming.TemplateParameterSuffix - # value: '' - # - key: readability-identifier-naming.TemplateTemplateParameterCase - # value: aNy_CasE - # - key: readability-identifier-naming.TemplateTemplateParameterPrefix - # value: '' - # - key: readability-identifier-naming.TemplateTemplateParameterSuffix - # value: '' - # - key: readability-identifier-naming.TypeTemplateParameterCase - # value: aNy_CasE - # - key: readability-identifier-naming.TypeTemplateParameterPrefix - # value: '' - # - key: readability-identifier-naming.TypeTemplateParameterSuffix - # value: '' - # - key: readability-identifier-naming.TypedefCase - # value: aNy_CasE - # - key: readability-identifier-naming.TypedefPrefix - # value: '' - # - key: readability-identifier-naming.TypedefSuffix - # value: '' - # - key: readability-identifier-naming.UnionCase - # value: aNy_CasE - # - key: readability-identifier-naming.UnionPrefix - # value: '' - # - key: readability-identifier-naming.UnionSuffix - # value: '' - # - key: readability-identifier-naming.ValueTemplateParameterCase - # value: aNy_CasE - # - key: readability-identifier-naming.ValueTemplateParameterPrefix - # value: '' - # - key: readability-identifier-naming.ValueTemplateParameterSuffix - # value: '' - # - key: readability-identifier-naming.VariableCase - # value: aNy_CasE - # - key: readability-identifier-naming.VariablePrefix - # value: '' - # - key: readability-identifier-naming.VariableSuffix - # value: '' - # - key: readability-identifier-naming.VirtualMethodCase - # value: aNy_CasE - # - key: readability-identifier-naming.VirtualMethodPrefix - # value: '' - # - key: readability-identifier-naming.VirtualMethodSuffix - # value: '' - # - key: readability-simplify-boolean-expr.ChainedConditionalAssignment - # value: '0' - # - key: readability-simplify-boolean-expr.ChainedConditionalReturn - # value: '0' - - key: modernize-use-override.OverrideSpelling - value: 'ZMQ_OVERRIDE' - - key: modernize-use-override.FinalSpelling - value: 'ZMQ_FINAL' diff --git a/libs/libzmq/.git-blame-ignore-revs b/libs/libzmq/.git-blame-ignore-revs deleted file mode 100644 index 985588c..0000000 --- a/libs/libzmq/.git-blame-ignore-revs +++ /dev/null @@ -1,2 +0,0 @@ -# tree-wide clang format -41f459e1dc6f7cdedd1268298153c970e290b2ce diff --git a/libs/libzmq/.github/CONTRIBUTING.md b/libs/libzmq/.github/CONTRIBUTING.md deleted file mode 100644 index 10bb5ab..0000000 --- a/libs/libzmq/.github/CONTRIBUTING.md +++ /dev/null @@ -1,48 +0,0 @@ -# Pull Request Notice - -Before sending a pull request make sure each commit solves one clear, minimal, -plausible problem. Further each commit should have the following format: - -``` -Problem: X is broken - -Solution: do Y and Z to fix X -``` - -Please try to have the code changes conform to our coding style. For your -convenience, you can install clang-format (at least version 5.0) and then -run ```make clang-format-check```. Don't fix existing issues, if any - just -make sure your changes are compliant. ```make clang-format-diff``` will -automatically apply the required changes. -To set a specific clang-format binary with autotools, you can for example -run: ```./configure CLANG_FORMAT=clang-format-5.0``` - -Please avoid sending a pull request with recursive merge nodes, as they -are impossible to fix once merged. Please rebase your branch on -zeromq/libzmq master instead of merging it. - -``` -git remote add upstream git@github.com:zeromq/libzmq.git -git fetch upstream -git rebase upstream/master -git push -f -``` - -In case you already merged instead of rebasing you can drop the merge commit. - -``` -git rebase -i HEAD~10 -``` - -Now, find your merge commit and mark it as drop and save. Finally rebase! - -If you are a new contributor please have a look at our contributing guidelines: -[CONTRIBUTING](http://zeromq.org/docs:contributing) - -# FIRST TIME CONTRIBUTORS PLEASE NOTE - -Please add an additional commit with a relicensing grant. - -[Example](https://github.com/zeromq/libzmq/commit/fecbd42dbe45455fff3b6456350ceca047b82050) - -[More information on RELICENSING effort](https://github.com/zeromq/libzmq/tree/master/RELICENSE/README.md) diff --git a/libs/libzmq/.github/issue_template.md b/libs/libzmq/.github/issue_template.md deleted file mode 100644 index 21b837a..0000000 --- a/libs/libzmq/.github/issue_template.md +++ /dev/null @@ -1,22 +0,0 @@ -*Please use this template for reporting suspected bugs or requests for help.* - -# Issue description - - - -# Environment - -* libzmq version (commit hash if unreleased): -* OS: - -# Minimal test code / Steps to reproduce the issue - -1. - - -# What's the actual result? (include assertion message & call stack if applicable) - - - -# What's the expected result? - diff --git a/libs/libzmq/.github/stale.yml b/libs/libzmq/.github/stale.yml deleted file mode 100644 index a06b57d..0000000 --- a/libs/libzmq/.github/stale.yml +++ /dev/null @@ -1,19 +0,0 @@ -# Number of days of inactivity before an issue becomes stale -daysUntilStale: 365 -# Number of days of inactivity before a stale issue is closed -daysUntilClose: 56 -# Issues with these labels will never be considered stale -exemptLabels: - - "Help Request" - - "Feature Request" - - "Problem reproduced" - - Critical -# Label to use when marking an issue as stale -staleLabel: stale -# Comment to post when marking an issue as stale. Set to `false` to disable -markComment: > - This issue has been automatically marked as stale because it has not had - activity for 365 days. It will be closed if no further activity occurs within - 56 days. Thank you for your contributions. -# Comment to post when closing a stale issue. Set to `false` to disable -closeComment: false diff --git a/libs/libzmq/.github/workflows/CI.yaml b/libs/libzmq/.github/workflows/CI.yaml deleted file mode 100644 index 1256c03..0000000 --- a/libs/libzmq/.github/workflows/CI.yaml +++ /dev/null @@ -1,243 +0,0 @@ -name: CI -on: - push: - pull_request: - schedule: - - cron: "0 9 * * 5" - -jobs: - build: - if: github.event_name == 'pull_request' || github.event_name == 'push' - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - include: - - platform: x64 - configuration: release - os: windows-2019 - WITH_LIBSODIUM: ON - ENABLE_CURVE: ON - CMAKE_GENERATOR: Visual Studio 16 2019 - MSVCVERSION: v142 - MSVCYEAR: vs2019 - ARTIFACT_NAME: v142-x64 - ENABLE_DRAFTS: ON - - platform: x64 - configuration: Release - os: windows-2016 - WITH_LIBSODIUM: ON - ENABLE_CURVE: ON - CMAKE_GENERATOR: "Visual Studio 15 2017 Win64" - MSVCVERSION: "v141" - MSVCYEAR: "vs2017" - ARTIFACT_NAME: v141-x64 - ENABLE_DRAFTS: ON - - os: ubuntu-latest - BUILD_TYPE: default - PACKAGES: asciidoc xmlto - CURVE: tweetnacl - DRAFT: disabled - POLLER: select - - os: ubuntu-latest - BUILD_TYPE: default - CURVE: tweetnacl - DRAFT: disabled - POLLER: poll - - os: ubuntu-latest - BUILD_TYPE: android - CURVE: tweetnacl - DRAFT: disabled - - os: ubuntu-latest - BUILD_TYPE: coverage - PACKAGES: libkrb5-dev libnorm-dev libpgm-dev libgnutls28-dev lcov - CURVE: tweetnacl - DRAFT: enabled - GSSAPI: enabled - PGM: enabled - NORM: enabled - TIPC: enabled - TLS: enabled - VMCI: enabled - - os: ubuntu-latest - BUILD_TYPE: valgrind - PACKAGES: valgrind libgnutls28-dev - CURVE: tweetnacl - DRAFT: enabled - - os: ubuntu-latest - BUILD_TYPE: cmake - CURVE: libsodium - DRAFT: enabled - PACKAGES: cmake libsodium-dev - TLS: enabled - - os: ubuntu-latest - BUILD_TYPE: cmake - DRAFT: enabled - PACKAGES: cmake clang-format-11 - DO_CLANG_FORMAT_CHECK: 1 - - os: ubuntu-latest - BUILD_TYPE: default - PACKAGES: libkrb5-dev libnorm-dev libpgm-dev libgnutls28-dev libsodium-dev libnss3-dev libbsd-dev - CURVE: libsodium - ADDRESS_SANITIZER: enabled - DRAFT: enabled - - os: ubuntu-latest - BUILD_TYPE: default - PACKAGES: libkrb5-dev libnorm-dev libpgm-dev libgnutls28-dev libsodium-dev libnss3-dev libbsd-dev - CURVE: libsodium - GSSAPI: enabled - PGM: enabled - NORM: enabled - TIPC: enabled - IPv6: ON - TLS: enabled - USE_NSS: yes - VMCI: enabled - DRAFT: enabled - - os: ubuntu-latest - BUILD_TYPE: default - PACKAGES: libkrb5-dev libnorm-dev libpgm-dev libgnutls28-dev libsodium-dev libnss3-dev - CURVE: libsodium - GSSAPI: enabled - PGM: enabled - NORM: enabled - TIPC: enabled - IPv6: ON - TLS: enabled - USE_NSS: yes - VMCI: enabled - DRAFT: enabled - FORCE_98: enabled - CXX: clang++ - - os: ubuntu-latest - BUILD_TYPE: abi-compliance-checker - PACKAGES: abi-dumper abi-compliance-checker - CURVE: tweetnacl - DRAFT: disabled - - os: ubuntu-latest - BUILD_TYPE: cmake - PACKAGES: clang-tidy clang-tools - CURVE: tweetnacl - DRAFT: enabled - CXX: clang++ - - os: macos-latest - BUILD_TYPE: default - PACKAGES: automake autoconf - CURVE: tweetnacl - DRAFT: enabled - - os: macos-latest - BUILD_TYPE: default - PACKAGES: automake autoconf libsodium - CURVE: libsodium - DRAFT: disabled - env: - platform: ${{ matrix.platform }} - configuration: ${{ matrix.configuration }} - WITH_LIBSODIUM: ${{ matrix.WITH_LIBSODIUM }} - ENABLE_CURVE: ${{ matrix.ENABLE_CURVE }} - CMAKE_GENERATOR: ${{ matrix.CMAKE_GENERATOR }} - MSVCVERSION: ${{ matrix.MSVCVERSION }} - MSVCYEAR: ${{ matrix.MSVCYEAR }} - ARTIFACT_NAME: ${{ matrix.ARTIFACT_NAME }} - ENABLE_DRAFTS: ${{ matrix.ENABLE_DRAFTS }} - SODIUM_INCLUDE_DIR: ${{ github.workspace }}\libsodium\src\libsodium\include" - SODIUM_LIBRARY_DIR: ${{ github.workspace }}\libsodium\bin\${{ matrix.platform }}\${{ matrix.configuration }}\${{ matrix.MSVCVERSION }}\dynamic" - LIBZMQ_SRCDIR: ${{ github.workspace }}\libzmq - BUILD_TYPE: ${{ matrix.BUILD_TYPE }} - CURVE: ${{ matrix.CURVE }} - DRAFT: ${{ matrix.DRAFT }} - ADDRESS_SANITIZER: ${{ matrix.ADDRESS_SANITIZER }} - DO_CLANG_FORMAT_CHECK: ${{ matrix.DO_CLANG_FORMAT_CHECK }} - FORCE_98: ${{ matrix.FORCE_98 }} - CXX: ${{ matrix.CXX }} - GSSAPI: ${{ matrix.GSSAPI }} - PGM: ${{ matrix.PGM }} - NORM: ${{ matrix.NORM }} - TIPC: ${{ matrix.TIPC }} - IPv6: ${{ matrix.IPv6 }} - TLS: ${{ matrix.TLS }} - USE_NSS: ${{ matrix.USE_NSS }} - VMCI: ${{ matrix.VMCI }} - POLLER: ${{ matrix.POLLER }} - steps: - - name: Add msbuild to PATH - uses: microsoft/setup-msbuild@v1.0.2 - if: matrix.os == 'windows-2019' - - name: Add msbuild to PATH 2016 - uses: microsoft/setup-msbuild@v1.0.2 - with: - vs-version: '[15.0,16.0)' - if: matrix.os == 'windows-2016' - - uses: actions/checkout@v2 - if: matrix.WITH_LIBSODIUM == 'ON' - with: - repository: jedisct1/libsodium - ref: stable - path: libsodium - - name: Compile libsodium - if: matrix.WITH_LIBSODIUM == 'ON' && (matrix.os == 'windows-2019' || matrix.os == 'windows-2016') - shell: cmd - working-directory: libsodium - run: msbuild /v:minimal /p:Configuration=%Configuration%DLL builds\msvc\%MSVCYEAR%\libsodium\libsodium.vcxproj - - name: Copy libsodium - if: matrix.WITH_LIBSODIUM == 'ON' && (matrix.os == 'windows-2019' || matrix.os == 'windows-2016') - shell: powershell - working-directory: libsodium - run: Copy-Item "bin\${env:Platform}\${env:Configuration}\${env:MSVCVERSION}\dynamic\libsodium.lib" -Destination "bin\${env:Platform}\${env:Configuration}\${env:MSVCVERSION}\dynamic\sodium.lib" - - uses: actions/checkout@v2 - with: - path: libzmq - - run: md build_libzmq - shell: cmd - if: matrix.os == 'windows-2019' || matrix.os == 'windows-2016' - - name: build-win - if: matrix.os == 'windows-2019' || matrix.os == 'windows-2016' - shell: cmd - working-directory: build_libzmq - run: | - cmake -D CMAKE_INCLUDE_PATH="%SODIUM_INCLUDE_DIR%" -D CMAKE_LIBRARY_PATH="%SODIUM_LIBRARY_DIR%" -D WITH_LIBSODIUM="%WITH_LIBSODIUM%" -D ENABLE_DRAFTS="%ENABLE_DRAFTS%" -D ENABLE_ANALYSIS="%ENABLE_ANALYSIS%" -D ENABLE_CURVE="%ENABLE_CURVE%" -D API_POLLER="%API_POLLER%" -D POLLER="%POLLER%" %EXTRA_FLAGS% -D WITH_LIBSODIUM="%WITH_LIBSODIUM%" -D LIBZMQ_WERROR="%LIBZMQ_WERROR%" -G "%CMAKE_GENERATOR%" "%LIBZMQ_SRCDIR%" - cmake --build . --config %configuration% --target install -- -verbosity:Minimal -maxcpucount - - name: test - if: matrix.os == 'windows-2019' || matrix.os == 'windows-2016' - shell: cmd - working-directory: build_libzmq - run: ctest -C "%Configuration%" - - name: Add debian packages - if: matrix.os == 'ubuntu-latest' && (matrix.BUILD_TYPE != 'coverage' || github.repository == 'zeromq/libzmq') - uses: myci-actions/add-deb-repo@10 - with: - repo-name: obs - repo: deb http://download.opensuse.org/repositories/network:/messaging:/zeromq:/git-stable/xUbuntu_20.04/ ./ - keys-asc: https://download.opensuse.org/repositories/network:/messaging:/zeromq:/git-stable/xUbuntu_20.04/Release.key - install: ${{ matrix.PACKAGES }} - - name: Add brew packages - if: matrix.os == 'macos-latest' - shell: bash - run: brew install ${{ matrix.PACKAGES }} - - name: build - if: (matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest') && (matrix.BUILD_TYPE != 'coverage' || github.repository == 'zeromq/libzmq') - shell: bash - working-directory: libzmq - run: ./ci_build.sh - - name: coveralls - if: matrix.BUILD_TYPE == 'coverage' && github.repository == 'zeromq/libzmq' - uses: coverallsapp/github-action@master - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - path-to-lcov: /home/runner/work/libzmq/libzmq/libzmq/lcov.info - cron: - runs-on: ubuntu-latest - if: github.event_name == 'schedule' - strategy: - fail-fast: false - env: - BUILD_TYPE: cmake - CXX: clang++ - CLANG_TIDY: clang-tidy - steps: - - name: Add debian packages - run: apt-get install --yes clang-tidy clang-tools - - name: build - shell: bash - working-directory: libzmq - run: ./ci_build.sh diff --git a/libs/libzmq/.github/workflows/Fuzzers.yaml b/libs/libzmq/.github/workflows/Fuzzers.yaml deleted file mode 100644 index e8ae6b5..0000000 --- a/libs/libzmq/.github/workflows/Fuzzers.yaml +++ /dev/null @@ -1,35 +0,0 @@ -name: Fuzzers -on: - push: - branches: - - master - pull_request: - paths: - - '.github/workflows/Fuzzers.yaml' - - 'src/*' - - 'tests/*fuzzer.cpp' -jobs: - Fuzzing: - runs-on: ubuntu-latest - if: github.repository == 'zeromq/libzmq' - strategy: - matrix: - san: [address, memory, undefined] - steps: - - name: Build Fuzzers (${{ matrix.san }}) - id: build - uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master - with: - sanitizer: ${{ matrix.san }} - oss-fuzz-project-name: 'libzmq' - allowed-broken-targets-percentage: 0 - dry-run: false - - name: Run Fuzzers (${{ matrix.san }}) - id: run - uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master - with: - sanitizer: ${{ matrix.san }} - oss-fuzz-project-name: 'libzmq' - allowed-broken-targets-percentage: 0 - dry-run: false - fuzz-seconds: 300 diff --git a/libs/libzmq/.gitignore b/libs/libzmq/.gitignore deleted file mode 100644 index 6170b15..0000000 --- a/libs/libzmq/.gitignore +++ /dev/null @@ -1,127 +0,0 @@ -syntax: glob # for hg-git users - -# Generated build scripts and IDE generating files -## autotools -/Makefile -builds/Makefile -builds/deprecated-msvc/Makefile -doc/Makefile -libtool -### automake -Makefile.in -.deps/ -.dirstamp -### autoconf -autom4te.cache -aclocal.m4 -config -config.status -config.log -configure -stamp-h1 -## CMake -cmake-build-debug/ -build/ -## Android -builds/android/prefix -## IntelliJ -.idea/ -## Visual Code -.vscode/ -## other results-like folders -bin/ -lib/ -obj/ -## Doxygen -doxygen/ -## Packaging -packaging/nuget/*.nupkg - -# Test related build files -libtestutil.a -libunity.a - -# Some build outputs and temporal files -*.o -*.gcno -*.gcda -*.gcov -*.ncb -*.lo -*.loT -*.la -*.exe -*.html -*.pdf -*.ps -*~ -.*~ -.libs - -# /src -## Ignore generated files in configuration process -src/platform.hpp* -src/libzmq.pc - -# /tools -## Executable binaries are ignored -tools/curve_keygen -## Executable source files must be tracked -!tools/*.[ch] -!tools/*.[ch]pp - -# /tests -## Test binaries and logs are ignored -tests/test* -tests/test*.log -tests/test*.trs -## Test source files must be tracked -!tests/test*.[ch] -!tests/test*.[ch]pp -## Build script and documentations must be tracked -!tests/CMakeLists.txt -!tests/README.md - -# /unittests -## Unit test binaries and logs are ignored -unittests/unittest_* -unittests/unittest*.log -unittests/unittest*.trs -## Unit test source files must be tracked -!unittests/unittest*.[ch] -!unittests/unittest*.[ch]pp -## Build script and documentations must be tracked -!unittests/CMakeLists.txt -!unittests/README.md - -# check test log files -test-suite*.log - -# /perf -## Benchmarking binaries and result files are ignored -perf/*_lat -perf/*_thr -perf/benchmark_* -perf/results -## Benchmarking source files must be tracked -!perf/*.[ch] -!perf/*.[ch]pp -## Benchmarking tool scripts must be tracked -!perf/*.py -!perf/*.sh - -# /doc -## Generated document files -doc/*.[137] -doc/*.html -doc/*.xml - -# external libraries and release archive files -foreign/openpgm/* -!foreign/openpgm/*.tar.bz2 -!foreign/openpgm/*.tar.gz -!foreign/openpgm/Makefile.am -zeromq-*.tar.gz -zeromq-*.zip -core - diff --git a/libs/libzmq/.hgeol b/libs/libzmq/.hgeol deleted file mode 100644 index a484af6..0000000 --- a/libs/libzmq/.hgeol +++ /dev/null @@ -1,2 +0,0 @@ -[patterns] -** = native diff --git a/libs/libzmq/.mailmap b/libs/libzmq/.mailmap deleted file mode 100644 index 77e75fa..0000000 --- a/libs/libzmq/.mailmap +++ /dev/null @@ -1,81 +0,0 @@ -Ahmet Kakici ahmet -Andrey Sibiryov Kobolog -Brian Knox taotetek -Chernyshev Vyacheslav Astellar -Chris Laws Chris Laws -Chris Staite Chris -Christoph Zach czach -Chuck Remes Chuck Remes -Chuck Remes Chuck Remes -Constantin Rack Constantin Rack -Constantin Rack Constantin Rack -Daniel Krikun danielkr -Daiyu Hurst DaiyuHurst -Diego Rodriguez-Losada Diego -Dongmin Yu Min(Dongmin Yu) -Doron Somech somdoron -Elliot Saba staticfloat -Eric Voskuil evoskuil -Eric Voskuil anonymous -Felipe Farinon psl-felipefarinon -Frank Hartmann Frank -Gian Lorenzo Meocci meox -Hardeep Singh Hardeep -Henrik Feldt Henrik -Huang Xin chrox -Ian Barber Ian Barber -Jens Auer Jens Auer -Jens Auer Jens Auer -Joe Eli McIlvain Joe McIlvain -Jos Decoster jdc8 -Jos Decoster Jos Decoster -Joshua Gao Josh Gao -Jörg Kreuzberger kreuzberger -Arnaud Kapp Kapp Arnaud -Arnaud Kapp KAPP Arnaud -Arnaud Kapp KAPP Arnaud -Kenneth Wilke KennethWilke -Kevin Sapper sappo -Kevin Sapper Kevin Sapper -Leonard Michelet leonarf -Martijn Jasperse mjasperse -Martin Hurton Martin Hurtoň -Martin Lucina Martin Lucina -Martin Sustrik Martin Sustrik -Martin Sustrik Martin Sustrik -Martin Sustrik sustrik -Martin Sustrik Martin Sustrik -Martin Sustrik unknown -Martin Sustrik Martin Sustrik -Maurice Barnum maurice barnum -Maurizio Melato unknown -Max Skaller skaller -Michael Fox <415fox@gmail.com> m <415fox@gmail.com> -Michael Hand Mipa -Michel Zou xantares -Mikael Helbo Kjaer Mikael Helbo Kjær -Mike Gatny Mike Gatny -Mikko Koppanen Mikko Koppanen -Mikko Koppanen Mikko Koppanen -Mikko Koppanen Mikko Koppanen -Min RK MinRK -Min RK Min Ragan-Kelley -Montoya Edu montoyaedu -Nikita Kozlov nikita kozlov -Pavol Malosek malosek -Pieter Hintjens Pieter Hintjens -Reza Ebrahimi reza.ebrahimi -Ricardo Catalinas Jiménez Ricardo Catalinas Jiménez -Rohan Bedarkar rohanbedarkar -Rohan Bedarkar Rohan -Sergey KHripchenko root -Sergey KHripchenko shripchenko -Sergey M. Sergey M․ -Steven McCoy Steve-o -Tamara Kustarova tamara -Timothee Besset Timothee "TTimo" Besset -Timothy Mossbarger Tim M -Trevor Bernard Trevor Bernard -Trevor Bernard Trevor Bernard -Volodymyr Korniichuk Volodymyr Korniichuk <9173519@gmail.com> -lysyloren lysyloren diff --git a/libs/libzmq/.obs/workflows.yml b/libs/libzmq/.obs/workflows.yml deleted file mode 100644 index fd3c13b..0000000 --- a/libs/libzmq/.obs/workflows.yml +++ /dev/null @@ -1,16 +0,0 @@ -workflow: - steps: - - branch_package: - source_project: network:messaging:zeromq:git-draft - source_package: libzmq - target_project: network:messaging:zeromq:ci -release: - steps: - - trigger_services: - project: network:messaging:zeromq:release-stable - package: libzmq - - trigger_services: - project: network:messaging:zeromq:release-draft - package: libzmq - filters: - event: tag_push diff --git a/libs/libzmq/.travis.yml b/libs/libzmq/.travis.yml deleted file mode 100644 index e4cb1dd..0000000 --- a/libs/libzmq/.travis.yml +++ /dev/null @@ -1,43 +0,0 @@ -# Travis CI script - -language: c - -os: -- linux - -dist: bionic - -cache: ccache - -env: - matrix: - - BUILD_TYPE=default - # tokens to deploy releases on OBS and create/delete temporary branch on Github. - # 1) Create a token on https://github.com/settings/tokens/new with "public_repo" - # capability and encrypt it with travis encrypt --org -r zeromq/libzmq GH_TOKEN="" - # 2) Create 2 OBS tokens with osc token --create network:messaging:zeromq:release- libzmq - # encrypt them with travis encrypt --org -r zeromq/libzmq OBS__TOKEN="" - global: - - secure: aaIs9Y44FYp9VFCqa6LLD4illBH4aUfbS0zzzbAQ5xJvD6NfBsMiKEIhf/kRNCHAtP+1VfQVOejTD6/i08ALsVr3cZD9oB/t7874tz2/jeZUIhRNo+1KwyaVqNg0yUSV6ASIoq4aOfuGnjBlezNQ8LQ2bjQB2m4Enl5wxoYcYdA= - - secure: YFrcedBIKe0NR1WC6qQi9phZgtnzOiBIXm40TirvCtstV4eVnSouKgtQfLLArZ4o2tjflq4grQQNo1rJatvyi5YPOXsMcndsni18S+4Ffu8qbECdtPrK52vBweuf7q9oV9Ydax0Fm4bEqEMOZ2/mRBy3nK+mgsE3upeMwyWR0Zw= - - secure: lbZSzmqN39QdJwewKOZgq/1ijPKuyx9MFrGzMqXj2+eOSlaZS/tNavHMdKJOev+qJGK9wxmwzxOxS10AiH+AvN7WBacXX4ZtudjScz2HKJRDWTKyzMbzyScq51afniItzrsm+Vo8NHkenNFkux0sSbh0aHlpkLwrGQu+WZWcDN4= - - secure: "ZFL7hLJlGwYix8fF835OnQYakBt/o5iS7IfSW7el44ejEvGAOM9O5/ufxCcqSqn8Np7nOaM3RriAVTqWPZD6S7tMeflGTSGYHPYwWUc83z4rUPyG2FWVKXdB8ufpebAwu3hCgLiSmVeoQG47dl6xNk1oKCd+3UIjgz33u1Ecfps=" - -# Build and check this project according to the BUILD_TYPE -script: ./ci_build.sh - -# Deploy tags -before_deploy: -- . ./ci_deploy.sh -deploy: - provider: releases - api_key: - secure: vGB5E+A8wxm2J1GJZzmIgT9PrjEzvd9gE8iui8FyxSbxAsW9vFZFGZC/21sTtpVcmRarwQCHH1UEbtg+nJwN2iD9YzMRnSVks8xqP+b709YW+VXaMuhZgTzWa74IorQku7NuvLibvQk72/OSgdwPGaNJ6f5AX9pnWVWbEoW1svE= - file_glob: true - file: ${LIBZMQ_DEPLOYMENT} - skip_cleanup: true - on: - repo: zeromq/libzmq - branch: master - tags: true - condition: "$TRAVIS_OS_NAME =~ (linux) && $BUILD_TYPE =~ (default) && $CURVE =~ (libsodium) && -z $DRAFT" diff --git a/libs/libzmq/AUTHORS b/libs/libzmq/AUTHORS deleted file mode 100644 index 42b865f..0000000 --- a/libs/libzmq/AUTHORS +++ /dev/null @@ -1,152 +0,0 @@ -Corporate Contributors -====================== - -Copyright (c) 2007-2014 iMatix Corporation -Copyright (c) 2009-2011 250bpm s.r.o. -Copyright (c) 2010-2011 Miru Limited -Copyright (c) 2011 VMware, Inc. -Copyright (c) 2012 Spotify AB -Copyright (c) 2013 Ericsson AB -Copyright (c) 2014 AppDynamics Inc. -Copyright (c) 2015 Google, Inc. -Copyright (c) 2015-2016 Brocade Communications Systems Inc. - -Individual Contributors -======================= - -AJ Lewis -Alexej Lotz -Andrew Thompson -André Caron -Asko Kauppi -Attila Mark -Barak Amar -Ben Gray -Bernd Melchers -Bernd Prager -Bob Beaty -Brandon Carpenter -Brett Cameron -Brian Buchanan -Burak Arslan -Carl Clemens -Chia-liang Kao -Chris Busbey -Chris Rempel -Chris Wong -Christian Gudrian -Christian Kamm -Chuck Remes -Conrad D. Steenberg -Constantin Rack -Daniel J. Bernstein -Dhammika Pathirana -Dhruva Krishnamurthy -Dirk O. Kaar -Doron Somech -Douglas Creager -Drew Crawford -Erich Heine -Erik Hugne -Erik Rigtorp -Fabien Ninoles -Frank Denis -George Neill -Gerard Toonstra -Ghislain Putois -Gonzalo Diethelm -Guido Goldstein -Harald Achitz -Hardeep Singh -Hiten Pandya -Ian Barber -Ilja Golshtein -Ilya Kulakov -Ivo Danihelka -Jacob Rideout -Joe Thornber -Jon Dyte -Kamil Shakirov -Ken Steele -Kouhei Sutou -Laurent Alebarde -Leonardo J. Consoni -Lionel Flandrin -Lourens Naudé -Luca Boccassi -Marc Rossi -Mark Barbisan -Martin Hurton -Martin Lucina -Martin Pales -Martin Sustrik -Matus Hamorsky -Max Wolf -McClain Looney -Michael Compton -Mika Fischer -Mikael Helbo Kjaer -Mike Gatny -Mikko Koppanen -Min Ragan-Kelley -Neale Ferguson -Nir Soffer -Osiris Pedroso -Paul Betts -Paul Colomiets -Pavel Gushcha -Pavol Malosek -Perry Kundert -Peter Bourgon -Philip Kovacs -Pieter Hintjens -Piotr Trojanek -Reza Ebrahimi -Richard Newton -Rik van der Heijden -Robert G. Jakabosky -Sebastian Otaegui -Stefan Radomski -Steven McCoy -Stuart Webster -Tamara Kustarova -Taras Shpot -Tero Marttila -Terry Wilson -Thijs Terlouw -Thomas Rodgers -Tim Mossbarger -Toralf Wittner -Tore Halvorsen -Trevor Bernard -Vitaly Mayatskikh - -Credits -======= - -Aamir Mohammad -Adrian von Bidder -Aleksey Yeschenko -Alessio Spadaro -Alexander Majorov -Anh Vu -Bernd Schumacher -Brian Granger -Carsten Dinkelmann -David Bahi -Dirk Eddelbuettel -Evgueny Khartchenko -Frank Vanden Berghen -Ian Barber -John Apps -Markus Fischer -Matt Muggeridge -Michael Santy -Oleg Sevostyanov -Paulo Henrique Silva -Peter Busser -Peter Lemenkov -Robert Zhang -Toralf Wittner -Zed Shaw - diff --git a/libs/libzmq/CMakeLists.txt b/libs/libzmq/CMakeLists.txt deleted file mode 100644 index 23c5c1d..0000000 --- a/libs/libzmq/CMakeLists.txt +++ /dev/null @@ -1,1864 +0,0 @@ -# CMake build script for ZeroMQ -project(ZeroMQ) - -if(${CMAKE_SYSTEM_NAME} STREQUAL Darwin) - cmake_minimum_required(VERSION 3.0.2) -else() - cmake_minimum_required(VERSION 2.8.12) -endif() - -include(CheckIncludeFiles) -include(CheckCCompilerFlag) -include(CheckCXXCompilerFlag) -include(CheckLibraryExists) -include(CheckCSourceCompiles) -include(CheckCSourceRuns) -include(CMakeDependentOption) -include(CheckCXXSymbolExists) -include(CheckStructHasMember) -include(CheckTypeSize) -include(FindThreads) -include(GNUInstallDirs) -include(CheckTypeSize) -include(CMakePackageConfigHelpers) - -list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRENT_SOURCE_DIR}") -set(ZMQ_CMAKE_MODULES_DIR ${CMAKE_CURRENT_SOURCE_DIR}/builds/cmake/Modules) -list(APPEND CMAKE_MODULE_PATH ${ZMQ_CMAKE_MODULES_DIR}) - -include(TestZMQVersion) -include(ZMQSourceRunChecks) -include(ZMQSupportMacros) - -find_package(PkgConfig) - -# Set lists to empty beforehand as to not accidentally take values from parent -set(sources) -set(cxx-sources) -set(html-docs) -set(target_outputs) - -option(ENABLE_ASAN "Build with address sanitizer" OFF) -if(ENABLE_ASAN) - message(STATUS "Instrumenting with Address Sanitizer") - set(CMAKE_BUILD_TYPE "RelWithDebInfo") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -fsanitize-address-use-after-scope -fno-omit-frame-pointer") - set(CMAKE_CXX_FLAGS - "${CMAKE_CXX_FLAGS} -fsanitize=address -fsanitize-address-use-after-scope -fno-omit-frame-pointer") - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fsanitize=address -fsanitize-address-use-after-scope") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address -fsanitize-address-use-after-scope") -endif() - -# NOTE: Running libzmq under TSAN doesn't make much sense -- synchronization in libzmq is to some extent -# handled by the code "knowing" what threads are allowed to do, rather than by enforcing those -# restrictions, so TSAN generates a lot of (presumably) false positives from libzmq. -# The settings below are intended to enable libzmq to be built with minimal support for TSAN -# such that it can be used along with other code that is also built with TSAN. -option(ENABLE_TSAN "Build with thread sanitizer" OFF) -if(ENABLE_TSAN) - message(STATUS "Instrumenting with Thread Sanitizer") - set(CMAKE_BUILD_TYPE "RelWithDebInfo") - set(TSAN_FLAGS "-fno-omit-frame-pointer -fsanitize=thread") - set(TSAN_CCFLAGS "${TSAN_CCFLAGS} -mllvm -tsan-instrument-memory-accesses=0") - set(TSAN_CCFLAGS "${TSAN_CCFLAGS} -mllvm -tsan-instrument-atomics=0") - set(TSAN_CCFLAGS "${TSAN_CCFLAGS} -mllvm -tsan-instrument-func-entry-exit=1") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${TSAN_FLAGS} ${TSAN_CCFLAGS} -fPIE") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TSAN_FLAGS} ${TSAN_CCFLAGS} -fPIE") - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${TSAN_FLAGS} -pie -Qunused-arguments") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${TSAN_FLAGS} -pie -Qunused-arguments") -endif() - -option(ENABLE_UBSAN "Build with undefined behavior sanitizer" OFF) -if(ENABLE_UBSAN) - message(STATUS "Instrumenting with Undefined Behavior Sanitizer") - set(CMAKE_BUILD_TYPE "Debug") - set(UBSAN_FLAGS "${UBSAN_FLAGS} -fno-omit-frame-pointer") - set(UBSAN_FLAGS "${UBSAN_FLAGS} -fsanitize=undefined") - set(UBSAN_FLAGS "${UBSAN_FLAGS} -fsanitize=implicit-conversion") - set(UBSAN_FLAGS "${UBSAN_FLAGS} -fsanitize=implicit-integer-truncation") - set(UBSAN_FLAGS "${UBSAN_FLAGS} -fsanitize=integer") - set(UBSAN_FLAGS "${UBSAN_FLAGS} -fsanitize=nullability") - set(UBSAN_FLAGS "${UBSAN_FLAGS} -fsanitize=vptr") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${UBSAN_FLAGS}") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${UBSAN_FLAGS}") - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${UBSAN_FLAGS}") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${UBSAN_FLAGS}") -endif() - -option(ENABLE_INTRINSICS "Build using compiler intrinsics for atomic ops" OFF) -if(ENABLE_INTRINSICS) - message(STATUS "Using compiler intrinsics for atomic ops") - add_definitions(-DZMQ_HAVE_ATOMIC_INTRINSICS) -endif() - -set(ZMQ_OUTPUT_BASENAME - "zmq" - CACHE STRING "Output zmq library base name") - -if(${CMAKE_SYSTEM_NAME} STREQUAL Darwin) - # Find more information: https://cmake.org/Wiki/CMake_RPATH_handling - - # Apply CMP0042: MACOSX_RPATH is enabled by default - cmake_policy(SET CMP0042 NEW) - - # Add an install rpath if it is not a system directory - list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" isSystemDir) - if("${isSystemDir}" STREQUAL "-1") - set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") - endif() - - # Add linker search paths pointing to external dependencies - set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) -endif() - -if (NOT MSVC) - if(NOT CMAKE_CXX_FLAGS MATCHES "-std=" AND NOT CXX_STANDARD AND NOT CMAKE_CXX_STANDARD) - # use C++11 by default if supported - check_cxx_compiler_flag("-std=c++11" COMPILER_SUPPORTS_CXX11) - if(COMPILER_SUPPORTS_CXX11) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") - endif() - endif() - if(NOT CMAKE_C_FLAGS MATCHES "-std=" AND NOT C_STANDARD AND NOT CMAKE_C_STANDARD) - check_c_compiler_flag("-std=c11" COMPILER_SUPPORTS_C11) - if(COMPILER_SUPPORTS_C11) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11") - else() - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99") - endif() - endif() - - # clang 6 has a warning that does not make sense on multi-platform code - check_cxx_compiler_flag("-Wno-tautological-constant-compare" CXX_HAS_TAUT_WARNING) - if(CXX_HAS_TAUT_WARNING) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-tautological-constant-compare") - endif() - check_c_compiler_flag("-Wno-tautological-constant-compare" CC_HAS_TAUT_WARNING) - if(CC_HAS_TAUT_WARNING) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-tautological-constant-compare") - endif() -endif() - -# Will be used to add flags to pkg-config useful when apps want to statically link -set(pkg_config_libs_private "") -set(pkg_config_names_private "") - -option(WITH_OPENPGM "Build with support for OpenPGM" OFF) -option(WITH_NORM "Build with support for NORM" OFF) -option(WITH_VMCI "Build with support for VMware VMCI socket" OFF) - -if(APPLE) - option(ZMQ_BUILD_FRAMEWORK "Build as OS X framework" OFF) -endif() - -if(EXISTS "${CMAKE_SOURCE_DIR}/.git") - option(ENABLE_DRAFTS "Build and install draft classes and methods" ON) -else() - option(ENABLE_DRAFTS "Build and install draft classes and methods" OFF) -endif() - -# Enable WebSocket transport and RadixTree -if(ENABLE_DRAFTS) - message(STATUS "Building draft classes and methods") - option(ENABLE_WS "Enable WebSocket transport" ON) - option(ENABLE_RADIX_TREE "Use radix tree implementation to manage subscriptions" ON) -else() - message(STATUS "Not building draft classes and methods") - option(ENABLE_WS "Enable WebSocket transport" OFF) - option(ENABLE_RADIX_TREE "Use radix tree implementation to manage subscriptions" OFF) -endif() - -if(ENABLE_RADIX_TREE) - message(STATUS "Using radix tree implementation to manage subscriptions") - set(ZMQ_USE_RADIX_TREE 1) -endif() - -if(ENABLE_WS) - list( - APPEND - sources - ${CMAKE_CURRENT_SOURCE_DIR}/src/ws_address.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/ws_connecter.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/ws_decoder.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/ws_encoder.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/ws_engine.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/ws_listener.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/ws_address.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/ws_connecter.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/ws_decoder.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/ws_encoder.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/ws_engine.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/ws_listener.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/ws_protocol.hpp) - set(ZMQ_HAVE_WS 1) - - message(STATUS "Enable WebSocket transport") - - option(WITH_TLS "Use TLS for WSS support" ON) - option(WITH_NSS "Use NSS instead of builtin sha1" OFF) - - if(WITH_TLS) - find_package("GnuTLS" 3.6.7) - if(GNUTLS_FOUND) - set(pkg_config_names_private "${pkg_config_names_private} gnutls") - list(APPEND sources ${CMAKE_CURRENT_SOURCE_DIR}/src/wss_address.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/wss_address.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/wss_engine.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/wss_engine.cpp) - - message(STATUS "Enable WSS transport") - set(ZMQ_USE_GNUTLS 1) - set(ZMQ_HAVE_WSS 1) - else() - message(WARNING "No WSS support, you may want to install GnuTLS and run cmake again") - endif() - endif() -endif() - -if(NOT ZMQ_USE_GNUTLS) - if(WITH_NSS) - pkg_check_modules(NSS3 "nss") - if(NSS3_FOUND) - set(pkg_config_names_private "${pkg_config_names_private} nss") - message(STATUS "Using NSS") - set(ZMQ_USE_NSS 1) - else() - find_package("NSS3") - if(NSS3_FOUND) - set(pkg_config_libs_private "${pkg_config_libs_private} -lnss3") - message(STATUS "Using NSS") - set(ZMQ_USE_NSS 1) - else() - message(WARNING "No nss installed, if you don't want builtin SHA1, install NSS or GnuTLS") - endif() - endif() - endif() - if(NOT ZMQ_USE_NSS) - list(APPEND sources ${CMAKE_CURRENT_SOURCE_DIR}/external/sha1/sha1.c - ${CMAKE_CURRENT_SOURCE_DIR}/external/sha1/sha1.h) - message(STATUS "Using builtin sha1") - set(ZMQ_USE_BUILTIN_SHA1 1) - endif() -endif() - -if(NOT MSVC) - option(WITH_LIBBSD "Use libbsd instead of builtin strlcpy" ON) - if(WITH_LIBBSD) - pkg_check_modules(LIBBSD "libbsd") - if(LIBBSD_FOUND) - message(STATUS "Using libbsd") - set(pkg_config_names_private "${pkg_config_names_private} libbsd") - set(ZMQ_HAVE_LIBBSD 1) - endif() - endif() - check_cxx_symbol_exists(strlcpy string.h ZMQ_HAVE_STRLCPY) -endif() - -# Select curve encryption library, defaults to tweetnacl To use libsodium instead, use --with-libsodium(must be -# installed) To disable curve, use --disable-curve - -option(WITH_LIBSODIUM "Use libsodium instead of built-in tweetnacl" ON) -option(WITH_LIBSODIUM_STATIC "Use static libsodium library" OFF) -option(ENABLE_LIBSODIUM_RANDOMBYTES_CLOSE "Automatically close libsodium randombytes. Not threadsafe without getrandom()" ON) -option(ENABLE_CURVE "Enable CURVE security" ON) - -if(ENABLE_CURVE) - if(WITH_LIBSODIUM) - find_package("Sodium") - if(SODIUM_FOUND) - message(STATUS "Using libsodium for CURVE security") - include_directories(${SODIUM_INCLUDE_DIRS}) - if(WITH_LIBSODIUM_STATIC) - add_compile_definitions(SODIUM_STATIC) - endif() - set(ZMQ_USE_LIBSODIUM 1) - set(ZMQ_HAVE_CURVE 1) - if (ENABLE_LIBSODIUM_RANDOMBYTES_CLOSE) - set(ZMQ_LIBSODIUM_RANDOMBYTES_CLOSE 1) - endif() - else() - message( - WARNING - "libsodium not installed, instead using builtin tweetnacl, you may want to install libsodium and run cmake again" - ) - endif() - endif() - if(NOT ZMQ_HAVE_CURVE) - message(STATUS "Using tweetnacl for CURVE security") - list(APPEND sources ${CMAKE_CURRENT_SOURCE_DIR}/src/tweetnacl.c) - set(ZMQ_USE_TWEETNACL 1) - set(ZMQ_HAVE_CURVE 1) - endif() -else() - message(STATUS "CURVE security is disabled") -endif() - -set(SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") - -option(WITH_MILITANT "Enable militant assertions" OFF) -if(WITH_MILITANT) - add_definitions(-DZMQ_ACT_MILITANT) -endif() - -set(API_POLLER - "" - CACHE STRING "Choose polling system for zmq_poll(er)_*. valid values are - poll or select [default=poll unless POLLER=select]") - -set(POLLER - "" - CACHE STRING "Choose polling system for I/O threads. valid values are - kqueue, epoll, devpoll, pollset, poll or select [default=autodetect]") - -if(WIN32) - if(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND CMAKE_SYSTEM_VERSION MATCHES "^10.0") - set(ZMQ_HAVE_WINDOWS_UWP ON) - set(ZMQ_HAVE_IPC OFF) - # to remove compile warninging "D9002 ignoring unknown option" - string(REPLACE "/Zi" "" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG}) - set(CMAKE_CXX_FLAGS_DEBUG - ${CMAKE_CXX_FLAGS_DEBUG} - CACHE STRING "" FORCE) - string(REPLACE "/Zi" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}) - set(CMAKE_CXX_FLAGS_RELWITHDEBINFO - ${CMAKE_CXX_FLAGS_RELWITHDEBINFO} - CACHE STRING "" FORCE) - string(REPLACE "/Zi" "" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG}) - endif() - # from https://stackoverflow.com/a/40217291/2019765 - macro(get_WIN32_WINNT version) - if(CMAKE_SYSTEM_VERSION) - set(ver ${CMAKE_SYSTEM_VERSION}) - string(REGEX MATCH "^([0-9]+).([0-9])" ver ${ver}) - string(REGEX MATCH "^([0-9]+)" verMajor ${ver}) - # Check for Windows 10, b/c we'll need to convert to hex 'A'. - if("${verMajor}" MATCHES "10") - set(verMajor "A") - string(REGEX REPLACE "^([0-9]+)" ${verMajor} ver ${ver}) - endif("${verMajor}" MATCHES "10") - # Remove all remaining '.' characters. - string(REPLACE "." "" ver ${ver}) - # Prepend each digit with a zero. - string(REGEX REPLACE "([0-9A-Z])" "0\\1" ver ${ver}) - set(${version} "0x${ver}") - endif(CMAKE_SYSTEM_VERSION) - endmacro(get_WIN32_WINNT) - - get_win32_winnt(ZMQ_WIN32_WINNT_DEFAULT) - message(STATUS "Detected _WIN32_WINNT from CMAKE_SYSTEM_VERSION: ${ZMQ_WIN32_WINNT_DEFAULT}") - - # TODO limit _WIN32_WINNT to the actual Windows SDK version, which might be different from the default version - # installed with Visual Studio - if(MSVC_VERSION STREQUAL "1500" AND CMAKE_SYSTEM_VERSION VERSION_GREATER "6.0") - set(ZMQ_WIN32_WINNT_LIMIT "0x0600") - elseif(MSVC_VERSION STREQUAL "1600" AND CMAKE_SYSTEM_VERSION VERSION_GREATER "6.1") - set(ZMQ_WIN32_WINNT_LIMIT "0x0601") - elseif(MSVC_VERSION STREQUAL "1700" AND CMAKE_SYSTEM_VERSION VERSION_GREATER "6.1") - set(ZMQ_WIN32_WINNT_LIMIT "0x0601") - elseif(MSVC_VERSION STREQUAL "1800" AND CMAKE_SYSTEM_VERSION VERSION_GREATER "6.2") - set(ZMQ_WIN32_WINNT_LIMIT "0x0602") - endif() - if(ZMQ_WIN32_WINNT_LIMIT) - message( - STATUS - "Mismatch of Visual Studio Version (${MSVC_VERSION}) and CMAKE_SYSTEM_VERSION (${CMAKE_SYSTEM_VERSION}), limiting _WIN32_WINNT to ${ZMQ_WIN32_WINNT_LIMIT}, you may override this by setting ZMQ_WIN32_WINNT" - ) - set(ZMQ_WIN32_WINNT_DEFAULT "${ZMQ_WIN32_WINNT_LIMIT}") - endif() - - set(ZMQ_WIN32_WINNT - "${ZMQ_WIN32_WINNT_DEFAULT}" - CACHE STRING "Value to set _WIN32_WINNT to for building [default=autodetect from build environment]") - - # On Windows Vista or greater, with MSVC 2013 or greater, default to epoll (which is required on Win 10 for ipc - # support) - if(ZMQ_WIN32_WINNT GREATER "0x05FF" - AND MSVC_VERSION GREATER 1799 - AND POLLER STREQUAL "" - AND NOT ZMQ_HAVE_WINDOWS_UWP) - set(POLLER "epoll") - endif() - - add_definitions(-D_WIN32_WINNT=${ZMQ_WIN32_WINNT}) -endif(WIN32) - -if(NOT MSVC) - if(POLLER STREQUAL "") - check_cxx_symbol_exists(kqueue sys/event.h HAVE_KQUEUE) - if(HAVE_KQUEUE) - set(POLLER "kqueue") - endif() - endif() - - if(POLLER STREQUAL "") - check_cxx_symbol_exists(epoll_create sys/epoll.h HAVE_EPOLL) - if(HAVE_EPOLL) - set(POLLER "epoll") - check_cxx_symbol_exists(epoll_create1 sys/epoll.h HAVE_EPOLL_CLOEXEC) - if(HAVE_EPOLL_CLOEXEC) - set(ZMQ_IOTHREAD_POLLER_USE_EPOLL_CLOEXEC 1) - endif() - endif() - endif() - - if(POLLER STREQUAL "") - set(CMAKE_EXTRA_INCLUDE_FILES sys/devpoll.h) - check_type_size("struct pollfd" DEVPOLL) - set(CMAKE_EXTRA_INCLUDE_FILES) - if(HAVE_DEVPOLL) - set(POLLER "devpoll") - endif() - endif() - - if(POLLER STREQUAL "") - check_cxx_symbol_exists(pollset_create sys/pollset.h HAVE_POLLSET) - if(HAVE_POLLSET) - set(POLLER "pollset") - endif() - endif() - - if(POLLER STREQUAL "") - check_cxx_symbol_exists(poll poll.h HAVE_POLL) - if(HAVE_POLL) - set(POLLER "poll") - endif() - endif() -endif() - -if(POLLER STREQUAL "") - if(WIN32) - set(HAVE_SELECT 1) - else() - check_cxx_symbol_exists(select sys/select.h HAVE_SELECT) - endif() - if(HAVE_SELECT) - set(POLLER "select") - else() - message(FATAL_ERROR "Could not autodetect polling method") - endif() -endif() - -if(POLLER STREQUAL "kqueue" - OR POLLER STREQUAL "epoll" - OR POLLER STREQUAL "devpoll" - OR POLLER STREQUAL "pollset" - OR POLLER STREQUAL "poll" - OR POLLER STREQUAL "select") - message(STATUS "Using polling method in I/O threads: ${POLLER}") - string(TOUPPER ${POLLER} UPPER_POLLER) - set(ZMQ_IOTHREAD_POLLER_USE_${UPPER_POLLER} 1) -else() - message(FATAL_ERROR "Invalid polling method") -endif() - -if(POLLER STREQUAL "epoll" AND WIN32) - message(STATUS "Including wepoll") - list(APPEND sources ${CMAKE_CURRENT_SOURCE_DIR}/external/wepoll/wepoll.c - ${CMAKE_CURRENT_SOURCE_DIR}/external/wepoll/wepoll.h) -endif() - -if(API_POLLER STREQUAL "") - if(POLLER STREQUAL "select") - set(API_POLLER "select") - else() - set(API_POLLER "poll") - endif() -endif() - -message(STATUS "Using polling method in zmq_poll(er)_* API: ${API_POLLER}") -string(TOUPPER ${API_POLLER} UPPER_API_POLLER) -set(ZMQ_POLL_BASED_ON_${UPPER_API_POLLER} 1) - -check_cxx_symbol_exists(pselect sys/select.h HAVE_PSELECT) -if (NOT WIN32 AND HAVE_PSELECT) - set(ZMQ_HAVE_PPOLL 1) -endif() - -# special alignment settings -execute_process( - COMMAND getconf LEVEL1_DCACHE_LINESIZE - OUTPUT_VARIABLE CACHELINE_SIZE - ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) -if(CACHELINE_SIZE STREQUAL "" - OR CACHELINE_SIZE EQUAL 0 - OR CACHELINE_SIZE EQUAL -1) - set(ZMQ_CACHELINE_SIZE 64) -else() - set(ZMQ_CACHELINE_SIZE ${CACHELINE_SIZE}) -endif() -message(STATUS "Using ${ZMQ_CACHELINE_SIZE} bytes alignment for lock-free data structures") -check_cxx_symbol_exists(posix_memalign stdlib.h HAVE_POSIX_MEMALIGN) - -if(NOT CYGWIN) - # TODO cannot we simply do 'if(WIN32) set(ZMQ_HAVE_WINDOWS ON)' or similar? - check_include_files(windows.h ZMQ_HAVE_WINDOWS) -endif() - -if(NOT WIN32) - set(ZMQ_HAVE_IPC 1) - set(ZMQ_HAVE_STRUCT_SOCKADDR_UN 1) -else() - check_include_files("winsock2.h;afunix.h" ZMQ_HAVE_IPC) - if(ZMQ_HAVE_IPC) - check_struct_has_member("struct sockaddr_un" sun_path "winsock2.h;afunix.h" ZMQ_HAVE_STRUCT_SOCKADDR_UN) - endif() -endif() - -# ##################### BEGIN condition_variable_t selection -if(NOT ZMQ_CV_IMPL) - # prefer C++11 STL std::condition_variable implementation, if available - check_include_files(condition_variable ZMQ_HAVE_STL_CONDITION_VARIABLE LANGUAGE CXX) - - if(ZMQ_HAVE_STL_CONDITION_VARIABLE) - set(ZMQ_CV_IMPL_DEFAULT "stl11") - else() - if(WIN32 AND NOT CMAKE_SYSTEM_VERSION VERSION_LESS "6.0") - # Win32API CONDITION_VARIABLE is supported from Windows Vista only - set(ZMQ_CV_IMPL_DEFAULT "win32api") - elseif(CMAKE_USE_PTHREADS_INIT) - set(ZMQ_CV_IMPL_DEFAULT "pthreads") - else() - set(ZMQ_CV_IMPL_DEFAULT "none") - endif() - endif() - - # TODO a vxworks implementation also exists, but vxworks is not currently supported with cmake at all - set(ZMQ_CV_IMPL - "${ZMQ_CV_IMPL_DEFAULT}" - CACHE STRING "Choose condition_variable_t implementation. Valid values are - stl11, win32api, pthreads, none [default=autodetect]") -endif() - -message(STATUS "Using condition_variable_t implementation: ${ZMQ_CV_IMPL}") -if(ZMQ_CV_IMPL STREQUAL "stl11") - set(ZMQ_USE_CV_IMPL_STL11 1) -elseif(ZMQ_CV_IMPL STREQUAL "win32api") - set(ZMQ_USE_CV_IMPL_WIN32API 1) -elseif(ZMQ_CV_IMPL STREQUAL "pthreads") - set(ZMQ_USE_CV_IMPL_PTHREADS 1) -elseif(ZMQ_CV_IMPL STREQUAL "none") - set(ZMQ_USE_CV_IMPL_NONE 1) -else() - message(ERROR "Unknown value for ZMQ_CV_IMPL: ${ZMQ_CV_IMPL}") -endif() -# ##################### END condition_variable_t selection - -if(NOT MSVC) - check_include_files(ifaddrs.h ZMQ_HAVE_IFADDRS) - check_include_files(sys/uio.h ZMQ_HAVE_UIO) - check_include_files(sys/eventfd.h ZMQ_HAVE_EVENTFD) - if(ZMQ_HAVE_EVENTFD AND NOT CMAKE_CROSSCOMPILING) - zmq_check_efd_cloexec() - endif() -endif() - -if(ZMQ_HAVE_WINDOWS) - # Cannot use check_library_exists because the symbol is always declared as char(*)(void) - set(CMAKE_REQUIRED_LIBRARIES "ws2_32.lib") - check_cxx_symbol_exists(WSAStartup "winsock2.h" HAVE_WS2_32) - - set(CMAKE_REQUIRED_LIBRARIES "rpcrt4.lib") - check_cxx_symbol_exists(UuidCreateSequential "rpc.h" HAVE_RPCRT4) - - set(CMAKE_REQUIRED_LIBRARIES "iphlpapi.lib") - check_cxx_symbol_exists(GetAdaptersAddresses "winsock2.h;iphlpapi.h" HAVE_IPHLAPI) - check_cxx_symbol_exists(if_nametoindex "iphlpapi.h" HAVE_IF_NAMETOINDEX) - - set(CMAKE_REQUIRED_LIBRARIES "") - # TODO: This not the symbol we're looking for. What is the symbol? - check_library_exists(ws2 fopen "" HAVE_WS2) -else() - check_cxx_symbol_exists(if_nametoindex net/if.h HAVE_IF_NAMETOINDEX) - check_cxx_symbol_exists(SO_PEERCRED sys/socket.h ZMQ_HAVE_SO_PEERCRED) - check_cxx_symbol_exists(LOCAL_PEERCRED sys/socket.h ZMQ_HAVE_LOCAL_PEERCRED) - check_cxx_symbol_exists(SO_BUSY_POLL sys/socket.h ZMQ_HAVE_BUSY_POLL) -endif() - -if(NOT MINGW) - find_library(RT_LIBRARY rt) - if(RT_LIBRARY) - set(pkg_config_libs_private "${pkg_config_libs_private} -lrt") - endif() -endif() - -find_package(Threads) - -if(WIN32 AND NOT CYGWIN) - if(NOT HAVE_WS2_32 AND NOT HAVE_WS2) - message(FATAL_ERROR "Cannot link to ws2_32 or ws2") - endif() - - if(NOT HAVE_RPCRT4) - message(FATAL_ERROR "Cannot link to rpcrt4") - endif() - - if(NOT HAVE_IPHLAPI) - message(FATAL_ERROR "Cannot link to iphlapi") - endif() -endif() - -if(NOT MSVC) - set(CMAKE_REQUIRED_LIBRARIES rt) - check_cxx_symbol_exists(clock_gettime time.h HAVE_CLOCK_GETTIME) - set(CMAKE_REQUIRED_LIBRARIES) - - check_cxx_symbol_exists(fork unistd.h HAVE_FORK) - check_cxx_symbol_exists(gethrtime sys/time.h HAVE_GETHRTIME) - check_cxx_symbol_exists(mkdtemp stdlib.h HAVE_MKDTEMP) - check_cxx_symbol_exists(accept4 sys/socket.h HAVE_ACCEPT4) - check_cxx_symbol_exists(strnlen string.h HAVE_STRNLEN) -else() - set(HAVE_STRNLEN 1) -endif() - -add_definitions(-D_REENTRANT -D_THREAD_SAFE) -add_definitions(-DZMQ_CUSTOM_PLATFORM_HPP) - -option(ENABLE_EVENTFD "Enable/disable eventfd" ZMQ_HAVE_EVENTFD) - -macro(zmq_check_cxx_flag_prepend flag) - check_cxx_compiler_flag("${flag}" HAVE_FLAG_${flag}) - - if(HAVE_FLAG_${flag}) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}") - endif() -endmacro() - -option(ENABLE_ANALYSIS "Build with static analysis(make take very long)" OFF) - -if(MSVC) - if(ENABLE_ANALYSIS) - zmq_check_cxx_flag_prepend("/W4") - - zmq_check_cxx_flag_prepend("/analyze") - - # C++11/14/17-specific, but maybe possible via conditional defines - zmq_check_cxx_flag_prepend("/wd26440") # Function '...' can be declared 'noexcept' - zmq_check_cxx_flag_prepend("/wd26432") # If you define or delete any default operation in the type '...', define or - # delete them all - zmq_check_cxx_flag_prepend("/wd26439") # This kind of function may not throw. Declare it 'noexcept' - zmq_check_cxx_flag_prepend("/wd26447") # The function is declared 'noexcept' but calls function '...' which may - # throw exceptions - zmq_check_cxx_flag_prepend("/wd26433") # Function '...' should be marked with 'override' - zmq_check_cxx_flag_prepend("/wd26409") # Avoid calling new and delete explicitly, use std::make_unique instead - # Requires GSL - zmq_check_cxx_flag_prepend("/wd26429") # Symbol '...' is never tested for nullness, it can be marked as not_null - zmq_check_cxx_flag_prepend("/wd26446") # Prefer to use gsl::at() - zmq_check_cxx_flag_prepend("/wd26481") # Don't use pointer arithmetic. Use span instead - zmq_check_cxx_flag_prepend("/wd26472") # Don't use a static_cast for arithmetic conversions. Use brace - # initialization, gsl::narrow_cast or gsl::narow - zmq_check_cxx_flag_prepend("/wd26448") # Consider using gsl::finally if final action is intended - zmq_check_cxx_flag_prepend("/wd26400") # Do not assign the result of an allocation or a function call with an - # owner return value to a raw pointer, use owner instead - zmq_check_cxx_flag_prepend("/wd26485") # Expression '...': No array to pointer decay(bounds.3) - else() - zmq_check_cxx_flag_prepend("/W3") - endif() - - if(MSVC_IDE) - set(MSVC_TOOLSET "-${CMAKE_VS_PLATFORM_TOOLSET}") - else() - set(MSVC_TOOLSET "") - endif() -else() - zmq_check_cxx_flag_prepend("-Wall") -endif() - -if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") - zmq_check_cxx_flag_prepend("-Wextra") -endif() - -option(LIBZMQ_PEDANTIC "" ON) -option(LIBZMQ_WERROR "" OFF) - -# TODO: why is -Wno-long-long defined differently than in configure.ac? -if(NOT MSVC) - zmq_check_cxx_flag_prepend("-Wno-long-long") - zmq_check_cxx_flag_prepend("-Wno-uninitialized") - - if(LIBZMQ_PEDANTIC) - zmq_check_cxx_flag_prepend("-pedantic") - - if(${CMAKE_CXX_COMPILER_ID} MATCHES "Intel") - zmq_check_cxx_flag_prepend("-strict-ansi") - endif() - - if(${CMAKE_CXX_COMPILER_ID} MATCHES "SunPro") - zmq_check_cxx_flag_prepend("-compat=5") - endif() - endif() -endif() - -if(LIBZMQ_WERROR) - if(MSVC) - zmq_check_cxx_flag_prepend("/WX") - else() - zmq_check_cxx_flag_prepend("-Werror") - if(NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") - zmq_check_cxx_flag_prepend("-errwarn=%all") - endif() - endif() -endif() - -if(CMAKE_SYSTEM_PROCESSOR MATCHES "^sparc") - zmq_check_cxx_flag_prepend("-mcpu=v9") -endif() - -if(${CMAKE_CXX_COMPILER_ID} MATCHES "SunPro") - zmq_check_cxx_flag_prepend("-features=zla") -endif() - -if(CMAKE_SYSTEM_NAME MATCHES "SunOS" - OR CMAKE_SYSTEM_NAME MATCHES "NetBSD" - OR CMAKE_SYSTEM_NAME MATCHES "QNX") - message(STATUS "Checking whether atomic operations can be used") - check_c_source_compiles( - "\ - #include \ - \ - int main() \ - { \ - uint32_t value; \ - atomic_cas_32(&value, 0, 0); \ - return 0; \ - } \ - " - HAVE_ATOMIC_H) - - if(NOT HAVE_ATOMIC_H) - set(ZMQ_FORCE_MUTEXES 1) - endif() -endif() - -if(NOT ANDROID) - zmq_check_noexcept() -endif() - -# ----------------------------------------------------------------------------- -if(NOT CMAKE_CROSSCOMPILING AND NOT MSVC) - zmq_check_sock_cloexec() - zmq_check_o_cloexec() - zmq_check_so_bindtodevice() - zmq_check_so_keepalive() - zmq_check_so_priority() - zmq_check_tcp_keepcnt() - zmq_check_tcp_keepidle() - zmq_check_tcp_keepintvl() - zmq_check_tcp_keepalive() - zmq_check_tcp_tipc() - zmq_check_pthread_setname() - zmq_check_pthread_setaffinity() - zmq_check_getrandom() -endif() - -if(CMAKE_SYSTEM_NAME MATCHES "Linux" - OR CMAKE_SYSTEM_NAME MATCHES "GNU/kFreeBSD" - OR CMAKE_SYSTEM_NAME MATCHES "GNU/Hurd" - OR CYGWIN) - add_definitions(-D_GNU_SOURCE) -elseif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD") - add_definitions(-D__BSD_VISIBLE) -elseif(CMAKE_SYSTEM_NAME MATCHES "NetBSD") - add_definitions(-D_NETBSD_SOURCE) -elseif(CMAKE_SYSTEM_NAME MATCHES "OpenBSD") - add_definitions(-D_OPENBSD_SOURCE) -elseif(CMAKE_SYSTEM_NAME MATCHES "SunOS") - add_definitions(-D_PTHREADS) -elseif(CMAKE_SYSTEM_NAME MATCHES "HP-UX") - add_definitions(-D_POSIX_C_SOURCE=200112L) - zmq_check_cxx_flag_prepend(-Ae) -elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin") - add_definitions(-D_DARWIN_C_SOURCE) -endif() - -find_package(AsciiDoc) - -cmake_dependent_option(WITH_DOC "Build Reference Guide documentation(requires DocBook)" ON "ASCIIDOC_FOUND;NOT WIN32" - OFF) # Do not build docs on Windows due to issues with symlinks - -if(MSVC) - if(WITH_OPENPGM) - # set(OPENPGM_ROOT "" CACHE PATH "Location of OpenPGM") - set(OPENPGM_VERSION_MAJOR 5) - set(OPENPGM_VERSION_MINOR 2) - set(OPENPGM_VERSION_MICRO 122) - if(CMAKE_CL_64) - find_path( - OPENPGM_ROOT include/pgm/pgm.h - PATHS - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Miru\\OpenPGM ${OPENPGM_VERSION_MAJOR}.${OPENPGM_VERSION_MINOR}.${OPENPGM_VERSION_MICRO}]" - NO_DEFAULT_PATH) - message(STATUS "OpenPGM x64 detected - ${OPENPGM_ROOT}") - else() - find_path( - OPENPGM_ROOT include/pgm/pgm.h - PATHS - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Miru\\OpenPGM ${OPENPGM_VERSION_MAJOR}.${OPENPGM_VERSION_MINOR}.${OPENPGM_VERSION_MICRO}]" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Miru\\OpenPGM ${OPENPGM_VERSION_MAJOR}.${OPENPGM_VERSION_MINOR}.${OPENPGM_VERSION_MICRO}]" - NO_DEFAULT_PATH) - message(STATUS "OpenPGM x86 detected - ${OPENPGM_ROOT}") - endif() - set(OPENPGM_INCLUDE_DIRS ${OPENPGM_ROOT}/include) - set(OPENPGM_LIBRARY_DIRS ${OPENPGM_ROOT}/lib) - set(OPENPGM_LIBRARIES - optimized - libpgm${MSVC_TOOLSET}-mt-${OPENPGM_VERSION_MAJOR}_${OPENPGM_VERSION_MINOR}_${OPENPGM_VERSION_MICRO}.lib debug - libpgm${MSVC_TOOLSET}-mt-gd-${OPENPGM_VERSION_MAJOR}_${OPENPGM_VERSION_MINOR}_${OPENPGM_VERSION_MICRO}.lib) - endif() -else() - if(WITH_OPENPGM) - # message(FATAL_ERROR "WITH_OPENPGM not implemented") - - if(NOT OPENPGM_PKGCONFIG_NAME) - set(OPENPGM_PKGCONFIG_NAME "openpgm-5.2") - endif() - - set(OPENPGM_PKGCONFIG_NAME - ${OPENPGM_PKGCONFIG_NAME} - CACHE STRING "Name pkg-config shall use to find openpgm libraries and include paths" FORCE) - - pkg_check_modules(OPENPGM ${OPENPGM_PKGCONFIG_NAME}) - - if(OPENPGM_FOUND) - message(STATUS ${OPENPGM_PKGCONFIG_NAME}" found") - set(pkg_config_names_private "${pkg_config_names_private} ${OPENPGM_PKGCONFIG_NAME}") - else() - message( - FATAL_ERROR - ${OPENPGM_PKGCONFIG_NAME}" not found. openpgm is searchd via `pkg-config ${OPENPGM_PKGCONFIG_NAME}`. Consider providing a valid OPENPGM_PKGCONFIG_NAME" - ) - endif() - - # DSO symbol visibility for openpgm - if(HAVE_FLAG_VISIBILITY_HIDDEN) - - elseif(HAVE_FLAG_LDSCOPE_HIDDEN) - - endif() - endif() -endif() - -# ----------------------------------------------------------------------------- -# force off-tree build - -if(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR}) - message( - FATAL_ERROR - "CMake generation is not allowed within the source directory! \ - Remove the CMakeCache.txt file and try again from another folder, e.g.: \ - \ - rm CMakeCache.txt \ - mkdir cmake-make \ - cd cmake-make \ - cmake ..") -endif() - -# ----------------------------------------------------------------------------- -# default to Release build - -if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) - # CMAKE_BUILD_TYPE is not used for multi-configuration generators like Visual Studio/XCode which instead use - # CMAKE_CONFIGURATION_TYPES - set(CMAKE_BUILD_TYPE - Release - CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." FORCE) -endif() - -# ----------------------------------------------------------------------------- -# output directories - -zmq_set_with_default(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${ZeroMQ_BINARY_DIR}/bin") -if(UNIX) - set(zmq_library_directory "lib") -else() - set(zmq_library_directory "bin") -endif() -zmq_set_with_default(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${ZeroMQ_BINARY_DIR}/${zmq_library_directory}") -zmq_set_with_default(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${ZeroMQ_BINARY_DIR}/lib") - -# ----------------------------------------------------------------------------- -# platform specifics - -if(WIN32) - # Socket limit is 16K(can be raised arbitrarily) - add_definitions(-DFD_SETSIZE=16384) - add_definitions(-D_CRT_SECURE_NO_WARNINGS) - add_definitions(-D_WINSOCK_DEPRECATED_NO_WARNINGS) -endif() - -if(MSVC) - # Parallel make. - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP") - - # Compile the static lib with debug information included note: we assume here that the default flags contain some /Z - # flag - string(REGEX REPLACE "/Z.[^:]" "/Z7 " CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") - string(REGEX REPLACE "/Z.[^:]" "/Z7 " CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") - -endif() - -# ----------------------------------------------------------------------------- -# source files - -set(cxx-sources - precompiled.cpp - address.cpp - channel.cpp - client.cpp - clock.cpp - ctx.cpp - curve_mechanism_base.cpp - curve_client.cpp - curve_server.cpp - dealer.cpp - devpoll.cpp - dgram.cpp - dist.cpp - endpoint.cpp - epoll.cpp - err.cpp - fq.cpp - io_object.cpp - io_thread.cpp - ip.cpp - ipc_address.cpp - ipc_connecter.cpp - ipc_listener.cpp - kqueue.cpp - lb.cpp - mailbox.cpp - mailbox_safe.cpp - mechanism.cpp - mechanism_base.cpp - metadata.cpp - msg.cpp - mtrie.cpp - norm_engine.cpp - object.cpp - options.cpp - own.cpp - null_mechanism.cpp - pair.cpp - peer.cpp - pgm_receiver.cpp - pgm_sender.cpp - pgm_socket.cpp - pipe.cpp - plain_client.cpp - plain_server.cpp - poll.cpp - poller_base.cpp - polling_util.cpp - pollset.cpp - proxy.cpp - pub.cpp - pull.cpp - push.cpp - random.cpp - raw_encoder.cpp - raw_decoder.cpp - raw_engine.cpp - reaper.cpp - rep.cpp - req.cpp - router.cpp - select.cpp - server.cpp - session_base.cpp - signaler.cpp - socket_base.cpp - socks.cpp - socks_connecter.cpp - stream.cpp - stream_engine_base.cpp - sub.cpp - tcp.cpp - tcp_address.cpp - tcp_connecter.cpp - tcp_listener.cpp - thread.cpp - trie.cpp - radix_tree.cpp - v1_decoder.cpp - v1_encoder.cpp - v2_decoder.cpp - v2_encoder.cpp - v3_1_encoder.cpp - xpub.cpp - xsub.cpp - zmq.cpp - zmq_utils.cpp - decoder_allocators.cpp - socket_poller.cpp - timers.cpp - config.hpp - radio.cpp - dish.cpp - udp_engine.cpp - udp_address.cpp - scatter.cpp - gather.cpp - ip_resolver.cpp - zap_client.cpp - zmtp_engine.cpp - # at least for VS, the header files must also be listed - address.hpp - array.hpp - atomic_counter.hpp - atomic_ptr.hpp - blob.hpp - channel.hpp - client.hpp - clock.hpp - command.hpp - compat.hpp - condition_variable.hpp - config.hpp - ctx.hpp - curve_client.hpp - curve_client_tools.hpp - curve_mechanism_base.hpp - curve_server.hpp - dbuffer.hpp - dealer.hpp - decoder.hpp - decoder_allocators.hpp - devpoll.hpp - dgram.hpp - dish.hpp - dist.hpp - encoder.hpp - endpoint.hpp - epoll.hpp - err.hpp - fd.hpp - fq.hpp - gather.hpp - generic_mtrie.hpp - generic_mtrie_impl.hpp - gssapi_client.hpp - gssapi_mechanism_base.hpp - gssapi_server.hpp - i_decoder.hpp - i_encoder.hpp - i_engine.hpp - i_mailbox.hpp - i_poll_events.hpp - io_object.hpp - io_thread.hpp - ip.hpp - ipc_address.hpp - ipc_connecter.hpp - ipc_listener.hpp - kqueue.hpp - lb.hpp - likely.hpp - macros.hpp - mailbox.hpp - mailbox_safe.hpp - mechanism.hpp - mechanism_base.hpp - metadata.hpp - msg.hpp - mtrie.hpp - mutex.hpp - norm_engine.hpp - null_mechanism.hpp - object.hpp - options.hpp - own.hpp - pair.hpp - peer.hpp - pgm_receiver.hpp - pgm_sender.hpp - pgm_socket.hpp - pipe.hpp - plain_client.hpp - plain_common.hpp - plain_server.hpp - poll.hpp - poller.hpp - poller_base.hpp - polling_util.hpp - pollset.hpp - precompiled.hpp - proxy.hpp - pub.hpp - pull.hpp - push.hpp - radio.hpp - random.hpp - raw_decoder.hpp - raw_encoder.hpp - raw_engine.hpp - reaper.hpp - rep.hpp - req.hpp - router.hpp - scatter.hpp - secure_allocator.hpp - select.hpp - server.hpp - session_base.hpp - signaler.hpp - socket_base.hpp - socket_poller.hpp - socks.hpp - socks_connecter.hpp - stdint.hpp - stream.hpp - stream_engine_base.hpp - stream_connecter_base.hpp - stream_connecter_base.cpp - stream_listener_base.hpp - stream_listener_base.cpp - sub.hpp - tcp.hpp - tcp_address.hpp - tcp_connecter.hpp - tcp_listener.hpp - thread.hpp - timers.hpp - tipc_address.hpp - tipc_connecter.hpp - tipc_listener.hpp - trie.hpp - udp_address.hpp - udp_engine.hpp - v1_decoder.hpp - v1_encoder.hpp - v2_decoder.hpp - v2_encoder.hpp - v3_1_encoder.hpp - v2_protocol.hpp - vmci.hpp - vmci_address.hpp - vmci_connecter.hpp - vmci_listener.hpp - windows.hpp - wire.hpp - xpub.hpp - xsub.hpp - ypipe.hpp - ypipe_base.hpp - ypipe_conflate.hpp - yqueue.hpp - zap_client.hpp - zmtp_engine.hpp) - -if(MINGW) - # Generate the right type when using -m32 or -m64 - macro(set_rc_arch rc_target) - set(CMAKE_RC_COMPILER_INIT windres) - enable_language(RC) - set(CMAKE_RC_COMPILE_OBJECT - " -O coff --target=${rc_target} -i -o ") - endmacro() - - if(NOT CMAKE_SYSTEM_PROCESSOR) - set(CMAKE_SYSTEM_PROCESSOR ${CMAKE_HOST_SYSTEM_PROCESSOR}) - endif() - - # Also happens on x86_64 systems...what a worthless variable - if(CMAKE_SYSTEM_PROCESSOR MATCHES "i386" - OR CMAKE_SYSTEM_PROCESSOR MATCHES "i486" - OR CMAKE_SYSTEM_PROCESSOR MATCHES "i586" - OR CMAKE_SYSTEM_PROCESSOR MATCHES "i686" - OR CMAKE_SYSTEM_PROCESSOR MATCHES "x86" - OR CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64" - OR CMAKE_SYSTEM_PROCESSOR MATCHES "amd64") - - if(CMAKE_SIZEOF_VOID_P EQUAL 8) - set_rc_arch("pe-x86-64") - else() - set_rc_arch("pe-i386") - endif() - endif() -endif() - -set(public_headers include/zmq.h include/zmq_utils.h) - -set(readme-docs AUTHORS COPYING COPYING.LESSER NEWS) - -# ----------------------------------------------------------------------------- -# optional modules - -if(WITH_OPENPGM) - add_definitions(-DZMQ_HAVE_OPENPGM) - include_directories(${OPENPGM_INCLUDE_DIRS}) - link_directories(${OPENPGM_LIBRARY_DIRS}) - set(OPTIONAL_LIBRARIES ${OPENPGM_LIBRARIES}) -endif() - -if(WITH_NORM) - find_package(norm) - if(norm_FOUND) - message(STATUS "Building with NORM") - set(ZMQ_HAVE_NORM 1) - else() - message(FATAL_ERROR "NORM not found") - endif() -endif() - -if(WITH_VMCI) - add_definitions(-DZMQ_HAVE_VMCI) - include_directories(${VMCI_INCLUDE_DIRS}) - list(APPEND cxx-sources vmci_address.cpp vmci_connecter.cpp vmci_listener.cpp vmci.cpp) -endif() - -if(ZMQ_HAVE_TIPC) - list(APPEND cxx-sources tipc_address.cpp tipc_connecter.cpp tipc_listener.cpp) -endif() - -# ----------------------------------------------------------------------------- -# source generators - -foreach(source ${cxx-sources}) - list(APPEND sources ${CMAKE_CURRENT_SOURCE_DIR}/src/${source}) -endforeach() - -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/version.rc.in ${CMAKE_CURRENT_BINARY_DIR}/version.rc) - -# Delete any src/platform.hpp left by configure -file(REMOVE ${CMAKE_CURRENT_SOURCE_DIR}/src/platform.hpp) - -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/builds/cmake/platform.hpp.in ${CMAKE_CURRENT_BINARY_DIR}/platform.hpp) -list(APPEND sources ${CMAKE_CURRENT_BINARY_DIR}/platform.hpp) - -set(prefix ${CMAKE_INSTALL_PREFIX}) -set(exec_prefix ${prefix}) -set(libdir ${prefix}/${CMAKE_INSTALL_LIBDIR}) -set(includedir ${prefix}/${CMAKE_INSTALL_INCLUDEDIR}) -set(VERSION ${ZMQ_VERSION_MAJOR}.${ZMQ_VERSION_MINOR}.${ZMQ_VERSION_PATCH}) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/libzmq.pc.in ${CMAKE_CURRENT_BINARY_DIR}/libzmq.pc @ONLY) -set(zmq-pkgconfig ${CMAKE_CURRENT_BINARY_DIR}/libzmq.pc) - -if(NOT ZMQ_BUILD_FRAMEWORK) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libzmq.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) -endif() - -if(MSVC) - if(CMAKE_CL_64) - set(nsis-template ${CMAKE_CURRENT_SOURCE_DIR}/builds/cmake/NSIS.template64.in) - else() - set(nsis-template ${CMAKE_CURRENT_SOURCE_DIR}/builds/cmake/NSIS.template32.in) - endif() - - add_custom_command( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/NSIS.template.in - COMMAND ${CMAKE_COMMAND} ARGS -E copy ${nsis-template} ${CMAKE_CURRENT_BINARY_DIR}/NSIS.template.in - DEPENDS ${nsis-template}) -endif() - -option(WITH_DOCS "Build html docs" ON) -if(WITH_DOCS) - file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc) - file( - GLOB docs - RELATIVE ${CMAKE_CURRENT_BINARY_DIR}/ - "${CMAKE_CURRENT_SOURCE_DIR}/doc/*.txt") - set(html-docs) - foreach(txt ${docs}) - string(REGEX REPLACE ".*/(.*)\\.txt" "\\1.html" html ${txt}) - set(src ${txt}) - set(dst doc/${html}) - if(WITH_DOC) - add_custom_command( - OUTPUT ${dst} - COMMAND ${ASCIIDOC_EXECUTABLE} -d manpage -b xhtml11 -f ${CMAKE_CURRENT_SOURCE_DIR}/doc/asciidoc.conf - -azmq_version=${ZMQ_VERSION} -o ${dst} ${src} - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${src} - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMENT "Generating ${html}") - list(APPEND html-docs ${CMAKE_CURRENT_BINARY_DIR}/${dst}) - endif() - endforeach() -endif() - -if(ZMQ_BUILD_FRAMEWORK) - add_custom_command( - TARGET libzmq - POST_BUILD - COMMAND ${CMAKE_COMMAND} ARGS -E make_directory - "${CMAKE_LIBRARY_OUTPUT_PATH}/ZeroMQ.framework/Versions/${ZMQ_VERSION}/MacOS" - COMMENT "Perf tools") -endif() - -option(ENABLE_PRECOMPILED "Enable precompiled headers, if possible" ON) -if(MSVC AND ENABLE_PRECOMPILED) - # default for all sources is to use precompiled headers - foreach(source ${sources}) - # C and C++ can not use the same precompiled header - if(${source} MATCHES ".cpp$" AND NOT ${source} STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}/src/precompiled.cpp") - set_source_files_properties(${source} PROPERTIES COMPILE_FLAGS "/Yuprecompiled.hpp" OBJECT_DEPENDS - precompiled.hpp) - endif() - endforeach() - # create precompiled header - set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/src/precompiled.cpp - PROPERTIES COMPILE_FLAGS "/Ycprecompiled.hpp" OBJECT_OUTPUTS precompiled.hpp) -endif() - -# ----------------------------------------------------------------------------- -# output -option(BUILD_SHARED "Whether or not to build the shared object" ON) -option(BUILD_STATIC "Whether or not to build the static archive" ON) - -if(MSVC) - # Suppress linker warnings caused by #ifdef omission of file content. - set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /ignore:4221") - set(PDB_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin") - set(PDB_NAME - "lib${ZMQ_OUTPUT_BASENAME}${MSVC_TOOLSET}-mt-gd-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}") - function(enable_vs_guideline_checker target) - set_target_properties( - ${target} PROPERTIES VS_GLOBAL_EnableCppCoreCheck true VS_GLOBAL_CodeAnalysisRuleSet CppCoreCheckRules.ruleset - VS_GLOBAL_RunCodeAnalysis true) - endfunction() - if(BUILD_SHARED) - # Whole Program Optimization flags. http://msdn.microsoft.com/en-us/magazine/cc301698.aspx - # - # "Finally, there's the subject of libraries. It's possible to create .LIB - # files with code in its IL form. The linker will happily work with these - # .LIB files. Be aware that these libraries will be tied to a specific - # version of the compiler and linker. If you distribute these libraries, - # you'll need to update them if Microsoft changes the format of IL in a - # future release." - # - # /GL and /LTCG can cause problems when libraries built with different - # versions of compiler are later linked into an executable while /LTCG is active. - # https://social.msdn.microsoft.com/Forums/vstudio/en-US/5c102025-c254-4f02-9a51-c775c6cc9f4b/problem-with-ltcg-when-building-a-static-library-in-vs2005?forum=vcgeneral - # - # For this reason, enable only when building a "Release" (e.g. non-DEBUG) DLL. - if(NOT ${CMAKE_BUILD_TYPE} MATCHES "Debug") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GL") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LTCG") - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /LTCG") - set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /LTCG") - endif() - - add_library(libzmq SHARED ${sources} ${public_headers} ${html-docs} ${readme-docs} - ${CMAKE_CURRENT_BINARY_DIR}/NSIS.template.in ${CMAKE_CURRENT_BINARY_DIR}/version.rc) - if(ENABLE_ANALYSIS) - enable_vs_guideline_checker(libzmq) - endif() - set_target_properties( - libzmq - PROPERTIES PUBLIC_HEADER "${public_headers}" - RELEASE_POSTFIX "${MSVC_TOOLSET}-mt-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}" - RELWITHDEBINFO_POSTFIX - "${MSVC_TOOLSET}-mt-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}" - MINSIZEREL_POSTFIX "${MSVC_TOOLSET}-mt-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}" - DEBUG_POSTFIX "${MSVC_TOOLSET}-mt-gd-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}" - RUNTIME_OUTPUT_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" - COMPILE_DEFINITIONS "DLL_EXPORT" - OUTPUT_NAME "lib${ZMQ_OUTPUT_BASENAME}") - if(ZMQ_HAVE_WINDOWS_UWP) - set_target_properties(libzmq PROPERTIES LINK_FLAGS_DEBUG "/OPT:NOICF /OPT:NOREF") - endif() - endif() - - if(BUILD_STATIC) - add_library(libzmq-static STATIC ${sources} ${CMAKE_CURRENT_BINARY_DIR}/version.rc) - set_target_properties( - libzmq-static - PROPERTIES PUBLIC_HEADER "${public_headers}" - RELEASE_POSTFIX "${MSVC_TOOLSET}-mt-s-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}" - RELWITHDEBINFO_POSTFIX - "${MSVC_TOOLSET}-mt-s-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}" - MINSIZEREL_POSTFIX - "${MSVC_TOOLSET}-mt-s-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}" - DEBUG_POSTFIX "${MSVC_TOOLSET}-mt-sgd-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}" - COMPILE_FLAGS "/DZMQ_STATIC" - OUTPUT_NAME "lib${ZMQ_OUTPUT_BASENAME}") - endif() -else() - # avoid building everything twice for shared + static only on *nix, as Windows needs different preprocessor defines in - # static builds - if(NOT MINGW) - add_library(objects OBJECT ${sources}) - set_property(TARGET objects PROPERTY POSITION_INDEPENDENT_CODE ON) - endif() - - if(BUILD_SHARED) - if(MINGW) - add_library(libzmq SHARED ${sources} ${public_headers} ${html-docs} ${readme-docs} ${zmq-pkgconfig} - ${CMAKE_CURRENT_BINARY_DIR}/version.rc) - else() - if (CMAKE_GENERATOR STREQUAL "Xcode") - add_library(libzmq SHARED ${sources} ${public_headers} ${html-docs} ${readme-docs} - ${zmq-pkgconfig} ${CMAKE_CURRENT_BINARY_DIR}/version.rc) - else() - add_library(libzmq SHARED $ ${public_headers} ${html-docs} ${readme-docs} - ${zmq-pkgconfig} ${CMAKE_CURRENT_BINARY_DIR}/version.rc) - endif() - - endif() - # NOTE: the SOVERSION and VERSION MUST be the same as the one generated by libtool! It is NOT the same as the - # version of the package. - set_target_properties( - libzmq PROPERTIES COMPILE_DEFINITIONS "DLL_EXPORT" PUBLIC_HEADER "${public_headers}" VERSION "5.2.5" - SOVERSION "5" OUTPUT_NAME "${ZMQ_OUTPUT_BASENAME}" PREFIX "lib") - if(ZMQ_BUILD_FRAMEWORK) - set_target_properties( - libzmq - PROPERTIES FRAMEWORK TRUE MACOSX_FRAMEWORK_IDENTIFIER "org.zeromq.libzmq" MACOSX_FRAMEWORK_SHORT_VERSION_STRING - ${ZMQ_VERSION} - MACOSX_FRAMEWORK_BUNDLE_VERSION ${ZMQ_VERSION}) - set_source_files_properties(${html-docs} PROPERTIES MACOSX_PACKAGE_LOCATION doc) - set_source_files_properties(${readme-docs} PROPERTIES MACOSX_PACKAGE_LOCATION etc) - set_source_files_properties(${zmq-pkgconfig} PROPERTIES MACOSX_PACKAGE_LOCATION lib/pkgconfig) - endif() - endif() - - if(BUILD_STATIC) - if(MINGW) - add_library(libzmq-static STATIC ${sources} ${public_headers} ${html-docs} ${readme-docs} ${zmq-pkgconfig} - ${CMAKE_CURRENT_BINARY_DIR}/version.rc) - else() - if (CMAKE_GENERATOR STREQUAL "Xcode") - add_library(libzmq-static STATIC ${sources} ${public_headers} ${html-docs} ${readme-docs} - ${zmq-pkgconfig} ${CMAKE_CURRENT_BINARY_DIR}/version.rc) - else() - add_library(libzmq-static STATIC $ ${public_headers} ${html-docs} ${readme-docs} - ${zmq-pkgconfig} ${CMAKE_CURRENT_BINARY_DIR}/version.rc) - endif() - endif() - if(CMAKE_SYSTEM_NAME MATCHES "QNX") - target_link_libraries(libzmq-static m) - endif() - set_target_properties( - libzmq-static PROPERTIES PUBLIC_HEADER "${public_headers}" OUTPUT_NAME "${ZMQ_OUTPUT_BASENAME}" PREFIX "lib") - endif() -endif() - -if(BUILD_STATIC) - target_compile_definitions(libzmq-static PUBLIC ZMQ_STATIC) -endif() - -list(APPEND target_outputs "") - -if(BUILD_SHARED) - list(APPEND target_outputs "libzmq") -endif() - -if(BUILD_STATIC) - list(APPEND target_outputs "libzmq-static") -endif() - -set(build_targets ${target_outputs}) -if(TARGET objects) - list(APPEND build_targets "objects") -endif() - -foreach(target ${build_targets}) - target_include_directories( - ${target} PUBLIC $ - $ $) - - if(ENABLE_DRAFTS) - target_compile_definitions(${target} PUBLIC ZMQ_BUILD_DRAFT_API) - endif() -endforeach() - -if(BUILD_SHARED) - target_link_libraries(libzmq ${CMAKE_THREAD_LIBS_INIT}) - if(GNUTLS_FOUND) - target_link_libraries(libzmq ${GNUTLS_LIBRARIES}) - endif() - - if(NSS3_FOUND) - target_link_libraries(libzmq ${NSS3_LIBRARIES}) - endif() - - if(LIBBSD_FOUND) - target_link_libraries(libzmq ${LIBBSD_LIBRARIES}) - endif() - - if(SODIUM_FOUND) - target_link_libraries(libzmq ${SODIUM_LIBRARIES}) - # On Solaris, libsodium depends on libssp - if(${CMAKE_SYSTEM_NAME} MATCHES "SunOS") - target_link_libraries(libzmq ssp) - endif() - endif() - - if(HAVE_WS2_32) - target_link_libraries(libzmq ws2_32) - elseif(HAVE_WS2) - target_link_libraries(libzmq ws2) - endif() - - if(HAVE_RPCRT4) - target_link_libraries(libzmq rpcrt4) - endif() - - if(HAVE_IPHLAPI) - target_link_libraries(libzmq iphlpapi) - endif() - - if(RT_LIBRARY) - target_link_libraries(libzmq -lrt) - endif() - - if(norm_FOUND) - target_link_libraries(libzmq norm::norm) - endif() -endif() - -if(BUILD_STATIC) - target_link_libraries(libzmq-static ${CMAKE_THREAD_LIBS_INIT}) - if(GNUTLS_FOUND) - target_link_libraries(libzmq-static ${GNUTLS_LIBRARIES}) - endif() - - if(LIBBSD_FOUND) - target_link_libraries(libzmq-static ${LIBBSD_LIBRARIES}) - endif() - - if(NSS3_FOUND) - target_link_libraries(libzmq-static ${NSS3_LIBRARIES}) - endif() - - if(SODIUM_FOUND) - target_link_libraries(libzmq-static ${SODIUM_LIBRARIES}) - # On Solaris, libsodium depends on libssp - if(${CMAKE_SYSTEM_NAME} MATCHES "SunOS") - target_link_libraries(libzmq-static ssp) - endif() - endif() - - if(HAVE_WS2_32) - target_link_libraries(libzmq-static ws2_32) - elseif(HAVE_WS2) - target_link_libraries(libzmq-static ws2) - endif() - - if(HAVE_RPCRT4) - target_link_libraries(libzmq-static rpcrt4) - endif() - - if(HAVE_IPHLAPI) - target_link_libraries(libzmq-static iphlpapi) - endif() - - if(RT_LIBRARY) - target_link_libraries(libzmq-static -lrt) - endif() - - if(CMAKE_SYSTEM_NAME MATCHES "QNX") - add_definitions(-DUNITY_EXCLUDE_MATH_H) - endif() - - if(norm_FOUND) - target_link_libraries(libzmq-static norm::norm) - endif() -endif() - -if(BUILD_SHARED) - set(perf-tools - local_lat - remote_lat - local_thr - remote_thr - inproc_lat - inproc_thr - proxy_thr) - - if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug") # Why? - option(WITH_PERF_TOOL "Build with perf-tools" ON) - else() - option(WITH_PERF_TOOL "Build with perf-tools" OFF) - endif() - - if(WITH_PERF_TOOL) - foreach(perf-tool ${perf-tools}) - add_executable(${perf-tool} perf/${perf-tool}.cpp) - target_link_libraries(${perf-tool} libzmq) - - if(GNUTLS_FOUND) - target_link_libraries(${perf-tool} ${GNUTLS_LIBRARIES}) - endif() - - if(LIBBSD_FOUND) - target_link_libraries(${perf-tool} ${LIBBSD_LIBRARIES}) - endif() - - if(NSS3_FOUND) - target_link_libraries(${perf-tool} ${NSS3_LIBRARIES}) - endif() - - if(SODIUM_FOUND) - target_link_libraries(${perf-tool} ${SODIUM_LIBRARIES}) - endif() - - if(ZMQ_BUILD_FRAMEWORK) - # Copy perf-tools binaries into Framework - add_custom_command( - TARGET libzmq - ${perf-tool} POST_BUILD - COMMAND ${CMAKE_COMMAND} ARGS -E copy "$" - "${LIBRARY_OUTPUT_PATH}/ZeroMQ.framework/Versions/${ZMQ_VERSION_STRING}/MacOS/${perf-tool}" - VERBATIM - COMMENT "Perf tools") - else() - install(TARGETS ${perf-tool} RUNTIME DESTINATION bin COMPONENT PerfTools) - endif() - if(ZMQ_HAVE_WINDOWS_UWP) - set_target_properties(${perf-tool} PROPERTIES LINK_FLAGS_DEBUG "/OPT:NOICF /OPT:NOREF") - endif() - endforeach() - - if(BUILD_STATIC) - add_executable(benchmark_radix_tree perf/benchmark_radix_tree.cpp) - target_link_libraries(benchmark_radix_tree libzmq-static) - target_include_directories(benchmark_radix_tree PUBLIC "${CMAKE_CURRENT_LIST_DIR}/src") - if(ZMQ_HAVE_WINDOWS_UWP) - set_target_properties(benchmark_radix_tree PROPERTIES LINK_FLAGS_DEBUG "/OPT:NOICF /OPT:NOREF") - endif() - endif() - elseif(WITH_PERF_TOOL) - message(FATAL_ERROR "Shared library disabled - perf-tools unavailable.") - endif() -endif() - -# ----------------------------------------------------------------------------- -# tests - -if(${CMAKE_VERSION} VERSION_LESS 3.12.3) - option(BUILD_TESTS "Whether or not to build the tests" OFF) -else() - option(BUILD_TESTS "Whether or not to build the tests" ON) -endif() - -set(ZMQ_BUILD_TESTS - ${BUILD_TESTS} - CACHE BOOL "Build the tests for ZeroMQ") - -if(ZMQ_BUILD_TESTS) - enable_testing() # Enable testing only works in root scope - add_subdirectory(tests) - if(BUILD_STATIC) - add_subdirectory(unittests) - else() - message(WARNING "Not building unit tests, since BUILD_STATIC is not enabled") - endif() -endif() - -# ----------------------------------------------------------------------------- -# installer - -if(MSVC AND (BUILD_SHARED OR BUILD_STATIC)) - install( - TARGETS ${target_outputs} - EXPORT ${PROJECT_NAME}-targets - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} COMPONENT SDK) - if(MSVC_IDE) - install( - FILES ${PDB_OUTPUT_DIRECTORY}/\${CMAKE_INSTALL_CONFIG_NAME}/${PDB_NAME}.pdb - DESTINATION ${CMAKE_INSTALL_BINDIR} - COMPONENT SDK - OPTIONAL) - else() - install( - FILES ${PDB_OUTPUT_DIRECTORY}/${PDB_NAME}.pdb - DESTINATION ${CMAKE_INSTALL_BINDIR} - COMPONENT SDK - OPTIONAL) - endif() - if(BUILD_SHARED) - install( - TARGETS libzmq - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} COMPONENT Runtime) - endif() -elseif(BUILD_SHARED OR BUILD_STATIC) - install( - TARGETS ${target_outputs} - EXPORT ${PROJECT_NAME}-targets - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - FRAMEWORK DESTINATION "Library/Frameworks" - PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) -endif() - -foreach(readme ${readme-docs}) - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${readme} ${CMAKE_CURRENT_BINARY_DIR}/${readme}.txt) - - if(NOT ZMQ_BUILD_FRAMEWORK) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${readme}.txt DESTINATION share/zmq) - endif() -endforeach() - -if(WITH_DOC) - if(NOT ZMQ_BUILD_FRAMEWORK) - install( - FILES ${html-docs} - DESTINATION doc/zmq - COMPONENT RefGuide) - endif() -endif() - -if(WIN32) - set(ZEROMQ_CMAKECONFIG_INSTALL_DIR - "CMake" - CACHE STRING "install path for ZeroMQConfig.cmake") -else() - # CMake search path wants either "share" (AKA GNUInstallDirs DATAROOTDIR) for arch-independent, or LIBDIR for arch- - # dependent, plus "cmake" as prefix - set(ZEROMQ_CMAKECONFIG_INSTALL_DIR - "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}" - CACHE STRING "install path for ZeroMQConfig.cmake") -endif() - -if((NOT CMAKE_VERSION VERSION_LESS 3.0) AND (BUILD_SHARED OR BUILD_STATIC)) - export(EXPORT ${PROJECT_NAME}-targets FILE "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Targets.cmake") -endif() -configure_package_config_file( - builds/cmake/${PROJECT_NAME}Config.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" - INSTALL_DESTINATION ${ZEROMQ_CMAKECONFIG_INSTALL_DIR}) -write_basic_package_version_file( - ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake - VERSION ${ZMQ_VERSION_MAJOR}.${ZMQ_VERSION_MINOR}.${ZMQ_VERSION_PATCH} - COMPATIBILITY AnyNewerVersion) -if(BUILD_SHARED OR BUILD_STATIC) - install( - EXPORT ${PROJECT_NAME}-targets - FILE ${PROJECT_NAME}Targets.cmake - DESTINATION ${ZEROMQ_CMAKECONFIG_INSTALL_DIR}) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake - ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake - DESTINATION ${ZEROMQ_CMAKECONFIG_INSTALL_DIR}) -endif() - -option(ENABLE_CPACK "Enables cpack rules" ON) -if(MSVC AND ENABLE_CPACK) - if(${CMAKE_BUILD_TYPE} MATCHES "Debug") - set(CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY TRUE) - set(CMAKE_INSTALL_DEBUG_LIBRARIES TRUE) - set(CMAKE_INSTALL_UCRT_LIBRARIES TRUE) - endif() - include(InstallRequiredSystemLibraries) - - if(CMAKE_CL_64) - set(arch_name "x64") - else() - set(arch_name "x86") - endif() - - set(CPACK_NSIS_DISPLAY_NAME "ZeroMQ ${ZMQ_VERSION_MAJOR}.${ZMQ_VERSION_MINOR}.${ZMQ_VERSION_PATCH}(${arch_name})") - set(CPACK_PACKAGE_FILE_NAME "ZeroMQ-${ZMQ_VERSION_MAJOR}.${ZMQ_VERSION_MINOR}.${ZMQ_VERSION_PATCH}-${arch_name}") - - # TODO: I think this part was intended to be used when running cpack separately from cmake but I don't know how that - # works. - # - # macro(add_crt_version version) set(rel_dir - # "${CMAKE_CURRENT_BINARY_DIR}/build/${arch_name}/${version};ZeroMQ;ALL;/") - # set(debug_dir - # "${CMAKE_CURRENT_BINARY_DIR}/debug/${arch_name}/${version};ZeroMQ;ALL;/") - # if(EXISTS ${rel_dir}) list(APPEND CPACK_INSTALL_CMAKE_PROJECTS ${rel_dir}) endif() - - # if(EXISTS ${debug_dir}) list(APPEND CPACK_INSTALL_CMAKE_PROJECTS ${rel_dir}) endmacro() endmacro() - - # add_crt_version(v110) add_crt_version(v100) add_crt_version(v90) - - list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_BINARY_DIR}) - set(CPACK_GENERATOR "NSIS") - set(CPACK_PACKAGE_NAME "ZeroMQ") - set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "ZeroMQ lightweight messaging kernel") - set(CPACK_PACKAGE_VENDOR "Miru") - set(CPACK_NSIS_CONTACT "Steven McCoy ") - set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_BINARY_DIR}\\\\COPYING.txt") - # set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_BINARY_DIR}\\\\README.txt") set(CPACK_RESOURCE_FILE_WELCOME - # "${CMAKE_CURRENT_BINARY_DIR}\\\\WELCOME.txt") There is a bug in NSI that does not handle full unix paths properly. - # Make sure there is at least one set of four(4) backslashes. - set(CPACK_NSIS_MUI_ICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\installer.ico") - set(CPACK_NSIS_MUI_UNIICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\installer.ico") - - set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\branding.bmp") - set(CPACK_NSIS_COMPRESSOR "/SOLID lzma") - set(CPACK_PACKAGE_VERSION ${ZMQ_VERSION}) - set(CPACK_PACKAGE_VERSION_MAJOR ${ZMQ_VERSION_MAJOR}) - set(CPACK_PACKAGE_VERSION_MINOR ${ZMQ_VERSION_MINOR}) - set(CPACK_PACKAGE_VERSION_PATCH ${ZMQ_VERSION_PATCH}) - # set(CPACK_PACKAGE_INSTALL_DIRECTORY "ZMQ Install Directory") set(CPACK_TEMPORARY_DIRECTORY "ZMQ Temporary CPack - # Directory") - - include(CPack) - - cpack_add_component_group(Development DISPLAY_NAME "ZeroMQ software development kit" EXPANDED) - cpack_add_component(PerfTools DISPLAY_NAME "ZeroMQ performance tools" INSTALL_TYPES FullInstall DevInstall) - cpack_add_component(SourceCode DISPLAY_NAME "ZeroMQ source code" DISABLED INSTALL_TYPES FullInstall) - cpack_add_component( - SDK - DISPLAY_NAME - "ZeroMQ headers and libraries" - INSTALL_TYPES - FullInstall - DevInstall - GROUP - Development) - if(WITH_DOC) - cpack_add_component( - RefGuide - DISPLAY_NAME - "ZeroMQ reference guide" - INSTALL_TYPES - FullInstall - DevInstall - GROUP - Development) - endif() - cpack_add_component( - Runtime - DISPLAY_NAME - "ZeroMQ runtime files" - REQUIRED - INSTALL_TYPES - FullInstall - DevInstall - MinInstall) - cpack_add_install_type(FullInstall DISPLAY_NAME "Full install, including source code") - cpack_add_install_type(DevInstall DISPLAY_NAME "Developer install, headers and libraries") - cpack_add_install_type(MinInstall DISPLAY_NAME "Minimal install, runtime only") -endif() - -# Export this for library to help build this as a sub-project -set(ZEROMQ_LIBRARY - libzmq - CACHE STRING "ZeroMQ library") - -# Workaround for MSVS10 to avoid the Dialog Hell FIXME: This could be removed with future version of CMake. -if(MSVC_VERSION EQUAL 1600) - set(ZMQ_SLN_FILENAME "${CMAKE_CURRENT_BINARY_DIR}/ZeroMQ.sln") - if(EXISTS "${ZMQ_SLN_FILENAME}") - file(APPEND "${ZMQ_SLN_FILENAME}" "\n# This should be regenerated!\n") - endif() -endif() - -# this cannot be moved, as it does not only contain function/macro definitions -option(ENABLE_CLANG "Include Clang" ON) -if (ENABLE_CLANG) - include(ClangFormat) -endif() - -# fixes https://github.com/zeromq/libzmq/issues/3776 The problem is, both libzmq-static libzmq try to use/generate -# precompiled.pch at the same time Add a dependency, so they run in order and so they dont get in each others way TODO -# still generates warning "build\x64-Debug\ninja : warning : multiple rules generate precompiled.hpp. builds involving -# this target will not be correct; continuing anyway [-w dupbuild=warn]" -if(MSVC - AND ENABLE_PRECOMPILED - AND BUILD_SHARED - AND BUILD_STATIC) - add_dependencies(libzmq-static libzmq) -endif() - -option(ENABLE_NO_EXPORT "Build with empty ZMQ_EXPORT macro, bypassing platform-based automated detection" OFF) -if(ENABLE_NO_EXPORT) - message(STATUS "Building with empty ZMQ_EXPORT macro") - add_definitions(-DZMQ_NO_EXPORT) -endif() diff --git a/libs/libzmq/COPYING b/libs/libzmq/COPYING deleted file mode 100644 index b6f3fd5..0000000 --- a/libs/libzmq/COPYING +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. diff --git a/libs/libzmq/COPYING.LESSER b/libs/libzmq/COPYING.LESSER deleted file mode 100644 index 02e943c..0000000 --- a/libs/libzmq/COPYING.LESSER +++ /dev/null @@ -1,181 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - - This version of the GNU Lesser General Public License incorporates -the terms and conditions of version 3 of the GNU General Public -License, supplemented by the additional permissions listed below. - - 0. Additional Definitions. - - As used herein, "this License" refers to version 3 of the GNU Lesser -General Public License, and the "GNU GPL" refers to version 3 of the GNU -General Public License. - - "The Library" refers to a covered work governed by this License, -other than an Application or a Combined Work as defined below. - - An "Application" is any work that makes use of an interface provided -by the Library, but which is not otherwise based on the Library. -Defining a subclass of a class defined by the Library is deemed a mode -of using an interface provided by the Library. - - A "Combined Work" is a work produced by combining or linking an -Application with the Library. The particular version of the Library -with which the Combined Work was made is also called the "Linked -Version". - - The "Minimal Corresponding Source" for a Combined Work means the -Corresponding Source for the Combined Work, excluding any source code -for portions of the Combined Work that, considered in isolation, are -based on the Application, and not on the Linked Version. - - The "Corresponding Application Code" for a Combined Work means the -object code and/or source code for the Application, including any data -and utility programs needed for reproducing the Combined Work from the -Application, but excluding the System Libraries of the Combined Work. - - 1. Exception to Section 3 of the GNU GPL. - - You may convey a covered work under sections 3 and 4 of this License -without being bound by section 3 of the GNU GPL. - - 2. Conveying Modified Versions. - - If you modify a copy of the Library, and, in your modifications, a -facility refers to a function or data to be supplied by an Application -that uses the facility (other than as an argument passed when the -facility is invoked), then you may convey a copy of the modified -version: - - a) under this License, provided that you make a good faith effort to - ensure that, in the event an Application does not supply the - function or data, the facility still operates, and performs - whatever part of its purpose remains meaningful, or - - b) under the GNU GPL, with none of the additional permissions of - this License applicable to that copy. - - 3. Object Code Incorporating Material from Library Header Files. - - The object code form of an Application may incorporate material from -a header file that is part of the Library. You may convey such object -code under terms of your choice, provided that, if the incorporated -material is not limited to numerical parameters, data structure -layouts and accessors, or small macros, inline functions and templates -(ten or fewer lines in length), you do both of the following: - - a) Give prominent notice with each copy of the object code that the - Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the object code with a copy of the GNU GPL and this license - document. - - 4. Combined Works. - - You may convey a Combined Work under terms of your choice that, -taken together, effectively do not restrict modification of the -portions of the Library contained in the Combined Work and reverse -engineering for debugging such modifications, if you also do each of -the following: - - a) Give prominent notice with each copy of the Combined Work that - the Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the Combined Work with a copy of the GNU GPL and this license - document. - - c) For a Combined Work that displays copyright notices during - execution, include the copyright notice for the Library among - these notices, as well as a reference directing the user to the - copies of the GNU GPL and this license document. - - d) Do one of the following: - - 0) Convey the Minimal Corresponding Source under the terms of this - License, and the Corresponding Application Code in a form - suitable for, and under terms that permit, the user to - recombine or relink the Application with a modified version of - the Linked Version to produce a modified Combined Work, in the - manner specified by section 6 of the GNU GPL for conveying - Corresponding Source. - - 1) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (a) uses at run time - a copy of the Library already present on the user's computer - system, and (b) will operate properly with a modified version - of the Library that is interface-compatible with the Linked - Version. - - e) Provide Installation Information, but only if you would otherwise - be required to provide such information under section 6 of the - GNU GPL, and only to the extent that such information is - necessary to install and execute a modified version of the - Combined Work produced by recombining or relinking the - Application with a modified version of the Linked Version. (If - you use option 4d0, the Installation Information must accompany - the Minimal Corresponding Source and Corresponding Application - Code. If you use option 4d1, you must provide the Installation - Information in the manner specified by section 6 of the GNU GPL - for conveying Corresponding Source.) - - 5. Combined Libraries. - - You may place library facilities that are a work based on the -Library side by side in a single library together with other library -facilities that are not Applications and are not covered by this -License, and convey such a combined library under terms of your -choice, if you do both of the following: - - a) Accompany the combined library with a copy of the same work based - on the Library, uncombined with any other library facilities, - conveyed under the terms of this License. - - b) Give prominent notice with the combined library that part of it - is a work based on the Library, and explaining where to find the - accompanying uncombined form of the same work. - - 6. Revised Versions of the GNU Lesser General Public License. - - The Free Software Foundation may publish revised and/or new versions -of the GNU Lesser General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - - Each version is given a distinguishing version number. If the -Library as you received it specifies that a certain numbered version -of the GNU Lesser General Public License "or any later version" -applies to it, you have the option of following the terms and -conditions either of that published version or of any later version -published by the Free Software Foundation. If the Library as you -received it does not specify a version number of the GNU Lesser -General Public License, you may choose any version of the GNU Lesser -General Public License ever published by the Free Software Foundation. - - If the Library as you received it specifies that a proxy can decide -whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is -permanent authorization for you to choose that version for the -Library. - --------------------------------------------------------------------------------- - - SPECIAL EXCEPTION GRANTED BY COPYRIGHT HOLDERS - -As a special exception, copyright holders give you permission to link this -library with independent modules to produce an executable, regardless of -the license terms of these independent modules, and to copy and distribute -the resulting executable under terms of your choice, provided that you also -meet, for each linked independent module, the terms and conditions of -the license of that module. An independent module is a module which is not -derived from or based on this library. If you modify this library, you must -extend this exception to your version of the library. - -Note: this exception relieves you of any obligations under sections 4 and 5 -of this license, and section 6 of the GNU General Public License. diff --git a/libs/libzmq/Dockerfile b/libs/libzmq/Dockerfile deleted file mode 100644 index 6b8c0c6..0000000 --- a/libs/libzmq/Dockerfile +++ /dev/null @@ -1,32 +0,0 @@ -FROM debian:buster-slim AS builder -LABEL maintainer="ZeroMQ Project " -ARG DEBIAN_FRONTEND=noninteractive -RUN apt-get update -qq \ - && apt-get install -qq --yes --no-install-recommends \ - autoconf \ - automake \ - build-essential \ - git \ - libkrb5-dev \ - libsodium-dev \ - libtool \ - pkg-config \ - && rm -rf /var/lib/apt/lists/* -WORKDIR /opt/libzmq -COPY . . -RUN ./autogen.sh \ - && ./configure --prefix=/usr/local --with-libsodium --with-libgssapi_krb5 \ - && make \ - && make check \ - && make install - -FROM debian:buster-slim -LABEL maintainer="ZeroMQ Project " -ARG DEBIAN_FRONTEND=noninteractive -RUN apt-get update -qq \ - && apt-get install -qq --yes --no-install-recommends \ - libkrb5-dev \ - libsodium23 \ - && rm -rf /var/lib/apt/lists/* -COPY --from=builder /usr/local /usr/local -RUN ldconfig && ldconfig -p | grep libzmq diff --git a/libs/libzmq/Doxygen.cfg b/libs/libzmq/Doxygen.cfg deleted file mode 100644 index 370f19b..0000000 --- a/libs/libzmq/Doxygen.cfg +++ /dev/null @@ -1,2320 +0,0 @@ -# Doxyfile 1.8.11 - -# This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project. -# -# All text after a double hash (##) is considered a comment and is placed in -# front of the TAG it is preceding. -# -# All text after a single hash (#) is considered a comment and will be ignored. -# The format is: -# TAG = value [value, ...] -# For lists, items can also be appended using: -# TAG += value [value, ...] -# Values that contain spaces should be placed between quotes (\" \"). - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- - -# This tag specifies the encoding used for all characters in the config file -# that follow. The default is UTF-8 which is also the encoding used for all text -# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv -# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv -# for the list of possible encodings. -# The default value is: UTF-8. - -DOXYFILE_ENCODING = UTF-8 - -# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by -# double-quotes, unless you are using Doxywizard) that should identify the -# project for which the documentation is generated. This name is used in the -# title of most generated pages and in a few other places. -# The default value is: My Project. - -PROJECT_NAME = libzmq - -# The PROJECT_NUMBER tag can be used to enter a project or revision number. This -# could be handy for archiving the generated documentation or if some version -# control system is used. - -PROJECT_NUMBER = master - -# Using the PROJECT_BRIEF tag one can provide an optional one line description -# for a project that appears at the top of each page and should give viewer a -# quick idea about the purpose of the project. Keep the description short. - -PROJECT_BRIEF = "ZeroMQ C++ Core Engine (LIBZMQ)" - -PROJECT_LOGO = branding.bmp - -# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path -# into which the generated documentation will be written. If a relative path is -# entered, it will be relative to the location where doxygen was started. If -# left blank the current directory will be used. - -OUTPUT_DIRECTORY = doxygen - -# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub- -# directories (in 2 levels) under the output directory of each output format and -# will distribute the generated files over these directories. Enabling this -# option can be useful when feeding doxygen a huge amount of source files, where -# putting all generated files in the same directory would otherwise causes -# performance problems for the file system. -# The default value is: NO. - -CREATE_SUBDIRS = YES - -# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII -# characters to appear in the names of generated files. If set to NO, non-ASCII -# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode -# U+3044. -# The default value is: NO. - -ALLOW_UNICODE_NAMES = NO - -# The OUTPUT_LANGUAGE tag is used to specify the language in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all constant output in the proper language. -# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese, -# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States), -# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian, -# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages), -# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian, -# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian, -# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish, -# Ukrainian and Vietnamese. -# The default value is: English. - -OUTPUT_LANGUAGE = English - -# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member -# descriptions after the members that are listed in the file and class -# documentation (similar to Javadoc). Set to NO to disable this. -# The default value is: YES. - -BRIEF_MEMBER_DESC = YES - -# If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief -# description of a member or function before the detailed description -# -# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the -# brief descriptions will be completely suppressed. -# The default value is: YES. - -REPEAT_BRIEF = YES - -# This tag implements a quasi-intelligent brief description abbreviator that is -# used to form the text in various listings. Each string in this list, if found -# as the leading text of the brief description, will be stripped from the text -# and the result, after processing the whole list, is used as the annotated -# text. Otherwise, the brief description is used as-is. If left blank, the -# following values are used ($name is automatically replaced with the name of -# the entity):The $name class, The $name widget, The $name file, is, provides, -# specifies, contains, represents, a, an and the. - -ABBREVIATE_BRIEF = - -# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then -# doxygen will generate a detailed section even if there is only a brief -# description. -# The default value is: NO. - -ALWAYS_DETAILED_SEC = NO - -# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all -# inherited members of a class in the documentation of that class as if those -# members were ordinary class members. Constructors, destructors and assignment -# operators of the base classes will not be shown. -# The default value is: NO. - -INLINE_INHERITED_MEMB = NO - -# If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path -# before files name in the file list and in the header files. If set to NO the -# shortest path that makes the file name unique will be used -# The default value is: YES. - -FULL_PATH_NAMES = NO - -# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path. -# Stripping is only done if one of the specified strings matches the left-hand -# part of the path. The tag can be used to show relative paths in the file list. -# If left blank the directory from which doxygen is run is used as the path to -# strip. -# -# Note that you can specify absolute paths here, but also relative paths, which -# will be relative from the directory where doxygen is started. -# This tag requires that the tag FULL_PATH_NAMES is set to YES. - -STRIP_FROM_PATH = ../.. - -# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the -# path mentioned in the documentation of a class, which tells the reader which -# header file to include in order to use a class. If left blank only the name of -# the header file containing the class definition is used. Otherwise one should -# specify the list of include paths that are normally passed to the compiler -# using the -I flag. - -STRIP_FROM_INC_PATH = - -# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but -# less readable) file names. This can be useful is your file systems doesn't -# support long names like on DOS, Mac, or CD-ROM. -# The default value is: NO. - -SHORT_NAMES = NO -JAVADOC_AUTOBRIEF = NO -QT_AUTOBRIEF = NO - -# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a -# multi-line C++ special comment block (i.e. a block of //! or /// comments) as -# a brief description. This used to be the default behavior. The new default is -# to treat a multi-line C++ comment block as a detailed description. Set this -# tag to YES if you prefer the old behavior instead. -# -# Note that setting this tag to YES also means that rational rose comments are -# not recognized any more. -# The default value is: NO. - -MULTILINE_CPP_IS_BRIEF = NO - -# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the -# documentation from any documented member that it re-implements. -# The default value is: YES. - -INHERIT_DOCS = YES - -# If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new -# page for each member. If set to NO, the documentation of a member will be part -# of the file/class/namespace that contains it. -# The default value is: NO. - -SEPARATE_MEMBER_PAGES = NO - -# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen -# uses this value to replace tabs by spaces in code fragments. -# Minimum value: 1, maximum value: 16, default value: 4. - -TAB_SIZE = 4 - -# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources -# only. Doxygen will then generate output that is more tailored for C. For -# instance, some of the names that are used will be different. The list of all -# members will be omitted, etc. -# The default value is: NO. - -OPTIMIZE_OUTPUT_FOR_C = NO - -OPTIMIZE_OUTPUT_JAVA = NO - -OPTIMIZE_FOR_FORTRAN = NO - -OPTIMIZE_OUTPUT_VHDL = NO - -# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments -# according to the Markdown format, which allows for more readable -# documentation. See http://daringfireball.net/projects/markdown/ for details. -# The output of markdown processing is further processed by doxygen, so you can -# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in -# case of backward compatibilities issues. -# The default value is: YES. - -MARKDOWN_SUPPORT = YES - -# When enabled doxygen tries to link words that correspond to documented -# classes, or namespaces to their corresponding documentation. Such a link can -# be prevented in individual cases by putting a % sign in front of the word or -# globally by setting AUTOLINK_SUPPORT to NO. -# The default value is: YES. - -AUTOLINK_SUPPORT = YES - -# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want -# to include (a tag file for) the STL sources as input, then you should set this -# tag to YES in order to let doxygen match functions declarations and -# definitions whose arguments contain STL classes (e.g. func(std::string); -# versus func(std::string) {}). This also make the inheritance and collaboration -# diagrams that involve STL classes more complete and accurate. -# The default value is: NO. - -BUILTIN_STL_SUPPORT = YES - -# If you use Microsoft's C++/CLI language, you should set this option to YES to -# enable parsing support. -# The default value is: NO. - -CPP_CLI_SUPPORT = NO - -# For Microsoft's IDL there are propget and propput attributes to indicate -# getter and setter methods for a property. Setting this option to YES will make -# doxygen to replace the get and set methods by a property in the documentation. -# This will only work if the methods are indeed getting or setting a simple -# type. If this is not the case, or you want to show the methods anyway, you -# should set this option to NO. -# The default value is: YES. - -IDL_PROPERTY_SUPPORT = YES - -# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC -# tag is set to YES then doxygen will reuse the documentation of the first -# member in the group (if any) for the other members of the group. By default -# all members of a group must be documented explicitly. -# The default value is: NO. - -DISTRIBUTE_GROUP_DOC = NO - -# If one adds a struct or class to a group and this option is enabled, then also -# any nested class or struct is added to the same group. By default this option -# is disabled and one has to add nested compounds explicitly via \ingroup. -# The default value is: NO. - -GROUP_NESTED_COMPOUNDS = NO - -# Set the SUBGROUPING tag to YES to allow class member groups of the same type -# (for instance a group of public functions) to be put as a subgroup of that -# type (e.g. under the Public Functions section). Set it to NO to prevent -# subgrouping. Alternatively, this can be done per class using the -# \nosubgrouping command. -# The default value is: YES. - -SUBGROUPING = YES - -# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions -# are shown inside the group in which they are included (e.g. using \ingroup) -# instead of on a separate page (for HTML and Man pages) or section (for LaTeX -# and RTF). -# -# Note that this feature does not work in combination with -# SEPARATE_MEMBER_PAGES. -# The default value is: NO. - -INLINE_GROUPED_CLASSES = NO - -# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions -# with only public data fields or simple typedef fields will be shown inline in -# the documentation of the scope in which they are defined (i.e. file, -# namespace, or group documentation), provided this scope is documented. If set -# to NO, structs, classes, and unions are shown on a separate page (for HTML and -# Man pages) or section (for LaTeX and RTF). -# The default value is: NO. - -INLINE_SIMPLE_STRUCTS = NO - -# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or -# enum is documented as struct, union, or enum with the name of the typedef. So -# typedef struct TypeS {} TypeT, will appear in the documentation as a struct -# with name TypeT. When disabled the typedef will appear as a member of a file, -# namespace, or class. And the struct will be named TypeS. This can typically be -# useful for C code in case the coding convention dictates that all compound -# types are typedef'ed and only the typedef is referenced, never the tag name. -# The default value is: NO. - -TYPEDEF_HIDES_STRUCT = NO - -# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This -# cache is used to resolve symbols given their name and scope. Since this can be -# an expensive process and often the same symbol appears multiple times in the -# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small -# doxygen will become slower. If the cache is too large, memory is wasted. The -# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range -# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536 -# symbols. At the end of a run doxygen will report the cache usage and suggest -# the optimal cache size from a speed point of view. -# Minimum value: 0, maximum value: 9, default value: 0. - -LOOKUP_CACHE_SIZE = 0 - -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- - -# If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in -# documentation are documented, even if no documentation was available. Private -# class members and static file members will be hidden unless the -# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES. -# Note: This will also disable the warnings about undocumented members that are -# normally produced when WARNINGS is set to YES. -# The default value is: NO. - -EXTRACT_ALL = YES - -# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will -# be included in the documentation. -# The default value is: NO. - -EXTRACT_PRIVATE = YES - -# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal -# scope will be included in the documentation. -# The default value is: NO. - -EXTRACT_PACKAGE = NO - -# If the EXTRACT_STATIC tag is set to YES, all static members of a file will be -# included in the documentation. -# The default value is: NO. - -EXTRACT_STATIC = YES - -# If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined -# locally in source files will be included in the documentation. If set to NO, -# only classes defined in header files are included. Does not have any effect -# for Java sources. -# The default value is: YES. - -EXTRACT_LOCAL_CLASSES = YES - -# If this flag is set to YES, the members of anonymous namespaces will be -# extracted and appear in the documentation as a namespace called -# 'anonymous_namespace{file}', where file will be replaced with the base name of -# the file that contains the anonymous namespace. By default anonymous namespace -# are hidden. -# The default value is: NO. - -EXTRACT_ANON_NSPACES = YES - -# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all -# undocumented members inside documented classes or files. If set to NO these -# members will be included in the various overviews, but no documentation -# section is generated. This option has no effect if EXTRACT_ALL is enabled. -# The default value is: NO. - -HIDE_UNDOC_MEMBERS = NO - -# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all -# undocumented classes that are normally visible in the class hierarchy. If set -# to NO, these classes will be included in the various overviews. This option -# has no effect if EXTRACT_ALL is enabled. -# The default value is: NO. - -HIDE_UNDOC_CLASSES = NO - -# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend -# (class|struct|union) declarations. If set to NO, these declarations will be -# included in the documentation. -# The default value is: NO. - -HIDE_FRIEND_COMPOUNDS = NO - -# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any -# documentation blocks found inside the body of a function. If set to NO, these -# blocks will be appended to the function's detailed documentation block. -# The default value is: NO. - -HIDE_IN_BODY_DOCS = NO - -# The INTERNAL_DOCS tag determines if documentation that is typed after a -# \internal command is included. If the tag is set to NO then the documentation -# will be excluded. Set it to YES to include the internal documentation. -# The default value is: NO. - -INTERNAL_DOCS = NO - -# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file -# names in lower-case letters. If set to YES, upper-case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows -# and Mac users are advised to set this option to NO. -# The default value is: system dependent. - -CASE_SENSE_NAMES = YES - -# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with -# their full class and namespace scopes in the documentation. If set to YES, the -# scope will be hidden. -# The default value is: NO. - -HIDE_SCOPE_NAMES = NO - -# If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will -# append additional text to a page's title, such as Class Reference. If set to -# YES the compound reference will be hidden. -# The default value is: NO. - -HIDE_COMPOUND_REFERENCE= NO - -# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of -# the files that are included by a file in the documentation of that file. -# The default value is: YES. - -SHOW_INCLUDE_FILES = YES - -# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each -# grouped member an include statement to the documentation, telling the reader -# which file to include in order to use the member. -# The default value is: NO. - -SHOW_GROUPED_MEMB_INC = NO - -# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include -# files with double quotes in the documentation rather than with sharp brackets. -# The default value is: NO. - -FORCE_LOCAL_INCLUDES = NO - -# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the -# documentation for inline members. -# The default value is: YES. - -INLINE_INFO = YES - -# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the -# (detailed) documentation of file and class members alphabetically by member -# name. If set to NO, the members will appear in declaration order. -# The default value is: YES. - -SORT_MEMBER_DOCS = YES - -# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief -# descriptions of file, namespace and class members alphabetically by member -# name. If set to NO, the members will appear in declaration order. Note that -# this will also influence the order of the classes in the class list. -# The default value is: NO. - -SORT_BRIEF_DOCS = YES - -# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the -# (brief and detailed) documentation of class members so that constructors and -# destructors are listed first. If set to NO the constructors will appear in the -# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS. -# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief -# member documentation. -# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting -# detailed member documentation. -# The default value is: NO. - -SORT_MEMBERS_CTORS_1ST = YES - -# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy -# of group names into alphabetical order. If set to NO the group names will -# appear in their defined order. -# The default value is: NO. - -SORT_GROUP_NAMES = NO - -# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by -# fully-qualified names, including namespaces. If set to NO, the class list will -# be sorted only by class name, not including the namespace part. -# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. -# Note: This option applies only to the class list, not to the alphabetical -# list. -# The default value is: NO. - -SORT_BY_SCOPE_NAME = NO - -# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper -# type resolution of all parameters of a function it will reject a match between -# the prototype and the implementation of a member function even if there is -# only one candidate or it is obvious which candidate to choose by doing a -# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still -# accept a match between prototype and implementation in such cases. -# The default value is: NO. - -STRICT_PROTO_MATCHING = NO - -# The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo -# list. This list is created by putting \todo commands in the documentation. -# The default value is: YES. - -GENERATE_TODOLIST = YES - -# The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test -# list. This list is created by putting \test commands in the documentation. -# The default value is: YES. - -GENERATE_TESTLIST = YES - -# The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug -# list. This list is created by putting \bug commands in the documentation. -# The default value is: YES. - -GENERATE_BUGLIST = YES - -# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO) -# the deprecated list. This list is created by putting \deprecated commands in -# the documentation. -# The default value is: YES. - -GENERATE_DEPRECATEDLIST= YES - -# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the -# initial value of a variable or macro / define can have for it to appear in the -# documentation. If the initializer consists of more lines than specified here -# it will be hidden. Use a value of 0 to hide initializers completely. The -# appearance of the value of individual variables and macros / defines can be -# controlled using \showinitializer or \hideinitializer command in the -# documentation regardless of this setting. -# Minimum value: 0, maximum value: 10000, default value: 30. - -MAX_INITIALIZER_LINES = 30 - -# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at -# the bottom of the documentation of classes and structs. If set to YES, the -# list will mention the files that were used to generate the documentation. -# The default value is: YES. - -SHOW_USED_FILES = NO - -# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This -# will remove the Files entry from the Quick Index and from the Folder Tree View -# (if specified). -# The default value is: YES. - -SHOW_FILES = YES - -# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces -# page. This will remove the Namespaces entry from the Quick Index and from the -# Folder Tree View (if specified). -# The default value is: YES. - -SHOW_NAMESPACES = NO - -# The FILE_VERSION_FILTER tag can be used to specify a program or script that -# doxygen should invoke to get the current version for each file (typically from -# the version control system). Doxygen will invoke the program by executing (via -# popen()) the command command input-file, where command is the value of the -# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided -# by doxygen. Whatever the program writes to standard output is used as the file -# version. For an example see the documentation. - -FILE_VERSION_FILTER = - -# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed -# by doxygen. The layout file controls the global structure of the generated -# output files in an output format independent way. To create the layout file -# that represents doxygen's defaults, run doxygen with the -l option. You can -# optionally specify a file name after the option, if omitted DoxygenLayout.xml -# will be used as the name of the layout file. -# -# Note that if you run doxygen from a directory containing a file called -# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE -# tag is left empty. - -LAYOUT_FILE = - -# The CITE_BIB_FILES tag can be used to specify one or more bib files containing -# the reference definitions. This must be a list of .bib files. The .bib -# extension is automatically appended if omitted. This requires the bibtex tool -# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info. -# For LaTeX the style of the bibliography can be controlled using -# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the -# search path. See also \cite for info how to create references. - -CITE_BIB_FILES = - -#--------------------------------------------------------------------------- -# Configuration options related to warning and progress messages -#--------------------------------------------------------------------------- - -# The QUIET tag can be used to turn on/off the messages that are generated to -# standard output by doxygen. If QUIET is set to YES this implies that the -# messages are off. -# The default value is: NO. - -QUIET = NO - -# The WARNINGS tag can be used to turn on/off the warning messages that are -# generated to standard error (stderr) by doxygen. If WARNINGS is set to YES -# this implies that the warnings are on. -# -# Tip: Turn warnings on while writing the documentation. -# The default value is: YES. - -WARNINGS = YES - -# If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate -# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag -# will automatically be disabled. -# The default value is: YES. - -WARN_IF_UNDOCUMENTED = NO - -# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some parameters -# in a documented function, or documenting parameters that don't exist or using -# markup commands wrongly. -# The default value is: YES. - -WARN_IF_DOC_ERROR = YES - -# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that -# are documented, but have no documentation for their parameters or return -# value. If set to NO, doxygen will only warn about wrong or incomplete -# parameter documentation, but not about the absence of documentation. -# The default value is: NO. - -WARN_NO_PARAMDOC = NO - -# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when -# a warning is encountered. -# The default value is: NO. - -WARN_AS_ERROR = NO - -# The WARN_FORMAT tag determines the format of the warning messages that doxygen -# can produce. The string should contain the $file, $line, and $text tags, which -# will be replaced by the file and line number from which the warning originated -# and the warning text. Optionally the format may contain $version, which will -# be replaced by the version of the file (if it could be obtained via -# FILE_VERSION_FILTER) -# The default value is: $file:$line: $text. - -WARN_FORMAT = - -# The WARN_LOGFILE tag can be used to specify a file to which warning and error -# messages should be written. If left blank the output is written to standard -# error (stderr). - -WARN_LOGFILE = - -#--------------------------------------------------------------------------- -# Configuration options related to the input files -#--------------------------------------------------------------------------- - -# The INPUT tag is used to specify the files and/or directories that contain -# documented source files. You may enter file names like myfile.cpp or -# directories like /usr/src/myproject. Separate the files or directories with -# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING -# Note: If this tag is empty the current directory is searched. - -INPUT = include \ - src \ - tests \ - perf \ - README.doxygen.md - -# This tag can be used to specify the character encoding of the source files -# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses -# libiconv (or the iconv built into libc) for the transcoding. See the libiconv -# documentation (see: http://www.gnu.org/software/libiconv) for the list of -# possible encodings. -# The default value is: UTF-8. - -INPUT_ENCODING = UTF-8 - -# If the value of the INPUT tag contains directories, you can use the -# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and -# *.h) to filter out the source-files in the directories. -# -# Note that for custom extensions or not directly supported extensions you also -# need to set EXTENSION_MAPPING for the extension otherwise the files are not -# read by doxygen. -# -# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp, -# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, -# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, -# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f, *.for, *.tcl, -# *.vhd, *.vhdl, *.ucf, *.qsf, *.as and *.js. - -FILE_PATTERNS = *.c \ - *.cpp \ - *.h \ - *.hpp - -# The RECURSIVE tag can be used to specify whether or not subdirectories should -# be searched for input files as well. -# The default value is: NO. - -RECURSIVE = YES - -# The EXCLUDE tag can be used to specify files and/or directories that should be -# excluded from the INPUT source files. This way you can easily exclude a -# subdirectory from a directory tree whose root is specified with the INPUT tag. -# -# Note that relative paths are relative to the directory from which doxygen is -# run. - -EXCLUDE = - -# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or -# directories that are symbolic links (a Unix file system feature) are excluded -# from the input. -# The default value is: NO. - -EXCLUDE_SYMLINKS = NO - -# If the value of the INPUT tag contains directories, you can use the -# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude -# certain files from those directories. -# -# Note that the wildcards are matched against the file with absolute path, so to -# exclude all test directories for example use the pattern */test/* - -EXCLUDE_PATTERNS = - -# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names -# (namespaces, classes, functions, etc.) that should be excluded from the -# output. The symbol name can be a fully qualified name, a word, or if the -# wildcard * is used, a substring. Examples: ANamespace, AClass, -# AClass::ANamespace, ANamespace::*Test -# -# Note that the wildcards are matched against the file with absolute path, so to -# exclude all test directories use the pattern */test/* - -EXCLUDE_SYMBOLS = - -# The EXAMPLE_PATH tag can be used to specify one or more files or directories -# that contain example code fragments that are included (see the \include -# command). - -EXAMPLE_PATH = tests perf - -# If the value of the EXAMPLE_PATH tag contains directories, you can use the -# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and -# *.h) to filter out the source-files in the directories. If left blank all -# files are included. - -EXAMPLE_PATTERNS = - -# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be -# searched for input files to be used with the \include or \dontinclude commands -# irrespective of the value of the RECURSIVE tag. -# The default value is: NO. - -EXAMPLE_RECURSIVE = YES - -# The IMAGE_PATH tag can be used to specify one or more files or directories -# that contain images that are to be included in the documentation (see the -# \image command). - -IMAGE_PATH = - -# The INPUT_FILTER tag can be used to specify a program that doxygen should -# invoke to filter for each input file. Doxygen will invoke the filter program -# by executing (via popen()) the command: -# -# -# -# where is the value of the INPUT_FILTER tag, and is the -# name of an input file. Doxygen will then use the output that the filter -# program writes to standard output. If FILTER_PATTERNS is specified, this tag -# will be ignored. -# -# Note that the filter must not add or remove lines; it is applied before the -# code is scanned, but not when the output code is generated. If lines are added -# or removed, the anchors will not be placed correctly. -# -# Note that for custom extensions or not directly supported extensions you also -# need to set EXTENSION_MAPPING for the extension otherwise the files are not -# properly processed by doxygen. - -INPUT_FILTER = - -# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern -# basis. Doxygen will compare the file name with each pattern and apply the -# filter if there is a match. The filters are a list of the form: pattern=filter -# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how -# filters are used. If the FILTER_PATTERNS tag is empty or if none of the -# patterns match the file name, INPUT_FILTER is applied. -# -# Note that for custom extensions or not directly supported extensions you also -# need to set EXTENSION_MAPPING for the extension otherwise the files are not -# properly processed by doxygen. - -FILTER_PATTERNS = - -# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using -# INPUT_FILTER) will also be used to filter the input files that are used for -# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES). -# The default value is: NO. - -FILTER_SOURCE_FILES = NO - -# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file -# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and -# it is also possible to disable source filtering for a specific pattern using -# *.ext= (so without naming a filter). -# This tag requires that the tag FILTER_SOURCE_FILES is set to YES. - -FILTER_SOURCE_PATTERNS = - -# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that -# is part of the input, its contents will be placed on the main page -# (index.html). This can be useful if you have a project on for instance GitHub -# and want to reuse the introduction page also for the doxygen output. - -USE_MDFILE_AS_MAINPAGE = README.doxygen.md - -#--------------------------------------------------------------------------- -# Configuration options related to source browsing -#--------------------------------------------------------------------------- - -# If the SOURCE_BROWSER tag is set to YES then a list of source files will be -# generated. Documented entities will be cross-referenced with these sources. -# -# Note: To get rid of all source code in the generated output, make sure that -# also VERBATIM_HEADERS is set to NO. -# The default value is: NO. - -SOURCE_BROWSER = YES - -# Setting the INLINE_SOURCES tag to YES will include the body of functions, -# classes and enums directly into the documentation. -# The default value is: NO. - -INLINE_SOURCES = NO - -# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any -# special comment blocks from generated source code fragments. Normal C, C++ and -# Fortran comments will always remain visible. -# The default value is: YES. - -STRIP_CODE_COMMENTS = NO - -# If the REFERENCED_BY_RELATION tag is set to YES then for each documented -# function all documented functions referencing it will be listed. -# The default value is: NO. - -REFERENCED_BY_RELATION = YES - -# If the REFERENCES_RELATION tag is set to YES then for each documented function -# all documented entities called/used by that function will be listed. -# The default value is: NO. - -REFERENCES_RELATION = YES - -# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set -# to YES then the hyperlinks from functions in REFERENCES_RELATION and -# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will -# link to the documentation. -# The default value is: YES. - -REFERENCES_LINK_SOURCE = YES - -# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the -# source code will show a tooltip with additional information such as prototype, -# brief description and links to the definition and documentation. Since this -# will make the HTML file larger and loading of large files a bit slower, you -# can opt to disable this feature. -# The default value is: YES. -# This tag requires that the tag SOURCE_BROWSER is set to YES. - -SOURCE_TOOLTIPS = YES - -# If the USE_HTAGS tag is set to YES then the references to source code will -# point to the HTML generated by the htags(1) tool instead of doxygen built-in -# source browser. The htags tool is part of GNU's global source tagging system -# (see http://www.gnu.org/software/global/global.html). You will need version -# 4.8.6 or higher. -# -# To use it do the following: -# - Install the latest version of global -# - Enable SOURCE_BROWSER and USE_HTAGS in the config file -# - Make sure the INPUT points to the root of the source tree -# - Run doxygen as normal -# -# Doxygen will invoke htags (and that will in turn invoke gtags), so these -# tools must be available from the command line (i.e. in the search path). -# -# The result: instead of the source browser generated by doxygen, the links to -# source code will now point to the output of htags. -# The default value is: NO. -# This tag requires that the tag SOURCE_BROWSER is set to YES. - -USE_HTAGS = NO - -# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a -# verbatim copy of the header file for each class for which an include is -# specified. Set to NO to disable this. -# See also: Section \class. -# The default value is: YES. - -VERBATIM_HEADERS = YES - -#--------------------------------------------------------------------------- -# Configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- - -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all -# compounds will be generated. Enable this if the project contains a lot of -# classes, structs, unions or interfaces. -# The default value is: YES. - -ALPHABETICAL_INDEX = YES - -# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in -# which the alphabetical index list will be split. -# Minimum value: 1, maximum value: 20, default value: 5. -# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. - -COLS_IN_ALPHA_INDEX = 4 - -# In case all classes in a project start with a common prefix, all classes will -# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag -# can be used to specify a prefix (or a list of prefixes) that should be ignored -# while generating the index headers. -# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. - -IGNORE_PREFIX = - -#--------------------------------------------------------------------------- -# Configuration options related to the HTML output -#--------------------------------------------------------------------------- - -# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output -# The default value is: YES. - -GENERATE_HTML = YES - -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a -# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of -# it. -# The default directory is: html. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_OUTPUT = html - -# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each -# generated HTML page (for example: .htm, .php, .asp). -# The default value is: .html. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_FILE_EXTENSION = .html - -# The HTML_HEADER tag can be used to specify a user-defined HTML header file for -# each generated HTML page. If the tag is left blank doxygen will generate a -# standard header. -# -# To get valid HTML the header file that includes any scripts and style sheets -# that doxygen needs, which is dependent on the configuration options used (e.g. -# the setting GENERATE_TREEVIEW). It is highly recommended to start with a -# default header using -# doxygen -w html new_header.html new_footer.html new_stylesheet.css -# YourConfigFile -# and then modify the file new_header.html. See also section "Doxygen usage" -# for information on how to generate the default header that doxygen normally -# uses. -# Note: The header is subject to change so you typically have to regenerate the -# default header when upgrading to a newer version of doxygen. For a description -# of the possible markers and block names see the documentation. -# This tag requires that the tag GENERATE_HTML is set to YES. - -# HTML_HEADER = doxygen.header - -# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each -# generated HTML page. If the tag is left blank doxygen will generate a standard -# footer. See HTML_HEADER for more information on how to generate a default -# footer and what special commands can be used inside the footer. See also -# section "Doxygen usage" for information on how to generate the default footer -# that doxygen normally uses. -# This tag requires that the tag GENERATE_HTML is set to YES. - -# HTML_FOOTER = doxygen.footer - -# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style -# sheet that is used by each HTML page. It can be used to fine-tune the look of -# the HTML output. If left blank doxygen will generate a default style sheet. -# See also section "Doxygen usage" for information on how to generate the style -# sheet that doxygen normally uses. -# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as -# it is more robust and this tag (HTML_STYLESHEET) will in the future become -# obsolete. -# This tag requires that the tag GENERATE_HTML is set to YES. - -# HTML_STYLESHEET = doxygen.css - -# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined -# cascading style sheets that are included after the standard style sheets -# created by doxygen. Using this option one can overrule certain style aspects. -# This is preferred over using HTML_STYLESHEET since it does not replace the -# standard style sheet and is therefore more robust against future updates. -# Doxygen will copy the style sheet files to the output directory. -# Note: The order of the extra style sheet files is of importance (e.g. the last -# style sheet in the list overrules the setting of the previous ones in the -# list). For an example see the documentation. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_EXTRA_STYLESHEET = - -# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or -# other source files which should be copied to the HTML output directory. Note -# that these files will be copied to the base HTML output directory. Use the -# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these -# files. In the HTML_STYLESHEET file, use the file name only. Also note that the -# files will be copied as-is; there are no commands or markers available. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_EXTRA_FILES = - -# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen -# will adjust the colors in the style sheet and background images according to -# this color. Hue is specified as an angle on a colorwheel, see -# http://en.wikipedia.org/wiki/Hue for more information. For instance the value -# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 -# purple, and 360 is red again. -# Minimum value: 0, maximum value: 359, default value: 220. -# This tag requires that the tag GENERATE_HTML is set to YES. - -# HTML_COLORSTYLE_HUE = 240 - -# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors -# in the HTML output. For a value of 0 the output will use grayscales only. A -# value of 255 will produce the most vivid colors. -# Minimum value: 0, maximum value: 255, default value: 100. -# This tag requires that the tag GENERATE_HTML is set to YES. - -#HTML_COLORSTYLE_SAT = 100 - -# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the -# luminance component of the colors in the HTML output. Values below 100 -# gradually make the output lighter, whereas values above 100 make the output -# darker. The value divided by 100 is the actual gamma applied, so 80 represents -# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not -# change the gamma. -# Minimum value: 40, maximum value: 240, default value: 80. -# This tag requires that the tag GENERATE_HTML is set to YES. - -#HTML_COLORSTYLE_GAMMA = 80 - -# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML -# page will contain the date and time when the page was generated. Setting this -# to YES can help to show when doxygen was last run and thus if the -# documentation is up to date. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_TIMESTAMP = NO - -# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML -# documentation will contain sections that can be hidden and shown after the -# page has loaded. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_DYNAMIC_SECTIONS = NO - -# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries -# shown in the various tree structured indices initially; the user can expand -# and collapse entries dynamically later on. Doxygen will expand the tree to -# such a level that at most the specified number of entries are visible (unless -# a fully collapsed tree already exceeds this amount). So setting the number of -# entries 1 will produce a full collapsed tree by default. 0 is a special value -# representing an infinite number of entries and will result in a full expanded -# tree by default. -# Minimum value: 0, maximum value: 9999, default value: 100. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_INDEX_NUM_ENTRIES = 100 - -# If the GENERATE_DOCSET tag is set to YES, additional index files will be -# generated that can be used as input for Apple's Xcode 3 integrated development -# environment (see: http://developer.apple.com/tools/xcode/), introduced with -# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a -# Makefile in the HTML output directory. Running make will produce the docset in -# that directory and running make install will install the docset in -# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at -# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html -# for more information. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_DOCSET = NO - -# This tag determines the name of the docset feed. A documentation feed provides -# an umbrella under which multiple documentation sets from a single provider -# (such as a company or product suite) can be grouped. -# The default value is: Doxygen generated docs. -# This tag requires that the tag GENERATE_DOCSET is set to YES. - -DOCSET_FEEDNAME = "Doxygen generated docs" - -# This tag specifies a string that should uniquely identify the documentation -# set bundle. This should be a reverse domain-name style string, e.g. -# com.mycompany.MyDocSet. Doxygen will append .docset to the name. -# The default value is: org.doxygen.Project. -# This tag requires that the tag GENERATE_DOCSET is set to YES. - -DOCSET_BUNDLE_ID = org.doxygen.Project - -# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify -# the documentation publisher. This should be a reverse domain-name style -# string, e.g. com.mycompany.MyDocSet.documentation. -# The default value is: org.doxygen.Publisher. -# This tag requires that the tag GENERATE_DOCSET is set to YES. - -DOCSET_PUBLISHER_ID = org.doxygen.Publisher - -# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. -# The default value is: Publisher. -# This tag requires that the tag GENERATE_DOCSET is set to YES. - -DOCSET_PUBLISHER_NAME = Publisher - -# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three -# additional HTML index files: index.hhp, index.hhc, and index.hhk. The -# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop -# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on -# Windows. -# -# The HTML Help Workshop contains a compiler that can convert all HTML output -# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML -# files are now used as the Windows 98 help format, and will replace the old -# Windows help format (.hlp) on all Windows platforms in the future. Compressed -# HTML files also contain an index, a table of contents, and you can search for -# words in the documentation. The HTML workshop also contains a viewer for -# compressed HTML files. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_HTMLHELP = NO - -# The CHM_FILE tag can be used to specify the file name of the resulting .chm -# file. You can add a path in front of the file if the result should not be -# written to the html output directory. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -CHM_FILE = - -# The HHC_LOCATION tag can be used to specify the location (absolute path -# including file name) of the HTML help compiler (hhc.exe). If non-empty, -# doxygen will try to run the HTML help compiler on the generated index.hhp. -# The file has to be specified with full path. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -HHC_LOCATION = - -# The GENERATE_CHI flag controls if a separate .chi index file is generated -# (YES) or that it should be included in the master .chm file (NO). -# The default value is: NO. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -GENERATE_CHI = NO - -# The CHM_INDEX_ENCODING is used to encode HtmlHelp index (hhk), content (hhc) -# and project file content. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -CHM_INDEX_ENCODING = - -# The BINARY_TOC flag controls whether a binary table of contents is generated -# (YES) or a normal table of contents (NO) in the .chm file. Furthermore it -# enables the Previous and Next buttons. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -BINARY_TOC = NO - -# The TOC_EXPAND flag can be set to YES to add extra items for group members to -# the table of contents of the HTML help documentation and to the tree view. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -TOC_EXPAND = NO - -# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and -# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that -# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help -# (.qch) of the generated HTML documentation. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_QHP = NO - -# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify -# the file name of the resulting .qch file. The path specified is relative to -# the HTML output folder. -# This tag requires that the tag GENERATE_QHP is set to YES. - -QCH_FILE = - -# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help -# Project output. For more information please see Qt Help Project / Namespace -# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace). -# The default value is: org.doxygen.Project. -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_NAMESPACE = org.doxygen.Project - -# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt -# Help Project output. For more information please see Qt Help Project / Virtual -# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual- -# folders). -# The default value is: doc. -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_VIRTUAL_FOLDER = doc - -# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom -# filter to add. For more information please see Qt Help Project / Custom -# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- -# filters). -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_CUST_FILTER_NAME = - -# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the -# custom filter to add. For more information please see Qt Help Project / Custom -# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- -# filters). -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_CUST_FILTER_ATTRS = - -# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this -# project's filter section matches. Qt Help Project / Filter Attributes (see: -# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes). -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_SECT_FILTER_ATTRS = - -# The QHG_LOCATION tag can be used to specify the location of Qt's -# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the -# generated .qhp file. -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHG_LOCATION = - -# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be -# generated, together with the HTML files, they form an Eclipse help plugin. To -# install this plugin and make it available under the help contents menu in -# Eclipse, the contents of the directory containing the HTML and XML files needs -# to be copied into the plugins directory of eclipse. The name of the directory -# within the plugins directory should be the same as the ECLIPSE_DOC_ID value. -# After copying Eclipse needs to be restarted before the help appears. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_ECLIPSEHELP = NO - -# A unique identifier for the Eclipse help plugin. When installing the plugin -# the directory name containing the HTML and XML files should also have this -# name. Each documentation set should have its own identifier. -# The default value is: org.doxygen.Project. -# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES. - -ECLIPSE_DOC_ID = org.doxygen.Project - -# If you want full control over the layout of the generated HTML pages it might -# be necessary to disable the index and replace it with your own. The -# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top -# of each HTML page. A value of NO enables the index and the value YES disables -# it. Since the tabs in the index contain the same information as the navigation -# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -DISABLE_INDEX = NO - -# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index -# structure should be generated to display hierarchical information. If the tag -# value is set to YES, a side panel will be generated containing a tree-like -# index structure (just like the one that is generated for HTML Help). For this -# to work a browser that supports JavaScript, DHTML, CSS and frames is required -# (i.e. any modern browser). Windows users are probably better off using the -# HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can -# further fine-tune the look of the index. As an example, the default style -# sheet generated by doxygen has an example that shows how to put an image at -# the root of the tree instead of the PROJECT_NAME. Since the tree basically has -# the same information as the tab index, you could consider setting -# DISABLE_INDEX to YES when enabling this option. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_TREEVIEW = YES - -# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that -# doxygen will group on one line in the generated HTML documentation. -# -# Note that a value of 0 will completely suppress the enum values from appearing -# in the overview section. -# Minimum value: 0, maximum value: 20, default value: 4. -# This tag requires that the tag GENERATE_HTML is set to YES. - -ENUM_VALUES_PER_LINE = 4 - -# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used -# to set the initial width (in pixels) of the frame in which the tree is shown. -# Minimum value: 0, maximum value: 1500, default value: 250. -# This tag requires that the tag GENERATE_HTML is set to YES. - -TREEVIEW_WIDTH = 200 - -# If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to -# external symbols imported via tag files in a separate window. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -EXT_LINKS_IN_WINDOW = NO - -# Use this tag to change the font size of LaTeX formulas included as images in -# the HTML documentation. When you change the font size after a successful -# doxygen run you need to manually remove any form_*.png images from the HTML -# output directory to force them to be regenerated. -# Minimum value: 8, maximum value: 50, default value: 10. -# This tag requires that the tag GENERATE_HTML is set to YES. - -FORMULA_FONTSIZE = 10 - -# Use the FORMULA_TRANPARENT tag to determine whether or not the images -# generated for formulas are transparent PNGs. Transparent PNGs are not -# supported properly for IE 6.0, but are supported on all modern browsers. -# -# Note that when changing this option you need to delete any form_*.png files in -# the HTML output directory before the changes have effect. -# The default value is: YES. -# This tag requires that the tag GENERATE_HTML is set to YES. - -FORMULA_TRANSPARENT = YES - -# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see -# http://www.mathjax.org) which uses client side Javascript for the rendering -# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX -# installed or if you want to formulas look prettier in the HTML output. When -# enabled you may also need to install MathJax separately and configure the path -# to it using the MATHJAX_RELPATH option. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -USE_MATHJAX = NO - -# When MathJax is enabled you can set the default output format to be used for -# the MathJax output. See the MathJax site (see: -# http://docs.mathjax.org/en/latest/output.html) for more details. -# Possible values are: HTML-CSS (which is slower, but has the best -# compatibility), NativeMML (i.e. MathML) and SVG. -# The default value is: HTML-CSS. -# This tag requires that the tag USE_MATHJAX is set to YES. - -MATHJAX_FORMAT = HTML-CSS - -# When MathJax is enabled you need to specify the location relative to the HTML -# output directory using the MATHJAX_RELPATH option. The destination directory -# should contain the MathJax.js script. For instance, if the mathjax directory -# is located at the same level as the HTML output directory, then -# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax -# Content Delivery Network so you can quickly see the result without installing -# MathJax. However, it is strongly recommended to install a local copy of -# MathJax from http://www.mathjax.org before deployment. -# The default value is: http://cdn.mathjax.org/mathjax/latest. -# This tag requires that the tag USE_MATHJAX is set to YES. - -MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest - -# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax -# extension names that should be enabled during MathJax rendering. For example -# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols -# This tag requires that the tag USE_MATHJAX is set to YES. - -MATHJAX_EXTENSIONS = - -# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces -# of code that will be used on startup of the MathJax code. See the MathJax site -# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an -# example see the documentation. -# This tag requires that the tag USE_MATHJAX is set to YES. - -MATHJAX_CODEFILE = - -# When the SEARCHENGINE tag is enabled doxygen will generate a search box for -# the HTML output. The underlying search engine uses javascript and DHTML and -# should work on any modern browser. Note that when using HTML help -# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) -# there is already a search function so this one should typically be disabled. -# For large projects the javascript based search engine can be slow, then -# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to -# search using the keyboard; to jump to the search box use + S -# (what the is depends on the OS and browser, but it is typically -# , /