Skip to content

Commit

Permalink
recover removed methods of Message
Browse files Browse the repository at this point in the history
  • Loading branch information
cyjseagull committed Oct 23, 2024
1 parent 49f2b02 commit 8f366ab
Show file tree
Hide file tree
Showing 11 changed files with 747 additions and 85 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/cpp_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -278,9 +278,6 @@ jobs:
run: |
alias cmake='cmake3'
. /opt/rh/devtoolset-11/enable
. /opt/rh/rh-perl530/enable
export LIBCLANG_PATH=/opt/rh/llvm-toolset-7/root/lib64/
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
mkdir -p cpp/build
cd cpp/build
cmake3 -DCMAKE_BUILD_TYPE=Release -DTESTS=ON -DCMAKE_TOOLCHAIN_FILE=/usr/local/share/vcpkg/scripts/buildsystems/vcpkg.cmake ../
Expand Down
4 changes: 4 additions & 0 deletions cpp/cmake/Options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ macro(configure_project)
endif ()

set(VISIBILITY_FLAG " -fvisibility=hidden -fvisibility-inlines-hidden")
set(PROGRAM_POSTFIX "")
if(CMAKE_HOST_SYSTEM_NAME MATCHES "Windows")
set(PROGRAM_POSTFIX ".exe")
endif()

set(MARCH_TYPE "-march=x86-64 -mtune=generic ${VISIBILITY_FLAG}")
if (ARCH_NATIVE)
Expand Down
2 changes: 1 addition & 1 deletion cpp/ppc-framework/protocol/PPCMessageFace.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

#pragma once
#include "Protocol.h"
#include "ppc-framework/protocol/P2PMessage.h"
#include "ppc-framework/protocol/Message.h"
#include <bcos-utilities/Common.h>
#include <boost/uuid/uuid.hpp>
#include <boost/uuid/uuid_generators.hpp>
Expand Down
3 changes: 1 addition & 2 deletions cpp/wedpr-crypto/ppc-crypto-core/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@ find_package(OpenSSL REQUIRED)
message(STATUS "OPENSSL_INCLUDE_DIR: ${OPENSSL_INCLUDE_DIR}")
message(STATUS "OPENSSL_LIBRARIES: ${OPENSSL_LIBRARIES}")

target_link_libraries(${CRYPTO_CORE_TARGET} PUBLIC unofficial-sodium::sodium
unofficial-sodium::sodium_config_public ${BCOS_UTILITIES_TARGET} OpenSSL::Crypto ${CPU_FEATURES_LIB})
target_link_libraries(${CRYPTO_CORE_TARGET} PUBLIC unofficial-sodium::sodium ${BCOS_UTILITIES_TARGET} OpenSSL::Crypto ${CPU_FEATURES_LIB})
2 changes: 1 addition & 1 deletion cpp/wedpr-protocol/grpc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ file(GLOB_RECURSE MESSAGES_PROTOS "${PROTO_INPUT_PATH}/Service*.proto")

# create PROTO_OUTPUT_PATH
file(MAKE_DIRECTORY ${PROTO_OUTPUT_PATH})

set(GRPC_CPP_PLUGIN_EXEC "grpc_cpp_plugin${PROGRAM_POSTFIX}")
find_program(GRPC_CPP_PLUGIN grpc_cpp_plugin REQUIRED)
find_program(PROTOC_BINARY protoc REQUIRED)

Expand Down
2 changes: 1 addition & 1 deletion cpp/wedpr-protocol/protocol/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ set(TEST_BINARY_NAME test-protocol)
add_executable(${TEST_BINARY_NAME} ${SOURCES})
target_include_directories(${TEST_BINARY_NAME} PRIVATE .)

target_link_libraries(${TEST_BINARY_NAME} ${PROTOCOL_TARGET} TBB::tbb ${BOOST_UNIT_TEST})
target_link_libraries(${TEST_BINARY_NAME} ${PROTOCOL_TARGET} ${BCOS_UTILITIES_TARGET} TBB::tbb ${BOOST_UNIT_TEST})
add_test(NAME test-protocol WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} COMMAND ${TEST_BINARY_NAME})
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,52 @@ public void setHeader(MessageHeader header) {
swigCPtr, this, MessageHeader.getCPtr(header), header);
}

/** the overloaed implementation === */
public int version() {
return wedpr_java_transportJNI.Message_version(swigCPtr, this);
}

public void setVersion(int version) {
wedpr_java_transportJNI.Message_setVersion(swigCPtr, this, version);
}

public int packetType() {
return wedpr_java_transportJNI.Message_packetType(swigCPtr, this);
}

