From 67979897a64bdbc17d2e8c5c85cdd0b5807e12cc Mon Sep 17 00:00:00 2001 From: tqcq <99722391+tqcq@users.noreply.github.com> Date: Mon, 4 Dec 2023 13:28:23 +0800 Subject: [PATCH] feature update proto --- src/plugins/c/c_service_client_plugin.cpp | 12 ++++++++++++ src/plugins/c/c_service_client_plugin.h | 3 +++ src/plugins/c/c_service_server_plugin.cpp | 3 +++ src/plugins/c/rpcs/crpc_server.cpp | 2 +- src/test.proto | 17 +++++++++++++++++ 5 files changed, 36 insertions(+), 1 deletion(-) diff --git a/src/plugins/c/c_service_client_plugin.cpp b/src/plugins/c/c_service_client_plugin.cpp index 31d15c6..430aa6c 100644 --- a/src/plugins/c/c_service_client_plugin.cpp +++ b/src/plugins/c/c_service_client_plugin.cpp @@ -430,4 +430,16 @@ CServiceClientPlugin::GenerateHeaderGuardStart(Service::Ptr service) return ss.str(); } +std::string +CServiceClientPlugin::GenerateHeaderExamples(Service::Ptr service) +{ + return ""; +} + +std::string +CServiceClientPlugin::GenerateSourceExamples(Service::Ptr service) +{ + return ""; +} + }// namespace tqcq diff --git a/src/plugins/c/c_service_client_plugin.h b/src/plugins/c/c_service_client_plugin.h index 00fd0cf..fac5faf 100644 --- a/src/plugins/c/c_service_client_plugin.h +++ b/src/plugins/c/c_service_client_plugin.h @@ -39,6 +39,9 @@ protected: std::string GenerateSourceSendFunctionDefinition(Service::Ptr service); std::string GenerateSourceDispatchFunctionDefinition(Service::Ptr service); + + std::string GenerateHeaderExamples(Service::Ptr service); + std::string GenerateSourceExamples(Service::Ptr service); }; }// namespace tqcq diff --git a/src/plugins/c/c_service_server_plugin.cpp b/src/plugins/c/c_service_server_plugin.cpp index c4d7fc3..b8b166c 100644 --- a/src/plugins/c/c_service_server_plugin.cpp +++ b/src/plugins/c/c_service_server_plugin.cpp @@ -38,10 +38,13 @@ std::string CServiceServerPlugin::GenerateHeaderStructAPIStart(Service::Ptr service) { std::stringstream ss; + ss << "/** api examples" << std::endl; for (const auto& rpc : service->rpcs()) { auto crpc = CRPCServer::Create(rpc); ss << crpc->GenerateAPITypedef(service->id()); } + ss << " * api examples" << std::endl; + ss << " */ " << std::endl; ss << std::endl; ss << "typedef struct " diff --git a/src/plugins/c/rpcs/crpc_server.cpp b/src/plugins/c/rpcs/crpc_server.cpp index 1e750dd..29e1f64 100644 --- a/src/plugins/c/rpcs/crpc_server.cpp +++ b/src/plugins/c/rpcs/crpc_server.cpp @@ -115,7 +115,7 @@ CRPCServer::GenerateAPITypedef(std::string service_id) const { std::stringstream ss; // ss << "typedef int32_t (*" << service_id << "_API_"<< id() << "_Type)(const " << request_id() << " *request, " << response_id() << " *response);\n"; - ss << "int32_t RPCSM_" << id() << "_API_Impl" << "(const " << request_id() << " *request, " << response_id() << " *response);\n";; + ss << "int32_t YOUR_PREFIX_" << id() << "_API_Impl" << "(const " << request_id() << " *request, " << response_id() << " *response);\n";; return ss.str(); } diff --git a/src/test.proto b/src/test.proto index b7c0ff9..3ec1a34 100644 --- a/src/test.proto +++ b/src/test.proto @@ -81,6 +81,18 @@ message SMSymmetricResponse { string out_data = 3; } +message SM2_3_Request { + string ecc_pubkey = 1; + string ecc_prikey = 2; + string in_data = 3; +} + +message SM2_3_Response { + int32 code = 1; + string msg = 2; + + string out_data = 3; +} service DeviceService { rpc Init(EmptyRequest) returns (StatusResponse) {} @@ -100,6 +112,11 @@ service DeviceService { rpc GenerateSignatureByExternalPrivateKey(GenerateSignatureByExternalPrivateKeyRequest) returns (SingleDataResponse) {} rpc VerifySignature(VerifySignatureRequest) returns (StatusResponse) {} + rpc SM2_3_Encrypt_ExternalPubkey(SM2_3_Request) returns (SM2_3_Response) {} + rpc SM2_3_Decrypt_ExternalPrikey(SM2_3_Request) returns (SM2_3_Response) {} + rpc SM2_3_Decrypt_InternalPrikey(SM2_3_Request) returns (SM2_3_Response) {} + rpc SM2_3_Decrypt_InternalCryptPrikey(SM2_3_Request) returns (SM2_3_Response) {} + rpc SM1Encrypt(SMSymmetricRequest) returns (SMSymmetricResponse) {} rpc SM1Decrypt(SMSymmetricRequest) returns (SMSymmetricResponse) {} rpc SM4Encrypt(SMSymmetricRequest) returns (SMSymmetricResponse) {}