diff --git a/src/groups/mqb/mqbcfg/mqbcfg.xsd b/src/groups/mqb/mqbcfg/mqbcfg.xsd index ca9ba8396a..50e5f2135c 100644 --- a/src/groups/mqb/mqbcfg/mqbcfg.xsd +++ b/src/groups/mqb/mqbcfg/mqbcfg.xsd @@ -75,7 +75,8 @@ bmqconfConfig........: configuration for bmqconf plugins..............: configuration for the plugins msgPropertiesSupport.: information about if/how to advertise support for v2 message properties - configureStream......: send new ConfigureStream instead of old ConfigureQueue/> + configureStream......: send new ConfigureStream instead of old ConfigureQueue + tls..................: optional configuation for TLS @@ -97,6 +98,7 @@ + @@ -239,9 +241,11 @@ heartbeatIntervalMs..: How often (in milliseconds) to check if the channel received data, and emit heartbeat. 0 to globally disable. - useNtf...............: + useNtf...............: Use the new NTF based TCP transport library instead of the existing one based on BTE + tls.................: + Use TLS on this interface. @@ -255,6 +259,7 @@ + @@ -271,6 +276,27 @@ + + + + certificateAuthority.: + A path to the FILE, containing concatenation of known certificates + the server can use to reference as its certificate store. + certificate..........: + A path to the FILE, containing the certificate the broker will use + to identify itself to other clients. + key..................: + A path to the FILE, containing the private key that the broker uses + to read the certificate. + + + + + + + + + diff --git a/src/groups/mqb/mqbcfg/mqbcfg_messages.cpp b/src/groups/mqb/mqbcfg/mqbcfg_messages.cpp index bb8eba117d..6145601c64 100644 --- a/src/groups/mqb/mqbcfg/mqbcfg_messages.cpp +++ b/src/groups/mqb/mqbcfg/mqbcfg_messages.cpp @@ -2735,6 +2735,8 @@ const int TcpInterfaceConfig::DEFAULT_INITIALIZER_HEARTBEAT_INTERVAL_MS = 3000; const bool TcpInterfaceConfig::DEFAULT_INITIALIZER_USE_NTF = false; +const bool TcpInterfaceConfig::DEFAULT_INITIALIZER_TLS = false; + const bdlat_AttributeInfo TcpInterfaceConfig::ATTRIBUTE_INFO_ARRAY[] = { {ATTRIBUTE_ID_NAME, "name", @@ -2785,6 +2787,11 @@ const bdlat_AttributeInfo TcpInterfaceConfig::ATTRIBUTE_INFO_ARRAY[] = { "useNtf", sizeof("useNtf") - 1, "", + bdlat_FormattingMode::e_TEXT}, + {ATTRIBUTE_ID_TLS, + "tls", + sizeof("tls") - 1, + "", bdlat_FormattingMode::e_TEXT}}; // CLASS METHODS @@ -2792,7 +2799,7 @@ const bdlat_AttributeInfo TcpInterfaceConfig::ATTRIBUTE_INFO_ARRAY[] = { const bdlat_AttributeInfo* TcpInterfaceConfig::lookupAttributeInfo(const char* name, int nameLength) { - for (int i = 0; i < 10; ++i) { + for (int i = 0; i < 11; ++i) { const bdlat_AttributeInfo& attributeInfo = TcpInterfaceConfig::ATTRIBUTE_INFO_ARRAY[i]; @@ -2826,6 +2833,7 @@ const bdlat_AttributeInfo* TcpInterfaceConfig::lookupAttributeInfo(int id) return &ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_HEARTBEAT_INTERVAL_MS]; case ATTRIBUTE_ID_USE_NTF: return &ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_USE_NTF]; + case ATTRIBUTE_ID_TLS: return &ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_TLS]; default: return 0; } } @@ -2843,6 +2851,7 @@ TcpInterfaceConfig::TcpInterfaceConfig(bslma::Allocator* basicAllocator) , d_maxConnections(DEFAULT_INITIALIZER_MAX_CONNECTIONS) , d_heartbeatIntervalMs(DEFAULT_INITIALIZER_HEARTBEAT_INTERVAL_MS) , d_useNtf(DEFAULT_INITIALIZER_USE_NTF) +, d_tls(DEFAULT_INITIALIZER_TLS) { } @@ -2858,6 +2867,7 @@ TcpInterfaceConfig::TcpInterfaceConfig(const TcpInterfaceConfig& original, , d_maxConnections(original.d_maxConnections) , d_heartbeatIntervalMs(original.d_heartbeatIntervalMs) , d_useNtf(original.d_useNtf) +, d_tls(original.d_tls) { } @@ -2873,7 +2883,8 @@ TcpInterfaceConfig::TcpInterfaceConfig(TcpInterfaceConfig&& original) noexcept d_ioThreads(bsl::move(original.d_ioThreads)), d_maxConnections(bsl::move(original.d_maxConnections)), d_heartbeatIntervalMs(bsl::move(original.d_heartbeatIntervalMs)), - d_useNtf(bsl::move(original.d_useNtf)) + d_useNtf(bsl::move(original.d_useNtf)), + d_tls(bsl::move(original.d_tls)) { } @@ -2889,6 +2900,7 @@ TcpInterfaceConfig::TcpInterfaceConfig(TcpInterfaceConfig&& original, , d_maxConnections(bsl::move(original.d_maxConnections)) , d_heartbeatIntervalMs(bsl::move(original.d_heartbeatIntervalMs)) , d_useNtf(bsl::move(original.d_useNtf)) +, d_tls(bsl::move(original.d_tls)) { } #endif @@ -2913,6 +2925,7 @@ TcpInterfaceConfig::operator=(const TcpInterfaceConfig& rhs) d_nodeHighWatermark = rhs.d_nodeHighWatermark; d_heartbeatIntervalMs = rhs.d_heartbeatIntervalMs; d_useNtf = rhs.d_useNtf; + d_tls = rhs.d_tls; } return *this; @@ -2933,6 +2946,7 @@ TcpInterfaceConfig& TcpInterfaceConfig::operator=(TcpInterfaceConfig&& rhs) d_nodeHighWatermark = bsl::move(rhs.d_nodeHighWatermark); d_heartbeatIntervalMs = bsl::move(rhs.d_heartbeatIntervalMs); d_useNtf = bsl::move(rhs.d_useNtf); + d_tls = bsl::move(rhs.d_tls); } return *this; @@ -2951,6 +2965,7 @@ void TcpInterfaceConfig::reset() d_nodeHighWatermark = DEFAULT_INITIALIZER_NODE_HIGH_WATERMARK; d_heartbeatIntervalMs = DEFAULT_INITIALIZER_HEARTBEAT_INTERVAL_MS; d_useNtf = DEFAULT_INITIALIZER_USE_NTF; + d_tls = DEFAULT_INITIALIZER_TLS; } // ACCESSORS @@ -2971,6 +2986,150 @@ bsl::ostream& TcpInterfaceConfig::print(bsl::ostream& stream, printer.printAttribute("nodeHighWatermark", this->nodeHighWatermark()); printer.printAttribute("heartbeatIntervalMs", this->heartbeatIntervalMs()); printer.printAttribute("useNtf", this->useNtf()); + printer.printAttribute("tls", this->tls()); + printer.end(); + return stream; +} + +// --------------- +// class TlsConfig +// --------------- + +// CONSTANTS + +const char TlsConfig::CLASS_NAME[] = "TlsConfig"; + +const bdlat_AttributeInfo TlsConfig::ATTRIBUTE_INFO_ARRAY[] = { + {ATTRIBUTE_ID_CERTIFICATE_AUTHORITY, + "certificateAuthority", + sizeof("certificateAuthority") - 1, + "", + bdlat_FormattingMode::e_TEXT}, + {ATTRIBUTE_ID_CERTIFICATE, + "certificate", + sizeof("certificate") - 1, + "", + bdlat_FormattingMode::e_TEXT}, + {ATTRIBUTE_ID_KEY, + "key", + sizeof("key") - 1, + "", + bdlat_FormattingMode::e_TEXT}}; + +// CLASS METHODS + +const bdlat_AttributeInfo* TlsConfig::lookupAttributeInfo(const char* name, + int nameLength) +{ + for (int i = 0; i < 3; ++i) { + const bdlat_AttributeInfo& attributeInfo = + TlsConfig::ATTRIBUTE_INFO_ARRAY[i]; + + if (nameLength == attributeInfo.d_nameLength && + 0 == bsl::memcmp(attributeInfo.d_name_p, name, nameLength)) { + return &attributeInfo; + } + } + + return 0; +} + +const bdlat_AttributeInfo* TlsConfig::lookupAttributeInfo(int id) +{ + switch (id) { + case ATTRIBUTE_ID_CERTIFICATE_AUTHORITY: + return &ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_CERTIFICATE_AUTHORITY]; + case ATTRIBUTE_ID_CERTIFICATE: + return &ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_CERTIFICATE]; + case ATTRIBUTE_ID_KEY: return &ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_KEY]; + default: return 0; + } +} + +// CREATORS + +TlsConfig::TlsConfig(bslma::Allocator* basicAllocator) +: d_certificateAuthority(basicAllocator) +, d_certificate(basicAllocator) +, d_key(basicAllocator) +{ +} + +TlsConfig::TlsConfig(const TlsConfig& original, + bslma::Allocator* basicAllocator) +: d_certificateAuthority(original.d_certificateAuthority, basicAllocator) +, d_certificate(original.d_certificate, basicAllocator) +, d_key(original.d_key, basicAllocator) +{ +} + +#if defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES) && \ + defined(BSLS_COMPILERFEATURES_SUPPORT_NOEXCEPT) +TlsConfig::TlsConfig(TlsConfig&& original) noexcept +: d_certificateAuthority(bsl::move(original.d_certificateAuthority)), + d_certificate(bsl::move(original.d_certificate)), + d_key(bsl::move(original.d_key)) +{ +} + +TlsConfig::TlsConfig(TlsConfig&& original, bslma::Allocator* basicAllocator) +: d_certificateAuthority(bsl::move(original.d_certificateAuthority), + basicAllocator) +, d_certificate(bsl::move(original.d_certificate), basicAllocator) +, d_key(bsl::move(original.d_key), basicAllocator) +{ +} +#endif + +TlsConfig::~TlsConfig() +{ +} + +// MANIPULATORS + +TlsConfig& TlsConfig::operator=(const TlsConfig& rhs) +{ + if (this != &rhs) { + d_certificateAuthority = rhs.d_certificateAuthority; + d_certificate = rhs.d_certificate; + d_key = rhs.d_key; + } + + return *this; +} + +#if defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES) && \ + defined(BSLS_COMPILERFEATURES_SUPPORT_NOEXCEPT) +TlsConfig& TlsConfig::operator=(TlsConfig&& rhs) +{ + if (this != &rhs) { + d_certificateAuthority = bsl::move(rhs.d_certificateAuthority); + d_certificate = bsl::move(rhs.d_certificate); + d_key = bsl::move(rhs.d_key); + } + + return *this; +} +#endif + +void TlsConfig::reset() +{ + bdlat_ValueTypeFunctions::reset(&d_certificateAuthority); + bdlat_ValueTypeFunctions::reset(&d_certificate); + bdlat_ValueTypeFunctions::reset(&d_key); +} + +// ACCESSORS + +bsl::ostream& +TlsConfig::print(bsl::ostream& stream, int level, int spacesPerLevel) const +{ + bslim::Printer printer(&stream, level, spacesPerLevel); + printer.start(); + printer.printAttribute("certificateAuthority", + this->certificateAuthority()); + printer.printAttribute("certificate", this->certificate()); + printer.printAttribute("key", this->key()); printer.end(); return stream; } @@ -5754,14 +5913,19 @@ const bdlat_AttributeInfo AppConfig::ATTRIBUTE_INFO_ARRAY[] = { "configureStream", sizeof("configureStream") - 1, "", - bdlat_FormattingMode::e_TEXT}}; + bdlat_FormattingMode::e_TEXT}, + {ATTRIBUTE_ID_TLS, + "tls", + sizeof("tls") - 1, + "", + bdlat_FormattingMode::e_DEFAULT}}; // CLASS METHODS const bdlat_AttributeInfo* AppConfig::lookupAttributeInfo(const char* name, int nameLength) { - for (int i = 0; i < 17; ++i) { + for (int i = 0; i < 18; ++i) { const bdlat_AttributeInfo& attributeInfo = AppConfig::ATTRIBUTE_INFO_ARRAY[i]; @@ -5811,6 +5975,7 @@ const bdlat_AttributeInfo* AppConfig::lookupAttributeInfo(int id) return &ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_MESSAGE_PROPERTIES_V2]; case ATTRIBUTE_ID_CONFIGURE_STREAM: return &ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_CONFIGURE_STREAM]; + case ATTRIBUTE_ID_TLS: return &ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_TLS]; default: return 0; } } @@ -5825,6 +5990,7 @@ AppConfig::AppConfig(bslma::Allocator* basicAllocator) , d_hostDataCenter(basicAllocator) , d_latencyMonitorDomain(DEFAULT_INITIALIZER_LATENCY_MONITOR_DOMAIN, basicAllocator) +, d_tls(basicAllocator) , d_stats(basicAllocator) , d_plugins(basicAllocator) , d_networkInterfaces(basicAllocator) @@ -5847,6 +6013,7 @@ AppConfig::AppConfig(const AppConfig& original, , d_hostTags(original.d_hostTags, basicAllocator) , d_hostDataCenter(original.d_hostDataCenter, basicAllocator) , d_latencyMonitorDomain(original.d_latencyMonitorDomain, basicAllocator) +, d_tls(original.d_tls, basicAllocator) , d_stats(original.d_stats, basicAllocator) , d_plugins(original.d_plugins, basicAllocator) , d_networkInterfaces(original.d_networkInterfaces, basicAllocator) @@ -5870,6 +6037,7 @@ AppConfig::AppConfig(AppConfig&& original) noexcept d_hostTags(bsl::move(original.d_hostTags)), d_hostDataCenter(bsl::move(original.d_hostDataCenter)), d_latencyMonitorDomain(bsl::move(original.d_latencyMonitorDomain)), + d_tls(bsl::move(original.d_tls)), d_stats(bsl::move(original.d_stats)), d_plugins(bsl::move(original.d_plugins)), d_networkInterfaces(bsl::move(original.d_networkInterfaces)), @@ -5893,6 +6061,7 @@ AppConfig::AppConfig(AppConfig&& original, bslma::Allocator* basicAllocator) , d_hostDataCenter(bsl::move(original.d_hostDataCenter), basicAllocator) , d_latencyMonitorDomain(bsl::move(original.d_latencyMonitorDomain), basicAllocator) +, d_tls(bsl::move(original.d_tls), basicAllocator) , d_stats(bsl::move(original.d_stats), basicAllocator) , d_plugins(bsl::move(original.d_plugins), basicAllocator) , d_networkInterfaces(bsl::move(original.d_networkInterfaces), basicAllocator) @@ -5934,6 +6103,7 @@ AppConfig& AppConfig::operator=(const AppConfig& rhs) d_plugins = rhs.d_plugins; d_messagePropertiesV2 = rhs.d_messagePropertiesV2; d_configureStream = rhs.d_configureStream; + d_tls = rhs.d_tls; } return *this; @@ -5961,6 +6131,7 @@ AppConfig& AppConfig::operator=(AppConfig&& rhs) d_plugins = bsl::move(rhs.d_plugins); d_messagePropertiesV2 = bsl::move(rhs.d_messagePropertiesV2); d_configureStream = bsl::move(rhs.d_configureStream); + d_tls = bsl::move(rhs.d_tls); } return *this; @@ -5986,6 +6157,7 @@ void AppConfig::reset() bdlat_ValueTypeFunctions::reset(&d_plugins); bdlat_ValueTypeFunctions::reset(&d_messagePropertiesV2); d_configureStream = DEFAULT_INITIALIZER_CONFIGURE_STREAM; + bdlat_ValueTypeFunctions::reset(&d_tls); } // ACCESSORS @@ -6013,6 +6185,7 @@ AppConfig::print(bsl::ostream& stream, int level, int spacesPerLevel) const printer.printAttribute("plugins", this->plugins()); printer.printAttribute("messagePropertiesV2", this->messagePropertiesV2()); printer.printAttribute("configureStream", this->configureStream()); + printer.printAttribute("tls", this->tls()); printer.end(); return stream; } @@ -6330,13 +6503,6 @@ Configuration::print(bsl::ostream& stream, int level, int spacesPerLevel) const } // close package namespace } // close enterprise namespace -// GENERATED BY BLP_BAS_CODEGEN_2023.10.07 +// GENERATED BY BLP_BAS_CODEGEN_2023.11.25 // USING bas_codegen.pl -m msg --noAggregateConversion --noExternalization // --noIdent --package mqbcfg --msgComponent messages mqbcfg.xsd -// ---------------------------------------------------------------------------- -// NOTICE: -// Copyright 2023 Bloomberg Finance L.P. All rights reserved. -// Property of Bloomberg Finance L.P. (BFLP) -// This software is made available solely pursuant to the -// terms of a BFLP license agreement which governs its use. -// ------------------------------- END-OF-FILE -------------------------------- diff --git a/src/groups/mqb/mqbcfg/mqbcfg_messages.h b/src/groups/mqb/mqbcfg/mqbcfg_messages.h index 15e81234e2..96c59cf363 100644 --- a/src/groups/mqb/mqbcfg/mqbcfg_messages.h +++ b/src/groups/mqb/mqbcfg/mqbcfg_messages.h @@ -105,6 +105,9 @@ namespace mqbcfg { class TcpInterfaceConfig; } namespace mqbcfg { +class TlsConfig; +} +namespace mqbcfg { class VirtualClusterInformation; } namespace mqbcfg { @@ -4059,7 +4062,8 @@ class TcpInterfaceConfig { // heartbeatIntervalMs..: How often (in milliseconds) to check if the // channel received data, and emit heartbeat. 0 to globally disable. // useNtf...............: Use the new NTF based TCP transport library - // instead of the existing one based on BTE + // instead of the existing one based on BTE tls.................: Use TLS + // on this interface. // INSTANCE DATA bsls::Types::Int64 d_lowWatermark; @@ -4072,6 +4076,7 @@ class TcpInterfaceConfig { int d_maxConnections; int d_heartbeatIntervalMs; bool d_useNtf; + bool d_tls; public: // TYPES @@ -4085,10 +4090,11 @@ class TcpInterfaceConfig { ATTRIBUTE_ID_NODE_LOW_WATERMARK = 6, ATTRIBUTE_ID_NODE_HIGH_WATERMARK = 7, ATTRIBUTE_ID_HEARTBEAT_INTERVAL_MS = 8, - ATTRIBUTE_ID_USE_NTF = 9 + ATTRIBUTE_ID_USE_NTF = 9, + ATTRIBUTE_ID_TLS = 10 }; - enum { NUM_ATTRIBUTES = 10 }; + enum { NUM_ATTRIBUTES = 11 }; enum { ATTRIBUTE_INDEX_NAME = 0, @@ -4100,7 +4106,8 @@ class TcpInterfaceConfig { ATTRIBUTE_INDEX_NODE_LOW_WATERMARK = 6, ATTRIBUTE_INDEX_NODE_HIGH_WATERMARK = 7, ATTRIBUTE_INDEX_HEARTBEAT_INTERVAL_MS = 8, - ATTRIBUTE_INDEX_USE_NTF = 9 + ATTRIBUTE_INDEX_USE_NTF = 9, + ATTRIBUTE_INDEX_TLS = 10 }; // CONSTANTS @@ -4116,6 +4123,8 @@ class TcpInterfaceConfig { static const bool DEFAULT_INITIALIZER_USE_NTF; + static const bool DEFAULT_INITIALIZER_TLS; + static const bdlat_AttributeInfo ATTRIBUTE_INFO_ARRAY[]; public: @@ -4249,6 +4258,9 @@ class TcpInterfaceConfig { // Return a reference to the modifiable "UseNtf" attribute of this // object. + bool& tls(); + // Return a reference to the modifiable "Tls" attribute of this object. + // ACCESSORS bsl::ostream& print(bsl::ostream& stream, int level = 0, int spacesPerLevel = 4) const; @@ -4324,6 +4336,9 @@ class TcpInterfaceConfig { bool useNtf() const; // Return the value of the "UseNtf" attribute of this object. + + bool tls() const; + // Return the value of the "Tls" attribute of this object. }; // FREE OPERATORS @@ -4360,6 +4375,230 @@ BDLAT_DECL_SEQUENCE_WITH_ALLOCATOR_BITWISEMOVEABLE_TRAITS( namespace mqbcfg { +// =============== +// class TlsConfig +// =============== + +class TlsConfig { + // certificateAuthority.: A path to the FILE, containing concatenation of + // known certificates the server can use to reference as its certificate + // store. certificate..........: A path to the FILE, containing the + // certificate the broker will use to identify itself to other clients. + // key..................: A path to the FILE, containing the private key + // that the broker uses to read the certificate. + + // INSTANCE DATA + bsl::string d_certificateAuthority; + bsl::string d_certificate; + bsl::string d_key; + + public: + // TYPES + enum { + ATTRIBUTE_ID_CERTIFICATE_AUTHORITY = 0, + ATTRIBUTE_ID_CERTIFICATE = 1, + ATTRIBUTE_ID_KEY = 2 + }; + + enum { NUM_ATTRIBUTES = 3 }; + + enum { + ATTRIBUTE_INDEX_CERTIFICATE_AUTHORITY = 0, + ATTRIBUTE_INDEX_CERTIFICATE = 1, + ATTRIBUTE_INDEX_KEY = 2 + }; + + // CONSTANTS + static const char CLASS_NAME[]; + + static const bdlat_AttributeInfo ATTRIBUTE_INFO_ARRAY[]; + + public: + // CLASS METHODS + static const bdlat_AttributeInfo* lookupAttributeInfo(int id); + // Return attribute information for the attribute indicated by the + // specified 'id' if the attribute exists, and 0 otherwise. + + static const bdlat_AttributeInfo* lookupAttributeInfo(const char* name, + int nameLength); + // Return attribute information for the attribute indicated by the + // specified 'name' of the specified 'nameLength' if the attribute + // exists, and 0 otherwise. + + // CREATORS + explicit TlsConfig(bslma::Allocator* basicAllocator = 0); + // Create an object of type 'TlsConfig' having the default value. Use + // the optionally specified 'basicAllocator' to supply memory. If + // 'basicAllocator' is 0, the currently installed default allocator is + // used. + + TlsConfig(const TlsConfig& original, bslma::Allocator* basicAllocator = 0); + // Create an object of type 'TlsConfig' having the value of the + // specified 'original' object. Use the optionally specified + // 'basicAllocator' to supply memory. If 'basicAllocator' is 0, the + // currently installed default allocator is used. + +#if defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES) && \ + defined(BSLS_COMPILERFEATURES_SUPPORT_NOEXCEPT) + TlsConfig(TlsConfig&& original) noexcept; + // Create an object of type 'TlsConfig' having the value of the + // specified 'original' object. After performing this action, the + // 'original' object will be left in a valid, but unspecified state. + + TlsConfig(TlsConfig&& original, bslma::Allocator* basicAllocator); + // Create an object of type 'TlsConfig' having the value of the + // specified 'original' object. After performing this action, the + // 'original' object will be left in a valid, but unspecified state. + // Use the optionally specified 'basicAllocator' to supply memory. If + // 'basicAllocator' is 0, the currently installed default allocator is + // used. +#endif + + ~TlsConfig(); + // Destroy this object. + + // MANIPULATORS + TlsConfig& operator=(const TlsConfig& rhs); + // Assign to this object the value of the specified 'rhs' object. + +#if defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES) && \ + defined(BSLS_COMPILERFEATURES_SUPPORT_NOEXCEPT) + TlsConfig& operator=(TlsConfig&& rhs); + // Assign to this object the value of the specified 'rhs' object. + // After performing this action, the 'rhs' object will be left in a + // valid, but unspecified state. +#endif + + void reset(); + // Reset this object to the default value (i.e., its value upon + // default construction). + + template + int manipulateAttributes(t_MANIPULATOR& manipulator); + // Invoke the specified 'manipulator' sequentially on the address of + // each (modifiable) attribute of this object, supplying 'manipulator' + // with the corresponding attribute information structure until such + // invocation returns a non-zero value. Return the value from the + // last invocation of 'manipulator' (i.e., the invocation that + // terminated the sequence). + + template + int manipulateAttribute(t_MANIPULATOR& manipulator, int id); + // Invoke the specified 'manipulator' on the address of + // the (modifiable) attribute indicated by the specified 'id', + // supplying 'manipulator' with the corresponding attribute + // information structure. Return the value returned from the + // invocation of 'manipulator' if 'id' identifies an attribute of this + // class, and -1 otherwise. + + template + int manipulateAttribute(t_MANIPULATOR& manipulator, + const char* name, + int nameLength); + // Invoke the specified 'manipulator' on the address of + // the (modifiable) attribute indicated by the specified 'name' of the + // specified 'nameLength', supplying 'manipulator' with the + // corresponding attribute information structure. Return the value + // returned from the invocation of 'manipulator' if 'name' identifies + // an attribute of this class, and -1 otherwise. + + bsl::string& certificateAuthority(); + // Return a reference to the modifiable "CertificateAuthority" + // attribute of this object. + + bsl::string& certificate(); + // Return a reference to the modifiable "Certificate" attribute of this + // object. + + bsl::string& key(); + // Return a reference to the modifiable "Key" attribute of this object. + + // ACCESSORS + bsl::ostream& + print(bsl::ostream& stream, int level = 0, int spacesPerLevel = 4) const; + // Format this object to the specified output 'stream' at the + // optionally specified indentation 'level' and return a reference to + // the modifiable 'stream'. If 'level' is specified, optionally + // specify 'spacesPerLevel', the number of spaces per indentation level + // for this and all of its nested objects. Each line is indented by + // the absolute value of 'level * spacesPerLevel'. If 'level' is + // negative, suppress indentation of the first line. If + // 'spacesPerLevel' is negative, suppress line breaks and format the + // entire output on one line. If 'stream' is initially invalid, this + // operation has no effect. Note that a trailing newline is provided + // in multiline mode only. + + template + int accessAttributes(t_ACCESSOR& accessor) const; + // Invoke the specified 'accessor' sequentially on each + // (non-modifiable) attribute of this object, supplying 'accessor' + // with the corresponding attribute information structure until such + // invocation returns a non-zero value. Return the value from the + // last invocation of 'accessor' (i.e., the invocation that terminated + // the sequence). + + template + int accessAttribute(t_ACCESSOR& accessor, int id) const; + // Invoke the specified 'accessor' on the (non-modifiable) attribute + // of this object indicated by the specified 'id', supplying 'accessor' + // with the corresponding attribute information structure. Return the + // value returned from the invocation of 'accessor' if 'id' identifies + // an attribute of this class, and -1 otherwise. + + template + int accessAttribute(t_ACCESSOR& accessor, + const char* name, + int nameLength) const; + // Invoke the specified 'accessor' on the (non-modifiable) attribute + // of this object indicated by the specified 'name' of the specified + // 'nameLength', supplying 'accessor' with the corresponding attribute + // information structure. Return the value returned from the + // invocation of 'accessor' if 'name' identifies an attribute of this + // class, and -1 otherwise. + + const bsl::string& certificateAuthority() const; + // Return a reference offering non-modifiable access to the + // "CertificateAuthority" attribute of this object. + + const bsl::string& certificate() const; + // Return a reference offering non-modifiable access to the + // "Certificate" attribute of this object. + + const bsl::string& key() const; + // Return a reference offering non-modifiable access to the "Key" + // attribute of this object. +}; + +// FREE OPERATORS +inline bool operator==(const TlsConfig& lhs, const TlsConfig& rhs); +// Return 'true' if the specified 'lhs' and 'rhs' attribute objects have +// the same value, and 'false' otherwise. Two attribute objects have the +// same value if each respective attribute has the same value. + +inline bool operator!=(const TlsConfig& lhs, const TlsConfig& rhs); +// Return 'true' if the specified 'lhs' and 'rhs' attribute objects do not +// have the same value, and 'false' otherwise. Two attribute objects do +// not have the same value if one or more respective attributes differ in +// values. + +inline bsl::ostream& operator<<(bsl::ostream& stream, const TlsConfig& rhs); +// Format the specified 'rhs' to the specified output 'stream' and +// return a reference to the modifiable 'stream'. + +template +void hashAppend(t_HASH_ALGORITHM& hashAlg, const TlsConfig& object); +// Pass the specified 'object' to the specified 'hashAlg'. This function +// integrates with the 'bslh' modular hashing system and effectively +// provides a 'bsl::hash' specialization for 'TlsConfig'. + +} // close package namespace + +// TRAITS + +BDLAT_DECL_SEQUENCE_WITH_ALLOCATOR_BITWISEMOVEABLE_TRAITS(mqbcfg::TlsConfig) + +namespace mqbcfg { + // =============================== // class VirtualClusterInformation // =============================== @@ -8010,26 +8249,27 @@ class AppConfig { // configuration for the plugins msgPropertiesSupport.: information about // if/how to advertise support for v2 message properties // configureStream......: send new ConfigureStream instead of old - // ConfigureQueue/> + // ConfigureQueue tls..................: optional configuation for TLS // INSTANCE DATA - bsl::string d_brokerInstanceName; - bsl::string d_etcDir; - bsl::string d_hostName; - bsl::string d_hostTags; - bsl::string d_hostDataCenter; - bsl::string d_latencyMonitorDomain; - StatsConfig d_stats; - Plugins d_plugins; - NetworkInterfaces d_networkInterfaces; - MessagePropertiesV2 d_messagePropertiesV2; - DispatcherConfig d_dispatcherConfig; - BmqconfConfig d_bmqconfConfig; - int d_brokerVersion; - int d_configVersion; - int d_logsObserverMaxSize; - bool d_isRunningOnDev; - bool d_configureStream; + bsl::string d_brokerInstanceName; + bsl::string d_etcDir; + bsl::string d_hostName; + bsl::string d_hostTags; + bsl::string d_hostDataCenter; + bsl::string d_latencyMonitorDomain; + bdlb::NullableValue d_tls; + StatsConfig d_stats; + Plugins d_plugins; + NetworkInterfaces d_networkInterfaces; + MessagePropertiesV2 d_messagePropertiesV2; + DispatcherConfig d_dispatcherConfig; + BmqconfConfig d_bmqconfConfig; + int d_brokerVersion; + int d_configVersion; + int d_logsObserverMaxSize; + bool d_isRunningOnDev; + bool d_configureStream; public: // TYPES @@ -8050,10 +8290,11 @@ class AppConfig { ATTRIBUTE_ID_BMQCONF_CONFIG = 13, ATTRIBUTE_ID_PLUGINS = 14, ATTRIBUTE_ID_MESSAGE_PROPERTIES_V2 = 15, - ATTRIBUTE_ID_CONFIGURE_STREAM = 16 + ATTRIBUTE_ID_CONFIGURE_STREAM = 16, + ATTRIBUTE_ID_TLS = 17 }; - enum { NUM_ATTRIBUTES = 17 }; + enum { NUM_ATTRIBUTES = 18 }; enum { ATTRIBUTE_INDEX_BROKER_INSTANCE_NAME = 0, @@ -8072,7 +8313,8 @@ class AppConfig { ATTRIBUTE_INDEX_BMQCONF_CONFIG = 13, ATTRIBUTE_INDEX_PLUGINS = 14, ATTRIBUTE_INDEX_MESSAGE_PROPERTIES_V2 = 15, - ATTRIBUTE_INDEX_CONFIGURE_STREAM = 16 + ATTRIBUTE_INDEX_CONFIGURE_STREAM = 16, + ATTRIBUTE_INDEX_TLS = 17 }; // CONSTANTS @@ -8241,6 +8483,9 @@ class AppConfig { // Return a reference to the modifiable "ConfigureStream" attribute of // this object. + bdlb::NullableValue& tls(); + // Return a reference to the modifiable "Tls" attribute of this object. + // ACCESSORS bsl::ostream& print(bsl::ostream& stream, int level = 0, int spacesPerLevel = 4) const; @@ -8347,6 +8592,10 @@ class AppConfig { bool configureStream() const; // Return the value of the "ConfigureStream" attribute of this object. + + const bdlb::NullableValue& tls() const; + // Return a reference offering non-modifiable access to the "Tls" + // attribute of this object. }; // FREE OPERATORS @@ -8840,9 +9089,9 @@ void hashAppend(t_HASH_ALGORITHM& hashAlg, const Configuration& object); BDLAT_DECL_SEQUENCE_WITH_ALLOCATOR_BITWISEMOVEABLE_TRAITS( mqbcfg::Configuration) -// ============================================================================ -// INLINE FUNCTION DEFINITIONS -// ============================================================================ +//============================================================================= +// INLINE DEFINITIONS +//============================================================================= namespace mqbcfg { @@ -12321,6 +12570,11 @@ int TcpInterfaceConfig::manipulateAttributes(t_MANIPULATOR& manipulator) return ret; } + ret = manipulator(&d_tls, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_TLS]); + if (ret) { + return ret; + } + return 0; } @@ -12376,6 +12630,9 @@ int TcpInterfaceConfig::manipulateAttribute(t_MANIPULATOR& manipulator, int id) return manipulator(&d_useNtf, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_USE_NTF]); } + case ATTRIBUTE_ID_TLS: { + return manipulator(&d_tls, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_TLS]); + } default: return NOT_FOUND; } } @@ -12446,6 +12703,11 @@ inline bool& TcpInterfaceConfig::useNtf() return d_useNtf; } +inline bool& TcpInterfaceConfig::tls() +{ + return d_tls; +} + // ACCESSORS template int TcpInterfaceConfig::accessAttributes(t_ACCESSOR& accessor) const @@ -12510,6 +12772,11 @@ int TcpInterfaceConfig::accessAttributes(t_ACCESSOR& accessor) const return ret; } + ret = accessor(d_tls, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_TLS]); + if (ret) { + return ret; + } + return 0; } @@ -12560,6 +12827,9 @@ int TcpInterfaceConfig::accessAttribute(t_ACCESSOR& accessor, int id) const return accessor(d_useNtf, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_USE_NTF]); } + case ATTRIBUTE_ID_TLS: { + return accessor(d_tls, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_TLS]); + } default: return NOT_FOUND; } } @@ -12630,6 +12900,176 @@ inline bool TcpInterfaceConfig::useNtf() const return d_useNtf; } +inline bool TcpInterfaceConfig::tls() const +{ + return d_tls; +} + +// --------------- +// class TlsConfig +// --------------- + +// CLASS METHODS +// MANIPULATORS +template +int TlsConfig::manipulateAttributes(t_MANIPULATOR& manipulator) +{ + int ret; + + ret = manipulator( + &d_certificateAuthority, + ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_CERTIFICATE_AUTHORITY]); + if (ret) { + return ret; + } + + ret = manipulator(&d_certificate, + ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_CERTIFICATE]); + if (ret) { + return ret; + } + + ret = manipulator(&d_key, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_KEY]); + if (ret) { + return ret; + } + + return 0; +} + +template +int TlsConfig::manipulateAttribute(t_MANIPULATOR& manipulator, int id) +{ + enum { NOT_FOUND = -1 }; + + switch (id) { + case ATTRIBUTE_ID_CERTIFICATE_AUTHORITY: { + return manipulator( + &d_certificateAuthority, + ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_CERTIFICATE_AUTHORITY]); + } + case ATTRIBUTE_ID_CERTIFICATE: { + return manipulator(&d_certificate, + ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_CERTIFICATE]); + } + case ATTRIBUTE_ID_KEY: { + return manipulator(&d_key, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_KEY]); + } + default: return NOT_FOUND; + } +} + +template +int TlsConfig::manipulateAttribute(t_MANIPULATOR& manipulator, + const char* name, + int nameLength) +{ + enum { NOT_FOUND = -1 }; + + const bdlat_AttributeInfo* attributeInfo = lookupAttributeInfo(name, + nameLength); + if (0 == attributeInfo) { + return NOT_FOUND; + } + + return manipulateAttribute(manipulator, attributeInfo->d_id); +} + +inline bsl::string& TlsConfig::certificateAuthority() +{ + return d_certificateAuthority; +} + +inline bsl::string& TlsConfig::certificate() +{ + return d_certificate; +} + +inline bsl::string& TlsConfig::key() +{ + return d_key; +} + +// ACCESSORS +template +int TlsConfig::accessAttributes(t_ACCESSOR& accessor) const +{ + int ret; + + ret = accessor( + d_certificateAuthority, + ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_CERTIFICATE_AUTHORITY]); + if (ret) { + return ret; + } + + ret = accessor(d_certificate, + ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_CERTIFICATE]); + if (ret) { + return ret; + } + + ret = accessor(d_key, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_KEY]); + if (ret) { + return ret; + } + + return 0; +} + +template +int TlsConfig::accessAttribute(t_ACCESSOR& accessor, int id) const +{ + enum { NOT_FOUND = -1 }; + + switch (id) { + case ATTRIBUTE_ID_CERTIFICATE_AUTHORITY: { + return accessor( + d_certificateAuthority, + ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_CERTIFICATE_AUTHORITY]); + } + case ATTRIBUTE_ID_CERTIFICATE: { + return accessor(d_certificate, + ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_CERTIFICATE]); + } + case ATTRIBUTE_ID_KEY: { + return accessor(d_key, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_KEY]); + } + default: return NOT_FOUND; + } +} + +template +int TlsConfig::accessAttribute(t_ACCESSOR& accessor, + const char* name, + int nameLength) const +{ + enum { NOT_FOUND = -1 }; + + const bdlat_AttributeInfo* attributeInfo = lookupAttributeInfo(name, + nameLength); + if (0 == attributeInfo) { + return NOT_FOUND; + } + + return accessAttribute(accessor, attributeInfo->d_id); +} + +inline const bsl::string& TlsConfig::certificateAuthority() const +{ + return d_certificateAuthority; +} + +inline const bsl::string& TlsConfig::certificate() const +{ + return d_certificate; +} + +inline const bsl::string& TlsConfig::key() const +{ + return d_key; +} + // ------------------------------- // class VirtualClusterInformation // ------------------------------- @@ -15968,6 +16408,11 @@ int AppConfig::manipulateAttributes(t_MANIPULATOR& manipulator) return ret; } + ret = manipulator(&d_tls, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_TLS]); + if (ret) { + return ret; + } + return 0; } @@ -16057,6 +16502,9 @@ int AppConfig::manipulateAttribute(t_MANIPULATOR& manipulator, int id) &d_configureStream, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_CONFIGURE_STREAM]); } + case ATTRIBUTE_ID_TLS: { + return manipulator(&d_tls, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_TLS]); + } default: return NOT_FOUND; } } @@ -16162,6 +16610,11 @@ inline bool& AppConfig::configureStream() return d_configureStream; } +inline bdlb::NullableValue& AppConfig::tls() +{ + return d_tls; +} + // ACCESSORS template int AppConfig::accessAttributes(t_ACCESSOR& accessor) const @@ -16270,6 +16723,11 @@ int AppConfig::accessAttributes(t_ACCESSOR& accessor) const return ret; } + ret = accessor(d_tls, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_TLS]); + if (ret) { + return ret; + } + return 0; } @@ -16355,6 +16813,9 @@ int AppConfig::accessAttribute(t_ACCESSOR& accessor, int id) const d_configureStream, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_CONFIGURE_STREAM]); } + case ATTRIBUTE_ID_TLS: { + return accessor(d_tls, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_TLS]); + } default: return NOT_FOUND; } } @@ -16460,6 +16921,11 @@ inline bool AppConfig::configureStream() const return d_configureStream; } +inline const bdlb::NullableValue& AppConfig::tls() const +{ + return d_tls; +} + // ------------------------ // class ClustersDefinition // ------------------------ @@ -17380,7 +17846,7 @@ inline bool mqbcfg::operator==(const mqbcfg::TcpInterfaceConfig& lhs, lhs.nodeLowWatermark() == rhs.nodeLowWatermark() && lhs.nodeHighWatermark() == rhs.nodeHighWatermark() && lhs.heartbeatIntervalMs() == rhs.heartbeatIntervalMs() && - lhs.useNtf() == rhs.useNtf(); + lhs.useNtf() == rhs.useNtf() && lhs.tls() == rhs.tls(); } inline bool mqbcfg::operator!=(const mqbcfg::TcpInterfaceConfig& lhs, @@ -17410,6 +17876,36 @@ void mqbcfg::hashAppend(t_HASH_ALGORITHM& hashAlg, hashAppend(hashAlg, object.nodeHighWatermark()); hashAppend(hashAlg, object.heartbeatIntervalMs()); hashAppend(hashAlg, object.useNtf()); + hashAppend(hashAlg, object.tls()); +} + +inline bool mqbcfg::operator==(const mqbcfg::TlsConfig& lhs, + const mqbcfg::TlsConfig& rhs) +{ + return lhs.certificateAuthority() == rhs.certificateAuthority() && + lhs.certificate() == rhs.certificate() && lhs.key() == rhs.key(); +} + +inline bool mqbcfg::operator!=(const mqbcfg::TlsConfig& lhs, + const mqbcfg::TlsConfig& rhs) +{ + return !(lhs == rhs); +} + +inline bsl::ostream& mqbcfg::operator<<(bsl::ostream& stream, + const mqbcfg::TlsConfig& rhs) +{ + return rhs.print(stream, 0, -1); +} + +template +void mqbcfg::hashAppend(t_HASH_ALGORITHM& hashAlg, + const mqbcfg::TlsConfig& object) +{ + using bslh::hashAppend; + hashAppend(hashAlg, object.certificateAuthority()); + hashAppend(hashAlg, object.certificate()); + hashAppend(hashAlg, object.key()); } inline bool mqbcfg::operator==(const mqbcfg::VirtualClusterInformation& lhs, @@ -17942,7 +18438,8 @@ inline bool mqbcfg::operator==(const mqbcfg::AppConfig& lhs, lhs.bmqconfConfig() == rhs.bmqconfConfig() && lhs.plugins() == rhs.plugins() && lhs.messagePropertiesV2() == rhs.messagePropertiesV2() && - lhs.configureStream() == rhs.configureStream(); + lhs.configureStream() == rhs.configureStream() && + lhs.tls() == rhs.tls(); } inline bool mqbcfg::operator!=(const mqbcfg::AppConfig& lhs, @@ -17979,6 +18476,7 @@ void mqbcfg::hashAppend(t_HASH_ALGORITHM& hashAlg, hashAppend(hashAlg, object.plugins()); hashAppend(hashAlg, object.messagePropertiesV2()); hashAppend(hashAlg, object.configureStream()); + hashAppend(hashAlg, object.tls()); } inline bool mqbcfg::operator==(const mqbcfg::ClustersDefinition& lhs, @@ -18047,13 +18545,6 @@ void mqbcfg::hashAppend(t_HASH_ALGORITHM& hashAlg, } // close enterprise namespace #endif -// GENERATED BY BLP_BAS_CODEGEN_2023.10.07 +// GENERATED BY BLP_BAS_CODEGEN_2023.11.25 // USING bas_codegen.pl -m msg --noAggregateConversion --noExternalization // --noIdent --package mqbcfg --msgComponent messages mqbcfg.xsd -// ---------------------------------------------------------------------------- -// NOTICE: -// Copyright 2023 Bloomberg Finance L.P. All rights reserved. -// Property of Bloomberg Finance L.P. (BFLP) -// This software is made available solely pursuant to the -// terms of a BFLP license agreement which governs its use. -// ------------------------------- END-OF-FILE --------------------------------