phrocker commented on a change in pull request #482: Minificpp 658 - Port Raw 
Site to Site to C
URL: https://github.com/apache/nifi-minifi-cpp/pull/482#discussion_r260494014
 
 

 ##########
 File path: nanofi/include/sitetosite/CRawSocketProtocol.h
 ##########
 @@ -0,0 +1,198 @@
+/**
+ * @file RawSiteToSiteClient.h
+ * RawSiteToSiteClient class declaration
+ *
+ * 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 __CSITE2SITE_CLIENT_PROTOCOL_H__
+#define __CSITE2SITE_CLIENT_PROTOCOL_H__
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <uuid/uuid.h>
+
+#include "api/nanofi.h"
+#include "CSiteToSite.h"
+#include "CPeer.h"
+
+#include "uthash.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define DESCRIPTION_BUFFER_SIZE 2048
+
+struct CRawSiteToSiteClient;
+
+int readResponse(struct CRawSiteToSiteClient* client, RespondCode *code);
+
+int writeResponse(struct CRawSiteToSiteClient* client, RespondCode code, const 
char * message);
+
+int readRequestType(struct CRawSiteToSiteClient* client, RequestType *type);
+
+int writeRequestType(struct CRawSiteToSiteClient* client, RequestType type);
+
+void tearDown(struct CRawSiteToSiteClient* client);
+
+int initiateResourceNegotiation(struct CRawSiteToSiteClient* client);
+
+int initiateCodecResourceNegotiation(struct CRawSiteToSiteClient* client);
+
+int negotiateCodec(struct CRawSiteToSiteClient* client);
+
+int establish(struct CRawSiteToSiteClient* client);
+
+void addTransaction(struct CRawSiteToSiteClient * client, CTransaction * 
transaction);
+
+CTransaction * findTransaction(const struct CRawSiteToSiteClient * client, 
const char * id);
+
+void deleteTransaction(struct CRawSiteToSiteClient * client, const char * id);
+
+void clearTransactions(struct CRawSiteToSiteClient * client);
+
+int handShake(struct CRawSiteToSiteClient * client);
+
+int bootstrap(struct CRawSiteToSiteClient * client);
+
+int complete(struct CRawSiteToSiteClient * client, const char * transactionID);
+
+int confirm(struct CRawSiteToSiteClient * client, const char * transactionID);
+
+int transmitPayload(struct CRawSiteToSiteClient * client, const char * 
payload, const attribute_set * attributes);
+
+int16_t sendPacket(struct CRawSiteToSiteClient * client, const char * 
transactionID, CDataPacket *packet, flow_file_record * ff);
+
+CTransaction* createTransaction(struct CRawSiteToSiteClient * client, 
TransferDirection direction);
+
+static const char * getResourceName(const struct CRawSiteToSiteClient * c) {
+  return "SocketFlowFileProtocol";
+}
+
+static const char * getCodecResourceName(const struct CRawSiteToSiteClient * 
c) {
+  return "StandardFlowFileCodec";
+}
+
+static RespondCodeContext *getRespondCodeContext(RespondCode code) {
+  unsigned int i;
+  for ( i = 0; i < sizeof(respondCodeContext) / sizeof(RespondCodeContext); 
i++) {
+    if (respondCodeContext[i].code == code) {
+      return &respondCodeContext[i];
+    }
+  }
+  return NULL;
+}
+
+// RawSiteToSiteClient Class
+struct CRawSiteToSiteClient {
+  // Batch Count
+  uint64_t _batchCount;
 
 Review comment:
   I know this was copied and changed to a struct, but can we change this to 
use the rest of the project's guidelines for variable naming?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to