public void setPacketType(int packetType) {
wedpr_java_transportJNI.Message_setPacketType(swigCPtr, this, packetType);
}

public String seq() {
return wedpr_java_transportJNI.Message_seq(swigCPtr, this);
}

public void setSeq(String traceID) {
wedpr_java_transportJNI.Message_setSeq(swigCPtr, this, traceID);
}

public int ext() {
return wedpr_java_transportJNI.Message_ext(swigCPtr, this);
}

public void setExt(int ext) {
wedpr_java_transportJNI.Message_setExt(swigCPtr, this, ext);
}

public boolean isRespPacket() {
return wedpr_java_transportJNI.Message_isRespPacket(swigCPtr, this);
}

public void setRespPacket() {
wedpr_java_transportJNI.Message_setRespPacket(swigCPtr, this);
}

public void setPayload(ubytes _payload) {
wedpr_java_transportJNI.Message_setPayload(
swigCPtr, this, ubytes.getCPtr(_payload), _payload);
}

public byte[] payloadBuffer() {
return wedpr_java_transportJNI.Message_payloadBuffer(swigCPtr, this);
}
Expand Down Expand Up @@ -83,11 +129,6 @@ public ubytes payload() {
return (cPtr == 0) ? null : new ubytes(cPtr, true);
}

public void setPayload(ubytes _payload) {
wedpr_java_transportJNI.Message_setPayload(
swigCPtr, this, ubytes.getCPtr(_payload), _payload);
}

