From commits-return-44821-archive-asf-public=cust-asf.ponee.io@nifi.apache.org Wed Jun 23 16:57:08 2021 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mxout1-ec2-va.apache.org (mxout1-ec2-va.apache.org [3.227.148.255]) by mx-eu-01.ponee.io (Postfix) with ESMTPS id 0DFD5180674 for ; Wed, 23 Jun 2021 18:57:08 +0200 (CEST) Received: from mail.apache.org (mailroute1-lw-us.apache.org [207.244.88.153]) by mxout1-ec2-va.apache.org (ASF Mail Server at mxout1-ec2-va.apache.org) with SMTP id A96AE4325C for ; Wed, 23 Jun 2021 16:56:00 +0000 (UTC) Received: (qmail 29919 invoked by uid 500); 23 Jun 2021 16:55:50 -0000 Mailing-List: contact commits-help@nifi.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@nifi.apache.org Delivered-To: mailing list commits@nifi.apache.org Received: (qmail 29730 invoked by uid 99); 23 Jun 2021 16:55:49 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 23 Jun 2021 16:55:49 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id 63340821E0; Wed, 23 Jun 2021 16:55:49 +0000 (UTC) Date: Wed, 23 Jun 2021 16:55:52 +0000 To: "commits@nifi.apache.org" Subject: [nifi-minifi-cpp] 04/06: MINIFICPP-1567 enable linter checks in extensions (part 3) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit From: szaszm@apache.org In-Reply-To: <162446734879.17647.16161136135857412236@gitbox.apache.org> References: <162446734879.17647.16161136135857412236@gitbox.apache.org> X-Git-Host: gitbox.apache.org X-Git-Repo: nifi-minifi-cpp X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Rev: 89f1713f7440a71bd2e4804e1b27b7f6291f6c62 X-Git-NotificationType: diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated Message-Id: <20210623165549.63340821E0@gitbox.apache.org> This is an automated email from the ASF dual-hosted git repository. szaszm pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/nifi-minifi-cpp.git commit 89f1713f7440a71bd2e4804e1b27b7f6291f6c62 Author: Martin Zink AuthorDate: Wed Jun 23 18:16:37 2021 +0200 MINIFICPP-1567 enable linter checks in extensions (part 3) extensions: libarchive, mqtt, opc, opencv, openwsman, pcap Closes #1103 Signed-off-by: Marton Szasz Co-authored-by: Ferenc Gerlits --- extensions/libarchive/ArchiveLoader.h | 8 +- extensions/libarchive/ArchiveMetadata.cpp | 215 ++++++++++----------- extensions/libarchive/ArchiveMetadata.h | 100 +++++----- extensions/libarchive/ArchiveTests.h | 7 +- extensions/libarchive/BinFiles.cpp | 3 +- extensions/libarchive/BinFiles.h | 14 +- extensions/libarchive/CMakeLists.txt | 4 +- extensions/libarchive/CompressContent.cpp | 3 - extensions/libarchive/CompressContent.h | 23 +-- extensions/libarchive/FocusArchiveEntry.cpp | 6 +- extensions/libarchive/FocusArchiveEntry.h | 8 +- extensions/libarchive/ManipulateArchive.cpp | 11 +- extensions/libarchive/ManipulateArchive.h | 17 +- extensions/libarchive/MergeContent.cpp | 9 +- extensions/libarchive/MergeContent.h | 13 +- extensions/libarchive/UnfocusArchiveEntry.cpp | 6 +- extensions/libarchive/UnfocusArchiveEntry.h | 7 +- extensions/mqtt/CMakeLists.txt | 4 +- extensions/mqtt/MQTTLoader.h | 8 +- .../controllerservice/MQTTControllerService.cpp | 2 +- .../mqtt/controllerservice/MQTTControllerService.h | 21 +- extensions/mqtt/processors/AbstractMQTTProcessor.h | 16 +- extensions/mqtt/processors/ConsumeMQTT.h | 8 +- extensions/mqtt/processors/ConvertBase.h | 11 +- extensions/mqtt/processors/ConvertHeartBeat.cpp | 2 + extensions/mqtt/processors/ConvertHeartBeat.h | 21 +- extensions/mqtt/processors/ConvertJSONAck.h | 17 +- extensions/mqtt/processors/ConvertUpdate.cpp | 6 + extensions/mqtt/processors/ConvertUpdate.h | 20 +- extensions/mqtt/processors/PublishMQTT.h | 9 +- extensions/mqtt/protocol/MQTTC2Protocol.cpp | 3 +- extensions/mqtt/protocol/MQTTC2Protocol.h | 6 +- extensions/opc/CMakeLists.txt | 1 + extensions/opc/include/fetchopc.h | 20 +- extensions/opc/include/opc.h | 19 +- extensions/opc/include/opcbase.h | 10 +- extensions/opc/include/putopc.h | 20 +- extensions/opc/src/fetchopc.cpp | 4 +- extensions/opc/src/opc.cpp | 148 +++++++------- extensions/opencv/CMakeLists.txt | 3 +- extensions/opencv/CaptureRTSPFrame.cpp | 20 +- extensions/opencv/CaptureRTSPFrame.h | 16 +- extensions/opencv/FrameIO.h | 73 +++---- extensions/opencv/MotionDetector.cpp | 5 + extensions/opencv/MotionDetector.h | 26 +-- extensions/opencv/OpenCVLoader.h | 10 +- extensions/opencv/tests/CaptureRTSPFrameTest.cpp | 2 +- extensions/openwsman/CMakeLists.txt | 1 + .../SourceInitiatedSubscriptionListener.h | 5 +- extensions/pcap/CMakeLists.txt | 4 +- extensions/pcap/CapturePacket.cpp | 13 +- extensions/pcap/CapturePacket.h | 15 +- extensions/pcap/PcapLoader.h | 8 +- libminifi/include/io/validation.h | 1 + .../test/archive-tests/ManipulateArchiveTests.cpp | 4 +- 55 files changed, 495 insertions(+), 541 deletions(-) diff --git a/extensions/libarchive/ArchiveLoader.h b/extensions/libarchive/ArchiveLoader.h index 79eed4e..2a71aeb 100644 --- a/extensions/libarchive/ArchiveLoader.h +++ b/extensions/libarchive/ArchiveLoader.h @@ -15,8 +15,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef EXTENSION_ARCHIVELOADER_H -#define EXTENSION_ARCHIVELOADER_H +#pragma once + +#include +#include +#include #include "MergeContent.h" #include "CompressContent.h" @@ -76,4 +79,3 @@ class ArchiveFactory : public core::ObjectFactory { extern "C" { void *createArchiveFactory(void); } -#endif /* EXTENSION_ARCHIVELOADER_H */ diff --git a/extensions/libarchive/ArchiveMetadata.cpp b/extensions/libarchive/ArchiveMetadata.cpp index 69af90a..7b7a527 100644 --- a/extensions/libarchive/ArchiveMetadata.cpp +++ b/extensions/libarchive/ArchiveMetadata.cpp @@ -20,10 +20,8 @@ #include "ArchiveMetadata.h" -#include #include -#include #include #include #include @@ -32,179 +30,180 @@ #include "utils/gsl.h" #include "Exception.h" +#include "rapidjson/writer.h" +#include "rapidjson/error/en.h" + using org::apache::nifi::minifi::Exception; using org::apache::nifi::minifi::ExceptionType; rapidjson::Value ArchiveEntryMetadata::toJson(rapidjson::Document::AllocatorType &alloc) const { - rapidjson::Value entryVal(rapidjson::kObjectType); + rapidjson::Value entryVal(rapidjson::kObjectType); - rapidjson::Value entryNameVal; - entryNameVal.SetString(entryName.c_str(), gsl::narrow(entryName.length())); - entryVal.AddMember("entry_name", entryNameVal, alloc); + rapidjson::Value entryNameVal; + entryNameVal.SetString(entryName.c_str(), gsl::narrow(entryName.length())); + entryVal.AddMember("entry_name", entryNameVal, alloc); - entryVal.AddMember("entry_type", entryType, alloc); - entryVal.AddMember("entry_perm", entryPerm, alloc); - entryVal.AddMember("entry_size", entrySize, alloc); - entryVal.AddMember("entry_uid", entryUID, alloc); - entryVal.AddMember("entry_gid", entryGID, alloc); - entryVal.AddMember("entry_mtime", entryMTime, alloc); - entryVal.AddMember("entry_mtime_nsec", entryMTimeNsec, alloc); + entryVal.AddMember("entry_type", entryType, alloc); + entryVal.AddMember("entry_perm", entryPerm, alloc); + entryVal.AddMember("entry_size", entrySize, alloc); + entryVal.AddMember("entry_uid", entryUID, alloc); + entryVal.AddMember("entry_gid", entryGID, alloc); + entryVal.AddMember("entry_mtime", entryMTime, alloc); + entryVal.AddMember("entry_mtime_nsec", entryMTimeNsec, alloc); - if (entryType == AE_IFREG) { - rapidjson::Value stashKeyVal; - stashKeyVal.SetString(stashKey.c_str(), gsl::narrow(stashKey.length())); - entryVal.AddMember("stash_key", stashKeyVal, alloc); - } + if (entryType == AE_IFREG) { + rapidjson::Value stashKeyVal; + stashKeyVal.SetString(stashKey.c_str(), gsl::narrow(stashKey.length())); + entryVal.AddMember("stash_key", stashKeyVal, alloc); + } - return entryVal; + return entryVal; } void ArchiveEntryMetadata::loadJson(const rapidjson::Value& entryVal) { - entryName.assign(entryVal["entry_name"].GetString()); - entryType = gsl::narrow(entryVal["entry_type"].GetUint64()); - entryPerm = gsl::narrow(entryVal["entry_perm"].GetUint64()); - entrySize = entryVal["entry_size"].GetUint64(); - entryUID = gsl::narrow(entryVal["entry_uid"].GetUint64()); - entryGID = entryVal["entry_gid"].GetUint64(); - entryMTime = entryVal["entry_mtime"].GetUint64(); - entryMTimeNsec = entryVal["entry_mtime_nsec"].GetInt64(); + entryName.assign(entryVal["entry_name"].GetString()); + entryType = gsl::narrow(entryVal["entry_type"].GetUint64()); + entryPerm = gsl::narrow(entryVal["entry_perm"].GetUint64()); + entrySize = entryVal["entry_size"].GetUint64(); + entryUID = gsl::narrow(entryVal["entry_uid"].GetUint64()); + entryGID = entryVal["entry_gid"].GetUint64(); + entryMTime = entryVal["entry_mtime"].GetUint64(); + entryMTimeNsec = entryVal["entry_mtime_nsec"].GetInt64(); - if (entryType == AE_IFREG) - stashKey.assign(entryVal["stash_key"].GetString()); + if (entryType == AE_IFREG) + stashKey.assign(entryVal["stash_key"].GetString()); } ArchiveEntryMetadata ArchiveEntryMetadata::fromJson(const rapidjson::Value& entryVal) { - ArchiveEntryMetadata aem; - aem.loadJson(entryVal); - return aem; + ArchiveEntryMetadata aem; + aem.loadJson(entryVal); + return aem; } ArchiveEntryIterator ArchiveMetadata::find(const std::string& name) { - auto targetTest = [&](const ArchiveEntryMetadata& entry) -> bool { - return entry.entryName == name; - }; + auto targetTest = [&](const ArchiveEntryMetadata& entry) -> bool { + return entry.entryName == name; + }; - return std::find_if(entryMetadata.begin(), - entryMetadata.end(), - targetTest); + return std::find_if(entryMetadata.begin(), entryMetadata.end(), targetTest); } ArchiveEntryIterator ArchiveMetadata::eraseEntry(ArchiveEntryIterator position) { - return entryMetadata.erase(position); + return entryMetadata.erase(position); } ArchiveEntryIterator ArchiveMetadata::insertEntry( - ArchiveEntryIterator position, const ArchiveEntryMetadata& entry) { - return entryMetadata.insert(position, entry); + ArchiveEntryIterator position, const ArchiveEntryMetadata& entry) { + return entryMetadata.insert(position, entry); } rapidjson::Value ArchiveMetadata::toJson(rapidjson::Document::AllocatorType &alloc) const { - rapidjson::Value structVal(rapidjson::kArrayType); + rapidjson::Value structVal(rapidjson::kArrayType); - for (const auto &entry : entryMetadata) { - structVal.PushBack(entry.toJson(alloc), alloc); - } + for (const auto &entry : entryMetadata) { + structVal.PushBack(entry.toJson(alloc), alloc); + } - rapidjson::Value lensVal(rapidjson::kObjectType); + rapidjson::Value lensVal(rapidjson::kObjectType); - rapidjson::Value archiveFormatNameVal; - archiveFormatNameVal.SetString(archiveFormatName.c_str(), gsl::narrow(archiveFormatName.length())); - lensVal.AddMember("archive_format_name", archiveFormatNameVal, alloc); + rapidjson::Value archiveFormatNameVal; + archiveFormatNameVal.SetString(archiveFormatName.c_str(), gsl::narrow(archiveFormatName.length())); + lensVal.AddMember("archive_format_name", archiveFormatNameVal, alloc); - lensVal.AddMember("archive_format", archiveFormat, alloc); - lensVal.AddMember("archive_structure", structVal, alloc); + lensVal.AddMember("archive_format", archiveFormat, alloc); + lensVal.AddMember("archive_structure", structVal, alloc); - if (!archiveName.empty()) { - rapidjson::Value archiveNameVal; - archiveNameVal.SetString(archiveName.c_str(), gsl::narrow(archiveName.length())); - lensVal.AddMember("archive_name", archiveNameVal, alloc); - } + if (!archiveName.empty()) { + rapidjson::Value archiveNameVal; + archiveNameVal.SetString(archiveName.c_str(), gsl::narrow(archiveName.length())); + lensVal.AddMember("archive_name", archiveNameVal, alloc); + } - rapidjson::Value focusedEntryVal; - focusedEntryVal.SetString(focusedEntry.c_str(), gsl::narrow(focusedEntry.length())); - lensVal.AddMember("focused_entry", focusedEntryVal, alloc); + rapidjson::Value focusedEntryVal; + focusedEntryVal.SetString(focusedEntry.c_str(), gsl::narrow(focusedEntry.length())); + lensVal.AddMember("focused_entry", focusedEntryVal, alloc); - return lensVal; + return lensVal; } ArchiveMetadata ArchiveMetadata::fromJson(const rapidjson::Value& metadataDoc) { - ArchiveMetadata am; - am.loadJson(metadataDoc); - return am; + ArchiveMetadata am; + am.loadJson(metadataDoc); + return am; } void ArchiveMetadata::loadJson(const rapidjson::Value& metadataDoc) { - rapidjson::Value::ConstMemberIterator itr = metadataDoc.FindMember("archive_name"); - if (itr != metadataDoc.MemberEnd()) - archiveName.assign(itr->value.GetString()); + rapidjson::Value::ConstMemberIterator itr = metadataDoc.FindMember("archive_name"); + if (itr != metadataDoc.MemberEnd()) + archiveName.assign(itr->value.GetString()); + + archiveFormatName.assign(metadataDoc["archive_format_name"].GetString()); + archiveFormat = gsl::narrow(metadataDoc["archive_format"].GetUint64()); - archiveFormatName.assign(metadataDoc["archive_format_name"].GetString()); - archiveFormat = gsl::narrow(metadataDoc["archive_format"].GetUint64()); + focusedEntry = metadataDoc["focused_entry"].GetString(); - focusedEntry = metadataDoc["focused_entry"].GetString(); - - for (const auto &entryVal : metadataDoc["archive_structure"].GetArray()) { - entryMetadata.push_back(ArchiveEntryMetadata::fromJson(entryVal)); - } + for (const auto &entryVal : metadataDoc["archive_structure"].GetArray()) { + entryMetadata.push_back(ArchiveEntryMetadata::fromJson(entryVal)); + } } void ArchiveMetadata::seedTempPaths(fileutils::FileManager *file_man, bool keep = false) { - for (auto& entry : entryMetadata) - entry.tmpFileName.assign(file_man->unique_file(keep)); + for (auto& entry : entryMetadata) + entry.tmpFileName.assign(file_man->unique_file(keep)); } ArchiveStack ArchiveStack::fromJson(const rapidjson::Value& input) { - ArchiveStack as; - as.loadJson(input); - return as; + ArchiveStack as; + as.loadJson(input); + return as; } ArchiveStack ArchiveStack::fromJsonString(const std::string& input) { - ArchiveStack as; - as.loadJsonString(input); - return as; + ArchiveStack as; + as.loadJsonString(input); + return as; } void ArchiveStack::loadJson(const rapidjson::Value& lensStack) { - for (const auto& metadata : lensStack.GetArray()) { - stack_.push_back(ArchiveMetadata::fromJson(metadata)); - } + for (const auto& metadata : lensStack.GetArray()) { + stack_.push_back(ArchiveMetadata::fromJson(metadata)); + } } void ArchiveStack::loadJsonString(const std::string& input) { - rapidjson::Document lensStack; - rapidjson::ParseResult ok = lensStack.Parse(input.c_str()); + rapidjson::Document lensStack; + rapidjson::ParseResult ok = lensStack.Parse(input.c_str()); - if (!ok) { - std::stringstream ss; - ss << "Failed to parse archive lens stack from JSON string with reason: " - << rapidjson::GetParseError_En(ok.Code()) - << " at offset " << ok.Offset(); + if (!ok) { + std::stringstream ss; + ss << "Failed to parse archive lens stack from JSON string with reason: " + << rapidjson::GetParseError_En(ok.Code()) + << " at offset " << ok.Offset(); - throw Exception(ExceptionType::GENERAL_EXCEPTION, ss.str()); - } + throw Exception(ExceptionType::GENERAL_EXCEPTION, ss.str()); + } - loadJson(lensStack); + loadJson(lensStack); } rapidjson::Document ArchiveStack::toJson() const { - rapidjson::Document lensStack(rapidjson::kArrayType); - rapidjson::Document::AllocatorType &alloc = lensStack.GetAllocator(); + rapidjson::Document lensStack(rapidjson::kArrayType); + rapidjson::Document::AllocatorType &alloc = lensStack.GetAllocator(); - for (const auto& metadata : stack_) { - lensStack.PushBack(metadata.toJson(alloc), alloc); - } + for (const auto& metadata : stack_) { + lensStack.PushBack(metadata.toJson(alloc), alloc); + } - return lensStack; + return lensStack; } std::string ArchiveStack::toJsonString() const { - rapidjson::Document d = toJson(); - - rapidjson::StringBuffer buffer; - rapidjson::Writer writer(buffer); - d.Accept(writer); - - std::string jsonString = buffer.GetString(); - return jsonString; + rapidjson::Document d = toJson(); + + rapidjson::StringBuffer buffer; + rapidjson::Writer writer(buffer); + d.Accept(writer); + + std::string jsonString = buffer.GetString(); + return jsonString; } diff --git a/extensions/libarchive/ArchiveMetadata.h b/extensions/libarchive/ArchiveMetadata.h index 6896c1d..081a9b6 100644 --- a/extensions/libarchive/ArchiveMetadata.h +++ b/extensions/libarchive/ArchiveMetadata.h @@ -20,79 +20,75 @@ #ifndef EXTENSIONS_LIBARCHIVE_ARCHIVEMETADATA_H_ #define EXTENSIONS_LIBARCHIVE_ARCHIVEMETADATA_H_ -#include "rapidjson/document.h" -#include "rapidjson/writer.h" -#include "rapidjson/stringbuffer.h" -#include "rapidjson/error/en.h" - #include #include #include -#include + +#include "rapidjson/document.h" +#include "rapidjson/stringbuffer.h" #include "ArchiveCommon.h" -#include "core/Core.h" #include "utils/file/FileManager.h" class ArchiveEntryMetadata { -public: - std::string entryName; - mode_t entryType; - mode_t entryPerm; - uid_t entryUID; - gid_t entryGID; - uint64_t entryMTime; - uint64_t entryMTimeNsec; - uint64_t entrySize; - - std::string tmpFileName; - std::string stashKey; - - inline rapidjson::Value toJson(rapidjson::Document::AllocatorType &alloc) const; - static inline ArchiveEntryMetadata fromJson(const rapidjson::Value&); - -private: - inline void loadJson(const rapidjson::Value&); + public: + std::string entryName; + mode_t entryType; + mode_t entryPerm; + uid_t entryUID; + gid_t entryGID; + uint64_t entryMTime; + uint64_t entryMTimeNsec; + uint64_t entrySize; + + std::string tmpFileName; + std::string stashKey; + + inline rapidjson::Value toJson(rapidjson::Document::AllocatorType &alloc) const; + static inline ArchiveEntryMetadata fromJson(const rapidjson::Value&); + + private: + inline void loadJson(const rapidjson::Value&); }; using ArchiveEntryIterator = typename std::list::iterator; class ArchiveMetadata { -public: - std::string archiveName; - std::string archiveFormatName; - int archiveFormat; - std::list entryMetadata; + public: + std::string archiveName; + std::string archiveFormatName; + int archiveFormat; + std::list entryMetadata; - std::string focusedEntry; + std::string focusedEntry; - ArchiveEntryIterator find(const std::string& name); - ArchiveEntryIterator eraseEntry(ArchiveEntryIterator position); - ArchiveEntryIterator insertEntry(ArchiveEntryIterator it, const ArchiveEntryMetadata& entry); + ArchiveEntryIterator find(const std::string& name); + ArchiveEntryIterator eraseEntry(ArchiveEntryIterator position); + ArchiveEntryIterator insertEntry(ArchiveEntryIterator it, const ArchiveEntryMetadata& entry); - void seedTempPaths(fileutils::FileManager* file_man, bool keep); + void seedTempPaths(fileutils::FileManager* file_man, bool keep); - rapidjson::Value toJson(rapidjson::Document::AllocatorType &alloc) const; - static ArchiveMetadata fromJson(const rapidjson::Value&); + rapidjson::Value toJson(rapidjson::Document::AllocatorType &alloc) const; + static ArchiveMetadata fromJson(const rapidjson::Value&); -private: - void loadJson(const rapidjson::Value&); + private: + void loadJson(const rapidjson::Value&); }; class ArchiveStack { -public: - static ArchiveStack fromJsonString(const std::string& input); - static ArchiveStack fromJson(const rapidjson::Value& input); - void push(const ArchiveMetadata& metadata) { stack_.push_back(metadata); } - ArchiveMetadata pop() { auto x = top(); stack_.pop_back(); return x; } - ArchiveMetadata top() const { return stack_.back(); } - void loadJson(const rapidjson::Value& input); - void loadJsonString(const std::string& input); - std::string toJsonString() const; - rapidjson::Document toJson() const; - -private: - std::vector stack_; + public: + static ArchiveStack fromJsonString(const std::string& input); + static ArchiveStack fromJson(const rapidjson::Value& input); + void push(const ArchiveMetadata& metadata) { stack_.push_back(metadata); } + ArchiveMetadata pop() { auto x = top(); stack_.pop_back(); return x; } + ArchiveMetadata top() const { return stack_.back(); } + void loadJson(const rapidjson::Value& input); + void loadJsonString(const std::string& input); + std::string toJsonString() const; + rapidjson::Document toJson() const; + + private: + std::vector stack_; }; #endif // EXTENSIONS_LIBARCHIVE_ARCHIVEMETADATA_H_ diff --git a/extensions/libarchive/ArchiveTests.h b/extensions/libarchive/ArchiveTests.h index 333abf4..a8d60cd 100644 --- a/extensions/libarchive/ArchiveTests.h +++ b/extensions/libarchive/ArchiveTests.h @@ -18,15 +18,13 @@ * limitations under the License. */ -#ifndef ARCHIVE_TESTS_H -#define ARCHIVE_TESTS_H +#pragma once #include #include #include -#include -#include +#include "archive_entry.h" #include "ArchiveCommon.h" @@ -63,4 +61,3 @@ void build_test_archive(std::string, OrderedTestArchive); bool check_archive_contents(std::string, TAE_MAP_T entries, bool check_attributes = true, FN_VEC_T order = FN_VEC_T()); bool check_archive_contents(std::string, OrderedTestArchive, bool check_attributes = true); -#endif diff --git a/extensions/libarchive/BinFiles.cpp b/extensions/libarchive/BinFiles.cpp index c3c92e2..3b12026 100644 --- a/extensions/libarchive/BinFiles.cpp +++ b/extensions/libarchive/BinFiles.cpp @@ -23,11 +23,10 @@ #include #include #include -#include +#include #include #include #include -#include "utils/TimeUtil.h" #include "utils/StringUtils.h" #include "core/ProcessContext.h" #include "core/ProcessSession.h" diff --git a/extensions/libarchive/BinFiles.h b/extensions/libarchive/BinFiles.h index bc245a8..40b6bb7 100644 --- a/extensions/libarchive/BinFiles.h +++ b/extensions/libarchive/BinFiles.h @@ -17,17 +17,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef __BIN_FILES_H__ -#define __BIN_FILES_H__ +#pragma once #include #include #include +#include +#include +#include +#include #include #include "FlowFileRecord.h" #include "core/Processor.h" #include "core/ProcessSession.h" -#include "core/Core.h" #include "core/Resource.h" #include "core/logging/LoggerConfiguration.h" #include "utils/gsl.h" @@ -124,8 +126,6 @@ class Bin { return groupId_; } - protected: - private: uint64_t minSize_; uint64_t maxSize_; @@ -184,8 +184,6 @@ class BinManager { // get ready bin from binManager void getReadyBin(std::deque> &retBins); - protected: - private: std::mutex mutex_; uint64_t minSize_{0}; @@ -205,6 +203,7 @@ class BinManager { class BinFiles : public core::Processor { protected: static core::Relationship Self; + public: using core::Processor::Processor; // Destructor @@ -302,4 +301,3 @@ REGISTER_RESOURCE(BinFiles, "Bins flow files into buckets based on the number of } /* namespace apache */ } /* namespace org */ -#endif diff --git a/extensions/libarchive/CMakeLists.txt b/extensions/libarchive/CMakeLists.txt index cc55acd..8cb361e 100644 --- a/extensions/libarchive/CMakeLists.txt +++ b/extensions/libarchive/CMakeLists.txt @@ -17,7 +17,7 @@ # under the License. # -include(${CMAKE_SOURCE_DIR}/extensions/ExtensionHeader.txt) +include(${CMAKE_SOURCE_DIR}/extensions/ExtensionHeader.txt) file(GLOB SOURCES "*.cpp") @@ -30,4 +30,4 @@ target_link_libraries(minifi-archive-extensions LibArchive::LibArchive) SET (ARCHIVE-EXTENSIONS minifi-archive-extensions PARENT_SCOPE) register_extension(minifi-archive-extensions) - +register_extension_linter(minifi-archive-extensions-linter) diff --git a/extensions/libarchive/CompressContent.cpp b/extensions/libarchive/CompressContent.cpp index 821c2bd..82c2f80 100644 --- a/extensions/libarchive/CompressContent.cpp +++ b/extensions/libarchive/CompressContent.cpp @@ -19,13 +19,10 @@ */ #include "CompressContent.h" #include -#include #include #include #include #include -#include "utils/TimeUtil.h" -#include "utils/StringUtils.h" #include "core/ProcessContext.h" #include "core/ProcessSession.h" diff --git a/extensions/libarchive/CompressContent.h b/extensions/libarchive/CompressContent.h index 8865dfe..8d8a048 100644 --- a/extensions/libarchive/CompressContent.h +++ b/extensions/libarchive/CompressContent.h @@ -17,11 +17,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef __COMPRESS_CONTENT_H__ -#define __COMPRESS_CONTENT_H__ +#pragma once #include +#include #include +#include +#include +#include #include "archive_entry.h" #include "archive.h" @@ -45,7 +48,7 @@ namespace processors { // CompressContent Class class CompressContent : public core::Processor { -public: + public: // Constructor /*! * Create a new processor @@ -88,10 +91,10 @@ public: (USE_MIME_TYPE, "use mime.type attribute") ) -public: + public: // Nest Callback Class for read stream from flow for compress class ReadCallbackCompress: public InputStreamCallback { - public: + public: ReadCallbackCompress(std::shared_ptr &flow, struct archive *arch, struct archive_entry *entry) : flow_(flow), arch_(arch), entry_(entry), status_(0), logger_(logging::LoggerFactory::getLogger()) { } @@ -155,7 +158,7 @@ public: }; // Nest Callback Class for write stream class WriteCallback: public OutputStreamCallback { - public: + public: WriteCallback(CompressionMode compress_mode, int compress_level, CompressionFormat compress_format, const std::shared_ptr &flow, const std::shared_ptr &session) : compress_mode_(compress_mode), compress_level_(compress_level), compress_format_(compress_format), @@ -187,7 +190,7 @@ public: } static la_ssize_t archive_read(struct archive* archive, void *context, const void **buff) { - auto *callback = (WriteCallback *) context; + auto *callback = reinterpret_cast(context); callback->session_->read(callback->flow_, &callback->readDecompressCb_); *buff = callback->readDecompressCb_.buffer; if (io::isError(callback->readDecompressCb_.stream_read_result)) { @@ -414,7 +417,7 @@ public: } }; -public: + public: /** * Function that's executed when the processor is scheduled. * @param context process context. @@ -430,7 +433,7 @@ public: // Initialize, over write by NiFi CompressContent void initialize() override; -private: + private: static std::string toMimeType(CompressionFormat format); void processFlowFile(const std::shared_ptr& flowFile, const std::shared_ptr& session); @@ -457,5 +460,3 @@ REGISTER_RESOURCE(CompressContent, "Compresses or decompresses the contents of F } /* namespace nifi */ } /* namespace apache */ } /* namespace org */ - -#endif diff --git a/extensions/libarchive/FocusArchiveEntry.cpp b/extensions/libarchive/FocusArchiveEntry.cpp index 04bdb2c..3a4e91c 100644 --- a/extensions/libarchive/FocusArchiveEntry.cpp +++ b/extensions/libarchive/FocusArchiveEntry.cpp @@ -27,8 +27,6 @@ #include #include -#include -#include #include #include "core/ProcessContext.h" @@ -123,9 +121,7 @@ void FocusArchiveEntry::onTrigger(core::ProcessContext *context, core::ProcessSe archiveStack.push(archiveMetadata); - std::string stackStr = archiveStack.toJsonString(); - - flowFile->setAttribute("lens.archive.stack", stackStr); + flowFile->setAttribute("lens.archive.stack", archiveStack.toJsonString()); } // Update filename attribute to that of focused entry diff --git a/extensions/libarchive/FocusArchiveEntry.h b/extensions/libarchive/FocusArchiveEntry.h index 71f1223..bee6dcc 100644 --- a/extensions/libarchive/FocusArchiveEntry.h +++ b/extensions/libarchive/FocusArchiveEntry.h @@ -17,14 +17,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef LIBMINIFI_INCLUDE_PROCESSORS_FOCUSARCHIVEENTRY_H_ -#define LIBMINIFI_INCLUDE_PROCESSORS_FOCUSARCHIVEENTRY_H_ +#pragma once -#include #include #include -#include +#include "archive.h" #include "ArchiveMetadata.h" #include "FlowFileRecord.h" @@ -98,5 +96,3 @@ REGISTER_RESOURCE(FocusArchiveEntry, "Allows manipulation of entries within an a } /* namespace nifi */ } /* namespace apache */ } /* namespace org */ - -#endif // LIBMINIFI_INCLUDE_PROCESSORS_FOCUSARCHIVEENTRY_H_ diff --git a/extensions/libarchive/ManipulateArchive.cpp b/extensions/libarchive/ManipulateArchive.cpp index 2a21577..f553103 100644 --- a/extensions/libarchive/ManipulateArchive.cpp +++ b/extensions/libarchive/ManipulateArchive.cpp @@ -17,16 +17,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include #include -#include #include #include #include #include +#include -#include -#include +#include "archive.h" +#include "archive_entry.h" #include "ManipulateArchive.h" #include "Exception.h" @@ -34,6 +33,8 @@ #include "core/ProcessSession.h" #include "core/FlowFile.h" #include "utils/file/FileManager.h" +#include "FocusArchiveEntry.h" +#include "UnfocusArchiveEntry.h" namespace org { namespace apache { @@ -107,7 +108,7 @@ void ManipulateArchive::onSchedule(core::ProcessContext *context, core::ProcessS if (before_.size() && after_.size()) { logger_->log_error("ManipulateArchive: cannot specify both before and after."); invalid = true; - } + } if (invalid) { throw Exception(GENERAL_EXCEPTION, "Invalid ManipulateArchive configuration"); diff --git a/extensions/libarchive/ManipulateArchive.h b/extensions/libarchive/ManipulateArchive.h index b630a69..d3927ca 100644 --- a/extensions/libarchive/ManipulateArchive.h +++ b/extensions/libarchive/ManipulateArchive.h @@ -17,19 +17,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef LIBMINIFI_INCLUDE_PROCESSORS_MANIPULATEARCHIVE_H_ -#define LIBMINIFI_INCLUDE_PROCESSORS_MANIPULATEARCHIVE_H_ +#pragma once -#include #include +#include #include "FlowFileRecord.h" #include "ArchiveMetadata.h" #include "core/Processor.h" #include "core/ProcessSession.h" -#include "FocusArchiveEntry.h" -#include "UnfocusArchiveEntry.h" namespace org { namespace apache { @@ -40,8 +37,8 @@ namespace processors { using logging::Logger; class ManipulateArchive : public core::Processor { -public: - ManipulateArchive(const std::string& name, const utils::Identifier& uuid = {}) + public: + explicit ManipulateArchive(const std::string& name, const utils::Identifier& uuid = {}) : core::Processor(name, uuid), logger_(logging::LoggerFactory::getLogger()) { } @@ -70,9 +67,7 @@ public: // Initialize, over write by NiFi ManipulateArchive void initialize(void); -protected: - -private: + private: // Logger std::shared_ptr logger_; std::string before_, after_, operation_, destination_, targetEntry_; @@ -85,5 +80,3 @@ REGISTER_RESOURCE(ManipulateArchive, "Performs an operation which manipulates an } /* namespace nifi */ } /* namespace apache */ } /* namespace org */ - -#endif // LIBMINIFI_INCLUDE_PROCESSORS_MANIPULATEARCHIVE_H_ diff --git a/extensions/libarchive/MergeContent.cpp b/extensions/libarchive/MergeContent.cpp index 9923fe0..fb4fb82 100644 --- a/extensions/libarchive/MergeContent.cpp +++ b/extensions/libarchive/MergeContent.cpp @@ -21,16 +21,13 @@ #include #include #include -#include #include -#include #include #include #include #include #include #include "utils/TimeUtil.h" -#include "utils/StringUtils.h" #include "utils/GeneralUtils.h" #include "core/ProcessContext.h" #include "core/ProcessSession.h" @@ -289,11 +286,11 @@ bool MergeContent::processBin(core::ProcessContext *context, core::ProcessSessio } std::shared_ptr merge_flow = std::static_pointer_cast(session->create()); - if (attributeStrategy_ == merge_content_options::ATTRIBUTE_STRATEGY_KEEP_COMMON) + if (attributeStrategy_ == merge_content_options::ATTRIBUTE_STRATEGY_KEEP_COMMON) { KeepOnlyCommonAttributesMerger(bin->getFlowFile()).mergeAttributes(session, merge_flow); - else if (attributeStrategy_ == merge_content_options::ATTRIBUTE_STRATEGY_KEEP_ALL_UNIQUE) + } else if (attributeStrategy_ == merge_content_options::ATTRIBUTE_STRATEGY_KEEP_ALL_UNIQUE) { KeepAllUniqueAttributesMerger(bin->getFlowFile()).mergeAttributes(session, merge_flow); - else { + } else { logger_->log_error("Attribute strategy not supported %s", attributeStrategy_); return false; } diff --git a/extensions/libarchive/MergeContent.h b/extensions/libarchive/MergeContent.h index d14b924..7fd852a 100644 --- a/extensions/libarchive/MergeContent.h +++ b/extensions/libarchive/MergeContent.h @@ -17,8 +17,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef __MERGE_CONTENT_H__ -#define __MERGE_CONTENT_H__ +#pragma once + +#include +#include +#include +#include +#include #include "ArchiveCommon.h" #include "BinFiles.h" @@ -172,7 +177,7 @@ class ArchiveMerge { FlowFileSerializer& serializer_; static la_ssize_t archive_write(struct archive* /*arch*/, void *context, const void *buff, size_t size) { - WriteCallback *callback = (WriteCallback *) context; + WriteCallback *callback = reinterpret_cast(context); uint8_t* data = reinterpret_cast(const_cast(buff)); la_ssize_t totalWrote = 0; size_t remaining = size; @@ -376,5 +381,3 @@ REGISTER_RESOURCE(MergeContent, "Merges a Group of FlowFiles together based on a } /* namespace nifi */ } /* namespace apache */ } /* namespace org */ - -#endif diff --git a/extensions/libarchive/UnfocusArchiveEntry.cpp b/extensions/libarchive/UnfocusArchiveEntry.cpp index de54bc2..cd33233 100644 --- a/extensions/libarchive/UnfocusArchiveEntry.cpp +++ b/extensions/libarchive/UnfocusArchiveEntry.cpp @@ -26,8 +26,8 @@ #include #include -#include -#include +#include "archive.h" +#include "archive_entry.h" #include "core/ProcessContext.h" #include "core/ProcessSession.h" @@ -192,7 +192,7 @@ int64_t UnfocusArchiveEntry::WriteCallback::process(const std::shared_ptr(entryMetadata.entryMTimeNsec)); + archive_entry_set_mtime(entry, entryMetadata.entryMTime, gsl::narrow(entryMetadata.entryMTimeNsec)); // NOLINT long comes from libarchive API logger_->log_info("Writing %s with type %d, perms %d, size %d, uid %d, gid %d, mtime %d,%d", entryMetadata.entryName, entryMetadata.entryType, entryMetadata.entryPerm, entryMetadata.entrySize, entryMetadata.entryUID, entryMetadata.entryGID, entryMetadata.entryMTime, entryMetadata.entryMTimeNsec); diff --git a/extensions/libarchive/UnfocusArchiveEntry.h b/extensions/libarchive/UnfocusArchiveEntry.h index a4a38bb..e74cad9 100644 --- a/extensions/libarchive/UnfocusArchiveEntry.h +++ b/extensions/libarchive/UnfocusArchiveEntry.h @@ -17,13 +17,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef LIBMINIFI_INCLUDE_PROCESSORS_UNFOCUSARCHIVEENTRY_H_ -#define LIBMINIFI_INCLUDE_PROCESSORS_UNFOCUSARCHIVEENTRY_H_ +#pragma once #include #include -#include +#include "archive.h" #include "FocusArchiveEntry.h" #include "FlowFileRecord.h" @@ -91,5 +90,3 @@ REGISTER_RESOURCE(UnfocusArchiveEntry, "Restores a FlowFile which has had an arc } /* namespace nifi */ } /* namespace apache */ } /* namespace org */ - -#endif // LIBMINIFI_INCLUDE_PROCESSORS_UNFOCUSARCHIVEENTRY_H_ diff --git a/extensions/mqtt/CMakeLists.txt b/extensions/mqtt/CMakeLists.txt index 1b7cacd..decd009 100644 --- a/extensions/mqtt/CMakeLists.txt +++ b/extensions/mqtt/CMakeLists.txt @@ -17,7 +17,7 @@ # under the License. # -include(${CMAKE_SOURCE_DIR}/extensions/ExtensionHeader.txt) +include(${CMAKE_SOURCE_DIR}/extensions/ExtensionHeader.txt) include_directories(./controllerservice ./processors ./protocol ../../libminifi/include ../../libminifi/include/core) file(GLOB SOURCES "*.cpp" "protocol/*.cpp" "processors/*.cpp" "controllerservice/*.cpp") @@ -34,4 +34,4 @@ target_link_libraries(minifi-mqtt-extensions paho.mqtt.c) SET (MQTT-EXTENSIONS minifi-mqtt-extensions PARENT_SCOPE) register_extension(minifi-mqtt-extensions) - +register_extension_linter(minifi-mqtt-extensions-linter) diff --git a/extensions/mqtt/MQTTLoader.h b/extensions/mqtt/MQTTLoader.h index 125b042..95475c2 100644 --- a/extensions/mqtt/MQTTLoader.h +++ b/extensions/mqtt/MQTTLoader.h @@ -15,8 +15,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef EXTENSION_MQTTLOADER_H -#define EXTENSION_MQTTLOADER_H +#pragma once + +#include +#include +#include #include "controllerservice/MQTTControllerService.h" #include "processors/PublishMQTT.h" @@ -83,4 +86,3 @@ class MQTTFactory : public core::ObjectFactory { extern "C" { DLL_EXPORT void *createMQTTFactory(void); } -#endif /* EXTENSION_MQTTLOADER_H */ diff --git a/extensions/mqtt/controllerservice/MQTTControllerService.cpp b/extensions/mqtt/controllerservice/MQTTControllerService.cpp index d12541b..7595e74 100644 --- a/extensions/mqtt/controllerservice/MQTTControllerService.cpp +++ b/extensions/mqtt/controllerservice/MQTTControllerService.cpp @@ -70,7 +70,7 @@ void MQTTControllerService::onEnable() { } if (client_) { - MQTTClient_setCallbacks(client_, (void *) this, reconnectCallback, receiveCallback, deliveryCallback); + MQTTClient_setCallbacks(client_, this, reconnectCallback, receiveCallback, deliveryCallback); // call reconnect to bootstrap this->reconnect(); } diff --git a/extensions/mqtt/controllerservice/MQTTControllerService.h b/extensions/mqtt/controllerservice/MQTTControllerService.h index 10d5f1f..3c99e52 100644 --- a/extensions/mqtt/controllerservice/MQTTControllerService.h +++ b/extensions/mqtt/controllerservice/MQTTControllerService.h @@ -15,16 +15,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef LIBMINIFI_INCLUDE_CONTROLLERS_MQTTCONTEXTSERVICE_H_ -#define LIBMINIFI_INCLUDE_CONTROLLERS_MQTTCONTEXTSERVICE_H_ +#pragma once #include #include #include #include +#include +#include +#include +#include + #include "core/Resource.h" #include "utils/StringUtils.h" -#include "io/validation.h" #include "core/controller/ControllerService.h" #include "core/logging/LoggerConfiguration.h" #include "controllers/SSLContextService.h" @@ -47,7 +50,7 @@ class Message { Message() = default; explicit Message(const std::string &topic, void *data, size_t dataLen) : topic_(topic), - data_((uint8_t*) data, ((uint8_t*)data + dataLen)) { + data_(reinterpret_cast(data), (reinterpret_cast(data) + dataLen)) { } Message(const Message &other) = default; @@ -223,7 +226,6 @@ class MQTTControllerService : public core::controller::ControllerService { } protected: - void acknowledgeDelivery(MQTTClient_deliveryToken token) { std::lock_guard lock(delivery_mutex_); // locked the mutex @@ -242,12 +244,12 @@ class MQTTControllerService : public core::controller::ControllerService { } static void deliveryCallback(void *context, MQTTClient_deliveryToken dt) { - MQTTControllerService *service = (MQTTControllerService *) context; + MQTTControllerService *service = reinterpret_cast(context); service->acknowledgeDelivery(dt); } static int receiveCallback(void *context, char *topicName, int topicLen, MQTTClient_message *message) { - MQTTControllerService *service = (MQTTControllerService *) context; + MQTTControllerService *service = reinterpret_cast(context); std::string topic(topicName, topicLen == 0 ? strlen(topicName) : topicLen); Message queueMessage(topic, message->payload, message->payloadlen); service->enqueue(topic, std::move(queueMessage)); @@ -256,7 +258,7 @@ class MQTTControllerService : public core::controller::ControllerService { return 1; } static void reconnectCallback(void *context, char* /*cause*/) { - MQTTControllerService *service = (MQTTControllerService *) context; + MQTTControllerService *service = reinterpret_cast(context); service->reconnect(); } @@ -302,7 +304,6 @@ class MQTTControllerService : public core::controller::ControllerService { std::string passWord_; private: - std::map delivered_; std::map > topics_; @@ -321,5 +322,3 @@ class MQTTControllerService : public core::controller::ControllerService { } /* namespace nifi */ } /* namespace apache */ } /* namespace org */ - -#endif /* LIBMINIFI_INCLUDE_CONTROLLERS_MQTTCONTEXTSERVICE_H_ */ diff --git a/extensions/mqtt/processors/AbstractMQTTProcessor.h b/extensions/mqtt/processors/AbstractMQTTProcessor.h index 5b1a28a..fbe8dac 100644 --- a/extensions/mqtt/processors/AbstractMQTTProcessor.h +++ b/extensions/mqtt/processors/AbstractMQTTProcessor.h @@ -17,14 +17,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef __ABSTRACTMQTT_H__ -#define __ABSTRACTMQTT_H__ +#pragma once + +#include +#include +#include #include "FlowFileRecord.h" #include "core/Processor.h" #include "core/ProcessSession.h" #include "core/Core.h" -#include "core/Resource.h" #include "core/logging/LoggerConfiguration.h" #include "MQTTClient.h" @@ -98,11 +100,11 @@ class AbstractMQTTProcessor : public core::Processor { // MQTT async callbacks static void msgDelivered(void *context, MQTTClient_deliveryToken dt) { - AbstractMQTTProcessor *processor = (AbstractMQTTProcessor *) context; + AbstractMQTTProcessor *processor = reinterpret_cast(context); processor->delivered_token_ = dt; } static int msgReceived(void *context, char *topicName, int /*topicLen*/, MQTTClient_message *message) { - AbstractMQTTProcessor *processor = (AbstractMQTTProcessor *) context; + AbstractMQTTProcessor *processor = reinterpret_cast(context); if (processor->isSubscriber_) { if (!processor->enqueueReceiveMQTTMsg(message)) MQTTClient_freeMessage(&message); @@ -113,7 +115,7 @@ class AbstractMQTTProcessor : public core::Processor { return 1; } static void connectionLost(void *context, char* /*cause*/) { - AbstractMQTTProcessor *processor = (AbstractMQTTProcessor *) context; + AbstractMQTTProcessor *processor = reinterpret_cast(context); processor->reconnect(); } bool reconnect(); @@ -154,5 +156,3 @@ class AbstractMQTTProcessor : public core::Processor { } /* namespace nifi */ } /* namespace apache */ } /* namespace org */ - -#endif diff --git a/extensions/mqtt/processors/ConsumeMQTT.h b/extensions/mqtt/processors/ConsumeMQTT.h index 10208c6..d279fc0 100644 --- a/extensions/mqtt/processors/ConsumeMQTT.h +++ b/extensions/mqtt/processors/ConsumeMQTT.h @@ -17,10 +17,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef __CONSUME_MQTT_H__ -#define __CONSUME_MQTT_H__ +#pragma once #include +#include +#include + #include #include "FlowFileRecord.h" #include "core/Processor.h" @@ -135,5 +137,3 @@ REGISTER_RESOURCE(ConsumeMQTT, "This Processor gets the contents of a FlowFile f } /* namespace nifi */ } /* namespace apache */ } /* namespace org */ - -#endif diff --git a/extensions/mqtt/processors/ConvertBase.h b/extensions/mqtt/processors/ConvertBase.h index 96fd7dc..4b1bbbd 100644 --- a/extensions/mqtt/processors/ConvertBase.h +++ b/extensions/mqtt/processors/ConvertBase.h @@ -15,8 +15,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef EXTENSIONS_MQTT_PROTOCOL_CONVERTBASE_H_ -#define EXTENSIONS_MQTT_PROTOCOL_CONVERTBASE_H_ +#pragma once + +#include +#include #include "MQTTControllerService.h" #include "FlowFileRecord.h" @@ -57,7 +59,6 @@ class ConvertBase : public core::Processor, public minifi::c2::RESTProtocol { static core::Relationship Success; public: - /** * Initialization of the processor */ @@ -69,8 +70,8 @@ class ConvertBase : public core::Processor, public minifi::c2::RESTProtocol { * ProcessSession objects. */ void onSchedule(const std::shared_ptr &context, const std::shared_ptr &sessionFactory) override; - protected: + protected: /** * MQTT controller service. */ @@ -84,5 +85,3 @@ class ConvertBase : public core::Processor, public minifi::c2::RESTProtocol { } /* namespace nifi */ } /* namespace apache */ } /* namespace org */ - -#endif /* EXTENSIONS_MQTT_PROTOCOL_CONVERTBASE_H_ */ diff --git a/extensions/mqtt/processors/ConvertHeartBeat.cpp b/extensions/mqtt/processors/ConvertHeartBeat.cpp index 78c4e10..5fcb95b 100644 --- a/extensions/mqtt/processors/ConvertHeartBeat.cpp +++ b/extensions/mqtt/processors/ConvertHeartBeat.cpp @@ -20,7 +20,9 @@ #include #include #include +#include #include + #include "utils/TimeUtil.h" #include "utils/StringUtils.h" #include "core/ProcessContext.h" diff --git a/extensions/mqtt/processors/ConvertHeartBeat.h b/extensions/mqtt/processors/ConvertHeartBeat.h index ee8161e..9f0292e 100644 --- a/extensions/mqtt/processors/ConvertHeartBeat.h +++ b/extensions/mqtt/processors/ConvertHeartBeat.h @@ -15,19 +15,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef __CONVERT_HEARTBEAT_H__ -#define __CONVERT_HEARTBEAT_H__ +#pragma once + +#include +#include -#include "MQTTControllerService.h" -#include "FlowFileRecord.h" -#include "core/Processor.h" #include "core/ProcessSession.h" #include "core/Core.h" -#include "core/Resource.h" -#include "core/Property.h" #include "core/logging/LoggerConfiguration.h" -#include "MQTTClient.h" -#include "c2/protocols/RESTProtocol.h" #include "ConvertBase.h" namespace org { @@ -40,7 +35,7 @@ namespace processors { * Purpose: ConvertHeartBeat converts heatbeats into MQTT messages. */ class ConvertHeartBeat: public ConvertBase{ -public: + public: // Constructor /*! * Create a new processor @@ -53,7 +48,7 @@ public: // Processor Name static constexpr char const* ProcessorName = "ConvertHeartBeat"; -public: + public: /** * Function that's executed when the processor is triggered. * @param context process context. @@ -63,7 +58,7 @@ public: void onTrigger(const std::shared_ptr &context, const std::shared_ptr &session) override; -private: + private: std::shared_ptr logger_; }; @@ -73,5 +68,3 @@ private: } /* namespace nifi */ } /* namespace apache */ } /* namespace org */ - -#endif diff --git a/extensions/mqtt/processors/ConvertJSONAck.h b/extensions/mqtt/processors/ConvertJSONAck.h index 6c9d3cd..8ec804e 100644 --- a/extensions/mqtt/processors/ConvertJSONAck.h +++ b/extensions/mqtt/processors/ConvertJSONAck.h @@ -17,22 +17,21 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef __CONVERT_ACKNOWLEDGEMENT_H__ -#define __CONVERT_ACKNOWLEDGEMENT_H__ +#pragma once + +#include +#include +#include -#include "MQTTControllerService.h" #include "FlowFileRecord.h" -#include "core/Processor.h" #include "core/ProcessSession.h" #include "core/Core.h" #include "core/Resource.h" -#include "core/Property.h" #include "core/logging/LoggerConfiguration.h" -#include "MQTTClient.h" -#include "c2/protocols/RESTProtocol.h" #include "ConvertBase.h" #include "utils/gsl.h" + namespace org { namespace apache { namespace nifi { @@ -70,7 +69,6 @@ class ConvertJSONAck : public ConvertBase { void onTrigger(const std::shared_ptr &context, const std::shared_ptr &session) override; protected: - class ReadCallback : public InputStreamCallback { public: ReadCallback() = default; @@ -90,6 +88,7 @@ class ConvertJSONAck : public ConvertBase { * @param json json representation defined by the restful protocol */ std::string parseTopicName(const std::string &json); + private: std::shared_ptr logger_; }; @@ -99,5 +98,3 @@ class ConvertJSONAck : public ConvertBase { } /* namespace nifi */ } /* namespace apache */ } /* namespace org */ - -#endif diff --git a/extensions/mqtt/processors/ConvertUpdate.cpp b/extensions/mqtt/processors/ConvertUpdate.cpp index 9f3b456..b759eef 100644 --- a/extensions/mqtt/processors/ConvertUpdate.cpp +++ b/extensions/mqtt/processors/ConvertUpdate.cpp @@ -15,6 +15,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#include +#include +#include +#include +#include + #include "ConvertUpdate.h" #include "utils/HTTPClient.h" #include "io/BaseStream.h" diff --git a/extensions/mqtt/processors/ConvertUpdate.h b/extensions/mqtt/processors/ConvertUpdate.h index d24e5d4..376232a 100644 --- a/extensions/mqtt/processors/ConvertUpdate.h +++ b/extensions/mqtt/processors/ConvertUpdate.h @@ -15,20 +15,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef EXTENSIONS_MQTT_PROTOCOL_CONVERTUPDATE_H_ -#define EXTENSIONS_MQTT_PROTOCOL_CONVERTUPDATE_H_ +#pragma once +#include +#include #include "MQTTControllerService.h" -#include "FlowFileRecord.h" -#include "core/Processor.h" #include "core/ProcessSession.h" #include "core/Core.h" -#include "core/Resource.h" #include "core/Property.h" #include "core/logging/LoggerConfiguration.h" -#include "MQTTClient.h" -#include "c2/protocols/RESTProtocol.h" #include "ConvertBase.h" namespace org { @@ -60,8 +56,7 @@ class ConvertUpdate : public ConvertBase { // Processor Name static constexpr char const* ProcessorName = "ConvertUpdate"; -public: - + public: /** * Initialization of the processor */ @@ -75,9 +70,10 @@ public: void onTrigger(const std::shared_ptr &context, const std::shared_ptr &session) override; -protected: + protected: std::shared_ptr ssl_context_service_; -private: + + private: std::shared_ptr logger_; }; @@ -86,5 +82,3 @@ private: } /* namespace nifi */ } /* namespace apache */ } /* namespace org */ - -#endif /* EXTENSIONS_MQTT_PROTOCOL_CONVERTUPDATE_H_ */ diff --git a/extensions/mqtt/processors/PublishMQTT.h b/extensions/mqtt/processors/PublishMQTT.h index 04368c7..710d597 100644 --- a/extensions/mqtt/processors/PublishMQTT.h +++ b/extensions/mqtt/processors/PublishMQTT.h @@ -17,8 +17,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef __PUBLISH_MQTT_H__ -#define __PUBLISH_MQTT_H__ +#pragma once + +#include +#include +#include #include @@ -151,5 +154,3 @@ REGISTER_RESOURCE(PublishMQTT, "PublishMQTT serializes FlowFile content as an MQ } /* namespace nifi */ } /* namespace apache */ } /* namespace org */ - -#endif diff --git a/extensions/mqtt/protocol/MQTTC2Protocol.cpp b/extensions/mqtt/protocol/MQTTC2Protocol.cpp index d50f8cb..7b0da5b 100644 --- a/extensions/mqtt/protocol/MQTTC2Protocol.cpp +++ b/extensions/mqtt/protocol/MQTTC2Protocol.cpp @@ -34,8 +34,9 @@ void MQTTC2Protocol::initialize(core::controller::ControllerServiceProvider* con if (configure->get("nifi.c2.mqtt.connector.service", controller_service_name_)) { auto service = controller->getControllerService(controller_service_name_); mqtt_service_ = std::static_pointer_cast(service); - } else + } else { mqtt_service_ = nullptr; + } agent_identifier_ = configure->getAgentIdentifier(); diff --git a/extensions/mqtt/protocol/MQTTC2Protocol.h b/extensions/mqtt/protocol/MQTTC2Protocol.h index 6b94ca6..0c9ff77 100644 --- a/extensions/mqtt/protocol/MQTTC2Protocol.h +++ b/extensions/mqtt/protocol/MQTTC2Protocol.h @@ -15,8 +15,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef EXTENSIONS_MQTT_PROTOCOL_MQTTC2PROTOCOL_H_ -#define EXTENSIONS_MQTT_PROTOCOL_MQTTC2PROTOCOL_H_ +#pragma once #include #include @@ -67,7 +66,6 @@ class MQTTC2Protocol : public C2Protocol { void initialize(core::controller::ControllerServiceProvider* controller, const std::shared_ptr &configure) override; protected: - C2Payload serialize(const C2Payload &payload); std::mutex input_mutex_; @@ -85,11 +83,9 @@ class MQTTC2Protocol : public C2Protocol { std::shared_ptr logger_; // mqtt controller serviec name. std::string controller_service_name_; - }; } /* namespace c2 */ } /* namespace minifi */ } /* namespace nifi */ } /* namespace apache */ } /* namespace org */ -#endif /* EXTENSIONS_MQTT_PROTOCOL_MQTTC2PROTOCOL_H_ */ diff --git a/extensions/opc/CMakeLists.txt b/extensions/opc/CMakeLists.txt index 4a51adf..a029143 100644 --- a/extensions/opc/CMakeLists.txt +++ b/extensions/opc/CMakeLists.txt @@ -35,3 +35,4 @@ target_link_libraries(minifi-opc-extensions ${CMAKE_DL_LIBS} spdlog open62541::o SET (OPC-EXTENSIONS minifi-opc-extensions PARENT_SCOPE) register_extension(minifi-opc-extensions) +register_extension_linter(minifi-opc-extensions-linter) diff --git a/extensions/opc/include/fetchopc.h b/extensions/opc/include/fetchopc.h index f4102c2..8e210cb 100644 --- a/extensions/opc/include/fetchopc.h +++ b/extensions/opc/include/fetchopc.h @@ -16,23 +16,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef NIFI_MINIFI_CPP_FetchOPCProcessor_H -#define NIFI_MINIFI_CPP_FetchOPCProcessor_H +#pragma once #include #include -#include #include #include -#include +#include #include "opc.h" #include "opcbase.h" -#include "utils/ByteArrayCallback.h" #include "FlowFileRecord.h" #include "core/Processor.h" #include "core/ProcessSession.h" -#include "core/Core.h" #include "core/Property.h" #include "core/Resource.h" #include "controllers/SSLContextService.h" @@ -47,7 +43,7 @@ namespace minifi { namespace processors { class FetchOPCProcessor : public BaseOPCProcessor { -public: + public: static constexpr char const* ProcessorName = "FetchOPC"; // Supported Properties static core::Property NodeIDType; @@ -60,7 +56,7 @@ public: static core::Relationship Success; static core::Relationship Failure; - FetchOPCProcessor(const std::string& name, const utils::Identifier& uuid = {}) + explicit FetchOPCProcessor(const std::string& name, const utils::Identifier& uuid = {}) : BaseOPCProcessor(name, uuid), nameSpaceIdx_(0), nodesFound_(0), variablesFound_(0), maxDepth_(0) { logger_ = logging::LoggerFactory::getLogger(); } @@ -71,7 +67,7 @@ public: void initialize(void) override; -protected: + protected: bool nodeFoundCallBack(opc::Client& client, const UA_ReferenceDescription *ref, const std::string& path, const std::shared_ptr &context, const std::shared_ptr &session); @@ -80,7 +76,7 @@ protected: class WriteCallback : public OutputStreamCallback { std::string data_; public: - WriteCallback(std::string&& data) + explicit WriteCallback(std::string&& data) : data_(data) { } int64_t process(const std::shared_ptr& stream) { @@ -96,7 +92,7 @@ protected: uint64_t maxDepth_; bool lazy_mode_; -private: + private: std::mutex onTriggerMutex_; std::vector translatedNodeIDs_; // Only used when user provides path, path->nodeid translation is only done once std::unordered_map node_timestamp_; // Key = Full path, Value = Timestamp @@ -109,5 +105,3 @@ REGISTER_RESOURCE(FetchOPCProcessor, "Fetches OPC-UA node"); } /* namespace nifi */ } /* namespace apache */ } /* namespace org */ - -#endif // NIFI_MINIFI_CPP_FetchOPCProcessor_H diff --git a/extensions/opc/include/opc.h b/extensions/opc/include/opc.h index 2cffe5a..9646f3d 100644 --- a/extensions/opc/include/opc.h +++ b/extensions/opc/include/opc.h @@ -16,18 +16,17 @@ */ -#ifndef NIFI_MINIFI_CPP_OPC_H -#define NIFI_MINIFI_CPP_OPC_H - -#include "open62541/client.h" -#include "open62541/client_highlevel.h" -#include "open62541/client_config_default.h" -#include "logging/Logger.h" -#include "Exception.h" +#pragma once #include #include #include +#include +#include + +#include "open62541/client.h" +#include "logging/Logger.h" +#include "Exception.h" namespace org { namespace apache { @@ -108,7 +107,7 @@ struct NodeData { private: UA_Variant* var_; - NodeData(UA_Variant * var = nullptr) { + explicit NodeData(UA_Variant * var = nullptr) { var_ = var; } void addVariant(UA_Variant * var) { @@ -140,5 +139,3 @@ void logFunc(void *context, UA_LogLevel level, UA_LogCategory category, const ch } /* namespace apache */ } /* namespace org */ - -#endif // NIFI_MINIFI_CPP_OPC_H diff --git a/extensions/opc/include/opcbase.h b/extensions/opc/include/opcbase.h index 54fc7f2..ea4dc46 100644 --- a/extensions/opc/include/opcbase.h +++ b/extensions/opc/include/opcbase.h @@ -17,10 +17,12 @@ * limitations under the License. */ -#ifndef NIFI_MINIFI_CPP_OPCBASE_H -#define NIFI_MINIFI_CPP_OPCBASE_H +#pragma once #include +#include +#include +#include #include "opc.h" #include "core/Processor.h" @@ -45,7 +47,7 @@ class BaseOPCProcessor : public core::Processor { static core::Property KeyPath; static core::Property TrustedPath; - BaseOPCProcessor(const std::string& name, const utils::Identifier& uuid = {}) + explicit BaseOPCProcessor(const std::string& name, const utils::Identifier& uuid = {}) : Processor(name, uuid) { } @@ -79,5 +81,3 @@ class BaseOPCProcessor : public core::Processor { } /* namespace nifi */ } /* namespace apache */ } /* namespace org */ - -#endif // NIFI_MINIFI_CPP_OPCBASE_H diff --git a/extensions/opc/include/putopc.h b/extensions/opc/include/putopc.h index c1d402a..7443361 100644 --- a/extensions/opc/include/putopc.h +++ b/extensions/opc/include/putopc.h @@ -17,23 +17,18 @@ * limitations under the License. */ -#ifndef NIFI_MINIFI_CPP_PUTOPC_H -#define NIFI_MINIFI_CPP_PUTOPC_H +#pragma once #include #include -#include -#include +#include #include -#include #include "opc.h" #include "opcbase.h" -#include "utils/ByteArrayCallback.h" #include "FlowFileRecord.h" #include "core/Processor.h" #include "core/ProcessSession.h" -#include "core/Core.h" #include "core/Property.h" #include "core/Resource.h" #include "controllers/SSLContextService.h" @@ -64,7 +59,7 @@ class PutOPCProcessor : public BaseOPCProcessor { static core::Relationship Success; static core::Relationship Failure; - PutOPCProcessor(const std::string& name, const utils::Identifier& uuid = {}) + explicit PutOPCProcessor(const std::string& name, const utils::Identifier& uuid = {}) : BaseOPCProcessor(name, uuid), nameSpaceIdx_(0), parentExists_(false) { logger_ = logging::LoggerFactory::getLogger(); } @@ -76,14 +71,13 @@ class PutOPCProcessor : public BaseOPCProcessor { void initialize(void) override; private: - class ReadCallback : public InputStreamCallback { - public: - ReadCallback(std::shared_ptr logger) : logger_(logger) {} + public: + explicit ReadCallback(std::shared_ptr logger) : logger_(logger) {} int64_t process(const std::shared_ptr& stream) override; const std::vector& getContent() const { return buf_; } - private: + private: std::vector buf_; std::shared_ptr logger_; }; @@ -107,5 +101,3 @@ REGISTER_RESOURCE(PutOPCProcessor, "Creates/updates OPC nodes"); } /* namespace nifi */ } /* namespace apache */ } /* namespace org */ - -#endif // NIFI_MINIFI_CPP_PUTOPC_H diff --git a/extensions/opc/src/fetchopc.cpp b/extensions/opc/src/fetchopc.cpp index b8ce1fd..3778215 100644 --- a/extensions/opc/src/fetchopc.cpp +++ b/extensions/opc/src/fetchopc.cpp @@ -207,8 +207,8 @@ namespace processors { variablesFound_++; } } catch (const std::exception& exception) { - std::string browsename((char*)ref->browseName.name.data, ref->browseName.name.length); - logger_->log_warn("Caught Exception while trying to get data from node %s: %s", path + "/" + browsename, exception.what()); + std::string browse_name(reinterpret_cast(ref->browseName.name.data), ref->browseName.name.length); + logger_->log_warn("Caught Exception while trying to get data from node %s: %s", path + "/" + browse_name, exception.what()); } } return true; diff --git a/extensions/opc/src/opc.cpp b/extensions/opc/src/opc.cpp index da86e79..a85d36b 100644 --- a/extensions/opc/src/opc.cpp +++ b/extensions/opc/src/opc.cpp @@ -15,23 +15,23 @@ * limitations under the License. */ -// OPC includes #include "opc.h" -// MiNiFi includes +#include +#include +#include +#include +#include + #include "utils/StringUtils.h" #include "logging/Logger.h" #include "Exception.h" #include "utils/gsl.h" -// Standard includes -#include -#include -#include -#include -#include -#include +#include "open62541/client_highlevel.h" +#include "open62541/client_config_default.h" + namespace org { namespace apache { @@ -45,70 +45,70 @@ namespace opc { namespace { - void add_value_to_variant(UA_Variant *variant, std::string &value) { - UA_String ua_value = UA_STRING(&value[0]); - UA_Variant_setScalarCopy(variant, &ua_value, &UA_TYPES[UA_TYPES_STRING]); - } +void add_value_to_variant(UA_Variant *variant, std::string &value) { + UA_String ua_value = UA_STRING(&value[0]); + UA_Variant_setScalarCopy(variant, &ua_value, &UA_TYPES[UA_TYPES_STRING]); +} - void add_value_to_variant(UA_Variant *variant, const char *value) { - std::string strvalue(value); - add_value_to_variant(variant, strvalue); - } +void add_value_to_variant(UA_Variant *variant, const char *value) { + std::string strvalue(value); + add_value_to_variant(variant, strvalue); +} - void add_value_to_variant(UA_Variant *variant, int64_t value) { - UA_Int64 ua_value = value; - UA_Variant_setScalarCopy(variant, &ua_value, &UA_TYPES[UA_TYPES_INT64]); - } +void add_value_to_variant(UA_Variant *variant, int64_t value) { + UA_Int64 ua_value = value; + UA_Variant_setScalarCopy(variant, &ua_value, &UA_TYPES[UA_TYPES_INT64]); +} - void add_value_to_variant(UA_Variant *variant, uint64_t value) { - UA_UInt64 ua_value = value; - UA_Variant_setScalarCopy(variant, &ua_value, &UA_TYPES[UA_TYPES_UINT64]); - } +void add_value_to_variant(UA_Variant *variant, uint64_t value) { + UA_UInt64 ua_value = value; + UA_Variant_setScalarCopy(variant, &ua_value, &UA_TYPES[UA_TYPES_UINT64]); +} - void add_value_to_variant(UA_Variant *variant, int32_t value) { - UA_Int32 ua_value = value; - UA_Variant_setScalarCopy(variant, &ua_value, &UA_TYPES[UA_TYPES_INT32]); - } +void add_value_to_variant(UA_Variant *variant, int32_t value) { + UA_Int32 ua_value = value; + UA_Variant_setScalarCopy(variant, &ua_value, &UA_TYPES[UA_TYPES_INT32]); +} - void add_value_to_variant(UA_Variant *variant, uint32_t value) { - UA_UInt32 ua_value = value; - UA_Variant_setScalarCopy(variant, &ua_value, &UA_TYPES[UA_TYPES_UINT32]); - } +void add_value_to_variant(UA_Variant *variant, uint32_t value) { + UA_UInt32 ua_value = value; + UA_Variant_setScalarCopy(variant, &ua_value, &UA_TYPES[UA_TYPES_UINT32]); +} - void add_value_to_variant(UA_Variant *variant, bool value) { - UA_Boolean ua_value = value; - UA_Variant_setScalarCopy(variant, &ua_value, &UA_TYPES[UA_TYPES_BOOLEAN]); - } +void add_value_to_variant(UA_Variant *variant, bool value) { + UA_Boolean ua_value = value; + UA_Variant_setScalarCopy(variant, &ua_value, &UA_TYPES[UA_TYPES_BOOLEAN]); +} - void add_value_to_variant(UA_Variant *variant, float value) { - UA_Float ua_value = value; - UA_Variant_setScalarCopy(variant, &ua_value, &UA_TYPES[UA_TYPES_FLOAT]); - } +void add_value_to_variant(UA_Variant *variant, float value) { + UA_Float ua_value = value; + UA_Variant_setScalarCopy(variant, &ua_value, &UA_TYPES[UA_TYPES_FLOAT]); +} - void add_value_to_variant(UA_Variant *variant, double value) { - UA_Double ua_value = value; - UA_Variant_setScalarCopy(variant, &ua_value, &UA_TYPES[UA_TYPES_DOUBLE]); - } +void add_value_to_variant(UA_Variant *variant, double value) { + UA_Double ua_value = value; + UA_Variant_setScalarCopy(variant, &ua_value, &UA_TYPES[UA_TYPES_DOUBLE]); +} - core::logging::LOG_LEVEL MapOPCLogLevel(UA_LogLevel ualvl) { - switch (ualvl) { - case UA_LOGLEVEL_TRACE: - return core::logging::trace; - case UA_LOGLEVEL_DEBUG: - return core::logging::debug; - case UA_LOGLEVEL_INFO: - return core::logging::info; - case UA_LOGLEVEL_WARNING: - return core::logging::warn; - case UA_LOGLEVEL_ERROR: - return core::logging::err; - case UA_LOGLEVEL_FATAL: - return core::logging::critical; - default: - return core::logging::critical; - } +core::logging::LOG_LEVEL MapOPCLogLevel(UA_LogLevel ualvl) { + switch (ualvl) { + case UA_LOGLEVEL_TRACE: + return core::logging::trace; + case UA_LOGLEVEL_DEBUG: + return core::logging::debug; + case UA_LOGLEVEL_INFO: + return core::logging::info; + case UA_LOGLEVEL_WARNING: + return core::logging::warn; + case UA_LOGLEVEL_ERROR: + return core::logging::err; + case UA_LOGLEVEL_FATAL: + return core::logging::critical; + default: + return core::logging::critical; } } +} // namespace /* * End of internal functions @@ -127,13 +127,13 @@ Client::Client(std::shared_ptr logger, const std::string& // Certificate UA_ByteString certByteString = UA_STRING_NULL; certByteString.length = certBuffer.size(); - certByteString.data = (UA_Byte*)UA_malloc(certByteString.length * sizeof(UA_Byte)); + certByteString.data = reinterpret_cast(UA_malloc(certByteString.length * sizeof(UA_Byte))); memcpy(certByteString.data, certBuffer.data(), certByteString.length); // Key UA_ByteString keyByteString = UA_STRING_NULL; keyByteString.length = keyBuffer.size(); - keyByteString.data = (UA_Byte*)UA_malloc(keyByteString.length * sizeof(UA_Byte)); + keyByteString.data = reinterpret_cast(UA_malloc(keyByteString.length * sizeof(UA_Byte))); memcpy(keyByteString.data, keyBuffer.data(), keyByteString.length); // Trusted certificates @@ -142,7 +142,7 @@ Client::Client(std::shared_ptr logger, const std::string& for (size_t i = 0; i < trustBuffers.size(); i++) { trustList[i] = UA_STRING_NULL; trustList[i].length = trustBuffers[i].size(); - trustList[i].data = (UA_Byte*)UA_malloc(trustList[i].length * sizeof(UA_Byte)); + trustList[i].data = reinterpret_cast(UA_malloc(trustList[i].length * sizeof(UA_Byte))); memcpy(trustList[i].data, trustBuffers[i].data(), trustList[i].length); } UA_StatusCode sc = UA_ClientConfig_setDefaultEncryption(cc, certByteString, keyByteString, @@ -313,8 +313,8 @@ void Client::traverse(UA_NodeId nodeId, std::function cb, UA_ReferenceDescription *ref = &(bResp.results[i].references[j]); if (cb(*this, ref, basePath)) { if (ref->nodeClass == UA_NODECLASS_VARIABLE || ref->nodeClass == UA_NODECLASS_OBJECT) { - std::string browsename((char *) ref->browseName.name.data, ref->browseName.name.length); - traverse(ref->nodeId.nodeId, cb, basePath + browsename, maxDepth, false); + std::string browse_name(reinterpret_cast(ref->browseName.name.data), ref->browseName.name.length); + traverse(ref->nodeId.nodeId, cb, basePath + browse_name, maxDepth, false); } } else { return; @@ -347,7 +347,7 @@ UA_StatusCode Client::translateBrowsePathsToNodeIdsRequest(const std::string& pa UA_BrowsePath_init(&browsePath); browsePath.startingNode = UA_NODEID_NUMERIC(0, UA_NS0ID_OBJECTSFOLDER); - browsePath.relativePath.elements = (UA_RelativePathElement*)UA_Array_new(tokens.size(), &UA_TYPES[UA_TYPES_RELATIVEPATHELEMENT]); + browsePath.relativePath.elements = reinterpret_cast(UA_Array_new(tokens.size(), &UA_TYPES[UA_TYPES_RELATIVEPATHELEMENT])); browsePath.relativePath.elementsSize = tokens.size(); for (size_t i = 0; i < tokens.size(); ++i) { @@ -381,7 +381,7 @@ UA_StatusCode Client::translateBrowsePathsToNodeIdsRequest(const std::string& pa UA_NodeId resultId; UA_NodeId_copy(&res.targets[j].targetId.nodeId, &resultId); foundNodeIDs.push_back(resultId); - std::string namespaceUri((char*)res.targets[j].targetId.namespaceUri.data, res.targets[j].targetId.namespaceUri.length); + std::string namespaceUri(reinterpret_cast(res.targets[j].targetId.namespaceUri.data), res.targets[j].targetId.namespaceUri.length); } } @@ -450,8 +450,10 @@ template UA_StatusCode Client::add_node(const UA_NodeId parentNodeId, template UA_StatusCode Client::add_node(const UA_NodeId parentNodeId, const UA_NodeId targetNodeId, std::string browseName, float value, OPCNodeDataType dt, UA_NodeId *receivedNodeId); template UA_StatusCode Client::add_node(const UA_NodeId parentNodeId, const UA_NodeId targetNodeId, std::string browseName, double value, OPCNodeDataType dt, UA_NodeId *receivedNodeId); template UA_StatusCode Client::add_node(const UA_NodeId parentNodeId, const UA_NodeId targetNodeId, std::string browseName, bool value, OPCNodeDataType dt, UA_NodeId *receivedNodeId); -template UA_StatusCode Client::add_node(const UA_NodeId parentNodeId, const UA_NodeId targetNodeId, std::string browseName, const char * value, OPCNodeDataType dt, UA_NodeId *receivedNodeId); -template UA_StatusCode Client::add_node(const UA_NodeId parentNodeId, const UA_NodeId targetNodeId, std::string browseName, std::string value, OPCNodeDataType dt, UA_NodeId *receivedNodeId); +template UA_StatusCode Client::add_node(const UA_NodeId parentNodeId, const UA_NodeId targetNodeId, std::string browseName, + const char * value, OPCNodeDataType dt, UA_NodeId *receivedNodeId); +template UA_StatusCode Client::add_node(const UA_NodeId parentNodeId, const UA_NodeId targetNodeId, std::string browseName, + std::string value, OPCNodeDataType dt, UA_NodeId *receivedNodeId); int32_t OPCNodeDataTypeToTypeID(OPCNodeDataType dt) { switch (dt) { @@ -482,7 +484,7 @@ std::string nodeValue2String(const NodeData& nd) { case UA_TYPES_STRING: case UA_TYPES_LOCALIZEDTEXT: case UA_TYPES_BYTESTRING: { - UA_String value = *(UA_String *)(nd.var_->data); + UA_String value = *reinterpret_cast(nd.var_->data); ret_val = std::string(reinterpret_cast(value.data), value.length); break; } @@ -572,7 +574,7 @@ std::string OPCDateTime2String(UA_DateTime raw_date) { void logFunc(void *context, UA_LogLevel level, UA_LogCategory /*category*/, const char *msg, va_list args) { char buffer[1024]; - vsnprintf(buffer, 1024, msg, args); + vsnprintf(buffer, sizeof buffer, msg, args); auto loggerPtr = reinterpret_cast(context); loggerPtr->log_string(MapOPCLogLevel(level), buffer); } diff --git a/extensions/opencv/CMakeLists.txt b/extensions/opencv/CMakeLists.txt index 49d5e99..c1fcd84 100644 --- a/extensions/opencv/CMakeLists.txt +++ b/extensions/opencv/CMakeLists.txt @@ -75,4 +75,5 @@ target_link_libraries(minifi-opencv ${OpenCV_LIBS}) include_directories(${OpenCV_INCLUDE_DIRS}) SET (OPENCV-EXTENSION minifi-opencv PARENT_SCOPE) -register_extension(minifi-opencv) \ No newline at end of file +register_extension(minifi-opencv) +register_extension_linter(minifi-opencv-linter) diff --git a/extensions/opencv/CaptureRTSPFrame.cpp b/extensions/opencv/CaptureRTSPFrame.cpp index e3c69da..dc241ba 100644 --- a/extensions/opencv/CaptureRTSPFrame.cpp +++ b/extensions/opencv/CaptureRTSPFrame.cpp @@ -14,6 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#include #include "CaptureRTSPFrame.h" @@ -30,32 +31,31 @@ static core::Property rtspURI; static core::Property captureFrameRate; static core::Property imageEncoding; -core::Property CaptureRTSPFrame::RTSPUsername( // NOLINT +core::Property CaptureRTSPFrame::RTSPUsername( "RTSP Username", "The username for connecting to the RTSP stream", ""); -core::Property CaptureRTSPFrame::RTSPPassword( // NOLINT +core::Property CaptureRTSPFrame::RTSPPassword( "RTSP Password", "Password used to connect to the RTSP stream", ""); -core::Property CaptureRTSPFrame::RTSPHostname( // NOLINT +core::Property CaptureRTSPFrame::RTSPHostname( "RTSP Hostname", "Hostname of the RTSP stream we are trying to connect to", ""); -core::Property CaptureRTSPFrame::RTSPURI( // NOLINT +core::Property CaptureRTSPFrame::RTSPURI( "RTSP URI", "URI that should be appended to the RTSP stream hostname", ""); -core::Property CaptureRTSPFrame::RTSPPort( // NOLINT +core::Property CaptureRTSPFrame::RTSPPort( "RTSP Port", "Port that should be connected to to receive RTSP Frames", ""); -core::Property CaptureRTSPFrame::ImageEncoding( // NOLINT +core::Property CaptureRTSPFrame::ImageEncoding( "Image Encoding", "The encoding that should be applied the the frame images captured from the RTSP stream", - ".jpg" - ); + ".jpg"); -core::Relationship CaptureRTSPFrame::Success( // NOLINT +core::Relationship CaptureRTSPFrame::Success( "success", "Successful capture of RTSP frame"); -core::Relationship CaptureRTSPFrame::Failure( // NOLINT +core::Relationship CaptureRTSPFrame::Failure( "failure", "Failures to capture RTSP frame"); diff --git a/extensions/opencv/CaptureRTSPFrame.h b/extensions/opencv/CaptureRTSPFrame.h index 0262478..3c16743 100644 --- a/extensions/opencv/CaptureRTSPFrame.h +++ b/extensions/opencv/CaptureRTSPFrame.h @@ -15,18 +15,22 @@ * limitations under the License. */ -#ifndef NIFI_MINIFI_CPP_CAPTURERTSPFRAME_H -#define NIFI_MINIFI_CPP_CAPTURERTSPFRAME_H +#pragma once #include #include #include +#include +#include +#include +#include #include #include "core/Resource.h" #include "core/Processor.h" #include "utils/gsl.h" + namespace org { namespace apache { namespace nifi { @@ -35,7 +39,6 @@ namespace processors { class CaptureRTSPFrame : public core::Processor { public: - explicit CaptureRTSPFrame(const std::string &name, const utils::Identifier &uuid = {}) : Processor(name, uuid), logger_(logging::LoggerFactory::getLogger()) { @@ -63,8 +66,8 @@ class CaptureRTSPFrame : public core::Processor { class CaptureRTSPFrameWriteCallback : public OutputStreamCallback { public: - explicit CaptureRTSPFrameWriteCallback(cv::Mat image_mat, std::string image_encoding_) - : image_mat_(std::move(image_mat)), image_encoding_(image_encoding_) { + explicit CaptureRTSPFrameWriteCallback(cv::Mat image_mat, std::string image_encoding) + : image_mat_(std::move(image_mat)), image_encoding_(image_encoding) { } ~CaptureRTSPFrameWriteCallback() override = default; @@ -135,6 +138,3 @@ REGISTER_RESOURCE(CaptureRTSPFrame, "Captures a frame from the RTSP stream at sp } /* namespace nifi */ } /* namespace apache */ } /* namespace org */ - - -#endif // NIFI_MINIFI_CPP_CAPTURERTSPFRAME_H diff --git a/extensions/opencv/FrameIO.h b/extensions/opencv/FrameIO.h index fa8d192..0f8b4e1 100644 --- a/extensions/opencv/FrameIO.h +++ b/extensions/opencv/FrameIO.h @@ -15,8 +15,12 @@ * limitations under the License. */ -#ifndef NIFI_MINIFI_CPP_FRAMEIO_H -#define NIFI_MINIFI_CPP_FRAMEIO_H +#pragma once + +#include +#include +#include +#include #include "utils/gsl.h" @@ -27,46 +31,45 @@ namespace minifi { namespace opencv { class FrameWriteCallback : public OutputStreamCallback { - public: - explicit FrameWriteCallback(cv::Mat image_mat, std::string image_encoding_) - // TODO - Nghia: Check std::move(img_mat). - : image_mat_(std::move(image_mat)), image_encoding_(image_encoding_) { - } - ~FrameWriteCallback() override = default; + public: + explicit FrameWriteCallback(cv::Mat image_mat, std::string image_encoding) + : image_mat_(std::move(image_mat)), image_encoding_(image_encoding) { + } + ~FrameWriteCallback() override = default; - int64_t process(const std::shared_ptr& stream) override { - imencode(image_encoding_, image_mat_, image_buf_); - const auto ret = stream->write(image_buf_.data(), image_buf_.size()); - return io::isError(ret) ? -1 : gsl::narrow(ret); - } + int64_t process(const std::shared_ptr& stream) override { + imencode(image_encoding_, image_mat_, image_buf_); + const auto ret = stream->write(image_buf_.data(), image_buf_.size()); + return io::isError(ret) ? -1 : gsl::narrow(ret); + } - private: - std::vector image_buf_; - cv::Mat image_mat_; - std::string image_encoding_; + private: + std::vector image_buf_; + cv::Mat image_mat_; + std::string image_encoding_; }; class FrameReadCallback : public InputStreamCallback { - public: - explicit FrameReadCallback(cv::Mat &image_mat) - : image_mat_(image_mat) { - } - ~FrameReadCallback() override = default; + public: + explicit FrameReadCallback(cv::Mat &image_mat) + : image_mat_(image_mat) { + } + ~FrameReadCallback() override = default; - int64_t process(const std::shared_ptr& stream) override { - int64_t ret = 0; - image_buf_.resize(stream->size()); - ret = stream->read(image_buf_.data(), static_cast(stream->size())); - if (ret < 0 || static_cast(ret) != stream->size()) { - throw std::runtime_error("ImageReadCallback failed to fully read flow file input stream"); - } - image_mat_ = cv::imdecode(image_buf_, -1); - return ret; + int64_t process(const std::shared_ptr& stream) override { + int64_t ret = 0; + image_buf_.resize(stream->size()); + ret = stream->read(image_buf_.data(), static_cast(stream->size())); + if (ret < 0 || static_cast(ret) != stream->size()) { + throw std::runtime_error("ImageReadCallback failed to fully read flow file input stream"); } + image_mat_ = cv::imdecode(image_buf_, -1); + return ret; + } - private: - std::vector image_buf_; - cv::Mat &image_mat_; + private: + std::vector image_buf_; + cv::Mat &image_mat_; }; } /* namespace opencv */ @@ -74,5 +77,3 @@ class FrameReadCallback : public InputStreamCallback { } /* namespace nifi */ } /* namespace apache */ } /* namespace org */ - -#endif // NIFI_MINIFI_CPP_FRAMEIO_H diff --git a/extensions/opencv/MotionDetector.cpp b/extensions/opencv/MotionDetector.cpp index 1888a6c..d67b47a 100644 --- a/extensions/opencv/MotionDetector.cpp +++ b/extensions/opencv/MotionDetector.cpp @@ -15,7 +15,12 @@ * limitations under the License. */ +#include +#include +#include + #include "MotionDetector.h" +#include "FrameIO.h" namespace org { namespace apache { diff --git a/extensions/opencv/MotionDetector.h b/extensions/opencv/MotionDetector.h index 0cee7d3..95a7404 100644 --- a/extensions/opencv/MotionDetector.h +++ b/extensions/opencv/MotionDetector.h @@ -15,20 +15,16 @@ * limitations under the License. */ -#ifndef NIFI_MINIFI_CPP_MOTIONDETECTOR_H -#define NIFI_MINIFI_CPP_MOTIONDETECTOR_H - -#include - -#include -#include -#include -#include -#include -#include "FrameIO.h" +#pragma once #include -#include +#include +#include + +#include "core/Resource.h" +#include "core/Processor.h" +#include "opencv2/opencv.hpp" +#include "opencv2/imgproc.hpp" namespace org { namespace apache { @@ -38,7 +34,6 @@ namespace processors { class MotionDetector : public core::Processor { public: - explicit MotionDetector(const std::string &name, const utils::Identifier &uuid = {}) : Processor(name, uuid), logger_(logging::LoggerFactory::getLogger()) { @@ -60,7 +55,6 @@ class MotionDetector : public core::Processor { void notifyStop() override; private: - bool detectAndDraw(cv::Mat &frame); std::shared_ptr logger_; @@ -76,12 +70,10 @@ class MotionDetector : public core::Processor { const double IMG_WIDTH = 500.0; }; -REGISTER_RESOURCE(MotionDetector, "Detect motion from captured images."); // NOLINT +REGISTER_RESOURCE(MotionDetector, "Detect motion from captured images."); } /* namespace processors */ } /* namespace minifi */ } /* namespace nifi */ } /* namespace apache */ } /* namespace org */ - -#endif // NIFI_MINIFI_CPP_MOTIONDETECTOR_H diff --git a/extensions/opencv/OpenCVLoader.h b/extensions/opencv/OpenCVLoader.h index 516b87f..84ae4a3 100644 --- a/extensions/opencv/OpenCVLoader.h +++ b/extensions/opencv/OpenCVLoader.h @@ -15,8 +15,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef EXTENSIONS_OPENCVLOADER_H_ -#define EXTENSIONS_OPENCVLOADER_H_ +#pragma once + +#include +#include +#include #include "CaptureRTSPFrame.h" #include "core/ClassLoader.h" @@ -70,7 +73,7 @@ class OpenCVObjectFactory : public core::ObjectFactory { } } - virtual std::unique_ptr getInitializer() override { + std::unique_ptr getInitializer() override { return std::unique_ptr(new OpenCVObjectFactoryInitializer()); } @@ -80,4 +83,3 @@ class OpenCVObjectFactory : public core::ObjectFactory { extern "C" { DLL_EXPORT void *createOpenCVFactory(void); } -#endif /* EXTENSIONS_OPENCVLOADER_H_ */ diff --git a/extensions/opencv/tests/CaptureRTSPFrameTest.cpp b/extensions/opencv/tests/CaptureRTSPFrameTest.cpp index fd7e67c..bd74116 100644 --- a/extensions/opencv/tests/CaptureRTSPFrameTest.cpp +++ b/extensions/opencv/tests/CaptureRTSPFrameTest.cpp @@ -37,7 +37,7 @@ #include "processors/LogAttribute.h" #include "../../../libminifi/test/unit/ProvenanceTestHelper.h" -// TODO: valid capture test needs to be fixed +// TODO(_): valid capture test needs to be fixed TEST_CASE("CaptureRTSPFrame::ValidCapture", "[!mayfail]") { TestController testController; diff --git a/extensions/openwsman/CMakeLists.txt b/extensions/openwsman/CMakeLists.txt index a9470d3..0903ba1 100644 --- a/extensions/openwsman/CMakeLists.txt +++ b/extensions/openwsman/CMakeLists.txt @@ -30,3 +30,4 @@ target_link_libraries(minifi-openwsman OpenWSMAN::libwsman CIVETWEB::civetweb-cp SET (OPENWSMAN-EXTENSION minifi-openwsman PARENT_SCOPE) register_extension(minifi-openwsman) +register_extension_linter(minifi-openwsman-linter) diff --git a/extensions/openwsman/processors/SourceInitiatedSubscriptionListener.h b/extensions/openwsman/processors/SourceInitiatedSubscriptionListener.h index 1798d33..8f1c57e 100644 --- a/extensions/openwsman/processors/SourceInitiatedSubscriptionListener.h +++ b/extensions/openwsman/processors/SourceInitiatedSubscriptionListener.h @@ -15,8 +15,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef __SOURCE_INITIATED_SUBSCRIPTION_PROCESSOR_H__ -#define __SOURCE_INITIATED_SUBSCRIPTION_PROCESSOR_H__ +#pragma once #include #include @@ -169,5 +168,3 @@ REGISTER_RESOURCE(SourceInitiatedSubscriptionListener, "This processor implement } /* namespace nifi */ } /* namespace apache */ } /* namespace org */ - -#endif // __SOURCE_INITIATED_SUBSCRIPTION_PROCESSOR_H__ diff --git a/extensions/pcap/CMakeLists.txt b/extensions/pcap/CMakeLists.txt index 4698dd0..2d9f58b 100644 --- a/extensions/pcap/CMakeLists.txt +++ b/extensions/pcap/CMakeLists.txt @@ -19,7 +19,7 @@ find_package(PCAP REQUIRED) -include(${CMAKE_SOURCE_DIR}/extensions/ExtensionHeader.txt) +include(${CMAKE_SOURCE_DIR}/extensions/ExtensionHeader.txt) include_directories(/usr/include/netinet) @@ -67,4 +67,4 @@ target_link_libraries(minifi-pcap ${LIBMINIFI} Threads::Threads) SET (PCAP-EXTENSION minifi-pcap PARENT_SCOPE) register_extension(minifi-pcap) - +register_extension_linter(minifi-pcap-linter) diff --git a/extensions/pcap/CapturePacket.cpp b/extensions/pcap/CapturePacket.cpp index 8ab435b..33cf5d1 100644 --- a/extensions/pcap/CapturePacket.cpp +++ b/extensions/pcap/CapturePacket.cpp @@ -51,11 +51,18 @@ namespace minifi { namespace processors { std::shared_ptr CapturePacket::id_generator_ = utils::IdGenerator::getIdGenerator(); -core::Property CapturePacket::BaseDir(core::PropertyBuilder::createProperty("Base Directory")->withDescription("Scratch directory for PCAP files")->withDefaultValue("/tmp/")->build()); +core::Property CapturePacket::BaseDir(core::PropertyBuilder::createProperty("Base Directory") + ->withDescription("Scratch directory for PCAP files") + ->withDefaultValue("/tmp/")->build()); + +core::Property CapturePacket::BatchSize(core::PropertyBuilder::createProperty("Batch Size") + ->withDescription("The number of packets to combine within a given PCAP") + ->withDefaultValue(50)->build()); -core::Property CapturePacket::BatchSize(core::PropertyBuilder::createProperty("Batch Size")->withDescription("The number of packets to combine within a given PCAP")->withDefaultValue(50)->build()); core::Property CapturePacket::NetworkControllers("Network Controllers", "Regular expression of the network controller(s) to which we will attach", ".*"); -core::Property CapturePacket::CaptureBluetooth(core::PropertyBuilder::createProperty("Capture Bluetooth")->withDescription("True indicates that we support bluetooth interfaces")->withDefaultValue(false)->build()); +core::Property CapturePacket::CaptureBluetooth(core::PropertyBuilder::createProperty("Capture Bluetooth") + ->withDescription("True indicates that we support bluetooth interfaces") + ->withDefaultValue(false)->build()); const char *CapturePacket::ProcessorName = "CapturePacket"; diff --git a/extensions/pcap/CapturePacket.h b/extensions/pcap/CapturePacket.h index 860c549..c6ce10c 100644 --- a/extensions/pcap/CapturePacket.h +++ b/extensions/pcap/CapturePacket.h @@ -16,11 +16,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef EXTENSIONS_CAPTUREPACKET_H -#define EXTENSIONS_CAPTUREPACKET_H +#pragma once #include #include +#include +#include #include "PcapLiveDeviceList.h" #include "PcapFilter.h" @@ -73,15 +74,16 @@ class CapturePacketMechanism { return file_; } - long getSize() const { + int64_t getSize() const { return atomic_count_; } + protected: CapturePacketMechanism &operator=(const CapturePacketMechanism &other) = delete; std::string path_; std::string file_; int64_t *max_size_; - std::atomic atomic_count_; + std::atomic atomic_count_; }; struct PacketMovers { @@ -92,7 +94,6 @@ struct PacketMovers { // CapturePacket Class class CapturePacket : public core::Processor { public: - // Constructor /*! * Create a new processor @@ -122,7 +123,6 @@ class CapturePacket : public core::Processor { static void packet_callback(pcpp::RawPacket* packet, pcpp::PcapLiveDevice* dev, void* data); protected: - void notifyStop() override { logger_->log_debug("Stopping capture"); for (auto dev : device_list_) { @@ -149,7 +149,6 @@ class CapturePacket : public core::Processor { static CapturePacketMechanism *create_new_capture(const std::string &base_path, int64_t *max_size); private: - inline std::string getPath() { return base_dir_ + "/" + base_path_; } @@ -174,5 +173,3 @@ REGISTER_RESOURCE(CapturePacket, "CapturePacket captures and writes one or more } /* namespace nifi */ } /* namespace apache */ } /* namespace org */ - -#endif /* EXTENSIONS_CAPTUREPACKET_H */ diff --git a/extensions/pcap/PcapLoader.h b/extensions/pcap/PcapLoader.h index d361799..5b7c47d 100644 --- a/extensions/pcap/PcapLoader.h +++ b/extensions/pcap/PcapLoader.h @@ -15,8 +15,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef EXTENSIONS_PCAPLOADER_H -#define EXTENSIONS_PCAPLOADER_H +#pragma once + +#include +#include +#include #include "core/ClassLoader.h" #include "CapturePacket.h" @@ -61,4 +64,3 @@ class PcapFactory : public core::ObjectFactory { extern "C" { DLL_EXPORT void *createPcapFactory(void); } -#endif /* EXTENSIONS_PCAPLOADER_H */ diff --git a/libminifi/include/io/validation.h b/libminifi/include/io/validation.h index da21d8b..eea0fde 100644 --- a/libminifi/include/io/validation.h +++ b/libminifi/include/io/validation.h @@ -22,6 +22,7 @@ #include #include #include +#include /** * A checker that will, at compile time, tell us diff --git a/libminifi/test/archive-tests/ManipulateArchiveTests.cpp b/libminifi/test/archive-tests/ManipulateArchiveTests.cpp index 0657c9f..ff83482 100644 --- a/libminifi/test/archive-tests/ManipulateArchiveTests.cpp +++ b/libminifi/test/archive-tests/ManipulateArchiveTests.cpp @@ -16,9 +16,7 @@ * limitations under the License. */ -#include #include -#include #include #include #include @@ -30,6 +28,8 @@ #include "processors/LogAttribute.h" #include "processors/PutFile.h" #include "ManipulateArchive.h" +#include "FocusArchiveEntry.h" +#include "UnfocusArchiveEntry.h" const char TEST_ARCHIVE_NAME[] = "manipulate_test_archive.tar"; const int NUM_FILES = 3;