Github user achristianson commented on a diff in the pull request:
https://github.com/apache/nifi-minifi-cpp/pull/158#discussion_r147858424
--- Diff: extensions/http-curl/sitetosite/HTTPProtocol.h ---
@@ -0,0 +1,197 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __SITE2SITE_CLIENT_PROTOCOL_H__
+#define __SITE2SITE_CLIENT_PROTOCOL_H__
+
+#include <stdio.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <fcntl.h>
+#include <netdb.h>
+#include <string>
+#include <errno.h>
+#include <chrono>
+#include <set>
+#include <thread>
+#include <algorithm>
+#include <uuid/uuid.h>
+#include "HTTPTransaction.h"
+#include "sitetosite/SiteToSite.h"
+#include "sitetosite/SiteToSiteClient.h"
+#include "core/Property.h"
+#include "properties/Configure.h"
+#include "FlowFileRecord.h"
+#include "core/logging/LoggerConfiguration.h"
+#include "core/ProcessContext.h"
+#include "core/ProcessSession.h"
+#include "io/CRCStream.h"
+#include "sitetosite/Peer.h"
+#include "utils/Id.h"
+#include "../client/HTTPClient.h"
+
+
+namespace org {
+namespace apache {
+namespace nifi {
+namespace minifi {
+namespace sitetosite {
+
+/**
+ * Site2Site Peer
+ */
+typedef struct Site2SitePeerStatus {
+ std::string host_;
+ int port_;bool isSecure_;
+} Site2SitePeerStatus;
+
+// HttpSiteToSiteClient Class
+class HttpSiteToSiteClient : public sitetosite::SiteToSiteClient {
+
+ static constexpr char const* PROTOCOL_VERSION_HEADER =
"x-nifi-site-to-site-protocol-version";
+ public:
+
+ /*!
+ * Create a new http protocol
+ */
+ HttpSiteToSiteClient(std::string name, uuid_t uuid = 0)
+ : SiteToSiteClient(),
+ current_code(UNRECOGNIZED_RESPONSE_CODE),
+ logger_(logging::LoggerFactory<HttpSiteToSiteClient>::getLogger())
{
+ peer_state_ = READY;
+ }
+
+ /*!
+ * Create a new http protocol
+ */
+ HttpSiteToSiteClient(std::unique_ptr<SiteToSitePeer> peer)
+ : SiteToSiteClient(),
+ current_code(UNRECOGNIZED_RESPONSE_CODE),
+ logger_(logging::LoggerFactory<HttpSiteToSiteClient>::getLogger())
{
+ peer_ = std::move(peer);
+ peer_state_ = READY;
+ }
+ // Destructor
+ virtual ~HttpSiteToSiteClient() {
+
+ }
+
+ void setPeer(std::unique_ptr<SiteToSitePeer> peer) {
+ peer_ = std::move(peer);
+ }
+
+ virtual bool getPeerList(std::vector<PeerStatus> &peers);
--- End diff --
New c++ idiom is to mark this override rather than virtual. Helps better
express intent and catch bugs at compile time.
---