public void disOwnMemory() {
swigSetCMemOwn(false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,29 @@ public static final native boolean MessageHeader_hasOptionalField(
public static final native void Message_setHeader(
long jarg1, Message jarg1_, long jarg2, MessageHeader jarg2_);

public static final native int Message_version(long jarg1, Message jarg1_);

public static final native void Message_setVersion(long jarg1, Message jarg1_, int jarg2);

public static final native int Message_packetType(long jarg1, Message jarg1_);

public static final native void Message_setPacketType(long jarg1, Message jarg1_, int jarg2);

public static final native String Message_seq(long jarg1, Message jarg1_);

public static final native void Message_setSeq(long jarg1, Message jarg1_, String jarg2);

public static final native int Message_ext(long jarg1, Message jarg1_);

public static final native void Message_setExt(long jarg1, Message jarg1_, int jarg2);

public static final native boolean Message_isRespPacket(long jarg1, Message jarg1_);

public static final native void Message_setRespPacket(long jarg1, Message jarg1_);

public static final native void Message_setPayload(
long jarg1, Message jarg1_, long jarg2, ubytes jarg2_);

public static final native byte[] Message_payloadBuffer(long jarg1, Message jarg1_);

public static final native void Message_setFrontMessage(
Expand All @@ -505,9 +528,6 @@ public static final native boolean Message_encode(

public static final native long Message_payload(long jarg1, Message jarg1_);

public static final native void Message_setPayload(
long jarg1, Message jarg1_, long jarg2, ubytes jarg2_);

public static final native void delete_MessageHeaderBuilder(long jarg1);

public static final native long MessageHeaderBuilder_build__SWIG_0(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5072,6 +5072,200 @@ SWIGEXPORT void JNICALL Java_com_webank_wedpr_sdk_jni_generated_wedpr_1java_1tra
}


SWIGEXPORT jint JNICALL Java_com_webank_wedpr_sdk_jni_generated_wedpr_1java_1transportJNI_Message_1version(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
jint jresult = 0 ;
ppc::protocol::Message *arg1 = (ppc::protocol::Message *) 0 ;
std::shared_ptr< ppc::protocol::Message const > *smartarg1 = 0 ;
uint16_t result;

(void)jenv;
(void)jcls;
(void)jarg1_;

smartarg1 = *(std::shared_ptr< const ppc::protocol::Message > **)&jarg1;
arg1 = (ppc::protocol::Message *)(smartarg1 ? smartarg1->get() : 0);
result = (uint16_t)((ppc::protocol::Message const *)arg1)->version();
jresult = (jint)result;
return jresult;
}


SWIGEXPORT void JNICALL Java_com_webank_wedpr_sdk_jni_generated_wedpr_1java_1transportJNI_Message_1setVersion(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) {
ppc::protocol::Message *arg1 = (ppc::protocol::Message *) 0 ;
uint16_t arg2 ;
std::shared_ptr< ppc::protocol::Message > *smartarg1 = 0 ;

(void)jenv;
(void)jcls;
(void)jarg1_;

smartarg1 = *(std::shared_ptr< ppc::protocol::Message > **)&jarg1;
arg1 = (ppc::protocol::Message *)(smartarg1 ? smartarg1->get() : 0);
arg2 = (uint16_t)jarg2;
(arg1)->setVersion(arg2);
}


SWIGEXPORT jint JNICALL Java_com_webank_wedpr_sdk_jni_generated_wedpr_1java_1transportJNI_Message_1packetType(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
jint jresult = 0 ;
ppc::protocol::Message *arg1 = (ppc::protocol::Message *) 0 ;
std::shared_ptr< ppc::protocol::Message const > *smartarg1 = 0 ;
uint16_t result;

(void)jenv;
(void)jcls;
(void)jarg1_;

smartarg1 = *(std::shared_ptr< const ppc::protocol::Message > **)&jarg1;
arg1 = (ppc::protocol::Message *)(smartarg1 ? smartarg1->get() : 0);
result = (uint16_t)((ppc::protocol::Message const *)arg1)->packetType();
jresult = (jint)result;
return jresult;
}


SWIGEXPORT void JNICALL Java_com_webank_wedpr_sdk_jni_generated_wedpr_1java_1transportJNI_Message_1setPacketType(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) {
ppc::protocol::Message *arg1 = (ppc::protocol::Message *) 0 ;
uint16_t arg2 ;
std::shared_ptr< ppc::protocol::Message > *smartarg1 = 0 ;

(void)jenv;
(void)jcls;
(void)jarg1_;

smartarg1 = *(std::shared_ptr< ppc::protocol::Message > **)&jarg1;
arg1 = (ppc::protocol::Message *)(smartarg1 ? smartarg1->get() : 0);
arg2 = (uint16_t)jarg2;
(arg1)->setPacketType(arg2);
}


SWIGEXPORT jstring JNICALL Java_com_webank_wedpr_sdk_jni_generated_wedpr_1java_1transportJNI_Message_1seq(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
jstring jresult = 0 ;
ppc::protocol::Message *arg1 = (ppc::protocol::Message *) 0 ;
std::shared_ptr< ppc::protocol::Message const > *smartarg1 = 0 ;
std::string *result = 0 ;

(void)jenv;
(void)jcls;
(void)jarg1_;

smartarg1 = *(std::shared_ptr< const ppc::protocol::Message > **)&jarg1;
arg1 = (ppc::protocol::Message *)(smartarg1 ? smartarg1->get() : 0);
result = (std::string *) &((ppc::protocol::Message const *)arg1)->seq();
jresult = jenv->NewStringUTF(result->c_str());
return jresult;
}


SWIGEXPORT void JNICALL Java_com_webank_wedpr_sdk_jni_generated_wedpr_1java_1transportJNI_Message_1setSeq(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) {
ppc::protocol::Message *arg1 = (ppc::protocol::Message *) 0 ;
std::string arg2 ;
std::shared_ptr< ppc::protocol::Message > *smartarg1 = 0 ;

(void)jenv;
(void)jcls;
(void)jarg1_;

smartarg1 = *(std::shared_ptr< ppc::protocol::Message > **)&jarg1;
arg1 = (ppc::protocol::Message *)(smartarg1 ? smartarg1->get() : 0);
if(!jarg2) {
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string");
return ;
}
const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0);
if (!arg2_pstr) return ;
(&arg2)->assign(arg2_pstr);
jenv->ReleaseStringUTFChars(jarg2, arg2_pstr);
(arg1)->setSeq(arg2);
}


SWIGEXPORT jint JNICALL Java_com_webank_wedpr_sdk_jni_generated_wedpr_1java_1transportJNI_Message_1ext(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
jint jresult = 0 ;
ppc::protocol::Message *arg1 = (ppc::protocol::Message *) 0 ;
std::shared_ptr< ppc::protocol::Message const > *smartarg1 = 0 ;
uint16_t result;

(void)jenv;
(void)jcls;
(void)jarg1_;

smartarg1 = *(std::shared_ptr< const ppc::protocol::Message > **)&jarg1;
arg1 = (ppc::protocol::Message *)(smartarg1 ? smartarg1->get() : 0);
result = (uint16_t)((ppc::protocol::Message const *)arg1)->ext();
jresult = (jint)result;
return jresult;
}


SWIGEXPORT void JNICALL Java_com_webank_wedpr_sdk_jni_generated_wedpr_1java_1transportJNI_Message_1setExt(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) {
ppc::protocol::Message *arg1 = (ppc::protocol::Message *) 0 ;
uint16_t arg2 ;
std::shared_ptr< ppc::protocol::Message > *smartarg1 = 0 ;

(void)jenv;
(void)jcls;
(void)jarg1_;

smartarg1 = *(std::shared_ptr< ppc::protocol::Message > **)&jarg1;
arg1 = (ppc::protocol::Message *)(smartarg1 ? smartarg1->get() : 0);
arg2 = (uint16_t)jarg2;
(arg1)->setExt(arg2);
}


SWIGEXPORT jboolean JNICALL Java_com_webank_wedpr_sdk_jni_generated_wedpr_1java_1transportJNI_Message_1isRespPacket(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
jboolean jresult = 0 ;
ppc::protocol::Message *arg1 = (ppc::protocol::Message *) 0 ;
std::shared_ptr< ppc::protocol::Message const > *smartarg1 = 0 ;
bool result;

(void)jenv;
(void)jcls;
(void)jarg1_;

smartarg1 = *(std::shared_ptr< const ppc::protocol::Message > **)&jarg1;
arg1 = (ppc::protocol::Message *)(smartarg1 ? smartarg1->get() : 0);
result = (bool)((ppc::protocol::Message const *)arg1)->isRespPacket();
jresult = (jboolean)result;
return jresult;
}


SWIGEXPORT void JNICALL Java_com_webank_wedpr_sdk_jni_generated_wedpr_1java_1transportJNI_Message_1setRespPacket(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
ppc::protocol::Message *arg1 = (ppc::protocol::Message *) 0 ;
std::shared_ptr< ppc::protocol::Message > *smartarg1 = 0 ;

(void)jenv;
(void)jcls;
(void)jarg1_;

smartarg1 = *(std::shared_ptr< ppc::protocol::Message > **)&jarg1;
arg1 = (ppc::protocol::Message *)(smartarg1 ? smartarg1->get() : 0);
(arg1)->setRespPacket();
}


SWIGEXPORT void JNICALL Java_com_webank_wedpr_sdk_jni_generated_wedpr_1java_1transportJNI_Message_1setPayload(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) {
ppc::protocol::Message *arg1 = (ppc::protocol::Message *) 0 ;
std::shared_ptr< bcos::bytes > arg2 ;
std::shared_ptr< ppc::protocol::Message > *smartarg1 = 0 ;
std::shared_ptr< bcos::bytes > *argp2 ;

(void)jenv;
(void)jcls;
(void)jarg1_;
(void)jarg2_;

smartarg1 = *(std::shared_ptr< ppc::protocol::Message > **)&jarg1;
arg1 = (ppc::protocol::Message *)(smartarg1 ? smartarg1->get() : 0);
argp2 = *(std::shared_ptr< bcos::bytes > **)&jarg2;
if (argp2) arg2 = *argp2;
(arg1)->setPayload(arg2);
}


SWIGEXPORT jbyteArray JNICALL Java_com_webank_wedpr_sdk_jni_generated_wedpr_1java_1transportJNI_Message_1payloadBuffer(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
jbyteArray jresult = 0 ;
ppc::protocol::Message *arg1 = (ppc::protocol::Message *) 0 ;
Expand Down Expand Up @@ -5218,25 +5412,6 @@ SWIGEXPORT jlong JNICALL Java_com_webank_wedpr_sdk_jni_generated_wedpr_1java_1tr
}


SWIGEXPORT void JNICALL Java_com_webank_wedpr_sdk_jni_generated_wedpr_1java_1transportJNI_Message_1setPayload(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) {
ppc::protocol::Message *arg1 = (ppc::protocol::Message *) 0 ;
std::shared_ptr< bcos::bytes > arg2 ;
std::shared_ptr< ppc::protocol::Message > *smartarg1 = 0 ;
std::shared_ptr< bcos::bytes > *argp2 ;

(void)jenv;
(void)jcls;
(void)jarg1_;
(void)jarg2_;

smartarg1 = *(std::shared_ptr< ppc::protocol::Message > **)&jarg1;
arg1 = (ppc::protocol::Message *)(smartarg1 ? smartarg1->get() : 0);
argp2 = *(std::shared_ptr< bcos::bytes > **)&jarg2;
if (argp2) arg2 = *argp2;
(arg1)->setPayload(arg2);
}


SWIGEXPORT void JNICALL Java_com_webank_wedpr_sdk_jni_generated_wedpr_1java_1transportJNI_delete_1MessageHeaderBuilder(JNIEnv *jenv, jclass jcls, jlong jarg1) {
ppc::protocol::MessageHeaderBuilder *arg1 = (ppc::protocol::MessageHeaderBuilder *) 0 ;
std::shared_ptr< ppc::protocol::MessageHeaderBuilder > *smartarg1 = 0 ;
Expand Down
Loading

0 comments on commit 8f366ab

Please sign in to comment.