-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3f202ae
commit 4cad628
Showing
76 changed files
with
398 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
cpp/wedpr-component-c-sdk/CMakeLists.txt → cpp/wedpr-component-sdk/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
project(wedpr-component-c-sdk VERSION ${VERSION}) | ||
project(wedpr-component-sdk VERSION ${VERSION}) | ||
|
||
# export windows dll symbol | ||
if(WIN32) | ||
message(STATUS "Compile on Windows") | ||
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS "ON") | ||
endif() | ||
add_subdirectory(ppc-crypto-c-sdk) | ||
add_subdirectory(ppc-front-c-sdk) | ||
add_subdirectory(wedpr-front-cpp-sdk) | ||
|
||
if (TESTS) | ||
enable_testing() | ||
set(CTEST_OUTPUT_ON_FAILURE TRUE) | ||
add_subdirectory(tests) | ||
endif() | ||
endif() |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
file(GLOB_RECURSE SRCS *.cpp *.c) | ||
|
||
# generate the static lib | ||
add_library(${PPC_FRONT_C_SDK_STATIC_TARGET} ${SRCS}) | ||
target_link_libraries(${PPC_FRONT_C_SDK_STATIC_TARGET} PUBLIC ${BCOS_UTILITIES_TARGET}) | ||
|
||
# generate the shared lib | ||
add_library(${PPC_FRONT_C_SDK_TARGET} SHARED ${SRCS}) | ||
target_link_libraries(${PPC_FRONT_C_SDK_TARGET} PUBLIC ${BCOS_UTILITIES_TARGET}) |
92 changes: 92 additions & 0 deletions
92
cpp/wedpr-component-sdk/wedpr-front-cpp-sdk/wedpr_front_c.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
/** | ||
* 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 wedpr_front_c.h | ||
* @author: yujiechen | ||
* @date 2024-08-22 | ||
*/ | ||
#include "wedpr_front_c.h" | ||
|
||
/** | ||
* @brief create the wedpr_front using specified config | ||
* | ||
* @param config the config used to build the wedpr_front | ||
* @return void* the created wedpr_front | ||
*/ | ||
void* wedpr_front_create(struct wedpr_front_config* config) | ||
{ | ||
return nullptr; | ||
} | ||
|
||
/** | ||
* @brief start the wedpr_front | ||
* | ||
* @param front the front to start | ||
*/ | ||
void wedpr_front_start(void* front) {} | ||
|
||
/** | ||
* @brief stop the wedpr_front | ||
* | ||
* @param front the front to stop | ||
*/ | ||
void wedpr_front_stop(void* front) {} | ||
|
||
/** | ||
* @brief destroy the wedpr_front | ||
* | ||
* @param front the front to destroy | ||
*/ | ||
void wedpr_front_destroy(void* front) {} | ||
|
||
/** | ||
* @brief register the topic handler | ||
* | ||
* @param front the front object | ||
* @param topic the topic | ||
* @param callback the callback called when receive specified topic | ||
*/ | ||
void register_topic_handler(void* front, InputBuffer const* topic, wedpr_msg_handler_cb callback) {} | ||
|
||
/** | ||
* @brief async send message | ||
* | ||
* @param front the front to send the message | ||
* @param routerPolicy the router policy: | ||
* 0: route by nodeID | ||
* 1: route by component | ||
* 2: route by agency | ||
* @param topic the topic | ||
* @param dstInst the dst agency(must set when 'route by agency' and 'route by | ||
* component') | ||
* @param dstNodeID the dst nodeID(must set when 'route by nodeID') | ||
* @param componentType the componentType(must set when 'route by component') | ||
* @param payload the payload to send | ||
* @param seq the message seq | ||
* @param timeout timeout | ||
* @param callback callback | ||
*/ | ||
void async_send_message(void* front, int routerPolicy, InputBuffer const* topic, | ||
InputBuffer const* dstInst, InputBuffer const* dstNodeID, uint8_t componentType, | ||
InputBuffer const* payload, int seq, long timeout, wedpr_msg_handler_cb callback) | ||
{} | ||
|
||
// the sync interface for async_send_message | ||
wedpr_msg* push(void* front, int routerPolicy, InputBuffer const* topic, InputBuffer const* dstInst, | ||
InputBuffer const* dstNodeID, uint8_t componentType, InputBuffer const* payload, int seq, | ||
long timeout) | ||
{ | ||
return nullptr; | ||
} |
98 changes: 98 additions & 0 deletions
98
cpp/wedpr-component-sdk/wedpr-front-cpp-sdk/wedpr_front_c.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 wedpr_front_c.h | ||
* @author: yujiechen | ||
* @date 2024-08-22 | ||
*/ | ||
#ifndef __WEDPR_FRONT_C_H__ | ||
#define __WEDPR_FRONT_C_H__ | ||
#include "ppc-framework/libwrapper/Buffer.h" | ||
#include "wedpr_front_common.h" | ||
#include "wedpr_front_config.h" | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
/** | ||
* @brief create the wedpr_front using specified config | ||
* | ||
* @param config the config used to build the wedpr_front | ||
* @return void* the created wedpr_front | ||
*/ | ||
void* wedpr_front_create(struct wedpr_front_config* config); | ||
|
||
/** | ||
* @brief start the wedpr_front | ||
* | ||
* @param front the front to start | ||
*/ | ||
void wedpr_front_start(void* front); | ||
|
||
/** | ||
* @brief stop the wedpr_front | ||
* | ||
* @param front the front to stop | ||
*/ | ||
void wedpr_front_stop(void* front); | ||
|
||
/** | ||
* @brief destroy the wedpr_front | ||
* | ||
* @param front the front to destroy | ||
*/ | ||
void wedpr_front_destroy(void* front); | ||
|
||
/** | ||
* @brief register the topic handler | ||
* | ||
* @param front the front object | ||
* @param topic the topic | ||
* @param callback the callback called when receive specified topic | ||
*/ | ||
void register_topic_handler(void* front, InputBuffer const* topic, wedpr_msg_handler_cb callback); | ||
|
||
/** | ||
* @brief async send message | ||
* | ||
* @param front the front to send the message | ||
* @param routerPolicy the router policy: | ||
* 0: route by nodeID | ||
* 1: route by component | ||
* 2: route by agency | ||
* @param topic the topic | ||
* @param dstInst the dst agency(must set when 'route by agency' and 'route by | ||
* component') | ||
* @param dstNodeID the dst nodeID(must set when 'route by nodeID') | ||
* @param componentType the componentType(must set when 'route by component') | ||
* @param payload the payload to send | ||
* @param seq the message seq | ||
* @param timeout timeout | ||
* @param callback callback | ||
*/ | ||
void async_send_message(void* front, int routerPolicy, InputBuffer const* topic, | ||
InputBuffer const* dstInst, InputBuffer const* dstNodeID, uint8_t componentType, | ||
InputBuffer const* payload, int seq, long timeout, wedpr_msg_handler_cb callback); | ||
|
||
// the sync interface for async_send_message | ||
wedpr_msg* push(void* front, int routerPolicy, InputBuffer const* topic, InputBuffer const* dstInst, | ||
InputBuffer const* dstNodeID, uint8_t componentType, InputBuffer const* payload, int seq, | ||
long timeout); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
#endif |
28 changes: 28 additions & 0 deletions
28
cpp/wedpr-component-sdk/wedpr-front-cpp-sdk/wedpr_front_common.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/** | ||
* 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 wedpr_front_common.h | ||
* @author: yujiechen | ||
* @date 2024-08-22 | ||
*/ | ||
|
||
#ifndef __WEDPR_FRONT_COMMON_H__ | ||
#define __WEDPR_FRONT_COMMON_H__ | ||
|
||
#include "wedpr_msg.h" | ||
|
||
typedef void (*wedpr_msg_handler_cb)(struct wedpr_msg* response, void* context); | ||
|
||
#endif |
Oops, something went wrong.