diff --git a/.github/workflows/cpp_workflow.yml b/.github/workflows/cpp_workflow.yml index 8f8d4bac..376f5a4b 100644 --- a/.github/workflows/cpp_workflow.yml +++ b/.github/workflows/cpp_workflow.yml @@ -51,11 +51,11 @@ jobs: !c:/vcpkg/buildtrees !c:/vcpkg/packages !c:/vcpkg/downloads - key: build-${{ matrix.os }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }} + key: build-all-${{ matrix.os }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }} restore-keys: | - build-${{ matrix.os }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }} - build-${{ matrix.os }}-${{ github.base_ref }}- - build-${{ matrix.os }}- + build-all-${{ matrix.os }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }} + build-all-${{ matrix.os }}-${{ github.base_ref }}- + build-all-${{ matrix.os }}- - name: Build for linux if: runner.os == 'Linux' run: | @@ -105,11 +105,11 @@ jobs: ${{ env.VCPKG_ROOT }}/buildtrees ${{ env.VCPKG_ROOT }}/packages ${{ env.VCPKG_ROOT }}/downloads - key: build-${{ matrix.os }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }} + key: build-sdk-${{ matrix.os }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }} restore-keys: | - build-${{ matrix.os }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }} - build-${{ matrix.os }}-${{ github.base_ref }}- - build-${{ matrix.os }}- + build-sdk-${{ matrix.os }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }} + build-sdk-${{ matrix.os }}-${{ github.base_ref }}- + build-sdk-${{ matrix.os }}- - name: Add MSbuild to PATH if: runner.os == 'Windows' uses: microsoft/setup-msbuild@v1.1 @@ -118,7 +118,7 @@ jobs: run: | mkdir -p cpp/build && cd cpp/build && cmake -G "Visual Studio 16 2019" -A x64 -DCMAKE_BUILD_TYPE=Release -DTESTS=OFF -DBUILD_SDK=ON -DVCPKG_TARGET_TRIPLET=x64-windows-static -DCMAKE_TOOLCHAIN_FILE=c:/vcpkg/scripts/buildsystems/vcpkg.cmake .. MSBuild /version - MSBuild wedpr-component.sln /p:Configuration=Release /p:Platform=x64 + MSBuild WeDPR-Component.sln /p:Configuration=Release /p:Platform=x64 - name: Build for linux if: runner.os == 'Linux' run: | @@ -184,18 +184,18 @@ jobs: ${{ env.VCPKG_ROOT }}/buildtrees ${{ env.VCPKG_ROOT }}/packages ${{ env.VCPKG_ROOT }}/downloads - key: build-${{ matrix.os }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }} + key: build-toolkit-${{ matrix.os }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }} restore-keys: | - build-${{ matrix.os }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }} - build-${{ matrix.os }}-${{ github.base_ref }}- - build-${{ matrix.os }}- + build-toolkit-${{ matrix.os }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }} + build-toolkit-${{ matrix.os }}-${{ github.base_ref }}- + build-toolkit-${{ matrix.os }}- - name: Add MSbuild to PATH if: runner.os == 'Windows' uses: microsoft/setup-msbuild@v1.1 - name: Build for windows if: runner.os == 'Windows' run: | - mkdir -p cpp/build && cd cpp/build && cmake -G "Visual Studio 16 2019" -A x64 -DCMAKE_BUILD_TYPE=Release -DTESTS=OFF -DBUILD_WEDPR_TOOLKIT=ON -DVCPKG_TARGET_TRIPLET=x64-windows-static -DCMAKE_TOOLCHAIN_FILE=c:/vcpkg/scripts/buildsystems/vcpkg.cmake .. && MSBuild /version && MSBuild wedpr-component.sln /p:Configuration=Release /p:Platform=x64 + mkdir -p cpp/build && cd cpp/build && cmake -G "Visual Studio 16 2019" -A x64 -DCMAKE_BUILD_TYPE=Release -DTESTS=OFF -DBUILD_WEDPR_TOOLKIT=ON -DVCPKG_TARGET_TRIPLET=x64-windows-static -DCMAKE_TOOLCHAIN_FILE=c:/vcpkg/scripts/buildsystems/vcpkg.cmake .. && MSBuild /version && MSBuild WeDPR-Component.sln /p:Configuration=Release /p:Platform=x64 - name: Build for linux if: runner.os == 'Linux' run: | @@ -249,11 +249,11 @@ jobs: /usr/local/share/vcpkg/packages /home/runner/.ccache /Users/runner/.ccache/ - key: centos-notest-${{ matrix.os }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }} + key: centos-notest-all-${{ matrix.os }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }} restore-keys: | - centos-notest-${{ matrix.os }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }} - centos-notest-${{ matrix.os }}-${{ github.base_ref }}- - centos-notest-${{ matrix.os }}- + centos-notest-all-${{ matrix.os }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }} + centos-notest-all-${{ matrix.os }}-${{ github.base_ref }}- + centos-notest-all-${{ matrix.os }}- - name: Prepare centos tools run: | rpm -ivh https://cbs.centos.org/kojifiles/packages/centos-release-scl-rh/2/3.el7.centos/noarch/centos-release-scl-rh-2-3.el7.centos.noarch.rpm @@ -277,11 +277,10 @@ jobs: - name: Build run: | alias cmake='cmake3' - . /opt/rh/devtoolset-10/enable + . /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" - . /opt/rh/llvm-toolset-7/enable 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 ../ diff --git a/cpp/cmake/Dependencies.cmake b/cpp/cmake/Dependencies.cmake index ba8c9cb7..3e9f1854 100644 --- a/cpp/cmake/Dependencies.cmake +++ b/cpp/cmake/Dependencies.cmake @@ -20,6 +20,7 @@ endif() if(BUILD_ALL OR BUILD_WEDPR_TOOLKIT) find_package(TBB REQUIRED) find_package(gRPC REQUIRED) + find_package(jsoncpp REQUIRED) endif() ##### the sdk dependencies ##### if(BUILD_ALL OR BUILD_SDK OR BUILD_UDF) @@ -29,7 +30,6 @@ endif() ##### the full-dependencies ##### if(BUILD_ALL) - find_package(jsoncpp REQUIRED) find_package(${BCOS_BOOSTSSL_TARGET} REQUIRED) # tcmalloc include(ProjectTCMalloc) diff --git a/cpp/ppc-framework/protocol/Message.h b/cpp/ppc-framework/protocol/Message.h index 55a73ddd..c3b1a470 100644 --- a/cpp/ppc-framework/protocol/Message.h +++ b/cpp/ppc-framework/protocol/Message.h @@ -22,7 +22,6 @@ #include "RouteType.h" #include "ppc-framework/Helper.h" #include "ppc-framework/libwrapper/Buffer.h" -#include #include #include #include @@ -183,35 +182,28 @@ class MessageHeader uint16_t mutable m_length; }; -class Message : virtual public bcos::boostssl::MessageFace +class Message { public: using Ptr = std::shared_ptr; Message() = default; - ~Message() override {} + virtual ~Message() {} virtual MessageHeader::Ptr header() const { return m_header; } virtual void setHeader(MessageHeader::Ptr header) { m_header = std::move(header); } - /// the overloaed implementation === - uint16_t version() const override { return m_header->version(); } - void setVersion(uint16_t version) override { m_header->setVersion(version); } - uint16_t packetType() const override { return m_header->packetType(); } - void setPacketType(uint16_t packetType) override { m_header->setPacketType(packetType); } - std::string const& seq() const override { return m_header->traceID(); } - void setSeq(std::string traceID) override { m_header->setTraceID(traceID); } - uint16_t ext() const override { return m_header->ext(); } - void setExt(uint16_t ext) override { m_header->setExt(ext); } - - bool isRespPacket() const override { return m_header->isRespPacket(); } - void setRespPacket() override { m_header->setRespPacket(); } - - virtual uint32_t length() const override - { - return m_header->length() + (m_payload ? m_payload->size() : 0); - } - - std::shared_ptr payload() const override { return m_payload; } + uint16_t version() const { return m_header->version(); } + void setVersion(uint16_t version) { m_header->setVersion(version); } + uint16_t packetType() const { return m_header->packetType(); } + void setPacketType(uint16_t packetType) { m_header->setPacketType(packetType); } + std::string const& seq() const { return m_header->traceID(); } + void setSeq(std::string traceID) { m_header->setTraceID(traceID); } + uint16_t ext() const { return m_header->ext(); } + void setExt(uint16_t ext) { m_header->setExt(ext); } + + bool isRespPacket() const { return m_header->isRespPacket(); } + void setRespPacket() { m_header->setRespPacket(); } + void setPayload(std::shared_ptr _payload) { m_payload = std::move(_payload); } // for swig wrapper OutputBuffer payloadBuffer() const { @@ -222,11 +214,6 @@ class Message : virtual public bcos::boostssl::MessageFace return OutputBuffer{(unsigned char*)m_payload->data(), m_payload->size()}; } - void setPayload(std::shared_ptr _payload) override - { - m_payload = std::move(_payload); - } - void setFrontMessage(MessagePayload::Ptr frontMessage) { m_frontMessage = std::move(frontMessage); @@ -236,10 +223,15 @@ class Message : virtual public bcos::boostssl::MessageFace // Note: swig wrapper require define all methods virtual bool encode(bcos::bytes& _buffer) = 0; - // encode and return the {header, payload} - virtual bool encode(bcos::boostssl::EncodedMsg& _encodedMsg) = 0; virtual int64_t decode(bcos::bytesConstRef _buffer) = 0; + virtual uint32_t length() const + { + return m_header->length() + (m_payload ? m_payload->size() : 0); + } + + virtual std::shared_ptr payload() const { return m_payload; } + protected: MessageHeader::Ptr m_header; // Note: allocate here in case of wsService nullptr access caused coredump @@ -259,12 +251,12 @@ class MessageHeaderBuilder virtual MessageOptionalHeader::Ptr build(MessageOptionalHeader::Ptr const& optionalHeader) = 0; }; -class MessageBuilder : public bcos::boostssl::MessageFaceFactory +class MessageBuilder { public: using Ptr = std::shared_ptr; MessageBuilder() = default; - ~MessageBuilder() override = default; + virtual ~MessageBuilder() = default; virtual Message::Ptr build() = 0; virtual Message::Ptr build(bcos::bytesConstRef buffer) = 0; @@ -320,20 +312,6 @@ inline std::string printMessage(Message::Ptr const& _msg) } return stringstream.str(); } - -inline std::string printWsMessage(bcos::boostssl::MessageFace::Ptr const& _msg) -{ - if (!_msg) - { - return "nullptr"; - } - std::ostringstream stringstream; - stringstream << LOG_KV("rsp", _msg->isRespPacket()) << LOG_KV("traceID", _msg->seq()) - << LOG_KV("packetType", _msg->packetType()) << LOG_KV("length", _msg->length()) - << LOG_KV("ext", _msg->ext()); - return stringstream.str(); -} - // function to send response using SendResponseFunction = std::function&& payload)>; using ReceiveMsgFunc = std::function; diff --git a/cpp/ppc-framework/protocol/P2PMessage.h b/cpp/ppc-framework/protocol/P2PMessage.h new file mode 100644 index 00000000..735668d6 --- /dev/null +++ b/cpp/ppc-framework/protocol/P2PMessage.h @@ -0,0 +1,98 @@ +/** + * Copyright (C) 2023 WeDPR. + * SPDX-License-Identifier: Apache-2.0 + * Licensed 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. + * + * @file Message.h + * @author: yujiechen + * @date 2024-08-22 + */ +#pragma once +#include "Message.h" +#include +namespace ppc::protocol +{ +// the wrapper for override bcos::boostssl::MessageFace while use implementation for Message +class P2PMessage : virtual public bcos::boostssl::MessageFace +{ +public: + using Ptr = std::shared_ptr; + P2PMessage(Message::Ptr msg) : m_msg(std::move(msg)) {} + ~P2PMessage() override {} + + /// the overloaed implementation === + uint16_t version() const override { return m_msg->version(); } + void setVersion(uint16_t version) override { m_msg->setVersion(version); } + uint16_t packetType() const override { return m_msg->packetType(); } + void setPacketType(uint16_t packetType) override { m_msg->setPacketType(packetType); } + std::string const& seq() const override { return m_msg->seq(); } + void setSeq(std::string seq) override { m_msg->setSeq(seq); } + uint16_t ext() const override { return m_msg->ext(); } + void setExt(uint16_t ext) override { m_msg->setExt(ext); } + std::shared_ptr payload() const override { return m_msg->payload(); } + void setPayload(std::shared_ptr payload) override + { + m_msg->setPayload(std::move(payload)); + } + + bool encode(bcos::bytes& _buffer) override { return m_msg->encode(_buffer); } + + int64_t decode(bcos::bytesConstRef _buffer) override { return m_msg->decode(_buffer); } + + bool isRespPacket() const override { return m_msg->isRespPacket(); } + void setRespPacket() override { m_msg->setRespPacket(); } + uint32_t length() const override { return m_msg->length(); } + + // encode and return the {header, payload} + virtual bool encode(bcos::boostssl::EncodedMsg& _encodedMsg) = 0; + + Message::Ptr const& msg() { return m_msg; } + MessageHeader::Ptr header() const { return m_msg->header(); } + +protected: + Message::Ptr m_msg; +}; + + +class P2PMessageBuilder : virtual public bcos::boostssl::MessageFaceFactory +{ +public: + using Ptr = std::shared_ptr; + P2PMessageBuilder() = default; + ~P2PMessageBuilder() override = default; + + virtual P2PMessage::Ptr build() = 0; + virtual P2PMessage::Ptr build(ppc::protocol::RouteType routeType, + ppc::protocol::MessageOptionalHeader::Ptr const& routeInfo, bcos::bytes&& payload) = 0; +}; +inline std::string printWsMessage(bcos::boostssl::MessageFace::Ptr const& _msg) +{ + if (!_msg) + { + return "nullptr"; + } + std::ostringstream stringstream; + stringstream << LOG_KV("rsp", _msg->isRespPacket()) << LOG_KV("traceID", _msg->seq()) + << LOG_KV("packetType", _msg->packetType()) << LOG_KV("length", _msg->length()) + << LOG_KV("ext", _msg->ext()); + return stringstream.str(); +} +inline std::string printP2PMessage(P2PMessage::Ptr const& _msg) +{ + if (_msg->msg() == nullptr) + { + return ""; + } + return printMessage(_msg->msg()); +} +} // namespace ppc::protocol diff --git a/cpp/ppc-framework/protocol/PPCMessageFace.h b/cpp/ppc-framework/protocol/PPCMessageFace.h index 04fc9a76..abee0138 100644 --- a/cpp/ppc-framework/protocol/PPCMessageFace.h +++ b/cpp/ppc-framework/protocol/PPCMessageFace.h @@ -21,7 +21,7 @@ #pragma once #include "Protocol.h" -#include "ppc-framework/protocol/Message.h" +#include "ppc-framework/protocol/P2PMessage.h" #include #include #include diff --git a/cpp/vcpkg.json b/cpp/vcpkg.json index 2937c155..d605e402 100644 --- a/cpp/vcpkg.json +++ b/cpp/vcpkg.json @@ -48,11 +48,6 @@ "name": "grpc", "version": "1.51.1#1" }, - { - "name": "zlib", - "version": "1.2.12", - "port-version": 1 - }, { "name": "jsoncpp", "version": "1.9.5" @@ -122,8 +117,7 @@ }, "tarscpp", "tbb", - "libxml2", - "jsoncpp" + "libxml2" ] }, "sdk": { @@ -148,6 +142,7 @@ "version>=": "1.51.1" }, "tarscpp", + "jsoncpp", "tbb" ] } diff --git a/cpp/wedpr-crypto/ppc-crypto/src/CMakeLists.txt b/cpp/wedpr-crypto/ppc-crypto/src/CMakeLists.txt index 954f1ca6..11a8de42 100644 --- a/cpp/wedpr-crypto/ppc-crypto/src/CMakeLists.txt +++ b/cpp/wedpr-crypto/ppc-crypto/src/CMakeLists.txt @@ -6,7 +6,7 @@ find_package(OpenSSL REQUIRED) message(STATUS "OPENSSL_INCLUDE_DIR: ${OPENSSL_INCLUDE_DIR}") message(STATUS "OPENSSL_LIBRARIES: ${OPENSSL_LIBRARIES}") -target_link_libraries(${CRYPTO_TARGET} PUBLIC ${BCOS_UTILITIES_TARGET} ${CRYPTO_CORE_TARGET} OpenSSL::Crypto unofficial-sodium::sodium unofficial-sodium::sodium_config_public TBB::tbb ${CPU_FEATURES_LIB}) +target_link_libraries(${CRYPTO_TARGET} PUBLIC ${BCOS_UTILITIES_TARGET} ${CRYPTO_CORE_TARGET} OpenSSL::Crypto unofficial-sodium::sodium TBB::tbb ${CPU_FEATURES_LIB}) if (ENABLE_IPP_CRYPTO) find_package(ipp-crypto REQUIRED) diff --git a/cpp/wedpr-protocol/protocol/src/CMakeLists.txt b/cpp/wedpr-protocol/protocol/src/CMakeLists.txt index 095eeec4..60a80615 100644 --- a/cpp/wedpr-protocol/protocol/src/CMakeLists.txt +++ b/cpp/wedpr-protocol/protocol/src/CMakeLists.txt @@ -1,4 +1,4 @@ file(GLOB_RECURSE SRCS *.cpp) add_library(${PROTOCOL_TARGET} ${SRCS}) -target_link_libraries(${PROTOCOL_TARGET} PUBLIC ${BCOS_BOOSTSSL_TARGET} ${CPU_FEATURES_LIB} jsoncpp_static) +target_link_libraries(${PROTOCOL_TARGET} PUBLIC ${CPU_FEATURES_LIB} jsoncpp_static) diff --git a/cpp/wedpr-protocol/protocol/src/v1/MessageImpl.cpp b/cpp/wedpr-protocol/protocol/src/v1/MessageImpl.cpp index 9b156941..637209e4 100644 --- a/cpp/wedpr-protocol/protocol/src/v1/MessageImpl.cpp +++ b/cpp/wedpr-protocol/protocol/src/v1/MessageImpl.cpp @@ -36,24 +36,6 @@ bool MessageImpl::encode(bcos::bytes& _buffer) return true; } -bool MessageImpl::encode(bcos::boostssl::EncodedMsg& encodedMsg) -{ - try - { - // header - m_header->encode(encodedMsg.header); - // assign the payload back - encodedMsg.payload = m_payload; - return true; - } - catch (std::exception const& e) - { - PROTOCOL_LOG(WARNING) << LOG_DESC("encode message failed") - << LOG_KV("error", boost::diagnostic_information(e)); - return false; - } -} - int64_t MessageImpl::decode(bytesConstRef buffer) { if (buffer.size() > m_maxMessageLen) diff --git a/cpp/wedpr-protocol/protocol/src/v1/MessageImpl.h b/cpp/wedpr-protocol/protocol/src/v1/MessageImpl.h index 8fb053fe..c16c040a 100644 --- a/cpp/wedpr-protocol/protocol/src/v1/MessageImpl.h +++ b/cpp/wedpr-protocol/protocol/src/v1/MessageImpl.h @@ -20,7 +20,6 @@ #pragma once #include "ppc-framework/Common.h" #include "ppc-framework/protocol/Message.h" -#include "ppc-utilities/Utilities.h" #include #include #include @@ -46,11 +45,9 @@ class MessageImpl : public Message ~MessageImpl() override = default; bool encode(bcos::bytes& _buffer) override; - // encode and return the {header, payload} - bool encode(bcos::boostssl::EncodedMsg& _encodedMsg) override; int64_t decode(bcos::bytesConstRef _buffer) override; -private: +protected: MessageHeaderBuilder::Ptr m_headerBuilder; // default max message length is 100MB @@ -82,6 +79,11 @@ class MessageBuilderImpl : public MessageBuilder return std::make_shared(m_msgHeaderBuilder, m_maxMessageLen, buffer); } + virtual MessageOptionalHeader::Ptr build(MessageOptionalHeader::Ptr const& optionalHeader) + { + return m_msgHeaderBuilder->build(optionalHeader); + } + Message::Ptr build(ppc::protocol::RouteType routeType, ppc::protocol::MessageOptionalHeader::Ptr const& routeInfo, bcos::bytes&& payload) override { @@ -92,20 +94,9 @@ class MessageBuilderImpl : public MessageBuilder return msg; } - bcos::boostssl::MessageFace::Ptr buildMessage() override - { - return std::make_shared(m_msgHeaderBuilder, m_maxMessageLen); - } - - virtual MessageOptionalHeader::Ptr build(MessageOptionalHeader::Ptr const& optionalHeader) - { - return m_msgHeaderBuilder->build(optionalHeader); - } - std::string newSeq() override { return generateUUID(); } - -private: +protected: MessageHeaderBuilder::Ptr m_msgHeaderBuilder; // default max message length is 100MB size_t m_maxMessageLen = 100 * 1024 * 1024; }; -} // namespace ppc::protocol \ No newline at end of file +} // namespace ppc::protocol diff --git a/cpp/wedpr-transport/ppc-gateway/ppc-gateway/GatewayFactory.cpp b/cpp/wedpr-transport/ppc-gateway/ppc-gateway/GatewayFactory.cpp index a31a184d..db62f116 100644 --- a/cpp/wedpr-transport/ppc-gateway/ppc-gateway/GatewayFactory.cpp +++ b/cpp/wedpr-transport/ppc-gateway/ppc-gateway/GatewayFactory.cpp @@ -23,6 +23,7 @@ #include "bcos-boostssl/websocket/WsInitializer.h" #include "ppc-gateway/p2p/Service.h" #include "ppc-gateway/p2p/router/RouterTableImpl.h" +#include "ppc-gateway/protocol/P2PMessageImpl.h" #include "ppc-tools/src/config/PPCConfig.h" #include "protocol/src/v1/MessageHeaderImpl.h" #include "protocol/src/v1/MessageImpl.h" @@ -54,8 +55,9 @@ Service::Ptr GatewayFactory::buildService() const auto wsInitializer = std::make_shared(); // set the messageFactory - wsInitializer->setMessageFactory( - std::make_shared(std::make_shared())); + auto msgBuilder = + std::make_shared(std::make_shared()); + wsInitializer->setMessageFactory(std::make_shared(msgBuilder)); // set the config wsInitializer->setConfig(wsConfig); auto p2pService = std::make_shared(m_contextConfig->nodeID(), diff --git a/cpp/wedpr-transport/ppc-gateway/ppc-gateway/gateway/GatewayImpl.cpp b/cpp/wedpr-transport/ppc-gateway/ppc-gateway/gateway/GatewayImpl.cpp index 273bb7fe..effe4ece 100644 --- a/cpp/wedpr-transport/ppc-gateway/ppc-gateway/gateway/GatewayImpl.cpp +++ b/cpp/wedpr-transport/ppc-gateway/ppc-gateway/gateway/GatewayImpl.cpp @@ -35,7 +35,7 @@ GatewayImpl::GatewayImpl(Service::Ptr const& service, std::shared_ptr ioService, std::string const& agency) : m_service(service), m_msgBuilder( - std::dynamic_pointer_cast(service->messageFactory())), + std::dynamic_pointer_cast(service->messageFactory())), m_frontBuilder(frontBuilder), m_agency(agency), m_p2pRouterManager(std::make_shared(service)), @@ -155,13 +155,14 @@ void GatewayImpl::asyncSendMessage(ppc::protocol::RouteType routeType, auto p2pMessage = m_msgBuilder->build(routeType, routeInfo, std::move(payload)); p2pMessage->setSeq(traceID); p2pMessage->setPacketType((uint16_t)GatewayPacketType::P2PMessage); - GATEWAY_LOG(TRACE) << LOG_DESC("asyncSendMessage") << LOG_KV("msg", printMessage(p2pMessage)); + GATEWAY_LOG(TRACE) << LOG_DESC("asyncSendMessage") + << LOG_KV("msg", printP2PMessage(p2pMessage)); auto nodeList = m_localRouter->chooseReceiver(p2pMessage); // case send to the same agency if (!nodeList.empty()) { GATEWAY_LOG(TRACE) << LOG_DESC("hit the local router, dispatch message directly") - << LOG_KV("msg", printMessage(p2pMessage)); + << LOG_KV("msg", printP2PMessage(p2pMessage)); m_localRouter->dispatcherMessage(p2pMessage, callback); return; } @@ -171,7 +172,7 @@ void GatewayImpl::asyncSendMessage(ppc::protocol::RouteType routeType, if (selectedP2PNodes.empty()) { GATEWAY_LOG(INFO) << LOG_DESC("can't find the gateway to send the message") - << LOG_KV("detail", printMessage(p2pMessage)); + << LOG_KV("detail", printP2PMessage(p2pMessage)); if (callback) { callback(std::make_shared( @@ -189,7 +190,7 @@ void GatewayImpl::asyncSendMessage(ppc::protocol::RouteType routeType, void GatewayImpl::onReceiveP2PMessage(MessageFace::Ptr msg, WsSession::Ptr session) { // try to dispatcher to the front - auto p2pMessage = std::dynamic_pointer_cast(msg); + auto p2pMessage = std::dynamic_pointer_cast(msg); auto self = std::weak_ptr(shared_from_this()); // Note: the callback can only been called once since it binds the callback seq auto callback = [p2pMessage, session, self](Error::Ptr error) { @@ -209,7 +210,7 @@ void GatewayImpl::onReceiveP2PMessage(MessageFace::Ptr msg, WsSession::Ptr sessi GATEWAY_LOG(WARNING) << LOG_DESC("onReceiveP2PMessage: dispatcherMessage failed") << LOG_KV("code", error->errorCode()) << LOG_KV("msg", error->errorMessage()) - << printMessage(p2pMessage); + << printP2PMessage(p2pMessage); errorCode = std::to_string(error->errorCode()); } @@ -224,18 +225,18 @@ void GatewayImpl::onReceiveP2PMessage(MessageFace::Ptr msg, WsSession::Ptr sessi GATEWAY_LOG(ERROR) << LOG_DESC( "onReceiveP2PMessage failed to find the node that can dispatch this message") - << LOG_KV("msg", printMessage(p2pMessage)); + << LOG_KV("msg", printP2PMessage(p2pMessage)); callback(std::make_shared(CommonError::NotFoundFrontServiceDispatchMsg, "unable to find the node to dispatcher this message, message detail: " + - printMessage(p2pMessage))); + printP2PMessage(p2pMessage))); } } void GatewayImpl::onReceiveBroadcastMessage(MessageFace::Ptr msg, WsSession::Ptr) { - auto p2pMessage = std::dynamic_pointer_cast(msg); + auto p2pMessage = std::dynamic_pointer_cast(msg); GATEWAY_LOG(TRACE) << LOG_DESC("onReceiveBroadcastMessage, dispatcher") - << LOG_KV("msg", printMessage(p2pMessage)); + << LOG_KV("msg", printP2PMessage(p2pMessage)); m_localRouter->dispatcherMessage(p2pMessage, nullptr); } diff --git a/cpp/wedpr-transport/ppc-gateway/ppc-gateway/gateway/GatewayImpl.h b/cpp/wedpr-transport/ppc-gateway/ppc-gateway/gateway/GatewayImpl.h index aad2fb4f..e965bab3 100644 --- a/cpp/wedpr-transport/ppc-gateway/ppc-gateway/gateway/GatewayImpl.h +++ b/cpp/wedpr-transport/ppc-gateway/ppc-gateway/gateway/GatewayImpl.h @@ -86,7 +86,7 @@ class GatewayImpl : public IGateway, public std::enable_shared_from_this( -1, "can't find the gateway to send the message, detail: " + - printMessage(m_p2pMessage))); + printP2PMessage(m_p2pMessage))); } return; } @@ -66,7 +66,7 @@ void SendMessageWithRetry::trySendMessage() { GATEWAY_LOG(DEBUG) << LOG_BADGE("trySendMessage") << LOG_DESC("send message failed, retry again") - << LOG_KV("msg", printMessage(self->m_p2pMessage)) + << LOG_KV("msg", printP2PMessage(self->m_p2pMessage)) << LOG_KV("code", error->errorCode()) << LOG_KV("msg", error->errorMessage()) << LOG_KV("timeCost", (utcTime() - startT)); @@ -85,13 +85,13 @@ void SendMessageWithRetry::trySendMessage() { GATEWAY_LOG(DEBUG) << LOG_BADGE("trySendMessage again") << LOG_KV("respCode", respCode) - << LOG_KV("msg", printMessage(self->m_p2pMessage)); + << LOG_KV("msg", printP2PMessage(self->m_p2pMessage)); // try again self->trySendMessage(); return; } GATEWAY_LOG(TRACE) << LOG_BADGE("asyncSendMessageByNodeID success") - << LOG_KV("msg", printMessage(self->m_p2pMessage)); + << LOG_KV("msg", printP2PMessage(self->m_p2pMessage)); // send message successfully if (self->m_respFunc) { @@ -102,7 +102,7 @@ void SendMessageWithRetry::trySendMessage() catch (const std::exception& e) { GATEWAY_LOG(ERROR) << LOG_BADGE("trySendMessage and receive response exception") - << LOG_KV("msg", printMessage(self->m_p2pMessage)) + << LOG_KV("msg", printP2PMessage(self->m_p2pMessage)) << LOG_KV("error", boost::diagnostic_information(e)); self->trySendMessage(); diff --git a/cpp/wedpr-transport/ppc-gateway/ppc-gateway/gateway/SendMessageWithRetry.h b/cpp/wedpr-transport/ppc-gateway/ppc-gateway/gateway/SendMessageWithRetry.h index 7df3b6f3..bfd63a85 100644 --- a/cpp/wedpr-transport/ppc-gateway/ppc-gateway/gateway/SendMessageWithRetry.h +++ b/cpp/wedpr-transport/ppc-gateway/ppc-gateway/gateway/SendMessageWithRetry.h @@ -18,7 +18,7 @@ * @date 2024-08-26 */ #pragma once -#include "ppc-framework/protocol/Message.h" +#include "ppc-framework/protocol/P2PMessage.h" #include "ppc-gateway/gateway/router/GatewayNodeInfo.h" #include "ppc-gateway/p2p/Service.h" #include @@ -31,7 +31,7 @@ class SendMessageWithRetry : public std::enable_shared_from_this; SendMessageWithRetry(Service::Ptr const& service, GatewayNodeInfos&& dstNodeList, - ppc::protocol::Message::Ptr&& p2pMessage, ppc::protocol::ReceiveMsgFunc respFunc, + ppc::protocol::P2PMessage::Ptr&& p2pMessage, ppc::protocol::ReceiveMsgFunc respFunc, long timeout) : m_service(service), m_dstNodeList(std::move(dstNodeList)), @@ -54,7 +54,7 @@ class SendMessageWithRetry : public std::enable_shared_from_this #include @@ -29,7 +29,7 @@ namespace ppc::gateway { struct MessageInfo { - ppc::protocol::Message::Ptr msg; + ppc::protocol::P2PMessage::Ptr msg; ppc::protocol::ReceiveMsgFunc callback; }; struct HoldingMessageQueue @@ -50,7 +50,7 @@ class MessageCache : public std::enable_shared_from_this {} virtual ~MessageCache() = default; - void insertCache(std::string const& topic, ppc::protocol::Message::Ptr const& msg, + void insertCache(std::string const& topic, ppc::protocol::P2PMessage::Ptr const& msg, ppc::protocol::ReceiveMsgFunc callback); HoldingMessageQueue::Ptr pop(std::string const& topic); diff --git a/cpp/wedpr-transport/ppc-gateway/ppc-gateway/gateway/router/GatewayRouterManager.cpp b/cpp/wedpr-transport/ppc-gateway/ppc-gateway/gateway/router/GatewayRouterManager.cpp index b22b73a4..19553502 100644 --- a/cpp/wedpr-transport/ppc-gateway/ppc-gateway/gateway/router/GatewayRouterManager.cpp +++ b/cpp/wedpr-transport/ppc-gateway/ppc-gateway/gateway/router/GatewayRouterManager.cpp @@ -95,7 +95,7 @@ void GatewayRouterManager::onReceiveNodeSeqMessage(MessageFace::Ptr msg, WsSessi { auto statusSeq = boost::asio::detail::socket_ops::network_to_host_long(*((uint32_t*)msg->payload()->data())); - auto p2pMessage = std::dynamic_pointer_cast(msg); + auto p2pMessage = std::dynamic_pointer_cast(msg); auto const& from = (p2pMessage->header()->srcGwNode().size() > 0) ? p2pMessage->header()->srcGwNode() : session->nodeId(); @@ -128,7 +128,8 @@ bool GatewayRouterManager::statusChanged(std::string const& p2pNodeID, uint32_t void GatewayRouterManager::broadcastStatusSeq() { m_timer->restart(); - auto message = std::dynamic_pointer_cast(m_service->messageFactory()->buildMessage()); + auto message = + std::dynamic_pointer_cast(m_service->messageFactory()->buildMessage()); message->setPacketType((uint16_t)GatewayPacketType::SyncNodeSeq); auto seq = m_localRouter->statusSeq(); auto statusSeq = boost::asio::detail::socket_ops::host_to_network_long(seq); @@ -142,7 +143,7 @@ void GatewayRouterManager::broadcastStatusSeq() void GatewayRouterManager::onReceiveRequestNodeStatusMsg( MessageFace::Ptr msg, WsSession::Ptr session) { - auto p2pMessage = std::dynamic_pointer_cast(msg); + auto p2pMessage = std::dynamic_pointer_cast(msg); auto const& from = (!p2pMessage->header()->srcGwNode().empty()) ? p2pMessage->header()->srcGwNode() : session->nodeId(); @@ -167,7 +168,7 @@ void GatewayRouterManager::onRecvResponseNodeStatusMsg(MessageFace::Ptr msg, WsS auto nodeStatus = m_nodeStatusFactory->build(); nodeStatus->decode(bytesConstRef(msg->payload()->data(), msg->payload()->size())); - auto p2pMessage = std::dynamic_pointer_cast(msg); + auto p2pMessage = std::dynamic_pointer_cast(msg); auto const& from = (!p2pMessage->header()->srcGwNode().empty()) ? p2pMessage->header()->srcGwNode() : session->nodeId(); diff --git a/cpp/wedpr-transport/ppc-gateway/ppc-gateway/gateway/router/LocalRouter.cpp b/cpp/wedpr-transport/ppc-gateway/ppc-gateway/gateway/router/LocalRouter.cpp index 9b910408..ef9ce7ba 100644 --- a/cpp/wedpr-transport/ppc-gateway/ppc-gateway/gateway/router/LocalRouter.cpp +++ b/cpp/wedpr-transport/ppc-gateway/ppc-gateway/gateway/router/LocalRouter.cpp @@ -76,7 +76,8 @@ void LocalRouter::unRegisterTopic(bcos::bytesConstRef _nodeID, std::string const m_routerInfo->unRegisterTopic(_nodeID.toBytes(), topic); } -bool LocalRouter::dispatcherMessage(Message::Ptr const& msg, ReceiveMsgFunc callback, bool holding) +bool LocalRouter::dispatcherMessage( + P2PMessage::Ptr const& msg, ReceiveMsgFunc callback, bool holding) { auto frontList = chooseReceiver(msg); // find the front @@ -88,11 +89,11 @@ bool LocalRouter::dispatcherMessage(Message::Ptr const& msg, ReceiveMsgFunc call { if (i == 0) { - front->onReceiveMessage(msg, callback); + front->onReceiveMessage(msg->msg(), callback); } else { - front->onReceiveMessage(msg, [](bcos::Error::Ptr error) { + front->onReceiveMessage(msg->msg(), [](bcos::Error::Ptr error) { if (!error || error->errorCode() == 0) { return; @@ -126,7 +127,7 @@ bool LocalRouter::dispatcherMessage(Message::Ptr const& msg, ReceiveMsgFunc call } std::vector LocalRouter::chooseReceiver( - ppc::protocol::Message::Ptr const& msg) + ppc::protocol::P2PMessage::Ptr const& msg) { std::vector receivers; auto const& dstInst = msg->header()->optionalField()->dstInst(); @@ -168,6 +169,6 @@ std::vector LocalRouter::chooseReceiver( default: BOOST_THROW_EXCEPTION(WeDPRException() << errinfo_comment( "chooseReceiver failed for unknown routeType, message detail: " + - printMessage(msg))); + printP2PMessage(msg))); } } diff --git a/cpp/wedpr-transport/ppc-gateway/ppc-gateway/gateway/router/LocalRouter.h b/cpp/wedpr-transport/ppc-gateway/ppc-gateway/gateway/router/LocalRouter.h index 7c2e015e..e64aadb8 100644 --- a/cpp/wedpr-transport/ppc-gateway/ppc-gateway/gateway/router/LocalRouter.h +++ b/cpp/wedpr-transport/ppc-gateway/ppc-gateway/gateway/router/LocalRouter.h @@ -21,7 +21,7 @@ #include "../cache/MessageCache.h" #include "GatewayNodeInfo.h" #include "ppc-framework/protocol/INodeInfo.h" -#include "ppc-framework/protocol/Message.h" +#include "ppc-framework/protocol/P2PMessage.h" #include "ppc-framework/protocol/RouteType.h" namespace ppc::gateway @@ -51,9 +51,9 @@ class LocalRouter virtual void unRegisterTopic(bcos::bytesConstRef nodeID, std::string const& topic); virtual std::vector chooseReceiver( - ppc::protocol::Message::Ptr const& msg); + ppc::protocol::P2PMessage::Ptr const& msg); - virtual bool dispatcherMessage(ppc::protocol::Message::Ptr const& msg, + virtual bool dispatcherMessage(ppc::protocol::P2PMessage::Ptr const& msg, ppc::protocol::ReceiveMsgFunc callback, bool holding = true); std::shared_ptr generateNodeStatus() diff --git a/cpp/wedpr-transport/ppc-gateway/ppc-gateway/gateway/router/PeerRouterTable.cpp b/cpp/wedpr-transport/ppc-gateway/ppc-gateway/gateway/router/PeerRouterTable.cpp index 6c7c1f4a..533578a0 100644 --- a/cpp/wedpr-transport/ppc-gateway/ppc-gateway/gateway/router/PeerRouterTable.cpp +++ b/cpp/wedpr-transport/ppc-gateway/ppc-gateway/gateway/router/PeerRouterTable.cpp @@ -284,7 +284,7 @@ void PeerRouterTable::selectRouterByComponent(GatewayNodeInfos& choosedGateway, } -void PeerRouterTable::asyncBroadcastMessage(ppc::protocol::Message::Ptr const& msg) const +void PeerRouterTable::asyncBroadcastMessage(ppc::protocol::P2PMessage::Ptr const& msg) const { bcos::ReadGuard l(x_mutex); for (auto const& it : m_agency2GatewayInfos) @@ -303,7 +303,7 @@ void PeerRouterTable::asyncBroadcastMessage(ppc::protocol::Message::Ptr const& m } PEER_ROUTER_LOG(TRACE) << LOG_DESC("asyncBroadcastMessage") << LOG_KV("nodeID", printP2PIDElegantly(selectedNode->p2pNodeID())) - << LOG_KV("msg", printMessage(msg)); + << LOG_KV("msg", printP2PMessage(msg)); m_service->asyncSendMessageByNodeID(selectedNode->p2pNodeID(), msg); } } diff --git a/cpp/wedpr-transport/ppc-gateway/ppc-gateway/gateway/router/PeerRouterTable.h b/cpp/wedpr-transport/ppc-gateway/ppc-gateway/gateway/router/PeerRouterTable.h index 330737f0..5600c46f 100644 --- a/cpp/wedpr-transport/ppc-gateway/ppc-gateway/gateway/router/PeerRouterTable.h +++ b/cpp/wedpr-transport/ppc-gateway/ppc-gateway/gateway/router/PeerRouterTable.h @@ -19,7 +19,7 @@ */ #pragma once #include "GatewayNodeInfo.h" -#include "ppc-framework/protocol/Message.h" +#include "ppc-framework/protocol/P2PMessage.h" #include "ppc-framework/protocol/RouteType.h" #include "ppc-gateway/p2p/Service.h" #include @@ -44,7 +44,7 @@ class PeerRouterTable virtual std::vector selectTargetNodes(ppc::protocol::RouteType const& routeType, ppc::protocol::MessageOptionalHeader::Ptr const& routeInfo) const; - virtual void asyncBroadcastMessage(ppc::protocol::Message::Ptr const& msg) const; + virtual void asyncBroadcastMessage(ppc::protocol::P2PMessage::Ptr const& msg) const; std::set agencies(std::vector const& components) const; diff --git a/cpp/wedpr-transport/ppc-gateway/ppc-gateway/p2p/Service.cpp b/cpp/wedpr-transport/ppc-gateway/ppc-gateway/p2p/Service.cpp index 12dcb06b..080d7aa9 100644 --- a/cpp/wedpr-transport/ppc-gateway/ppc-gateway/p2p/Service.cpp +++ b/cpp/wedpr-transport/ppc-gateway/ppc-gateway/p2p/Service.cpp @@ -206,7 +206,7 @@ WsSession::Ptr Service::getSessionByNodeID(std::string const& _nodeID) void Service::asyncSendMessageByNodeID( std::string const& dstNodeID, MessageFace::Ptr msg, Options options, RespCallBack respFunc) { - auto p2pMsg = std::dynamic_pointer_cast(msg); + auto p2pMsg = std::dynamic_pointer_cast(msg); p2pMsg->header()->setDstGwNode(dstNodeID); p2pMsg->header()->setSrcGwNode(m_nodeID); return asyncSendMessageWithForward(dstNodeID, msg, options, respFunc); @@ -215,17 +215,17 @@ void Service::asyncSendMessageByNodeID( void Service::asyncSendMessageWithForward( std::string const& dstNodeID, MessageFace::Ptr msg, Options options, RespCallBack respFunc) { - auto p2pMsg = std::dynamic_pointer_cast(msg); + auto p2pMsg = std::dynamic_pointer_cast(msg); // without nextHop: maybe network unreachable or with distance equal to 1 auto nextHop = m_routerTable->getNextHop(dstNodeID); if (nextHop.empty()) { - SERVICE_LOG(TRACE) << LOG_DESC("asyncSendMessage directly") << printMessage(p2pMsg); + SERVICE_LOG(TRACE) << LOG_DESC("asyncSendMessage directly") << printP2PMessage(p2pMsg); return asyncSendMessage(dstNodeID, msg, options, respFunc); } // with nextHop, send the message to nextHop SERVICE_LOG(TRACE) << LOG_DESC("asyncSendMessageWithForward to nextHop") - << printMessage(p2pMsg); + << printP2PMessage(p2pMsg); return asyncSendMessage(nextHop, msg, options, respFunc); } @@ -279,19 +279,19 @@ void Service::asyncSendMessage( void Service::onRecvMessage(MessageFace::Ptr _msg, std::shared_ptr _session) { - auto p2pMsg = std::dynamic_pointer_cast(_msg); + auto p2pMsg = std::dynamic_pointer_cast(_msg); // find the dstNode if (p2pMsg->header()->dstGwNode().empty() || p2pMsg->header()->dstGwNode() == m_nodeID) { SERVICE_LOG(TRACE) << LOG_DESC("onRecvMessage, dispatch for find the dst node") - << printMessage(p2pMsg); + << printP2PMessage(p2pMsg); WsService::onRecvMessage(_msg, _session); return; } // forward the message if (p2pMsg->header()->ttl() >= m_routerTable->unreachableDistance()) { - SERVICE_LOG(WARNING) << LOG_DESC("onRecvMessage: ttl expired") << printMessage(p2pMsg); + SERVICE_LOG(WARNING) << LOG_DESC("onRecvMessage: ttl expired") << printP2PMessage(p2pMsg); return; } p2pMsg->header()->setTTL(p2pMsg->header()->ttl() + 1); @@ -311,7 +311,7 @@ void Service::asyncBroadcastMessage(bcos::boostssl::MessageFace::Ptr msg, Option } for (auto const& node : reachableNodes) { - auto p2pMsg = std::dynamic_pointer_cast(msg); + auto p2pMsg = std::dynamic_pointer_cast(msg); p2pMsg->header()->setDstGwNode(node); asyncSendMessageByNodeID(node, msg, options); } @@ -336,8 +336,8 @@ void Service::asyncSendMessageByP2PNodeID(uint16_t type, std::string const& dstN void Service::sendRespMessageBySession(bcos::boostssl::ws::WsSession::Ptr const& session, bcos::boostssl::MessageFace::Ptr msg, std::shared_ptr&& payload) { - auto respMessage = std::dynamic_pointer_cast(m_messageFactory->buildMessage()); - auto requestMsg = std::dynamic_pointer_cast(msg); + auto respMessage = std::dynamic_pointer_cast(m_messageFactory->buildMessage()); + auto requestMsg = std::dynamic_pointer_cast(msg); if (requestMsg->header() && requestMsg->header()->optionalField()) { respMessage->header()->optionalField()->setDstNode( @@ -360,7 +360,8 @@ void Service::sendRespMessageBySession(bcos::boostssl::ws::WsSession::Ptr const& WsSessions sessions; sessions.emplace_back(session); WsService::asyncSendMessage(sessions, respMessage); - SERVICE_LOG(TRACE) << "sendRespMessageBySession: " << LOG_KV("resp", printMessage(respMessage)) + SERVICE_LOG(TRACE) << "sendRespMessageBySession: " + << LOG_KV("resp", printP2PMessage(respMessage)) << LOG_KV("sessionNode", printP2PIDElegantly(session->nodeId())) << LOG_KV("payloadSize", respMessage->payload() ? respMessage->payload()->size() : 0); diff --git a/cpp/wedpr-transport/ppc-gateway/ppc-gateway/p2p/Service.h b/cpp/wedpr-transport/ppc-gateway/ppc-gateway/p2p/Service.h index 20b525b1..64477b1e 100644 --- a/cpp/wedpr-transport/ppc-gateway/ppc-gateway/p2p/Service.h +++ b/cpp/wedpr-transport/ppc-gateway/ppc-gateway/p2p/Service.h @@ -20,7 +20,7 @@ #pragma once #include "../Common.h" -#include "ppc-framework/protocol/Message.h" +#include "ppc-framework/protocol/P2PMessage.h" #include "router/RouterTableInterface.h" #include namespace ppc::gateway diff --git a/cpp/wedpr-transport/ppc-gateway/ppc-gateway/p2p/router/RouterManager.cpp b/cpp/wedpr-transport/ppc-gateway/ppc-gateway/p2p/router/RouterManager.cpp index b4970643..b4518cb2 100644 --- a/cpp/wedpr-transport/ppc-gateway/ppc-gateway/p2p/router/RouterManager.cpp +++ b/cpp/wedpr-transport/ppc-gateway/ppc-gateway/p2p/router/RouterManager.cpp @@ -20,7 +20,7 @@ #include "RouterManager.h" #include "ppc-framework/Helper.h" #include "ppc-framework/gateway/GatewayProtocol.h" -#include "ppc-framework/protocol/Message.h" +#include "ppc-framework/protocol/P2PMessage.h" #include using namespace bcos; @@ -76,7 +76,7 @@ void RouterManager::onReceiveRouterSeq(MessageFace::Ptr msg, WsSession::Ptr sess << LOG_KV("peer", printP2PIDElegantly(session->nodeId())) << LOG_KV("seq", statusSeq); // request router table to peer - auto p2pMsg = std::dynamic_pointer_cast(msg); + auto p2pMsg = std::dynamic_pointer_cast(msg); auto dstP2PNodeID = (!p2pMsg->header()->srcGwNode().empty()) ? p2pMsg->header()->srcGwNode() : session->nodeId(); m_service->asyncSendMessageByP2PNodeID((uint16_t)GatewayPacketType::RouterTableRequest, @@ -117,7 +117,7 @@ void RouterManager::onReceiveRouterTableRequest(MessageFace::Ptr msg, WsSession: auto routerTableData = std::make_shared(); m_service->routerTable()->encode(*routerTableData); - auto p2pMsg = std::dynamic_pointer_cast(msg); + auto p2pMsg = std::dynamic_pointer_cast(msg); auto dstP2PNodeID = (!p2pMsg->header()->srcGwNode().empty()) ? p2pMsg->header()->srcGwNode() : session->nodeId(); m_service->asyncSendMessageByP2PNodeID( diff --git a/cpp/wedpr-transport/ppc-gateway/ppc-gateway/protocol/P2PMessageImpl.cpp b/cpp/wedpr-transport/ppc-gateway/ppc-gateway/protocol/P2PMessageImpl.cpp new file mode 100644 index 00000000..daa711fb --- /dev/null +++ b/cpp/wedpr-transport/ppc-gateway/ppc-gateway/protocol/P2PMessageImpl.cpp @@ -0,0 +1,43 @@ +/** + * Copyright (C) 2023 WeDPR. + * SPDX-License-Identifier: Apache-2.0 + * Licensed 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. + * + * @file MessageImpl.h + * @author: yujiechen + * @date 2024-08-22 + */ +#include "P2PMessageImpl.h" +#include "../Common.h" + +using namespace bcos; +using namespace ppc::protocol; + + +bool P2PMessageImpl::encode(bcos::boostssl::EncodedMsg& encodedMsg) +{ + try + { + // header + m_msg->header()->encode(encodedMsg.header); + // assign the payload back + encodedMsg.payload = m_msg->payload(); + return true; + } + catch (std::exception const& e) + { + GATEWAY_LOG(WARNING) << LOG_DESC("encode message failed") + << LOG_KV("error", boost::diagnostic_information(e)); + return false; + } +} \ No newline at end of file diff --git a/cpp/wedpr-transport/ppc-gateway/ppc-gateway/protocol/P2PMessageImpl.h b/cpp/wedpr-transport/ppc-gateway/ppc-gateway/protocol/P2PMessageImpl.h new file mode 100644 index 00000000..07a29edc --- /dev/null +++ b/cpp/wedpr-transport/ppc-gateway/ppc-gateway/protocol/P2PMessageImpl.h @@ -0,0 +1,64 @@ +/** + * Copyright (C) 2023 WeDPR. + * SPDX-License-Identifier: Apache-2.0 + * Licensed 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. + * + * @file MessageImpl.h + * @author: yujiechen + * @date 2024-08-22 + */ +#pragma once +#include "ppc-framework/protocol/P2PMessage.h" +#include "ppc-utilities/Utilities.h" + +namespace ppc::protocol +{ +class P2PMessageImpl : public P2PMessage +{ +public: + using Ptr = std::shared_ptr; + P2PMessageImpl(Message::Ptr msg) : P2PMessage(msg) {} + ~P2PMessageImpl() override = default; + // encode and return the {header, payload} + bool encode(bcos::boostssl::EncodedMsg& _encodedMsg) override; +}; + +class P2PMessageBuilderImpl : public P2PMessageBuilder +{ +public: + using Ptr = std::shared_ptr; + P2PMessageBuilderImpl(MessageBuilder::Ptr msgBuilder) : m_msgBuilder(std::move(msgBuilder)) {} + ~P2PMessageBuilderImpl() override = default; + + P2PMessage::Ptr build() override + { + return std::make_shared(m_msgBuilder->build()); + } + + P2PMessage::Ptr build(ppc::protocol::RouteType routeType, + ppc::protocol::MessageOptionalHeader::Ptr const& routeInfo, bcos::bytes&& payload) override + { + return std::make_shared( + m_msgBuilder->build(routeType, routeInfo, std::move(payload))); + } + + bcos::boostssl::MessageFace::Ptr buildMessage() override + { + return std::make_shared(m_msgBuilder->build()); + } + std::string newSeq() override { return ppc::generateUUID(); } + +protected: + MessageBuilder::Ptr m_msgBuilder; +}; +} // namespace ppc::protocol \ No newline at end of file diff --git a/cpp/wedpr-transport/sdk-wrapper/java/bindings/src/main/java/com/webank/wedpr/sdk/jni/generated/Message.java b/cpp/wedpr-transport/sdk-wrapper/java/bindings/src/main/java/com/webank/wedpr/sdk/jni/generated/Message.java index 32ddfb70..833c1152 100644 --- a/cpp/wedpr-transport/sdk-wrapper/java/bindings/src/main/java/com/webank/wedpr/sdk/jni/generated/Message.java +++ b/cpp/wedpr-transport/sdk-wrapper/java/bindings/src/main/java/com/webank/wedpr/sdk/jni/generated/Message.java @@ -50,45 +50,28 @@ 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 byte[] payloadBuffer() { + return wedpr_java_transportJNI.Message_payloadBuffer(swigCPtr, this); } - public int ext() { - return wedpr_java_transportJNI.Message_ext(swigCPtr, this); + public void setFrontMessage(MessagePayload frontMessage) { + wedpr_java_transportJNI.Message_setFrontMessage( + swigCPtr, this, MessagePayload.getCPtr(frontMessage), frontMessage); } - public void setExt(int ext) { - wedpr_java_transportJNI.Message_setExt(swigCPtr, this, ext); + public MessagePayload frontMessage() { + long cPtr = wedpr_java_transportJNI.Message_frontMessage(swigCPtr, this); + return (cPtr == 0) ? null : new MessagePayload(cPtr, true); } - public boolean isRespPacket() { - return wedpr_java_transportJNI.Message_isRespPacket(swigCPtr, this); + public boolean encode(ubytes _buffer) { + return wedpr_java_transportJNI.Message_encode( + swigCPtr, this, ubytes.getCPtr(_buffer), _buffer); } - public void setRespPacket() { - wedpr_java_transportJNI.Message_setRespPacket(swigCPtr, this); + public long decode(SWIGTYPE_p_bcos__bytesConstRef _buffer) { + return wedpr_java_transportJNI.Message_decode( + swigCPtr, this, SWIGTYPE_p_bcos__bytesConstRef.getCPtr(_buffer)); } public long length() { @@ -100,40 +83,11 @@ public ubytes payload() { return (cPtr == 0) ? null : new ubytes(cPtr, true); } - public byte[] payloadBuffer() { - return wedpr_java_transportJNI.Message_payloadBuffer(swigCPtr, this); - } - public void setPayload(ubytes _payload) { wedpr_java_transportJNI.Message_setPayload( swigCPtr, this, ubytes.getCPtr(_payload), _payload); } - public void setFrontMessage(MessagePayload frontMessage) { - wedpr_java_transportJNI.Message_setFrontMessage( - swigCPtr, this, MessagePayload.getCPtr(frontMessage), frontMessage); - } - - public MessagePayload frontMessage() { - long cPtr = wedpr_java_transportJNI.Message_frontMessage(swigCPtr, this); - return (cPtr == 0) ? null : new MessagePayload(cPtr, true); - } - - public boolean encode(ubytes _buffer) { - return wedpr_java_transportJNI.Message_encode__SWIG_0( - swigCPtr, this, ubytes.getCPtr(_buffer), _buffer); - } - - public boolean encode(SWIGTYPE_p_bcos__boostssl__EncodedMsg _encodedMsg) { - return wedpr_java_transportJNI.Message_encode__SWIG_1( - swigCPtr, this, SWIGTYPE_p_bcos__boostssl__EncodedMsg.getCPtr(_encodedMsg)); - } - - public long decode(SWIGTYPE_p_bcos__bytesConstRef _buffer) { - return wedpr_java_transportJNI.Message_decode( - swigCPtr, this, SWIGTYPE_p_bcos__bytesConstRef.getCPtr(_buffer)); - } - public void disOwnMemory() { swigSetCMemOwn(false); } diff --git a/cpp/wedpr-transport/sdk-wrapper/java/bindings/src/main/java/com/webank/wedpr/sdk/jni/generated/wedpr_java_transport.java b/cpp/wedpr-transport/sdk-wrapper/java/bindings/src/main/java/com/webank/wedpr/sdk/jni/generated/wedpr_java_transport.java index c8f1cdc8..d8b77685 100644 --- a/cpp/wedpr-transport/sdk-wrapper/java/bindings/src/main/java/com/webank/wedpr/sdk/jni/generated/wedpr_java_transport.java +++ b/cpp/wedpr-transport/sdk-wrapper/java/bindings/src/main/java/com/webank/wedpr/sdk/jni/generated/wedpr_java_transport.java @@ -21,9 +21,4 @@ public static String printOptionalField(MessageOptionalHeader optionalHeader) { public static String printMessage(Message _msg) { return wedpr_java_transportJNI.printMessage(Message.getCPtr(_msg), _msg); } - - public static String printWsMessage(SWIGTYPE_p_bcos__boostssl__MessageFace__Ptr _msg) { - return wedpr_java_transportJNI.printWsMessage( - SWIGTYPE_p_bcos__boostssl__MessageFace__Ptr.getCPtr(_msg)); - } } diff --git a/cpp/wedpr-transport/sdk-wrapper/java/bindings/src/main/java/com/webank/wedpr/sdk/jni/generated/wedpr_java_transportJNI.java b/cpp/wedpr-transport/sdk-wrapper/java/bindings/src/main/java/com/webank/wedpr/sdk/jni/generated/wedpr_java_transportJNI.java index 82e57708..15f817f2 100644 --- a/cpp/wedpr-transport/sdk-wrapper/java/bindings/src/main/java/com/webank/wedpr/sdk/jni/generated/wedpr_java_transportJNI.java +++ b/cpp/wedpr-transport/sdk-wrapper/java/bindings/src/main/java/com/webank/wedpr/sdk/jni/generated/wedpr_java_transportJNI.java @@ -489,48 +489,25 @@ 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 byte[] Message_payloadBuffer(long jarg1, Message jarg1_); - public static final native int Message_ext(long jarg1, Message jarg1_); + public static final native void Message_setFrontMessage( + long jarg1, Message jarg1_, long jarg2, MessagePayload jarg2_); - public static final native void Message_setExt(long jarg1, Message jarg1_, int jarg2); + public static final native long Message_frontMessage(long jarg1, Message jarg1_); - public static final native boolean Message_isRespPacket(long jarg1, Message jarg1_); + public static final native boolean Message_encode( + long jarg1, Message jarg1_, long jarg2, ubytes jarg2_); - public static final native void Message_setRespPacket(long jarg1, Message jarg1_); + public static final native long Message_decode(long jarg1, Message jarg1_, long jarg2); public static final native long Message_length(long jarg1, Message jarg1_); public static final native long Message_payload(long jarg1, Message jarg1_); - public static final native byte[] Message_payloadBuffer(long jarg1, Message jarg1_); - public static final native void Message_setPayload( long jarg1, Message jarg1_, long jarg2, ubytes jarg2_); - public static final native void Message_setFrontMessage( - long jarg1, Message jarg1_, long jarg2, MessagePayload jarg2_); - - public static final native long Message_frontMessage(long jarg1, Message jarg1_); - - public static final native boolean Message_encode__SWIG_0( - long jarg1, Message jarg1_, long jarg2, ubytes jarg2_); - - public static final native boolean Message_encode__SWIG_1( - long jarg1, Message jarg1_, long jarg2); - - public static final native long Message_decode(long jarg1, Message jarg1_, long jarg2); - public static final native void delete_MessageHeaderBuilder(long jarg1); public static final native long MessageHeaderBuilder_build__SWIG_0( @@ -573,8 +550,6 @@ public static final native long MessageOptionalHeaderBuilder_build__SWIG_1( public static final native String printMessage(long jarg1, Message jarg1_); - public static final native String printWsMessage(long jarg1); - public static final native int FrontMsgExtFlag_Response_get(); public static final native void delete_MessagePayload(long jarg1); diff --git a/cpp/wedpr-transport/sdk-wrapper/java/src/wedpr_java_transportJAVA_wrap.cxx b/cpp/wedpr-transport/sdk-wrapper/java/src/wedpr_java_transportJAVA_wrap.cxx index 699684c9..0be323b3 100644 --- a/cpp/wedpr-transport/sdk-wrapper/java/src/wedpr_java_transportJAVA_wrap.cxx +++ b/cpp/wedpr-transport/sdk-wrapper/java/src/wedpr_java_transportJAVA_wrap.cxx @@ -5072,11 +5072,11 @@ 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 ; +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 ; std::shared_ptr< ppc::protocol::Message const > *smartarg1 = 0 ; - uint16_t result; + OutputBuffer result; (void)jenv; (void)jcls; @@ -5084,33 +5084,39 @@ SWIGEXPORT jint JNICALL Java_com_webank_wedpr_sdk_jni_generated_wedpr_1java_1tra 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; + result = ((ppc::protocol::Message const *)arg1)->payloadBuffer(); + { + jresult = jenv->NewByteArray((&result)->len); + jenv->SetByteArrayRegion(jresult, 0, (&result)->len, (jbyte *) (&result)->data); + } 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) { +SWIGEXPORT void JNICALL Java_com_webank_wedpr_sdk_jni_generated_wedpr_1java_1transportJNI_Message_1setFrontMessage(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { ppc::protocol::Message *arg1 = (ppc::protocol::Message *) 0 ; - uint16_t arg2 ; + ppc::protocol::MessagePayload::Ptr arg2 ; std::shared_ptr< ppc::protocol::Message > *smartarg1 = 0 ; + ppc::protocol::MessagePayload::Ptr *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); - arg2 = (uint16_t)jarg2; - (arg1)->setVersion(arg2); + argp2 = *(ppc::protocol::MessagePayload::Ptr **)&jarg2; + if (argp2) arg2 = *argp2; + (arg1)->setFrontMessage(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 ; +SWIGEXPORT jlong JNICALL Java_com_webank_wedpr_sdk_jni_generated_wedpr_1java_1transportJNI_Message_1frontMessage(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; ppc::protocol::Message *arg1 = (ppc::protocol::Message *) 0 ; std::shared_ptr< ppc::protocol::Message const > *smartarg1 = 0 ; - uint16_t result; + ppc::protocol::MessagePayload::Ptr *result = 0 ; (void)jenv; (void)jcls; @@ -5118,124 +5124,45 @@ SWIGEXPORT jint JNICALL Java_com_webank_wedpr_sdk_jni_generated_wedpr_1java_1tra 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; + result = (ppc::protocol::MessagePayload::Ptr *) &((ppc::protocol::Message const *)arg1)->frontMessage(); + *(ppc::protocol::MessagePayload::Ptr **)&jresult = *result ? new ppc::protocol::MessagePayload::Ptr(*result) : 0; 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) { +SWIGEXPORT jboolean JNICALL Java_com_webank_wedpr_sdk_jni_generated_wedpr_1java_1transportJNI_Message_1encode(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jboolean jresult = 0 ; ppc::protocol::Message *arg1 = (ppc::protocol::Message *) 0 ; - uint16_t arg2 ; + bcos::bytes *arg2 = 0 ; std::shared_ptr< ppc::protocol::Message > *smartarg1 = 0 ; + bool result; (void)jenv; (void)jcls; (void)jarg1_; + (void)jarg2_; 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 ; + arg2 = (bcos::bytes *)((*(std::shared_ptr< bcos::bytes > **)&jarg2) ? (*(std::shared_ptr< bcos::bytes > **)&jarg2)->get() : 0); + if (!arg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "bcos::bytes & reference is null"); + return 0; } - 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(); + result = (bool)(arg1)->encode(*arg2); 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_) { +SWIGEXPORT jlong JNICALL Java_com_webank_wedpr_sdk_jni_generated_wedpr_1java_1transportJNI_Message_1decode(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + jlong jresult = 0 ; ppc::protocol::Message *arg1 = (ppc::protocol::Message *) 0 ; + bcos::bytesConstRef arg2 ; std::shared_ptr< ppc::protocol::Message > *smartarg1 = 0 ; + bcos::bytesConstRef *argp2 ; + int64_t result; (void)jenv; (void)jcls; @@ -5243,7 +5170,15 @@ SWIGEXPORT void JNICALL Java_com_webank_wedpr_sdk_jni_generated_wedpr_1java_1tra smartarg1 = *(std::shared_ptr< ppc::protocol::Message > **)&jarg1; arg1 = (ppc::protocol::Message *)(smartarg1 ? smartarg1->get() : 0); - (arg1)->setRespPacket(); + argp2 = *(bcos::bytesConstRef **)&jarg2; + if (!argp2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null bcos::bytesConstRef"); + return 0; + } + arg2 = *argp2; + result = (int64_t)(arg1)->decode(arg2); + jresult = (jlong)result; + return jresult; } @@ -5283,27 +5218,6 @@ SWIGEXPORT jlong JNICALL Java_com_webank_wedpr_sdk_jni_generated_wedpr_1java_1tr } -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 ; - std::shared_ptr< ppc::protocol::Message const > *smartarg1 = 0 ; - OutputBuffer 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 = ((ppc::protocol::Message const *)arg1)->payloadBuffer(); - { - jresult = jenv->NewByteArray((&result)->len); - jenv->SetByteArrayRegion(jresult, 0, (&result)->len, (jbyte *) (&result)->data); - } - return jresult; -} - - 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 ; @@ -5323,119 +5237,6 @@ SWIGEXPORT void JNICALL Java_com_webank_wedpr_sdk_jni_generated_wedpr_1java_1tra } -SWIGEXPORT void JNICALL Java_com_webank_wedpr_sdk_jni_generated_wedpr_1java_1transportJNI_Message_1setFrontMessage(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - ppc::protocol::Message *arg1 = (ppc::protocol::Message *) 0 ; - ppc::protocol::MessagePayload::Ptr arg2 ; - std::shared_ptr< ppc::protocol::Message > *smartarg1 = 0 ; - ppc::protocol::MessagePayload::Ptr *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 = *(ppc::protocol::MessagePayload::Ptr **)&jarg2; - if (argp2) arg2 = *argp2; - (arg1)->setFrontMessage(arg2); -} - - -SWIGEXPORT jlong JNICALL Java_com_webank_wedpr_sdk_jni_generated_wedpr_1java_1transportJNI_Message_1frontMessage(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - ppc::protocol::Message *arg1 = (ppc::protocol::Message *) 0 ; - std::shared_ptr< ppc::protocol::Message const > *smartarg1 = 0 ; - ppc::protocol::MessagePayload::Ptr *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 = (ppc::protocol::MessagePayload::Ptr *) &((ppc::protocol::Message const *)arg1)->frontMessage(); - *(ppc::protocol::MessagePayload::Ptr **)&jresult = *result ? new ppc::protocol::MessagePayload::Ptr(*result) : 0; - return jresult; -} - - -SWIGEXPORT jboolean JNICALL Java_com_webank_wedpr_sdk_jni_generated_wedpr_1java_1transportJNI_Message_1encode_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jboolean jresult = 0 ; - ppc::protocol::Message *arg1 = (ppc::protocol::Message *) 0 ; - bcos::bytes *arg2 = 0 ; - std::shared_ptr< ppc::protocol::Message > *smartarg1 = 0 ; - bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - - smartarg1 = *(std::shared_ptr< ppc::protocol::Message > **)&jarg1; - arg1 = (ppc::protocol::Message *)(smartarg1 ? smartarg1->get() : 0); - - arg2 = (bcos::bytes *)((*(std::shared_ptr< bcos::bytes > **)&jarg2) ? (*(std::shared_ptr< bcos::bytes > **)&jarg2)->get() : 0); - if (!arg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "bcos::bytes & reference is null"); - return 0; - } - result = (bool)(arg1)->encode(*arg2); - jresult = (jboolean)result; - return jresult; -} - - -SWIGEXPORT jboolean JNICALL Java_com_webank_wedpr_sdk_jni_generated_wedpr_1java_1transportJNI_Message_1encode_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - jboolean jresult = 0 ; - ppc::protocol::Message *arg1 = (ppc::protocol::Message *) 0 ; - bcos::boostssl::EncodedMsg *arg2 = 0 ; - std::shared_ptr< ppc::protocol::Message > *smartarg1 = 0 ; - bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - - smartarg1 = *(std::shared_ptr< ppc::protocol::Message > **)&jarg1; - arg1 = (ppc::protocol::Message *)(smartarg1 ? smartarg1->get() : 0); - arg2 = *(bcos::boostssl::EncodedMsg **)&jarg2; - if (!arg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "bcos::boostssl::EncodedMsg & is null"); - return 0; - } - result = (bool)(arg1)->encode(*arg2); - jresult = (jboolean)result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_com_webank_wedpr_sdk_jni_generated_wedpr_1java_1transportJNI_Message_1decode(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - jlong jresult = 0 ; - ppc::protocol::Message *arg1 = (ppc::protocol::Message *) 0 ; - bcos::bytesConstRef arg2 ; - std::shared_ptr< ppc::protocol::Message > *smartarg1 = 0 ; - bcos::bytesConstRef *argp2 ; - int64_t result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - - smartarg1 = *(std::shared_ptr< ppc::protocol::Message > **)&jarg1; - arg1 = (ppc::protocol::Message *)(smartarg1 ? smartarg1->get() : 0); - argp2 = *(bcos::bytesConstRef **)&jarg2; - if (!argp2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null bcos::bytesConstRef"); - return 0; - } - arg2 = *argp2; - result = (int64_t)(arg1)->decode(arg2); - jresult = (jlong)result; - return jresult; -} - - 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 ; @@ -5697,24 +5498,6 @@ SWIGEXPORT jstring JNICALL Java_com_webank_wedpr_sdk_jni_generated_wedpr_1java_1 } -SWIGEXPORT jstring JNICALL Java_com_webank_wedpr_sdk_jni_generated_wedpr_1java_1transportJNI_printWsMessage(JNIEnv *jenv, jclass jcls, jlong jarg1) { - jstring jresult = 0 ; - bcos::boostssl::MessageFace::Ptr *arg1 = 0 ; - std::string result; - - (void)jenv; - (void)jcls; - arg1 = *(bcos::boostssl::MessageFace::Ptr **)&jarg1; - if (!arg1) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "bcos::boostssl::MessageFace::Ptr const & is null"); - return 0; - } - result = ppc::protocol::printWsMessage((bcos::boostssl::MessageFace::Ptr const &)*arg1); - jresult = jenv->NewStringUTF((&result)->c_str()); - return jresult; -} - - SWIGEXPORT jint JNICALL Java_com_webank_wedpr_sdk_jni_generated_wedpr_1java_1transportJNI_FrontMsgExtFlag_1Response_1get(JNIEnv *jenv, jclass jcls) { jint jresult = 0 ; ppc::protocol::FrontMsgExtFlag result; diff --git a/cpp/wedpr-transport/sdk-wrapper/python/bindings/wedpr_python_gateway_sdk/transport/generated/wedpr_python_transport.py b/cpp/wedpr-transport/sdk-wrapper/python/bindings/wedpr_python_gateway_sdk/transport/generated/wedpr_python_transport.py index 0b97ed83..a344353c 100644 --- a/cpp/wedpr-transport/sdk-wrapper/python/bindings/wedpr_python_gateway_sdk/transport/generated/wedpr_python_transport.py +++ b/cpp/wedpr-transport/sdk-wrapper/python/bindings/wedpr_python_gateway_sdk/transport/generated/wedpr_python_transport.py @@ -1168,36 +1168,20 @@ def header(self): def setHeader(self, header): return _wedpr_python_transport.Message_setHeader(self, header) - def version(self): - r""" the overloaed implementation ===""" - return _wedpr_python_transport.Message_version(self) - - def setVersion(self, version): - return _wedpr_python_transport.Message_setVersion(self, version) - - def packetType(self): - return _wedpr_python_transport.Message_packetType(self) - - def setPacketType(self, packetType): - return _wedpr_python_transport.Message_setPacketType(self, packetType) - - def seq(self): - return _wedpr_python_transport.Message_seq(self) - - def setSeq(self, traceID): - return _wedpr_python_transport.Message_setSeq(self, traceID) + def payloadBuffer(self): + return _wedpr_python_transport.Message_payloadBuffer(self) - def ext(self): - return _wedpr_python_transport.Message_ext(self) + def setFrontMessage(self, frontMessage): + return _wedpr_python_transport.Message_setFrontMessage(self, frontMessage) - def setExt(self, ext): - return _wedpr_python_transport.Message_setExt(self, ext) + def frontMessage(self): + return _wedpr_python_transport.Message_frontMessage(self) - def isRespPacket(self): - return _wedpr_python_transport.Message_isRespPacket(self) + def encode(self, _buffer): + return _wedpr_python_transport.Message_encode(self, _buffer) - def setRespPacket(self): - return _wedpr_python_transport.Message_setRespPacket(self) + def decode(self, _buffer): + return _wedpr_python_transport.Message_decode(self, _buffer) def length(self): return _wedpr_python_transport.Message_length(self) @@ -1205,24 +1189,9 @@ def length(self): def payload(self): return _wedpr_python_transport.Message_payload(self) - def payloadBuffer(self): - return _wedpr_python_transport.Message_payloadBuffer(self) - def setPayload(self, _payload): return _wedpr_python_transport.Message_setPayload(self, _payload) - def setFrontMessage(self, frontMessage): - return _wedpr_python_transport.Message_setFrontMessage(self, frontMessage) - - def frontMessage(self): - return _wedpr_python_transport.Message_frontMessage(self) - - def encode(self, *args): - return _wedpr_python_transport.Message_encode(self, *args) - - def decode(self, _buffer): - return _wedpr_python_transport.Message_decode(self, _buffer) - # Register Message in _wedpr_python_transport: _wedpr_python_transport.Message_swigregister(Message) @@ -1288,10 +1257,6 @@ def printMessage(_msg): return _wedpr_python_transport.printMessage(_msg) -def printWsMessage(_msg): - return _wedpr_python_transport.printWsMessage(_msg) - - FrontMsgExtFlag_Response = _wedpr_python_transport.FrontMsgExtFlag_Response diff --git a/cpp/wedpr-transport/sdk-wrapper/python/src/wedpr_python_transportPYTHON_wrap.cxx b/cpp/wedpr-transport/sdk-wrapper/python/src/wedpr_python_transportPYTHON_wrap.cxx index fef8030e..96b87422 100644 --- a/cpp/wedpr-transport/sdk-wrapper/python/src/wedpr_python_transportPYTHON_wrap.cxx +++ b/cpp/wedpr-transport/sdk-wrapper/python/src/wedpr_python_transportPYTHON_wrap.cxx @@ -3654,87 +3654,85 @@ namespace Swig { #define SWIGTYPE_p_UniquePtr swig_types[6] #define SWIGTYPE_p_allocator_type swig_types[7] #define SWIGTYPE_p_bcos__Error swig_types[8] -#define SWIGTYPE_p_bcos__boostssl__EncodedMsg swig_types[9] -#define SWIGTYPE_p_bcos__boostssl__MessageFace__Ptr swig_types[10] -#define SWIGTYPE_p_bcos__bytesConstRef swig_types[11] -#define SWIGTYPE_p_char swig_types[12] -#define SWIGTYPE_p_difference_type swig_types[13] -#define SWIGTYPE_p_int swig_types[14] -#define SWIGTYPE_p_long_long swig_types[15] -#define SWIGTYPE_p_p_PyObject swig_types[16] -#define SWIGTYPE_p_ppc__front__ErrorCallback swig_types[17] -#define SWIGTYPE_p_ppc__front__FrontConfig swig_types[18] -#define SWIGTYPE_p_ppc__front__FrontConfigBuilder swig_types[19] -#define SWIGTYPE_p_ppc__front__GetPeersInfoHandler swig_types[20] -#define SWIGTYPE_p_ppc__front__IFront swig_types[21] -#define SWIGTYPE_p_ppc__front__IFrontBuilder swig_types[22] -#define SWIGTYPE_p_ppc__front__IFrontClient swig_types[23] -#define SWIGTYPE_p_ppc__front__IMessageHandler swig_types[24] -#define SWIGTYPE_p_ppc__front__MessageDispatcherHandler swig_types[25] -#define SWIGTYPE_p_ppc__front__SendResponseHandler swig_types[26] -#define SWIGTYPE_p_ppc__gateway__IGateway__Ptr swig_types[27] -#define SWIGTYPE_p_ppc__protocol__EndPoint swig_types[28] -#define SWIGTYPE_p_ppc__protocol__GrpcConfig swig_types[29] -#define SWIGTYPE_p_ppc__protocol__GrpcServerConfig swig_types[30] -#define SWIGTYPE_p_ppc__protocol__INodeInfo__Ptr swig_types[31] -#define SWIGTYPE_p_ppc__protocol__Message swig_types[32] -#define SWIGTYPE_p_ppc__protocol__MessageBuilder swig_types[33] -#define SWIGTYPE_p_ppc__protocol__MessageHeader swig_types[34] -#define SWIGTYPE_p_ppc__protocol__MessageHeaderBuilder swig_types[35] -#define SWIGTYPE_p_ppc__protocol__MessageOptionalHeader swig_types[36] -#define SWIGTYPE_p_ppc__protocol__MessageOptionalHeaderBuilder swig_types[37] -#define SWIGTYPE_p_ppc__protocol__MessagePayload swig_types[38] -#define SWIGTYPE_p_ppc__protocol__MessagePayloadBuilder swig_types[39] -#define SWIGTYPE_p_ppc__protocol__RouteType swig_types[40] -#define SWIGTYPE_p_ppc__sdk__Transport swig_types[41] -#define SWIGTYPE_p_ppc__sdk__TransportBuilder swig_types[42] -#define SWIGTYPE_p_short swig_types[43] -#define SWIGTYPE_p_signed_char swig_types[44] -#define SWIGTYPE_p_size_type swig_types[45] -#define SWIGTYPE_p_std__allocatorT_signed_char_t swig_types[46] -#define SWIGTYPE_p_std__allocatorT_std__string_t swig_types[47] -#define SWIGTYPE_p_std__allocatorT_unsigned_char_t swig_types[48] -#define SWIGTYPE_p_std__exception swig_types[49] -#define SWIGTYPE_p_std__functionT_void_fF_t swig_types[50] -#define SWIGTYPE_p_std__functionT_void_fstd__shared_ptrT_bcos__Error_tF_t swig_types[51] -#define SWIGTYPE_p_std__functionT_void_fstd__shared_ptrT_bcos__Error_t_std__shared_ptrT_ppc__protocol__Message_t_std__functionT_void_fstd__shared_ptrT_bcos__bytes_t_RRF_tF_t swig_types[52] -#define SWIGTYPE_p_std__functionT_void_fstd__shared_ptrT_bcos__bytes_t_RRF_t swig_types[53] -#define SWIGTYPE_p_std__functionT_void_fstd__shared_ptrT_ppc__protocol__Message_tF_t swig_types[54] -#define SWIGTYPE_p_std__invalid_argument swig_types[55] -#define SWIGTYPE_p_std__shared_ptrT_bcos__Error_t swig_types[56] -#define SWIGTYPE_p_std__shared_ptrT_bcos__bytes_t swig_types[57] -#define SWIGTYPE_p_std__shared_ptrT_ppc__front__ErrorCallback_t swig_types[58] -#define SWIGTYPE_p_std__shared_ptrT_ppc__front__FrontConfigBuilder_t swig_types[59] -#define SWIGTYPE_p_std__shared_ptrT_ppc__front__FrontConfig_t swig_types[60] -#define SWIGTYPE_p_std__shared_ptrT_ppc__front__GetPeersInfoHandler_t swig_types[61] -#define SWIGTYPE_p_std__shared_ptrT_ppc__front__IFrontClient_t swig_types[62] -#define SWIGTYPE_p_std__shared_ptrT_ppc__front__IFront_t swig_types[63] -#define SWIGTYPE_p_std__shared_ptrT_ppc__front__IMessageHandler_t swig_types[64] -#define SWIGTYPE_p_std__shared_ptrT_ppc__front__MessageDispatcherHandler_t swig_types[65] -#define SWIGTYPE_p_std__shared_ptrT_ppc__gateway__IGateway_t swig_types[66] -#define SWIGTYPE_p_std__shared_ptrT_ppc__protocol__GrpcConfig_t swig_types[67] -#define SWIGTYPE_p_std__shared_ptrT_ppc__protocol__MessageBuilder_t swig_types[68] -#define SWIGTYPE_p_std__shared_ptrT_ppc__protocol__MessageHeaderBuilder_t swig_types[69] -#define SWIGTYPE_p_std__shared_ptrT_ppc__protocol__MessageHeader_t swig_types[70] -#define SWIGTYPE_p_std__shared_ptrT_ppc__protocol__MessageOptionalHeaderBuilder_t swig_types[71] -#define SWIGTYPE_p_std__shared_ptrT_ppc__protocol__MessageOptionalHeader_t swig_types[72] -#define SWIGTYPE_p_std__shared_ptrT_ppc__protocol__MessagePayloadBuilder_t swig_types[73] -#define SWIGTYPE_p_std__shared_ptrT_ppc__protocol__MessagePayload_t swig_types[74] -#define SWIGTYPE_p_std__shared_ptrT_ppc__protocol__Message_t swig_types[75] -#define SWIGTYPE_p_std__shared_ptrT_ppc__sdk__Transport_t swig_types[76] -#define SWIGTYPE_p_std__string swig_types[77] -#define SWIGTYPE_p_std__string_view swig_types[78] -#define SWIGTYPE_p_std__vectorT_int8_t_t swig_types[79] -#define SWIGTYPE_p_std__vectorT_std__string_t swig_types[80] -#define SWIGTYPE_p_std__vectorT_uint8_t_t swig_types[81] -#define SWIGTYPE_p_swig__SwigPyIterator swig_types[82] -#define SWIGTYPE_p_unsigned_char swig_types[83] -#define SWIGTYPE_p_unsigned_int swig_types[84] -#define SWIGTYPE_p_unsigned_long_long swig_types[85] -#define SWIGTYPE_p_unsigned_short swig_types[86] -#define SWIGTYPE_p_value_type swig_types[87] -static swig_type_info *swig_types[89]; -static swig_module_info swig_module = {swig_types, 88, 0, 0, 0, 0}; +#define SWIGTYPE_p_bcos__bytesConstRef swig_types[9] +#define SWIGTYPE_p_char swig_types[10] +#define SWIGTYPE_p_difference_type swig_types[11] +#define SWIGTYPE_p_int swig_types[12] +#define SWIGTYPE_p_long_long swig_types[13] +#define SWIGTYPE_p_p_PyObject swig_types[14] +#define SWIGTYPE_p_ppc__front__ErrorCallback swig_types[15] +#define SWIGTYPE_p_ppc__front__FrontConfig swig_types[16] +#define SWIGTYPE_p_ppc__front__FrontConfigBuilder swig_types[17] +#define SWIGTYPE_p_ppc__front__GetPeersInfoHandler swig_types[18] +#define SWIGTYPE_p_ppc__front__IFront swig_types[19] +#define SWIGTYPE_p_ppc__front__IFrontBuilder swig_types[20] +#define SWIGTYPE_p_ppc__front__IFrontClient swig_types[21] +#define SWIGTYPE_p_ppc__front__IMessageHandler swig_types[22] +#define SWIGTYPE_p_ppc__front__MessageDispatcherHandler swig_types[23] +#define SWIGTYPE_p_ppc__front__SendResponseHandler swig_types[24] +#define SWIGTYPE_p_ppc__gateway__IGateway__Ptr swig_types[25] +#define SWIGTYPE_p_ppc__protocol__EndPoint swig_types[26] +#define SWIGTYPE_p_ppc__protocol__GrpcConfig swig_types[27] +#define SWIGTYPE_p_ppc__protocol__GrpcServerConfig swig_types[28] +#define SWIGTYPE_p_ppc__protocol__INodeInfo__Ptr swig_types[29] +#define SWIGTYPE_p_ppc__protocol__Message swig_types[30] +#define SWIGTYPE_p_ppc__protocol__MessageBuilder swig_types[31] +#define SWIGTYPE_p_ppc__protocol__MessageHeader swig_types[32] +#define SWIGTYPE_p_ppc__protocol__MessageHeaderBuilder swig_types[33] +#define SWIGTYPE_p_ppc__protocol__MessageOptionalHeader swig_types[34] +#define SWIGTYPE_p_ppc__protocol__MessageOptionalHeaderBuilder swig_types[35] +#define SWIGTYPE_p_ppc__protocol__MessagePayload swig_types[36] +#define SWIGTYPE_p_ppc__protocol__MessagePayloadBuilder swig_types[37] +#define SWIGTYPE_p_ppc__protocol__RouteType swig_types[38] +#define SWIGTYPE_p_ppc__sdk__Transport swig_types[39] +#define SWIGTYPE_p_ppc__sdk__TransportBuilder swig_types[40] +#define SWIGTYPE_p_short swig_types[41] +#define SWIGTYPE_p_signed_char swig_types[42] +#define SWIGTYPE_p_size_type swig_types[43] +#define SWIGTYPE_p_std__allocatorT_signed_char_t swig_types[44] +#define SWIGTYPE_p_std__allocatorT_std__string_t swig_types[45] +#define SWIGTYPE_p_std__allocatorT_unsigned_char_t swig_types[46] +#define SWIGTYPE_p_std__exception swig_types[47] +#define SWIGTYPE_p_std__functionT_void_fF_t swig_types[48] +#define SWIGTYPE_p_std__functionT_void_fstd__shared_ptrT_bcos__Error_tF_t swig_types[49] +#define SWIGTYPE_p_std__functionT_void_fstd__shared_ptrT_bcos__Error_t_std__shared_ptrT_ppc__protocol__Message_t_std__functionT_void_fstd__shared_ptrT_bcos__bytes_t_RRF_tF_t swig_types[50] +#define SWIGTYPE_p_std__functionT_void_fstd__shared_ptrT_bcos__bytes_t_RRF_t swig_types[51] +#define SWIGTYPE_p_std__functionT_void_fstd__shared_ptrT_ppc__protocol__Message_tF_t swig_types[52] +#define SWIGTYPE_p_std__invalid_argument swig_types[53] +#define SWIGTYPE_p_std__shared_ptrT_bcos__Error_t swig_types[54] +#define SWIGTYPE_p_std__shared_ptrT_bcos__bytes_t swig_types[55] +#define SWIGTYPE_p_std__shared_ptrT_ppc__front__ErrorCallback_t swig_types[56] +#define SWIGTYPE_p_std__shared_ptrT_ppc__front__FrontConfigBuilder_t swig_types[57] +#define SWIGTYPE_p_std__shared_ptrT_ppc__front__FrontConfig_t swig_types[58] +#define SWIGTYPE_p_std__shared_ptrT_ppc__front__GetPeersInfoHandler_t swig_types[59] +#define SWIGTYPE_p_std__shared_ptrT_ppc__front__IFrontClient_t swig_types[60] +#define SWIGTYPE_p_std__shared_ptrT_ppc__front__IFront_t swig_types[61] +#define SWIGTYPE_p_std__shared_ptrT_ppc__front__IMessageHandler_t swig_types[62] +#define SWIGTYPE_p_std__shared_ptrT_ppc__front__MessageDispatcherHandler_t swig_types[63] +#define SWIGTYPE_p_std__shared_ptrT_ppc__gateway__IGateway_t swig_types[64] +#define SWIGTYPE_p_std__shared_ptrT_ppc__protocol__GrpcConfig_t swig_types[65] +#define SWIGTYPE_p_std__shared_ptrT_ppc__protocol__MessageBuilder_t swig_types[66] +#define SWIGTYPE_p_std__shared_ptrT_ppc__protocol__MessageHeaderBuilder_t swig_types[67] +#define SWIGTYPE_p_std__shared_ptrT_ppc__protocol__MessageHeader_t swig_types[68] +#define SWIGTYPE_p_std__shared_ptrT_ppc__protocol__MessageOptionalHeaderBuilder_t swig_types[69] +#define SWIGTYPE_p_std__shared_ptrT_ppc__protocol__MessageOptionalHeader_t swig_types[70] +#define SWIGTYPE_p_std__shared_ptrT_ppc__protocol__MessagePayloadBuilder_t swig_types[71] +#define SWIGTYPE_p_std__shared_ptrT_ppc__protocol__MessagePayload_t swig_types[72] +#define SWIGTYPE_p_std__shared_ptrT_ppc__protocol__Message_t swig_types[73] +#define SWIGTYPE_p_std__shared_ptrT_ppc__sdk__Transport_t swig_types[74] +#define SWIGTYPE_p_std__string swig_types[75] +#define SWIGTYPE_p_std__string_view swig_types[76] +#define SWIGTYPE_p_std__vectorT_int8_t_t swig_types[77] +#define SWIGTYPE_p_std__vectorT_std__string_t swig_types[78] +#define SWIGTYPE_p_std__vectorT_uint8_t_t swig_types[79] +#define SWIGTYPE_p_swig__SwigPyIterator swig_types[80] +#define SWIGTYPE_p_unsigned_char swig_types[81] +#define SWIGTYPE_p_unsigned_int swig_types[82] +#define SWIGTYPE_p_unsigned_long_long swig_types[83] +#define SWIGTYPE_p_unsigned_short swig_types[84] +#define SWIGTYPE_p_value_type swig_types[85] +static swig_type_info *swig_types[87]; +static swig_module_info swig_module = {swig_types, 86, 0, 0, 0, 0}; #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name) #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name) @@ -18960,466 +18958,6 @@ SWIGINTERN PyObject *_wrap_Message_setHeader(PyObject *self, PyObject *args) { } -SWIGINTERN PyObject *_wrap_Message_version(PyObject *self, PyObject *args) { - PyObject *resultobj = 0; - ppc::protocol::Message *arg1 = (ppc::protocol::Message *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::shared_ptr< ppc::protocol::Message const > tempshared1 ; - std::shared_ptr< ppc::protocol::Message const > *smartarg1 = 0 ; - PyObject *swig_obj[1] ; - uint16_t result; - - (void)self; - if (!args) SWIG_fail; - swig_obj[0] = args; - { - int newmem = 0; - res1 = SWIG_ConvertPtrAndOwn(swig_obj[0], &argp1, SWIGTYPE_p_std__shared_ptrT_ppc__protocol__Message_t, 0 | 0 , &newmem); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Message_version" "', argument " "1"" of type '" "ppc::protocol::Message const *""'"); - } - if (newmem & SWIG_CAST_NEW_MEMORY) { - tempshared1 = *reinterpret_cast< std::shared_ptr< const ppc::protocol::Message > * >(argp1); - delete reinterpret_cast< std::shared_ptr< const ppc::protocol::Message > * >(argp1); - arg1 = const_cast< ppc::protocol::Message * >(tempshared1.get()); - } else { - smartarg1 = reinterpret_cast< std::shared_ptr< const ppc::protocol::Message > * >(argp1); - arg1 = const_cast< ppc::protocol::Message * >((smartarg1 ? smartarg1->get() : 0)); - } - } - result = (uint16_t)((ppc::protocol::Message const *)arg1)->version(); - resultobj = SWIG_From_unsigned_SS_short(static_cast< unsigned short >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_Message_setVersion(PyObject *self, PyObject *args) { - PyObject *resultobj = 0; - ppc::protocol::Message *arg1 = (ppc::protocol::Message *) 0 ; - uint16_t arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::shared_ptr< ppc::protocol::Message > tempshared1 ; - std::shared_ptr< ppc::protocol::Message > *smartarg1 = 0 ; - unsigned short val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - (void)self; - if (!SWIG_Python_UnpackTuple(args, "Message_setVersion", 2, 2, swig_obj)) SWIG_fail; - { - int newmem = 0; - res1 = SWIG_ConvertPtrAndOwn(swig_obj[0], &argp1, SWIGTYPE_p_std__shared_ptrT_ppc__protocol__Message_t, 0 | 0 , &newmem); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Message_setVersion" "', argument " "1"" of type '" "ppc::protocol::Message *""'"); - } - if (newmem & SWIG_CAST_NEW_MEMORY) { - tempshared1 = *reinterpret_cast< std::shared_ptr< ppc::protocol::Message > * >(argp1); - delete reinterpret_cast< std::shared_ptr< ppc::protocol::Message > * >(argp1); - arg1 = const_cast< ppc::protocol::Message * >(tempshared1.get()); - } else { - smartarg1 = reinterpret_cast< std::shared_ptr< ppc::protocol::Message > * >(argp1); - arg1 = const_cast< ppc::protocol::Message * >((smartarg1 ? smartarg1->get() : 0)); - } - } - ecode2 = SWIG_AsVal_unsigned_SS_short(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Message_setVersion" "', argument " "2"" of type '" "uint16_t""'"); - } - arg2 = static_cast< uint16_t >(val2); - (arg1)->setVersion(arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_Message_packetType(PyObject *self, PyObject *args) { - PyObject *resultobj = 0; - ppc::protocol::Message *arg1 = (ppc::protocol::Message *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::shared_ptr< ppc::protocol::Message const > tempshared1 ; - std::shared_ptr< ppc::protocol::Message const > *smartarg1 = 0 ; - PyObject *swig_obj[1] ; - uint16_t result; - - (void)self; - if (!args) SWIG_fail; - swig_obj[0] = args; - { - int newmem = 0; - res1 = SWIG_ConvertPtrAndOwn(swig_obj[0], &argp1, SWIGTYPE_p_std__shared_ptrT_ppc__protocol__Message_t, 0 | 0 , &newmem); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Message_packetType" "', argument " "1"" of type '" "ppc::protocol::Message const *""'"); - } - if (newmem & SWIG_CAST_NEW_MEMORY) { - tempshared1 = *reinterpret_cast< std::shared_ptr< const ppc::protocol::Message > * >(argp1); - delete reinterpret_cast< std::shared_ptr< const ppc::protocol::Message > * >(argp1); - arg1 = const_cast< ppc::protocol::Message * >(tempshared1.get()); - } else { - smartarg1 = reinterpret_cast< std::shared_ptr< const ppc::protocol::Message > * >(argp1); - arg1 = const_cast< ppc::protocol::Message * >((smartarg1 ? smartarg1->get() : 0)); - } - } - result = (uint16_t)((ppc::protocol::Message const *)arg1)->packetType(); - resultobj = SWIG_From_unsigned_SS_short(static_cast< unsigned short >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_Message_setPacketType(PyObject *self, PyObject *args) { - PyObject *resultobj = 0; - ppc::protocol::Message *arg1 = (ppc::protocol::Message *) 0 ; - uint16_t arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::shared_ptr< ppc::protocol::Message > tempshared1 ; - std::shared_ptr< ppc::protocol::Message > *smartarg1 = 0 ; - unsigned short val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - (void)self; - if (!SWIG_Python_UnpackTuple(args, "Message_setPacketType", 2, 2, swig_obj)) SWIG_fail; - { - int newmem = 0; - res1 = SWIG_ConvertPtrAndOwn(swig_obj[0], &argp1, SWIGTYPE_p_std__shared_ptrT_ppc__protocol__Message_t, 0 | 0 , &newmem); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Message_setPacketType" "', argument " "1"" of type '" "ppc::protocol::Message *""'"); - } - if (newmem & SWIG_CAST_NEW_MEMORY) { - tempshared1 = *reinterpret_cast< std::shared_ptr< ppc::protocol::Message > * >(argp1); - delete reinterpret_cast< std::shared_ptr< ppc::protocol::Message > * >(argp1); - arg1 = const_cast< ppc::protocol::Message * >(tempshared1.get()); - } else { - smartarg1 = reinterpret_cast< std::shared_ptr< ppc::protocol::Message > * >(argp1); - arg1 = const_cast< ppc::protocol::Message * >((smartarg1 ? smartarg1->get() : 0)); - } - } - ecode2 = SWIG_AsVal_unsigned_SS_short(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Message_setPacketType" "', argument " "2"" of type '" "uint16_t""'"); - } - arg2 = static_cast< uint16_t >(val2); - (arg1)->setPacketType(arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_Message_seq(PyObject *self, PyObject *args) { - PyObject *resultobj = 0; - ppc::protocol::Message *arg1 = (ppc::protocol::Message *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::shared_ptr< ppc::protocol::Message const > tempshared1 ; - std::shared_ptr< ppc::protocol::Message const > *smartarg1 = 0 ; - PyObject *swig_obj[1] ; - std::string *result = 0 ; - - (void)self; - if (!args) SWIG_fail; - swig_obj[0] = args; - { - int newmem = 0; - res1 = SWIG_ConvertPtrAndOwn(swig_obj[0], &argp1, SWIGTYPE_p_std__shared_ptrT_ppc__protocol__Message_t, 0 | 0 , &newmem); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Message_seq" "', argument " "1"" of type '" "ppc::protocol::Message const *""'"); - } - if (newmem & SWIG_CAST_NEW_MEMORY) { - tempshared1 = *reinterpret_cast< std::shared_ptr< const ppc::protocol::Message > * >(argp1); - delete reinterpret_cast< std::shared_ptr< const ppc::protocol::Message > * >(argp1); - arg1 = const_cast< ppc::protocol::Message * >(tempshared1.get()); - } else { - smartarg1 = reinterpret_cast< std::shared_ptr< const ppc::protocol::Message > * >(argp1); - arg1 = const_cast< ppc::protocol::Message * >((smartarg1 ? smartarg1->get() : 0)); - } - } - result = (std::string *) &((ppc::protocol::Message const *)arg1)->seq(); - resultobj = SWIG_From_std_string(static_cast< std::string >(*result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_Message_setSeq(PyObject *self, PyObject *args) { - PyObject *resultobj = 0; - ppc::protocol::Message *arg1 = (ppc::protocol::Message *) 0 ; - std::string arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::shared_ptr< ppc::protocol::Message > tempshared1 ; - std::shared_ptr< ppc::protocol::Message > *smartarg1 = 0 ; - PyObject *swig_obj[2] ; - - (void)self; - if (!SWIG_Python_UnpackTuple(args, "Message_setSeq", 2, 2, swig_obj)) SWIG_fail; - { - int newmem = 0; - res1 = SWIG_ConvertPtrAndOwn(swig_obj[0], &argp1, SWIGTYPE_p_std__shared_ptrT_ppc__protocol__Message_t, 0 | 0 , &newmem); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Message_setSeq" "', argument " "1"" of type '" "ppc::protocol::Message *""'"); - } - if (newmem & SWIG_CAST_NEW_MEMORY) { - tempshared1 = *reinterpret_cast< std::shared_ptr< ppc::protocol::Message > * >(argp1); - delete reinterpret_cast< std::shared_ptr< ppc::protocol::Message > * >(argp1); - arg1 = const_cast< ppc::protocol::Message * >(tempshared1.get()); - } else { - smartarg1 = reinterpret_cast< std::shared_ptr< ppc::protocol::Message > * >(argp1); - arg1 = const_cast< ppc::protocol::Message * >((smartarg1 ? smartarg1->get() : 0)); - } - } - { - std::string *ptr = (std::string *)0; - int res = SWIG_AsPtr_std_string(swig_obj[1], &ptr); - if (!SWIG_IsOK(res) || !ptr) { - SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "Message_setSeq" "', argument " "2"" of type '" "std::string""'"); - } - arg2 = *ptr; - if (SWIG_IsNewObj(res)) delete ptr; - } - (arg1)->setSeq(arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_Message_ext(PyObject *self, PyObject *args) { - PyObject *resultobj = 0; - ppc::protocol::Message *arg1 = (ppc::protocol::Message *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::shared_ptr< ppc::protocol::Message const > tempshared1 ; - std::shared_ptr< ppc::protocol::Message const > *smartarg1 = 0 ; - PyObject *swig_obj[1] ; - uint16_t result; - - (void)self; - if (!args) SWIG_fail; - swig_obj[0] = args; - { - int newmem = 0; - res1 = SWIG_ConvertPtrAndOwn(swig_obj[0], &argp1, SWIGTYPE_p_std__shared_ptrT_ppc__protocol__Message_t, 0 | 0 , &newmem); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Message_ext" "', argument " "1"" of type '" "ppc::protocol::Message const *""'"); - } - if (newmem & SWIG_CAST_NEW_MEMORY) { - tempshared1 = *reinterpret_cast< std::shared_ptr< const ppc::protocol::Message > * >(argp1); - delete reinterpret_cast< std::shared_ptr< const ppc::protocol::Message > * >(argp1); - arg1 = const_cast< ppc::protocol::Message * >(tempshared1.get()); - } else { - smartarg1 = reinterpret_cast< std::shared_ptr< const ppc::protocol::Message > * >(argp1); - arg1 = const_cast< ppc::protocol::Message * >((smartarg1 ? smartarg1->get() : 0)); - } - } - result = (uint16_t)((ppc::protocol::Message const *)arg1)->ext(); - resultobj = SWIG_From_unsigned_SS_short(static_cast< unsigned short >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_Message_setExt(PyObject *self, PyObject *args) { - PyObject *resultobj = 0; - ppc::protocol::Message *arg1 = (ppc::protocol::Message *) 0 ; - uint16_t arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::shared_ptr< ppc::protocol::Message > tempshared1 ; - std::shared_ptr< ppc::protocol::Message > *smartarg1 = 0 ; - unsigned short val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - (void)self; - if (!SWIG_Python_UnpackTuple(args, "Message_setExt", 2, 2, swig_obj)) SWIG_fail; - { - int newmem = 0; - res1 = SWIG_ConvertPtrAndOwn(swig_obj[0], &argp1, SWIGTYPE_p_std__shared_ptrT_ppc__protocol__Message_t, 0 | 0 , &newmem); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Message_setExt" "', argument " "1"" of type '" "ppc::protocol::Message *""'"); - } - if (newmem & SWIG_CAST_NEW_MEMORY) { - tempshared1 = *reinterpret_cast< std::shared_ptr< ppc::protocol::Message > * >(argp1); - delete reinterpret_cast< std::shared_ptr< ppc::protocol::Message > * >(argp1); - arg1 = const_cast< ppc::protocol::Message * >(tempshared1.get()); - } else { - smartarg1 = reinterpret_cast< std::shared_ptr< ppc::protocol::Message > * >(argp1); - arg1 = const_cast< ppc::protocol::Message * >((smartarg1 ? smartarg1->get() : 0)); - } - } - ecode2 = SWIG_AsVal_unsigned_SS_short(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Message_setExt" "', argument " "2"" of type '" "uint16_t""'"); - } - arg2 = static_cast< uint16_t >(val2); - (arg1)->setExt(arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_Message_isRespPacket(PyObject *self, PyObject *args) { - PyObject *resultobj = 0; - ppc::protocol::Message *arg1 = (ppc::protocol::Message *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::shared_ptr< ppc::protocol::Message const > tempshared1 ; - std::shared_ptr< ppc::protocol::Message const > *smartarg1 = 0 ; - PyObject *swig_obj[1] ; - bool result; - - (void)self; - if (!args) SWIG_fail; - swig_obj[0] = args; - { - int newmem = 0; - res1 = SWIG_ConvertPtrAndOwn(swig_obj[0], &argp1, SWIGTYPE_p_std__shared_ptrT_ppc__protocol__Message_t, 0 | 0 , &newmem); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Message_isRespPacket" "', argument " "1"" of type '" "ppc::protocol::Message const *""'"); - } - if (newmem & SWIG_CAST_NEW_MEMORY) { - tempshared1 = *reinterpret_cast< std::shared_ptr< const ppc::protocol::Message > * >(argp1); - delete reinterpret_cast< std::shared_ptr< const ppc::protocol::Message > * >(argp1); - arg1 = const_cast< ppc::protocol::Message * >(tempshared1.get()); - } else { - smartarg1 = reinterpret_cast< std::shared_ptr< const ppc::protocol::Message > * >(argp1); - arg1 = const_cast< ppc::protocol::Message * >((smartarg1 ? smartarg1->get() : 0)); - } - } - result = (bool)((ppc::protocol::Message const *)arg1)->isRespPacket(); - resultobj = SWIG_From_bool(static_cast< bool >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_Message_setRespPacket(PyObject *self, PyObject *args) { - PyObject *resultobj = 0; - ppc::protocol::Message *arg1 = (ppc::protocol::Message *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::shared_ptr< ppc::protocol::Message > tempshared1 ; - std::shared_ptr< ppc::protocol::Message > *smartarg1 = 0 ; - PyObject *swig_obj[1] ; - - (void)self; - if (!args) SWIG_fail; - swig_obj[0] = args; - { - int newmem = 0; - res1 = SWIG_ConvertPtrAndOwn(swig_obj[0], &argp1, SWIGTYPE_p_std__shared_ptrT_ppc__protocol__Message_t, 0 | 0 , &newmem); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Message_setRespPacket" "', argument " "1"" of type '" "ppc::protocol::Message *""'"); - } - if (newmem & SWIG_CAST_NEW_MEMORY) { - tempshared1 = *reinterpret_cast< std::shared_ptr< ppc::protocol::Message > * >(argp1); - delete reinterpret_cast< std::shared_ptr< ppc::protocol::Message > * >(argp1); - arg1 = const_cast< ppc::protocol::Message * >(tempshared1.get()); - } else { - smartarg1 = reinterpret_cast< std::shared_ptr< ppc::protocol::Message > * >(argp1); - arg1 = const_cast< ppc::protocol::Message * >((smartarg1 ? smartarg1->get() : 0)); - } - } - (arg1)->setRespPacket(); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_Message_length(PyObject *self, PyObject *args) { - PyObject *resultobj = 0; - ppc::protocol::Message *arg1 = (ppc::protocol::Message *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::shared_ptr< ppc::protocol::Message const > tempshared1 ; - std::shared_ptr< ppc::protocol::Message const > *smartarg1 = 0 ; - PyObject *swig_obj[1] ; - uint32_t result; - - (void)self; - if (!args) SWIG_fail; - swig_obj[0] = args; - { - int newmem = 0; - res1 = SWIG_ConvertPtrAndOwn(swig_obj[0], &argp1, SWIGTYPE_p_std__shared_ptrT_ppc__protocol__Message_t, 0 | 0 , &newmem); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Message_length" "', argument " "1"" of type '" "ppc::protocol::Message const *""'"); - } - if (newmem & SWIG_CAST_NEW_MEMORY) { - tempshared1 = *reinterpret_cast< std::shared_ptr< const ppc::protocol::Message > * >(argp1); - delete reinterpret_cast< std::shared_ptr< const ppc::protocol::Message > * >(argp1); - arg1 = const_cast< ppc::protocol::Message * >(tempshared1.get()); - } else { - smartarg1 = reinterpret_cast< std::shared_ptr< const ppc::protocol::Message > * >(argp1); - arg1 = const_cast< ppc::protocol::Message * >((smartarg1 ? smartarg1->get() : 0)); - } - } - result = (uint32_t)((ppc::protocol::Message const *)arg1)->length(); - resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_Message_payload(PyObject *self, PyObject *args) { - PyObject *resultobj = 0; - ppc::protocol::Message *arg1 = (ppc::protocol::Message *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::shared_ptr< ppc::protocol::Message const > tempshared1 ; - std::shared_ptr< ppc::protocol::Message const > *smartarg1 = 0 ; - PyObject *swig_obj[1] ; - std::shared_ptr< bcos::bytes > result; - - (void)self; - if (!args) SWIG_fail; - swig_obj[0] = args; - { - int newmem = 0; - res1 = SWIG_ConvertPtrAndOwn(swig_obj[0], &argp1, SWIGTYPE_p_std__shared_ptrT_ppc__protocol__Message_t, 0 | 0 , &newmem); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Message_payload" "', argument " "1"" of type '" "ppc::protocol::Message const *""'"); - } - if (newmem & SWIG_CAST_NEW_MEMORY) { - tempshared1 = *reinterpret_cast< std::shared_ptr< const ppc::protocol::Message > * >(argp1); - delete reinterpret_cast< std::shared_ptr< const ppc::protocol::Message > * >(argp1); - arg1 = const_cast< ppc::protocol::Message * >(tempshared1.get()); - } else { - smartarg1 = reinterpret_cast< std::shared_ptr< const ppc::protocol::Message > * >(argp1); - arg1 = const_cast< ppc::protocol::Message * >((smartarg1 ? smartarg1->get() : 0)); - } - } - result = ((ppc::protocol::Message const *)arg1)->payload(); - { - std::shared_ptr< bcos::bytes > *smartresult = result ? new std::shared_ptr< bcos::bytes >(result) : 0; - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(smartresult), SWIGTYPE_p_std__shared_ptrT_bcos__bytes_t, SWIG_POINTER_OWN); - } - return resultobj; -fail: - return NULL; -} - - SWIGINTERN PyObject *_wrap_Message_payloadBuffer(PyObject *self, PyObject *args) { PyObject *resultobj = 0; ppc::protocol::Message *arg1 = (ppc::protocol::Message *) 0 ; @@ -19458,52 +18996,6 @@ SWIGINTERN PyObject *_wrap_Message_payloadBuffer(PyObject *self, PyObject *args) } -SWIGINTERN PyObject *_wrap_Message_setPayload(PyObject *self, PyObject *args) { - PyObject *resultobj = 0; - ppc::protocol::Message *arg1 = (ppc::protocol::Message *) 0 ; - std::shared_ptr< bcos::bytes > arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::shared_ptr< ppc::protocol::Message > tempshared1 ; - std::shared_ptr< ppc::protocol::Message > *smartarg1 = 0 ; - void *argp2 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - - (void)self; - if (!SWIG_Python_UnpackTuple(args, "Message_setPayload", 2, 2, swig_obj)) SWIG_fail; - { - int newmem = 0; - res1 = SWIG_ConvertPtrAndOwn(swig_obj[0], &argp1, SWIGTYPE_p_std__shared_ptrT_ppc__protocol__Message_t, 0 | 0 , &newmem); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Message_setPayload" "', argument " "1"" of type '" "ppc::protocol::Message *""'"); - } - if (newmem & SWIG_CAST_NEW_MEMORY) { - tempshared1 = *reinterpret_cast< std::shared_ptr< ppc::protocol::Message > * >(argp1); - delete reinterpret_cast< std::shared_ptr< ppc::protocol::Message > * >(argp1); - arg1 = const_cast< ppc::protocol::Message * >(tempshared1.get()); - } else { - smartarg1 = reinterpret_cast< std::shared_ptr< ppc::protocol::Message > * >(argp1); - arg1 = const_cast< ppc::protocol::Message * >((smartarg1 ? smartarg1->get() : 0)); - } - } - { - int newmem = 0; - res2 = SWIG_ConvertPtrAndOwn(swig_obj[1], &argp2, SWIGTYPE_p_std__shared_ptrT_bcos__bytes_t, 0 , &newmem); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Message_setPayload" "', argument " "2"" of type '" "std::shared_ptr< bcos::bytes >""'"); - } - if (argp2) arg2 = *(reinterpret_cast< std::shared_ptr< bcos::bytes > * >(argp2)); - if (newmem & SWIG_CAST_NEW_MEMORY) delete reinterpret_cast< std::shared_ptr< bcos::bytes > * >(argp2); - } - (arg1)->setPayload(arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - SWIGINTERN PyObject *_wrap_Message_setFrontMessage(PyObject *self, PyObject *args) { PyObject *resultobj = 0; ppc::protocol::Message *arg1 = (ppc::protocol::Message *) 0 ; @@ -19589,7 +19081,7 @@ SWIGINTERN PyObject *_wrap_Message_frontMessage(PyObject *self, PyObject *args) } -SWIGINTERN PyObject *_wrap_Message_encode__SWIG_0(PyObject *self, Py_ssize_t nobjs, PyObject **swig_obj) { +SWIGINTERN PyObject *_wrap_Message_encode(PyObject *self, PyObject *args) { PyObject *resultobj = 0; ppc::protocol::Message *arg1 = (ppc::protocol::Message *) 0 ; bcos::bytes *arg2 = 0 ; @@ -19600,10 +19092,11 @@ SWIGINTERN PyObject *_wrap_Message_encode__SWIG_0(PyObject *self, Py_ssize_t nob void *argp2 = 0 ; int res2 = 0 ; std::shared_ptr< bcos::bytes > tempshared2 ; + PyObject *swig_obj[2] ; bool result; (void)self; - if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + if (!SWIG_Python_UnpackTuple(args, "Message_encode", 2, 2, swig_obj)) SWIG_fail; { int newmem = 0; res1 = SWIG_ConvertPtrAndOwn(swig_obj[0], &argp1, SWIGTYPE_p_std__shared_ptrT_ppc__protocol__Message_t, 0 | 0 , &newmem); @@ -19644,25 +19137,26 @@ SWIGINTERN PyObject *_wrap_Message_encode__SWIG_0(PyObject *self, Py_ssize_t nob } -SWIGINTERN PyObject *_wrap_Message_encode__SWIG_1(PyObject *self, Py_ssize_t nobjs, PyObject **swig_obj) { +SWIGINTERN PyObject *_wrap_Message_decode(PyObject *self, PyObject *args) { PyObject *resultobj = 0; ppc::protocol::Message *arg1 = (ppc::protocol::Message *) 0 ; - bcos::boostssl::EncodedMsg *arg2 = 0 ; + bcos::bytesConstRef arg2 ; void *argp1 = 0 ; int res1 = 0 ; std::shared_ptr< ppc::protocol::Message > tempshared1 ; std::shared_ptr< ppc::protocol::Message > *smartarg1 = 0 ; - void *argp2 = 0 ; + void *argp2 ; int res2 = 0 ; - bool result; + PyObject *swig_obj[2] ; + int64_t result; (void)self; - if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + if (!SWIG_Python_UnpackTuple(args, "Message_decode", 2, 2, swig_obj)) SWIG_fail; { int newmem = 0; res1 = SWIG_ConvertPtrAndOwn(swig_obj[0], &argp1, SWIGTYPE_p_std__shared_ptrT_ppc__protocol__Message_t, 0 | 0 , &newmem); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Message_encode" "', argument " "1"" of type '" "ppc::protocol::Message *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Message_decode" "', argument " "1"" of type '" "ppc::protocol::Message *""'"); } if (newmem & SWIG_CAST_NEW_MEMORY) { tempshared1 = *reinterpret_cast< std::shared_ptr< ppc::protocol::Message > * >(argp1); @@ -19673,69 +19167,106 @@ SWIGINTERN PyObject *_wrap_Message_encode__SWIG_1(PyObject *self, Py_ssize_t nob arg1 = const_cast< ppc::protocol::Message * >((smartarg1 ? smartarg1->get() : 0)); } } - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_bcos__boostssl__EncodedMsg, 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Message_encode" "', argument " "2"" of type '" "bcos::boostssl::EncodedMsg &""'"); - } - if (!argp2) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Message_encode" "', argument " "2"" of type '" "bcos::boostssl::EncodedMsg &""'"); + { + res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_bcos__bytesConstRef, 0 | 0); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Message_decode" "', argument " "2"" of type '" "bcos::bytesConstRef""'"); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Message_decode" "', argument " "2"" of type '" "bcos::bytesConstRef""'"); + } else { + bcos::bytesConstRef * temp = reinterpret_cast< bcos::bytesConstRef * >(argp2); + arg2 = *temp; + if (SWIG_IsNewObj(res2)) delete temp; + } } - arg2 = reinterpret_cast< bcos::boostssl::EncodedMsg * >(argp2); - result = (bool)(arg1)->encode(*arg2); - resultobj = SWIG_From_bool(static_cast< bool >(result)); + result = (int64_t)(arg1)->decode(arg2); + resultobj = SWIG_From_long_SS_long(static_cast< long long >(result)); return resultobj; fail: return NULL; } -SWIGINTERN PyObject *_wrap_Message_encode(PyObject *self, PyObject *args) { - Py_ssize_t argc; - PyObject *argv[3] = { - 0 - }; +SWIGINTERN PyObject *_wrap_Message_length(PyObject *self, PyObject *args) { + PyObject *resultobj = 0; + ppc::protocol::Message *arg1 = (ppc::protocol::Message *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::shared_ptr< ppc::protocol::Message const > tempshared1 ; + std::shared_ptr< ppc::protocol::Message const > *smartarg1 = 0 ; + PyObject *swig_obj[1] ; + uint32_t result; - if (!(argc = SWIG_Python_UnpackTuple(args, "Message_encode", 0, 2, argv))) SWIG_fail; - --argc; - if (argc == 2) { - int _v = 0; - int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_std__shared_ptrT_ppc__protocol__Message_t, 0); - _v = SWIG_CheckState(res); - if (_v) { - int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_std__shared_ptrT_bcos__bytes_t, 0); - _v = SWIG_CheckState(res); - if (_v) { - return _wrap_Message_encode__SWIG_0(self, argc, argv); - } + (void)self; + if (!args) SWIG_fail; + swig_obj[0] = args; + { + int newmem = 0; + res1 = SWIG_ConvertPtrAndOwn(swig_obj[0], &argp1, SWIGTYPE_p_std__shared_ptrT_ppc__protocol__Message_t, 0 | 0 , &newmem); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Message_length" "', argument " "1"" of type '" "ppc::protocol::Message const *""'"); } - } - if (argc == 2) { - int _v = 0; - int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_std__shared_ptrT_ppc__protocol__Message_t, 0); - _v = SWIG_CheckState(res); - if (_v) { - void *vptr = 0; - int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_bcos__boostssl__EncodedMsg, SWIG_POINTER_NO_NULL); - _v = SWIG_CheckState(res); - if (_v) { - return _wrap_Message_encode__SWIG_1(self, argc, argv); - } + if (newmem & SWIG_CAST_NEW_MEMORY) { + tempshared1 = *reinterpret_cast< std::shared_ptr< const ppc::protocol::Message > * >(argp1); + delete reinterpret_cast< std::shared_ptr< const ppc::protocol::Message > * >(argp1); + arg1 = const_cast< ppc::protocol::Message * >(tempshared1.get()); + } else { + smartarg1 = reinterpret_cast< std::shared_ptr< const ppc::protocol::Message > * >(argp1); + arg1 = const_cast< ppc::protocol::Message * >((smartarg1 ? smartarg1->get() : 0)); } } + result = (uint32_t)((ppc::protocol::Message const *)arg1)->length(); + resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Message_payload(PyObject *self, PyObject *args) { + PyObject *resultobj = 0; + ppc::protocol::Message *arg1 = (ppc::protocol::Message *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::shared_ptr< ppc::protocol::Message const > tempshared1 ; + std::shared_ptr< ppc::protocol::Message const > *smartarg1 = 0 ; + PyObject *swig_obj[1] ; + std::shared_ptr< bcos::bytes > result; + (void)self; + if (!args) SWIG_fail; + swig_obj[0] = args; + { + int newmem = 0; + res1 = SWIG_ConvertPtrAndOwn(swig_obj[0], &argp1, SWIGTYPE_p_std__shared_ptrT_ppc__protocol__Message_t, 0 | 0 , &newmem); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Message_payload" "', argument " "1"" of type '" "ppc::protocol::Message const *""'"); + } + if (newmem & SWIG_CAST_NEW_MEMORY) { + tempshared1 = *reinterpret_cast< std::shared_ptr< const ppc::protocol::Message > * >(argp1); + delete reinterpret_cast< std::shared_ptr< const ppc::protocol::Message > * >(argp1); + arg1 = const_cast< ppc::protocol::Message * >(tempshared1.get()); + } else { + smartarg1 = reinterpret_cast< std::shared_ptr< const ppc::protocol::Message > * >(argp1); + arg1 = const_cast< ppc::protocol::Message * >((smartarg1 ? smartarg1->get() : 0)); + } + } + result = ((ppc::protocol::Message const *)arg1)->payload(); + { + std::shared_ptr< bcos::bytes > *smartresult = result ? new std::shared_ptr< bcos::bytes >(result) : 0; + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(smartresult), SWIGTYPE_p_std__shared_ptrT_bcos__bytes_t, SWIG_POINTER_OWN); + } + return resultobj; fail: - SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'Message_encode'.\n" - " Possible C/C++ prototypes are:\n" - " ppc::protocol::Message::encode(bcos::bytes &)\n" - " ppc::protocol::Message::encode(bcos::boostssl::EncodedMsg &)\n"); - return 0; + return NULL; } -SWIGINTERN PyObject *_wrap_Message_decode(PyObject *self, PyObject *args) { +SWIGINTERN PyObject *_wrap_Message_setPayload(PyObject *self, PyObject *args) { PyObject *resultobj = 0; ppc::protocol::Message *arg1 = (ppc::protocol::Message *) 0 ; - bcos::bytesConstRef arg2 ; + std::shared_ptr< bcos::bytes > arg2 ; void *argp1 = 0 ; int res1 = 0 ; std::shared_ptr< ppc::protocol::Message > tempshared1 ; @@ -19743,15 +19274,14 @@ SWIGINTERN PyObject *_wrap_Message_decode(PyObject *self, PyObject *args) { void *argp2 ; int res2 = 0 ; PyObject *swig_obj[2] ; - int64_t result; (void)self; - if (!SWIG_Python_UnpackTuple(args, "Message_decode", 2, 2, swig_obj)) SWIG_fail; + if (!SWIG_Python_UnpackTuple(args, "Message_setPayload", 2, 2, swig_obj)) SWIG_fail; { int newmem = 0; res1 = SWIG_ConvertPtrAndOwn(swig_obj[0], &argp1, SWIGTYPE_p_std__shared_ptrT_ppc__protocol__Message_t, 0 | 0 , &newmem); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Message_decode" "', argument " "1"" of type '" "ppc::protocol::Message *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Message_setPayload" "', argument " "1"" of type '" "ppc::protocol::Message *""'"); } if (newmem & SWIG_CAST_NEW_MEMORY) { tempshared1 = *reinterpret_cast< std::shared_ptr< ppc::protocol::Message > * >(argp1); @@ -19763,20 +19293,16 @@ SWIGINTERN PyObject *_wrap_Message_decode(PyObject *self, PyObject *args) { } } { - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_bcos__bytesConstRef, 0 | 0); + int newmem = 0; + res2 = SWIG_ConvertPtrAndOwn(swig_obj[1], &argp2, SWIGTYPE_p_std__shared_ptrT_bcos__bytes_t, 0 , &newmem); if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Message_decode" "', argument " "2"" of type '" "bcos::bytesConstRef""'"); - } - if (!argp2) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Message_decode" "', argument " "2"" of type '" "bcos::bytesConstRef""'"); - } else { - bcos::bytesConstRef * temp = reinterpret_cast< bcos::bytesConstRef * >(argp2); - arg2 = *temp; - if (SWIG_IsNewObj(res2)) delete temp; + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Message_setPayload" "', argument " "2"" of type '" "std::shared_ptr< bcos::bytes >""'"); } + if (argp2) arg2 = *(reinterpret_cast< std::shared_ptr< bcos::bytes > * >(argp2)); + if (newmem & SWIG_CAST_NEW_MEMORY) delete reinterpret_cast< std::shared_ptr< bcos::bytes > * >(argp2); } - result = (int64_t)(arg1)->decode(arg2); - resultobj = SWIG_From_long_SS_long(static_cast< long long >(result)); + (arg1)->setPayload(arg2); + resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; @@ -20542,33 +20068,6 @@ SWIGINTERN PyObject *_wrap_printMessage(PyObject *self, PyObject *args) { } -SWIGINTERN PyObject *_wrap_printWsMessage(PyObject *self, PyObject *args) { - PyObject *resultobj = 0; - bcos::boostssl::MessageFace::Ptr *arg1 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::string result; - - (void)self; - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1, SWIGTYPE_p_bcos__boostssl__MessageFace__Ptr, 0 | 0); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "printWsMessage" "', argument " "1"" of type '" "bcos::boostssl::MessageFace::Ptr const &""'"); - } - if (!argp1) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "printWsMessage" "', argument " "1"" of type '" "bcos::boostssl::MessageFace::Ptr const &""'"); - } - arg1 = reinterpret_cast< bcos::boostssl::MessageFace::Ptr * >(argp1); - result = ppc::protocol::printWsMessage((bcos::boostssl::MessageFace::Ptr const &)*arg1); - resultobj = SWIG_From_std_string(static_cast< std::string >(result)); - return resultobj; -fail: - return NULL; -} - - SWIGINTERN PyObject *_wrap_delete_MessagePayload(PyObject *self, PyObject *args) { PyObject *resultobj = 0; ppc::protocol::MessagePayload *arg1 = (ppc::protocol::MessagePayload *) 0 ; @@ -24721,24 +24220,14 @@ static PyMethodDef SwigMethods[] = { { "delete_Message", _wrap_delete_Message, METH_O, NULL}, { "Message_header", _wrap_Message_header, METH_O, NULL}, { "Message_setHeader", _wrap_Message_setHeader, METH_VARARGS, NULL}, - { "Message_version", _wrap_Message_version, METH_O, " the overloaed implementation ==="}, - { "Message_setVersion", _wrap_Message_setVersion, METH_VARARGS, NULL}, - { "Message_packetType", _wrap_Message_packetType, METH_O, NULL}, - { "Message_setPacketType", _wrap_Message_setPacketType, METH_VARARGS, NULL}, - { "Message_seq", _wrap_Message_seq, METH_O, NULL}, - { "Message_setSeq", _wrap_Message_setSeq, METH_VARARGS, NULL}, - { "Message_ext", _wrap_Message_ext, METH_O, NULL}, - { "Message_setExt", _wrap_Message_setExt, METH_VARARGS, NULL}, - { "Message_isRespPacket", _wrap_Message_isRespPacket, METH_O, NULL}, - { "Message_setRespPacket", _wrap_Message_setRespPacket, METH_O, NULL}, - { "Message_length", _wrap_Message_length, METH_O, NULL}, - { "Message_payload", _wrap_Message_payload, METH_O, NULL}, { "Message_payloadBuffer", _wrap_Message_payloadBuffer, METH_O, NULL}, - { "Message_setPayload", _wrap_Message_setPayload, METH_VARARGS, NULL}, { "Message_setFrontMessage", _wrap_Message_setFrontMessage, METH_VARARGS, NULL}, { "Message_frontMessage", _wrap_Message_frontMessage, METH_O, NULL}, { "Message_encode", _wrap_Message_encode, METH_VARARGS, NULL}, { "Message_decode", _wrap_Message_decode, METH_VARARGS, NULL}, + { "Message_length", _wrap_Message_length, METH_O, NULL}, + { "Message_payload", _wrap_Message_payload, METH_O, NULL}, + { "Message_setPayload", _wrap_Message_setPayload, METH_VARARGS, NULL}, { "Message_swigregister", Message_swigregister, METH_O, NULL}, { "delete_MessageHeaderBuilder", _wrap_delete_MessageHeaderBuilder, METH_O, NULL}, { "MessageHeaderBuilder_build", _wrap_MessageHeaderBuilder_build, METH_VARARGS, NULL}, @@ -24751,7 +24240,6 @@ static PyMethodDef SwigMethods[] = { { "MessageOptionalHeaderBuilder_swigregister", MessageOptionalHeaderBuilder_swigregister, METH_O, NULL}, { "printOptionalField", _wrap_printOptionalField, METH_O, NULL}, { "printMessage", _wrap_printMessage, METH_O, NULL}, - { "printWsMessage", _wrap_printWsMessage, METH_O, NULL}, { "delete_MessagePayload", _wrap_delete_MessagePayload, METH_O, NULL}, { "MessagePayload_encode", _wrap_MessagePayload_encode, METH_VARARGS, NULL}, { "MessagePayload_decode", _wrap_MessagePayload_decode, METH_VARARGS, NULL}, @@ -24898,8 +24386,6 @@ static swig_type_info _swigt__p_UniqueConstPtr = {"_p_UniqueConstPtr", "UniqueCo static swig_type_info _swigt__p_UniquePtr = {"_p_UniquePtr", "UniquePtr *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_allocator_type = {"_p_allocator_type", "allocator_type *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_bcos__Error = {"_p_bcos__Error", "bcos::Error *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_bcos__boostssl__EncodedMsg = {"_p_bcos__boostssl__EncodedMsg", "bcos::boostssl::EncodedMsg *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_bcos__boostssl__MessageFace__Ptr = {"_p_bcos__boostssl__MessageFace__Ptr", "bcos::boostssl::MessageFace::Ptr *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_bcos__bytesConstRef = {"_p_bcos__bytesConstRef", "bcos::bytesConstRef *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_difference_type = {"_p_difference_type", "difference_type *", 0, 0, (void*)0, 0}; @@ -24988,8 +24474,6 @@ static swig_type_info *swig_type_initial[] = { &_swigt__p_UniquePtr, &_swigt__p_allocator_type, &_swigt__p_bcos__Error, - &_swigt__p_bcos__boostssl__EncodedMsg, - &_swigt__p_bcos__boostssl__MessageFace__Ptr, &_swigt__p_bcos__bytesConstRef, &_swigt__p_char, &_swigt__p_difference_type, @@ -25078,8 +24562,6 @@ static swig_cast_info _swigc__p_UniqueConstPtr[] = { {&_swigt__p_UniqueConstPtr static swig_cast_info _swigc__p_UniquePtr[] = { {&_swigt__p_UniquePtr, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_allocator_type[] = { {&_swigt__p_allocator_type, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_bcos__Error[] = { {&_swigt__p_bcos__Error, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_bcos__boostssl__EncodedMsg[] = { {&_swigt__p_bcos__boostssl__EncodedMsg, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_bcos__boostssl__MessageFace__Ptr[] = { {&_swigt__p_bcos__boostssl__MessageFace__Ptr, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_bcos__bytesConstRef[] = { {&_swigt__p_bcos__bytesConstRef, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_difference_type[] = { {&_swigt__p_difference_type, 0, 0, 0},{0, 0, 0, 0}}; @@ -25168,8 +24650,6 @@ static swig_cast_info *swig_cast_initial[] = { _swigc__p_UniquePtr, _swigc__p_allocator_type, _swigc__p_bcos__Error, - _swigc__p_bcos__boostssl__EncodedMsg, - _swigc__p_bcos__boostssl__MessageFace__Ptr, _swigc__p_bcos__bytesConstRef, _swigc__p_char, _swigc__p_difference_type,