diff --git a/internal/focus/proto/focus.pb.go b/internal/focus/proto/focus.pb.go index c52907f3..5601c418 100644 --- a/internal/focus/proto/focus.pb.go +++ b/internal/focus/proto/focus.pb.go @@ -17,19 +17,18 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.19.4 +// protoc-gen-go v1.28.0 +// protoc v3.21.3 // source: focus.proto package proto import ( - reflect "reflect" - sync "sync" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" emptypb "google.golang.org/protobuf/types/known/emptypb" + reflect "reflect" + sync "sync" ) const ( @@ -89,8 +88,8 @@ func (x *VersionResponse) GetVersion() string { var File_focus_proto protoreflect.FileDescriptor var file_focus_proto_rawDesc = []byte{ - 0x0a, 0x0b, 0x66, 0x6f, 0x63, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, + 0x0a, 0x0b, 0x66, 0x6f, 0x63, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x66, + 0x6f, 0x63, 0x75, 0x73, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x2b, 0x0a, 0x0f, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, @@ -101,7 +100,7 @@ var file_focus_proto_rawDesc = []byte{ 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x39, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, - 0x70, 0x74, 0x79, 0x1a, 0x16, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x56, 0x65, 0x72, 0x73, + 0x70, 0x74, 0x79, 0x1a, 0x16, 0x2e, 0x66, 0x6f, 0x63, 0x75, 0x73, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x3d, 0x5a, 0x3b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x6e, 0x4d, 0x61, 0x69, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x6e, 0x2d, 0x62, 0x72, 0x69, 0x64, @@ -124,14 +123,14 @@ func file_focus_proto_rawDescGZIP() []byte { var file_focus_proto_msgTypes = make([]protoimpl.MessageInfo, 1) var file_focus_proto_goTypes = []interface{}{ - (*VersionResponse)(nil), // 0: proto.VersionResponse + (*VersionResponse)(nil), // 0: focus.VersionResponse (*emptypb.Empty)(nil), // 1: google.protobuf.Empty } var file_focus_proto_depIdxs = []int32{ - 1, // 0: proto.Focus.Raise:input_type -> google.protobuf.Empty - 1, // 1: proto.Focus.Version:input_type -> google.protobuf.Empty - 1, // 2: proto.Focus.Raise:output_type -> google.protobuf.Empty - 0, // 3: proto.Focus.Version:output_type -> proto.VersionResponse + 1, // 0: focus.Focus.Raise:input_type -> google.protobuf.Empty + 1, // 1: focus.Focus.Version:input_type -> google.protobuf.Empty + 1, // 2: focus.Focus.Raise:output_type -> google.protobuf.Empty + 0, // 3: focus.Focus.Version:output_type -> focus.VersionResponse 2, // [2:4] is the sub-list for method output_type 0, // [0:2] is the sub-list for method input_type 0, // [0:0] is the sub-list for extension type_name diff --git a/internal/focus/proto/focus.proto b/internal/focus/proto/focus.proto index cd67352d..bbe5c6aa 100644 --- a/internal/focus/proto/focus.proto +++ b/internal/focus/proto/focus.proto @@ -21,7 +21,7 @@ import "google/protobuf/empty.proto"; option go_package = "github.com/ProtonMail/proton-bridge/v2/internal/focus/proto"; -package proto; +package focus; // ignored by Go, used as namespace name in C++. //********************************************************************************************************************** // Service Declaration diff --git a/internal/focus/proto/focus_grpc.pb.go b/internal/focus/proto/focus_grpc.pb.go index 672d5406..2c1a00f8 100644 --- a/internal/focus/proto/focus_grpc.pb.go +++ b/internal/focus/proto/focus_grpc.pb.go @@ -1,14 +1,13 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.2.0 -// - protoc v3.19.4 +// - protoc v3.21.3 // source: focus.proto package proto import ( context "context" - grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -38,7 +37,7 @@ func NewFocusClient(cc grpc.ClientConnInterface) FocusClient { func (c *focusClient) Raise(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error) { out := new(emptypb.Empty) - err := c.cc.Invoke(ctx, "/proto.Focus/Raise", in, out, opts...) + err := c.cc.Invoke(ctx, "/focus.Focus/Raise", in, out, opts...) if err != nil { return nil, err } @@ -47,7 +46,7 @@ func (c *focusClient) Raise(ctx context.Context, in *emptypb.Empty, opts ...grpc func (c *focusClient) Version(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*VersionResponse, error) { out := new(VersionResponse) - err := c.cc.Invoke(ctx, "/proto.Focus/Version", in, out, opts...) + err := c.cc.Invoke(ctx, "/focus.Focus/Version", in, out, opts...) if err != nil { return nil, err } @@ -96,7 +95,7 @@ func _Focus_Raise_Handler(srv interface{}, ctx context.Context, dec func(interfa } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/proto.Focus/Raise", + FullMethod: "/focus.Focus/Raise", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(FocusServer).Raise(ctx, req.(*emptypb.Empty)) @@ -114,7 +113,7 @@ func _Focus_Version_Handler(srv interface{}, ctx context.Context, dec func(inter } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/proto.Focus/Version", + FullMethod: "/focus.Focus/Version", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(FocusServer).Version(ctx, req.(*emptypb.Empty)) @@ -126,7 +125,7 @@ func _Focus_Version_Handler(srv interface{}, ctx context.Context, dec func(inter // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var Focus_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "proto.Focus", + ServiceName: "focus.Focus", HandlerType: (*FocusServer)(nil), Methods: []grpc.MethodDesc{ { diff --git a/internal/focus/service.go b/internal/focus/service.go index 5954eab3..cf42096e 100644 --- a/internal/focus/service.go +++ b/internal/focus/service.go @@ -89,6 +89,10 @@ func (service *Service) GetRaiseCh() <-chan struct{} { // Close closes the service. func (service *Service) Close() { - service.server.Stop() - close(service.raiseCh) + go func() { + // we do this in a goroutine, as on Windows, the gRPC shutdown may take minutes if something tries to + // interact with it in an invalid way (e.g. HTTP GET request from a Qt QNetworkManager instance). + service.server.Stop() + close(service.raiseCh) + }() } diff --git a/internal/frontend/bridge-gui/bridge-gui/main.cpp b/internal/frontend/bridge-gui/bridge-gui/main.cpp index 060d93c1..8a1e6701 100644 --- a/internal/frontend/bridge-gui/bridge-gui/main.cpp +++ b/internal/frontend/bridge-gui/bridge-gui/main.cpp @@ -20,9 +20,10 @@ #include "CommandLine.h" #include "QMLBackend.h" #include "Version.h" -#include #include #include +#include +#include #include @@ -44,18 +45,6 @@ QString const exeName = "bridge" + exeSuffix; ///< The bridge executable file na qint64 const grpcServiceConfigWaitDelayMs = 180000; ///< The wait delay for the gRPC config file in milliseconds. -//**************************************************************************************************************************************************** -/// According to Qt doc, one per application is OK, but its use should be restricted to a -/// single thread. -/// \return The network access manager for the application. -//**************************************************************************************************************************************************** -QNetworkAccessManager& networkManager() -{ - static QNetworkAccessManager nam; - return nam; -} - - } // anonymous namespace @@ -217,17 +206,8 @@ QUrl getFocusUrl() //**************************************************************************************************************************************************** bool isBridgeRunning() { - QTimer timer; - timer.setSingleShot(true); - - std::unique_ptr reply(networkManager().get(QNetworkRequest(getFocusUrl()))); - QEventLoop loop; - bool timedOut = false; - QObject::connect(&timer, &QTimer::timeout, [&]() { timedOut = true; loop.quit(); }); - QObject::connect(reply.get(), &QNetworkReply::finished, &loop, &QEventLoop::quit); - timer.start(1000); // we time out after 1 second and consider no other instance is running. - loop.exec(); - return ((!timedOut) && (reply->error() == QNetworkReply::NetworkError::NoError)); + FocusGRPCClient client; + return client.connectToServer(500); // we time out after 1 second and consider no other instance is running; } @@ -236,10 +216,19 @@ bool isBridgeRunning() //**************************************************************************************************************************************************** void focusOtherInstance() { - std::unique_ptr reply(networkManager().get(QNetworkRequest(getFocusUrl()))); - QEventLoop loop; - QObject::connect(reply.get(), &QNetworkReply::finished, &loop, &QEventLoop::quit); - loop.exec(); + try + { + FocusGRPCClient client; + QString error; + if (!client.connectToServer(5000, &error)) + throw Exception(QString("Could not connect to bridge focus service for a raise call: %1").arg(error)); + if (!client.raise().ok()) + throw Exception(QString("The raise call to the bridge focus service failed.")); + } + catch (Exception const& e) + { + app().log().error(e.qwhat()); + } } diff --git a/internal/frontend/bridge-gui/bridgepp/CMakeLists.txt b/internal/frontend/bridge-gui/bridgepp/CMakeLists.txt index 2fd3f608..4b1cf41a 100644 --- a/internal/frontend/bridge-gui/bridgepp/CMakeLists.txt +++ b/internal/frontend/bridge-gui/bridgepp/CMakeLists.txt @@ -66,6 +66,10 @@ else () message(STATUS "grpc_cpp_plugin found at ${GRPC_CPP_PLUGIN}") endif () + +#***************************************************************************************************************************************************** +# Bridge gRPC service source code generation +#***************************************************************************************************************************************************** set(PROTO_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../grpc") set(PROTO_FILE "${PROTO_DIR}/bridge.proto") set(GRPC_OUT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/bridgepp/GRPC") @@ -74,11 +78,6 @@ set(PROTO_H_FILE "${GRPC_OUT_DIR}/bridge.pb.h") set(GRPC_CPP_FILE "${GRPC_OUT_DIR}/bridge.grpc.pb.cc") set(GRPC_H_FILE "${GRPC_OUT_DIR}/bridge.grpc.pb.h") - -#***************************************************************************************************************************************************** -# Source files and output -#***************************************************************************************************************************************************** - add_custom_command( OUTPUT ${PROTO_CPP_FILE} @@ -95,8 +94,44 @@ add_custom_command( ${PROTO_FILE} DEPENDS ${PROTO_FILE} - COMMENT "Generating gPRC/Protobuf C++ code" - ) + COMMENT "Generating Bridge gPRC/Protobuf C++ code" +) + + +#***************************************************************************************************************************************************** +# Focus gRPC service source code generation +#***************************************************************************************************************************************************** +set(FOCUS_PROTO_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../focus/proto") +set(FOCUS_PROTO_FILE "${FOCUS_PROTO_DIR}/focus.proto") +set(FOCUS_GRPC_OUT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/bridgepp/FocusGRPC") +set(FOCUS_PROTO_CPP_FILE "${FOCUS_GRPC_OUT_DIR}/focus.pb.cc") +set(FOCUS_PROTO_H_FILE "${FOCUS_GRPC_OUT_DIR}/focus.pb.h") +set(FOCUS_GRPC_CPP_FILE "${FOCUS_GRPC_OUT_DIR}/focus.grpc.pb.cc") +set(FOCUS_GRPC_H_FILE "${FOCUS_GRPC_OUT_DIR}/focus.grpc.pb.h") + +add_custom_command( + OUTPUT + ${FOCUS_PROTO_CPP_FILE} + ${FOCUS_PROTO_H_FILE} + ${FOCUS_GRPC_CPP_FILE} + ${FOCUS_GRPC_H_FILE} + COMMAND + ${PROTOC_EXE} + ARGS + --proto_path=${FOCUS_PROTO_DIR} + --plugin=protoc-gen-grpc="${GRPC_CPP_PLUGIN}" + --cpp_out=${FOCUS_GRPC_OUT_DIR} + --grpc_out=${FOCUS_GRPC_OUT_DIR} + ${FOCUS_PROTO_FILE} + DEPENDS + ${FOCUS_PROTO_FILE} + COMMENT "Generating focus gPRC/Protobuf Focus service C++ code" +) + + +#***************************************************************************************************************************************************** +# Source files and output +#***************************************************************************************************************************************************** add_library(bridgepp @@ -107,6 +142,8 @@ add_library(bridgepp bridgepp/GRPC/GRPCConfig.cpp bridgepp/GRPC/GRPCConfig.h bridgepp/GRPC/GRPCUtils.cpp bridgepp/GRPC/GRPCUtils.h ${PROTO_CPP_FILE} ${PROTO_H_FILE} ${GRPC_CPP_FILE} ${GRPC_H_FILE} + ${FOCUS_PROTO_CPP_FILE} ${FOCUS_PROTO_H_FILE} ${FOCUS_GRPC_CPP_FILE} ${FOCUS_GRPC_H_FILE} + bridgepp/FocusGRPC/FocusGRPCClient.cpp bridgepp/FocusGRPC/FocusGRPCClient.h bridgepp/Log/Log.h bridgepp/Log/Log.cpp bridgepp/ProcessMonitor.cpp bridgepp/ProcessMonitor.h bridgepp/User/User.cpp bridgepp/User/User.h diff --git a/internal/frontend/bridge-gui/bridgepp/bridgepp/FocusGRPC/FocusGRPCClient.cpp b/internal/frontend/bridge-gui/bridgepp/bridgepp/FocusGRPC/FocusGRPCClient.cpp new file mode 100644 index 00000000..cf33f4d8 --- /dev/null +++ b/internal/frontend/bridge-gui/bridgepp/bridgepp/FocusGRPC/FocusGRPCClient.cpp @@ -0,0 +1,101 @@ +// Copyright (c) 2022 Proton AG +// +// This file is part of Proton Mail Bridge. +// +// Proton Mail Bridge is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Proton Mail Bridge is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Proton Mail Bridge. If not, see . + + +#include "FocusGRPCClient.h" +#include "../Exception/Exception.h" + + +using namespace focus; +using namespace grpc; +using namespace google::protobuf; + + +namespace +{ + + +Empty empty; ///< Empty protobuf message, re-used across calls. +qint64 const port = 1042; ///< The port for the focus service. +QString const hostname = "127.0.0.1"; ///< The hostname of the focus service. + + +} + + +namespace bridgepp +{ + + +//**************************************************************************************************************************************************** +/// \param[in] timeoutMs The timeout for the connexion. +/// \param[out] outError if not null and the function returns false. +/// \return true iff the connexion was successfully established. +//**************************************************************************************************************************************************** +bool FocusGRPCClient::connectToServer(qint64 timeoutMs, QString *outError) +{ + try + { + QString const address = QString("%1:%2").arg(hostname).arg(port); + channel_ = grpc::CreateChannel(address.toStdString(), grpc::InsecureChannelCredentials()); + if (!channel_) + throw Exception("Could not create focus service channel."); + stub_ = Focus::NewStub(channel_); + + if (!channel_->WaitForConnected(gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), gpr_time_from_millis(timeoutMs, GPR_TIMESPAN)))) + throw Exception("Could not connect to focus service"); + + if (channel_->GetState(true) != GRPC_CHANNEL_READY) + throw Exception("Connexion check with focus service failed."); + + return true; + } + catch (Exception const &e) + { + if (outError) + *outError = e.qwhat(); + return false; + } +} + + +//**************************************************************************************************************************************************** +/// \return The status for the call. +//**************************************************************************************************************************************************** +grpc::Status FocusGRPCClient::raise() +{ + ClientContext ctx; + return stub_->Raise(&ctx, empty, &empty); +} + + +//**************************************************************************************************************************************************** +/// \param[out] outVersion The version string. +/// \return The status for the call. +//**************************************************************************************************************************************************** +grpc::Status FocusGRPCClient::version(QString &outVersion) +{ + ClientContext ctx; + VersionResponse response; + Status status = stub_->Version(&ctx, empty, &response); + if (status.ok()) + outVersion = QString::fromStdString(response.version()); + return status; +} + + +}// namespace bridgepp diff --git a/internal/frontend/bridge-gui/bridgepp/bridgepp/FocusGRPC/FocusGRPCClient.h b/internal/frontend/bridge-gui/bridgepp/bridgepp/FocusGRPC/FocusGRPCClient.h new file mode 100644 index 00000000..62aa927c --- /dev/null +++ b/internal/frontend/bridge-gui/bridgepp/bridgepp/FocusGRPC/FocusGRPCClient.h @@ -0,0 +1,57 @@ +// Copyright (c) 2022 Proton AG +// +// This file is part of Proton Mail Bridge. +// +// Proton Mail Bridge is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Proton Mail Bridge is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Proton Mail Bridge. If not, see . + + +#ifndef BRIDGEPP_FOCUS_GRPC_CLIENT_H +#define BRIDGEPP_FOCUS_GRPC_CLIENT_H + + +#include "grpc++/grpc++.h" +#include "focus.grpc.pb.h" + + +namespace bridgepp +{ + + +//********************************************************************************************************************** +/// \brief Focus GRPC client class +//********************************************************************************************************************** +class FocusGRPCClient +{ +public: // member functions. + FocusGRPCClient() = default; ///< Default constructor. + FocusGRPCClient(FocusGRPCClient const &) = delete; ///< Disabled copy-constructor. + FocusGRPCClient(FocusGRPCClient &&) = delete; ///< Disabled assignment copy-constructor. + ~FocusGRPCClient() = default; ///< Destructor. + FocusGRPCClient &operator=(FocusGRPCClient const &) = delete; ///< Disabled assignment operator. + FocusGRPCClient &operator=(FocusGRPCClient &&) = delete; ///< Disabled move assignment operator. + bool connectToServer(qint64 timeoutMs, QString *outError = nullptr); ///< Connect to the focus server + + grpc::Status raise(); ///< Performs the 'raise' call. + grpc::Status version(QString &outVersion); ///< Performs the 'version' call. + +private: + std::shared_ptr channel_ { nullptr }; ///< The gRPC channel. + std::shared_ptr stub_ { nullptr }; ///< The gRPC stub (a.k.a. client). +}; + + +} + + +#endif //BRIDGEPP_FOCUS_GRPC_CLIENT_H diff --git a/internal/frontend/bridge-gui/bridgepp/bridgepp/FocusGRPC/focus.grpc.pb.cc b/internal/frontend/bridge-gui/bridgepp/bridgepp/FocusGRPC/focus.grpc.pb.cc new file mode 100644 index 00000000..55d3e961 --- /dev/null +++ b/internal/frontend/bridge-gui/bridgepp/bridgepp/FocusGRPC/focus.grpc.pb.cc @@ -0,0 +1,128 @@ +// Generated by the gRPC C++ plugin. +// If you make any local change, they will be lost. +// source: focus.proto + +#include "focus.pb.h" +#include "focus.grpc.pb.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +namespace focus { + +static const char* Focus_method_names[] = { + "/focus.Focus/Raise", + "/focus.Focus/Version", +}; + +std::unique_ptr< Focus::Stub> Focus::NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options) { + (void)options; + std::unique_ptr< Focus::Stub> stub(new Focus::Stub(channel, options)); + return stub; +} + +Focus::Stub::Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options) + : channel_(channel), rpcmethod_Raise_(Focus_method_names[0], options.suffix_for_stats(),::grpc::internal::RpcMethod::NORMAL_RPC, channel) + , rpcmethod_Version_(Focus_method_names[1], options.suffix_for_stats(),::grpc::internal::RpcMethod::NORMAL_RPC, channel) + {} + +::grpc::Status Focus::Stub::Raise(::grpc::ClientContext* context, const ::google::protobuf::Empty& request, ::google::protobuf::Empty* response) { + return ::grpc::internal::BlockingUnaryCall< ::google::protobuf::Empty, ::google::protobuf::Empty, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_Raise_, context, request, response); +} + +void Focus::Stub::async::Raise(::grpc::ClientContext* context, const ::google::protobuf::Empty* request, ::google::protobuf::Empty* response, std::function f) { + ::grpc::internal::CallbackUnaryCall< ::google::protobuf::Empty, ::google::protobuf::Empty, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_Raise_, context, request, response, std::move(f)); +} + +void Focus::Stub::async::Raise(::grpc::ClientContext* context, const ::google::protobuf::Empty* request, ::google::protobuf::Empty* response, ::grpc::ClientUnaryReactor* reactor) { + ::grpc::internal::ClientCallbackUnaryFactory::Create< ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_Raise_, context, request, response, reactor); +} + +::grpc::ClientAsyncResponseReader< ::google::protobuf::Empty>* Focus::Stub::PrepareAsyncRaiseRaw(::grpc::ClientContext* context, const ::google::protobuf::Empty& request, ::grpc::CompletionQueue* cq) { + return ::grpc::internal::ClientAsyncResponseReaderHelper::Create< ::google::protobuf::Empty, ::google::protobuf::Empty, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_Raise_, context, request); +} + +::grpc::ClientAsyncResponseReader< ::google::protobuf::Empty>* Focus::Stub::AsyncRaiseRaw(::grpc::ClientContext* context, const ::google::protobuf::Empty& request, ::grpc::CompletionQueue* cq) { + auto* result = + this->PrepareAsyncRaiseRaw(context, request, cq); + result->StartCall(); + return result; +} + +::grpc::Status Focus::Stub::Version(::grpc::ClientContext* context, const ::google::protobuf::Empty& request, ::focus::VersionResponse* response) { + return ::grpc::internal::BlockingUnaryCall< ::google::protobuf::Empty, ::focus::VersionResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_Version_, context, request, response); +} + +void Focus::Stub::async::Version(::grpc::ClientContext* context, const ::google::protobuf::Empty* request, ::focus::VersionResponse* response, std::function f) { + ::grpc::internal::CallbackUnaryCall< ::google::protobuf::Empty, ::focus::VersionResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_Version_, context, request, response, std::move(f)); +} + +void Focus::Stub::async::Version(::grpc::ClientContext* context, const ::google::protobuf::Empty* request, ::focus::VersionResponse* response, ::grpc::ClientUnaryReactor* reactor) { + ::grpc::internal::ClientCallbackUnaryFactory::Create< ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_Version_, context, request, response, reactor); +} + +::grpc::ClientAsyncResponseReader< ::focus::VersionResponse>* Focus::Stub::PrepareAsyncVersionRaw(::grpc::ClientContext* context, const ::google::protobuf::Empty& request, ::grpc::CompletionQueue* cq) { + return ::grpc::internal::ClientAsyncResponseReaderHelper::Create< ::focus::VersionResponse, ::google::protobuf::Empty, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_Version_, context, request); +} + +::grpc::ClientAsyncResponseReader< ::focus::VersionResponse>* Focus::Stub::AsyncVersionRaw(::grpc::ClientContext* context, const ::google::protobuf::Empty& request, ::grpc::CompletionQueue* cq) { + auto* result = + this->PrepareAsyncVersionRaw(context, request, cq); + result->StartCall(); + return result; +} + +Focus::Service::Service() { + AddMethod(new ::grpc::internal::RpcServiceMethod( + Focus_method_names[0], + ::grpc::internal::RpcMethod::NORMAL_RPC, + new ::grpc::internal::RpcMethodHandler< Focus::Service, ::google::protobuf::Empty, ::google::protobuf::Empty, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>( + [](Focus::Service* service, + ::grpc::ServerContext* ctx, + const ::google::protobuf::Empty* req, + ::google::protobuf::Empty* resp) { + return service->Raise(ctx, req, resp); + }, this))); + AddMethod(new ::grpc::internal::RpcServiceMethod( + Focus_method_names[1], + ::grpc::internal::RpcMethod::NORMAL_RPC, + new ::grpc::internal::RpcMethodHandler< Focus::Service, ::google::protobuf::Empty, ::focus::VersionResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>( + [](Focus::Service* service, + ::grpc::ServerContext* ctx, + const ::google::protobuf::Empty* req, + ::focus::VersionResponse* resp) { + return service->Version(ctx, req, resp); + }, this))); +} + +Focus::Service::~Service() { +} + +::grpc::Status Focus::Service::Raise(::grpc::ServerContext* context, const ::google::protobuf::Empty* request, ::google::protobuf::Empty* response) { + (void) context; + (void) request; + (void) response; + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); +} + +::grpc::Status Focus::Service::Version(::grpc::ServerContext* context, const ::google::protobuf::Empty* request, ::focus::VersionResponse* response) { + (void) context; + (void) request; + (void) response; + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); +} + + +} // namespace focus + diff --git a/internal/frontend/bridge-gui/bridgepp/bridgepp/FocusGRPC/focus.grpc.pb.h b/internal/frontend/bridge-gui/bridgepp/bridgepp/FocusGRPC/focus.grpc.pb.h new file mode 100644 index 00000000..be4b3441 --- /dev/null +++ b/internal/frontend/bridge-gui/bridgepp/bridgepp/FocusGRPC/focus.grpc.pb.h @@ -0,0 +1,418 @@ +// Generated by the gRPC C++ plugin. +// If you make any local change, they will be lost. +// source: focus.proto +// Original file comments: +// Copyright (c) 2022 Proton Technologies AG +// +// This file is part of ProtonMail Bridge. +// +// ProtonMail Bridge is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// ProtonMail Bridge is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with ProtonMail Bridge. If not, see . +// +#ifndef GRPC_focus_2eproto__INCLUDED +#define GRPC_focus_2eproto__INCLUDED + +#include "focus.pb.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace focus { + +// ********************************************************************************************************************** +// Service Declaration +// **********************************************************************************************************************≠–– +class Focus final { + public: + static constexpr char const* service_full_name() { + return "focus.Focus"; + } + class StubInterface { + public: + virtual ~StubInterface() {} + virtual ::grpc::Status Raise(::grpc::ClientContext* context, const ::google::protobuf::Empty& request, ::google::protobuf::Empty* response) = 0; + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::google::protobuf::Empty>> AsyncRaise(::grpc::ClientContext* context, const ::google::protobuf::Empty& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::google::protobuf::Empty>>(AsyncRaiseRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::google::protobuf::Empty>> PrepareAsyncRaise(::grpc::ClientContext* context, const ::google::protobuf::Empty& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::google::protobuf::Empty>>(PrepareAsyncRaiseRaw(context, request, cq)); + } + virtual ::grpc::Status Version(::grpc::ClientContext* context, const ::google::protobuf::Empty& request, ::focus::VersionResponse* response) = 0; + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::focus::VersionResponse>> AsyncVersion(::grpc::ClientContext* context, const ::google::protobuf::Empty& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::focus::VersionResponse>>(AsyncVersionRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::focus::VersionResponse>> PrepareAsyncVersion(::grpc::ClientContext* context, const ::google::protobuf::Empty& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::focus::VersionResponse>>(PrepareAsyncVersionRaw(context, request, cq)); + } + class async_interface { + public: + virtual ~async_interface() {} + virtual void Raise(::grpc::ClientContext* context, const ::google::protobuf::Empty* request, ::google::protobuf::Empty* response, std::function) = 0; + virtual void Raise(::grpc::ClientContext* context, const ::google::protobuf::Empty* request, ::google::protobuf::Empty* response, ::grpc::ClientUnaryReactor* reactor) = 0; + virtual void Version(::grpc::ClientContext* context, const ::google::protobuf::Empty* request, ::focus::VersionResponse* response, std::function) = 0; + virtual void Version(::grpc::ClientContext* context, const ::google::protobuf::Empty* request, ::focus::VersionResponse* response, ::grpc::ClientUnaryReactor* reactor) = 0; + }; + typedef class async_interface experimental_async_interface; + virtual class async_interface* async() { return nullptr; } + class async_interface* experimental_async() { return async(); } + private: + virtual ::grpc::ClientAsyncResponseReaderInterface< ::google::protobuf::Empty>* AsyncRaiseRaw(::grpc::ClientContext* context, const ::google::protobuf::Empty& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::google::protobuf::Empty>* PrepareAsyncRaiseRaw(::grpc::ClientContext* context, const ::google::protobuf::Empty& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::focus::VersionResponse>* AsyncVersionRaw(::grpc::ClientContext* context, const ::google::protobuf::Empty& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::focus::VersionResponse>* PrepareAsyncVersionRaw(::grpc::ClientContext* context, const ::google::protobuf::Empty& request, ::grpc::CompletionQueue* cq) = 0; + }; + class Stub final : public StubInterface { + public: + Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options = ::grpc::StubOptions()); + ::grpc::Status Raise(::grpc::ClientContext* context, const ::google::protobuf::Empty& request, ::google::protobuf::Empty* response) override; + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::google::protobuf::Empty>> AsyncRaise(::grpc::ClientContext* context, const ::google::protobuf::Empty& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::google::protobuf::Empty>>(AsyncRaiseRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::google::protobuf::Empty>> PrepareAsyncRaise(::grpc::ClientContext* context, const ::google::protobuf::Empty& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::google::protobuf::Empty>>(PrepareAsyncRaiseRaw(context, request, cq)); + } + ::grpc::Status Version(::grpc::ClientContext* context, const ::google::protobuf::Empty& request, ::focus::VersionResponse* response) override; + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::focus::VersionResponse>> AsyncVersion(::grpc::ClientContext* context, const ::google::protobuf::Empty& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::focus::VersionResponse>>(AsyncVersionRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::focus::VersionResponse>> PrepareAsyncVersion(::grpc::ClientContext* context, const ::google::protobuf::Empty& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::focus::VersionResponse>>(PrepareAsyncVersionRaw(context, request, cq)); + } + class async final : + public StubInterface::async_interface { + public: + void Raise(::grpc::ClientContext* context, const ::google::protobuf::Empty* request, ::google::protobuf::Empty* response, std::function) override; + void Raise(::grpc::ClientContext* context, const ::google::protobuf::Empty* request, ::google::protobuf::Empty* response, ::grpc::ClientUnaryReactor* reactor) override; + void Version(::grpc::ClientContext* context, const ::google::protobuf::Empty* request, ::focus::VersionResponse* response, std::function) override; + void Version(::grpc::ClientContext* context, const ::google::protobuf::Empty* request, ::focus::VersionResponse* response, ::grpc::ClientUnaryReactor* reactor) override; + private: + friend class Stub; + explicit async(Stub* stub): stub_(stub) { } + Stub* stub() { return stub_; } + Stub* stub_; + }; + class async* async() override { return &async_stub_; } + + private: + std::shared_ptr< ::grpc::ChannelInterface> channel_; + class async async_stub_{this}; + ::grpc::ClientAsyncResponseReader< ::google::protobuf::Empty>* AsyncRaiseRaw(::grpc::ClientContext* context, const ::google::protobuf::Empty& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::google::protobuf::Empty>* PrepareAsyncRaiseRaw(::grpc::ClientContext* context, const ::google::protobuf::Empty& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::focus::VersionResponse>* AsyncVersionRaw(::grpc::ClientContext* context, const ::google::protobuf::Empty& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::focus::VersionResponse>* PrepareAsyncVersionRaw(::grpc::ClientContext* context, const ::google::protobuf::Empty& request, ::grpc::CompletionQueue* cq) override; + const ::grpc::internal::RpcMethod rpcmethod_Raise_; + const ::grpc::internal::RpcMethod rpcmethod_Version_; + }; + static std::unique_ptr NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options = ::grpc::StubOptions()); + + class Service : public ::grpc::Service { + public: + Service(); + virtual ~Service(); + virtual ::grpc::Status Raise(::grpc::ServerContext* context, const ::google::protobuf::Empty* request, ::google::protobuf::Empty* response); + virtual ::grpc::Status Version(::grpc::ServerContext* context, const ::google::protobuf::Empty* request, ::focus::VersionResponse* response); + }; + template + class WithAsyncMethod_Raise : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithAsyncMethod_Raise() { + ::grpc::Service::MarkMethodAsync(0); + } + ~WithAsyncMethod_Raise() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status Raise(::grpc::ServerContext* /*context*/, const ::google::protobuf::Empty* /*request*/, ::google::protobuf::Empty* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestRaise(::grpc::ServerContext* context, ::google::protobuf::Empty* request, ::grpc::ServerAsyncResponseWriter< ::google::protobuf::Empty>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(0, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithAsyncMethod_Version : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithAsyncMethod_Version() { + ::grpc::Service::MarkMethodAsync(1); + } + ~WithAsyncMethod_Version() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status Version(::grpc::ServerContext* /*context*/, const ::google::protobuf::Empty* /*request*/, ::focus::VersionResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestVersion(::grpc::ServerContext* context, ::google::protobuf::Empty* request, ::grpc::ServerAsyncResponseWriter< ::focus::VersionResponse>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(1, context, request, response, new_call_cq, notification_cq, tag); + } + }; + typedef WithAsyncMethod_Raise > AsyncService; + template + class WithCallbackMethod_Raise : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithCallbackMethod_Raise() { + ::grpc::Service::MarkMethodCallback(0, + new ::grpc::internal::CallbackUnaryHandler< ::google::protobuf::Empty, ::google::protobuf::Empty>( + [this]( + ::grpc::CallbackServerContext* context, const ::google::protobuf::Empty* request, ::google::protobuf::Empty* response) { return this->Raise(context, request, response); }));} + void SetMessageAllocatorFor_Raise( + ::grpc::MessageAllocator< ::google::protobuf::Empty, ::google::protobuf::Empty>* allocator) { + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(0); + static_cast<::grpc::internal::CallbackUnaryHandler< ::google::protobuf::Empty, ::google::protobuf::Empty>*>(handler) + ->SetMessageAllocator(allocator); + } + ~WithCallbackMethod_Raise() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status Raise(::grpc::ServerContext* /*context*/, const ::google::protobuf::Empty* /*request*/, ::google::protobuf::Empty* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* Raise( + ::grpc::CallbackServerContext* /*context*/, const ::google::protobuf::Empty* /*request*/, ::google::protobuf::Empty* /*response*/) { return nullptr; } + }; + template + class WithCallbackMethod_Version : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithCallbackMethod_Version() { + ::grpc::Service::MarkMethodCallback(1, + new ::grpc::internal::CallbackUnaryHandler< ::google::protobuf::Empty, ::focus::VersionResponse>( + [this]( + ::grpc::CallbackServerContext* context, const ::google::protobuf::Empty* request, ::focus::VersionResponse* response) { return this->Version(context, request, response); }));} + void SetMessageAllocatorFor_Version( + ::grpc::MessageAllocator< ::google::protobuf::Empty, ::focus::VersionResponse>* allocator) { + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(1); + static_cast<::grpc::internal::CallbackUnaryHandler< ::google::protobuf::Empty, ::focus::VersionResponse>*>(handler) + ->SetMessageAllocator(allocator); + } + ~WithCallbackMethod_Version() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status Version(::grpc::ServerContext* /*context*/, const ::google::protobuf::Empty* /*request*/, ::focus::VersionResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* Version( + ::grpc::CallbackServerContext* /*context*/, const ::google::protobuf::Empty* /*request*/, ::focus::VersionResponse* /*response*/) { return nullptr; } + }; + typedef WithCallbackMethod_Raise > CallbackService; + typedef CallbackService ExperimentalCallbackService; + template + class WithGenericMethod_Raise : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithGenericMethod_Raise() { + ::grpc::Service::MarkMethodGeneric(0); + } + ~WithGenericMethod_Raise() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status Raise(::grpc::ServerContext* /*context*/, const ::google::protobuf::Empty* /*request*/, ::google::protobuf::Empty* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + }; + template + class WithGenericMethod_Version : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithGenericMethod_Version() { + ::grpc::Service::MarkMethodGeneric(1); + } + ~WithGenericMethod_Version() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status Version(::grpc::ServerContext* /*context*/, const ::google::protobuf::Empty* /*request*/, ::focus::VersionResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + }; + template + class WithRawMethod_Raise : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawMethod_Raise() { + ::grpc::Service::MarkMethodRaw(0); + } + ~WithRawMethod_Raise() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status Raise(::grpc::ServerContext* /*context*/, const ::google::protobuf::Empty* /*request*/, ::google::protobuf::Empty* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestRaise(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter< ::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(0, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithRawMethod_Version : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawMethod_Version() { + ::grpc::Service::MarkMethodRaw(1); + } + ~WithRawMethod_Version() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status Version(::grpc::ServerContext* /*context*/, const ::google::protobuf::Empty* /*request*/, ::focus::VersionResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestVersion(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter< ::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(1, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithRawCallbackMethod_Raise : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawCallbackMethod_Raise() { + ::grpc::Service::MarkMethodRawCallback(0, + new ::grpc::internal::CallbackUnaryHandler< ::grpc::ByteBuffer, ::grpc::ByteBuffer>( + [this]( + ::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) { return this->Raise(context, request, response); })); + } + ~WithRawCallbackMethod_Raise() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status Raise(::grpc::ServerContext* /*context*/, const ::google::protobuf::Empty* /*request*/, ::google::protobuf::Empty* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* Raise( + ::grpc::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/) { return nullptr; } + }; + template + class WithRawCallbackMethod_Version : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawCallbackMethod_Version() { + ::grpc::Service::MarkMethodRawCallback(1, + new ::grpc::internal::CallbackUnaryHandler< ::grpc::ByteBuffer, ::grpc::ByteBuffer>( + [this]( + ::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) { return this->Version(context, request, response); })); + } + ~WithRawCallbackMethod_Version() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status Version(::grpc::ServerContext* /*context*/, const ::google::protobuf::Empty* /*request*/, ::focus::VersionResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* Version( + ::grpc::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/) { return nullptr; } + }; + template + class WithStreamedUnaryMethod_Raise : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithStreamedUnaryMethod_Raise() { + ::grpc::Service::MarkMethodStreamed(0, + new ::grpc::internal::StreamedUnaryHandler< + ::google::protobuf::Empty, ::google::protobuf::Empty>( + [this](::grpc::ServerContext* context, + ::grpc::ServerUnaryStreamer< + ::google::protobuf::Empty, ::google::protobuf::Empty>* streamer) { + return this->StreamedRaise(context, + streamer); + })); + } + ~WithStreamedUnaryMethod_Raise() override { + BaseClassMustBeDerivedFromService(this); + } + // disable regular version of this method + ::grpc::Status Raise(::grpc::ServerContext* /*context*/, const ::google::protobuf::Empty* /*request*/, ::google::protobuf::Empty* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + // replace default version of method with streamed unary + virtual ::grpc::Status StreamedRaise(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< ::google::protobuf::Empty,::google::protobuf::Empty>* server_unary_streamer) = 0; + }; + template + class WithStreamedUnaryMethod_Version : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithStreamedUnaryMethod_Version() { + ::grpc::Service::MarkMethodStreamed(1, + new ::grpc::internal::StreamedUnaryHandler< + ::google::protobuf::Empty, ::focus::VersionResponse>( + [this](::grpc::ServerContext* context, + ::grpc::ServerUnaryStreamer< + ::google::protobuf::Empty, ::focus::VersionResponse>* streamer) { + return this->StreamedVersion(context, + streamer); + })); + } + ~WithStreamedUnaryMethod_Version() override { + BaseClassMustBeDerivedFromService(this); + } + // disable regular version of this method + ::grpc::Status Version(::grpc::ServerContext* /*context*/, const ::google::protobuf::Empty* /*request*/, ::focus::VersionResponse* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + // replace default version of method with streamed unary + virtual ::grpc::Status StreamedVersion(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< ::google::protobuf::Empty,::focus::VersionResponse>* server_unary_streamer) = 0; + }; + typedef WithStreamedUnaryMethod_Raise > StreamedUnaryService; + typedef Service SplitStreamedService; + typedef WithStreamedUnaryMethod_Raise > StreamedService; +}; + +} // namespace focus + + +#endif // GRPC_focus_2eproto__INCLUDED diff --git a/internal/frontend/bridge-gui/bridgepp/bridgepp/FocusGRPC/focus.pb.cc b/internal/frontend/bridge-gui/bridgepp/bridgepp/FocusGRPC/focus.pb.cc new file mode 100644 index 00000000..95fb29e5 --- /dev/null +++ b/internal/frontend/bridge-gui/bridgepp/bridgepp/FocusGRPC/focus.pb.cc @@ -0,0 +1,302 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: focus.proto + +#include "focus.pb.h" + +#include + +#include +#include +#include +#include +#include +#include +#include +// @@protoc_insertion_point(includes) +#include + +PROTOBUF_PRAGMA_INIT_SEG + +namespace _pb = ::PROTOBUF_NAMESPACE_ID; +namespace _pbi = _pb::internal; + +namespace focus { +PROTOBUF_CONSTEXPR VersionResponse::VersionResponse( + ::_pbi::ConstantInitialized): _impl_{ + /*decltype(_impl_.version_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}} + , /*decltype(_impl_._cached_size_)*/{}} {} +struct VersionResponseDefaultTypeInternal { + PROTOBUF_CONSTEXPR VersionResponseDefaultTypeInternal() + : _instance(::_pbi::ConstantInitialized{}) {} + ~VersionResponseDefaultTypeInternal() {} + union { + VersionResponse _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 VersionResponseDefaultTypeInternal _VersionResponse_default_instance_; +} // namespace focus +static ::_pb::Metadata file_level_metadata_focus_2eproto[1]; +static constexpr ::_pb::EnumDescriptor const** file_level_enum_descriptors_focus_2eproto = nullptr; +static constexpr ::_pb::ServiceDescriptor const** file_level_service_descriptors_focus_2eproto = nullptr; + +const uint32_t TableStruct_focus_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::focus::VersionResponse, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::focus::VersionResponse, _impl_.version_), +}; +static const ::_pbi::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { + { 0, -1, -1, sizeof(::focus::VersionResponse)}, +}; + +static const ::_pb::Message* const file_default_instances[] = { + &::focus::_VersionResponse_default_instance_._instance, +}; + +const char descriptor_table_protodef_focus_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = + "\n\013focus.proto\022\005focus\032\033google/protobuf/em" + "pty.proto\"\"\n\017VersionResponse\022\017\n\007version\030" + "\001 \001(\t2{\n\005Focus\0227\n\005Raise\022\026.google.protobu" + "f.Empty\032\026.google.protobuf.Empty\0229\n\007Versi" + "on\022\026.google.protobuf.Empty\032\026.focus.Versi" + "onResponseB=Z;github.com/ProtonMail/prot" + "on-bridge/v2/internal/focus/protob\006proto" + "3" + ; +static const ::_pbi::DescriptorTable* const descriptor_table_focus_2eproto_deps[1] = { + &::descriptor_table_google_2fprotobuf_2fempty_2eproto, +}; +static ::_pbi::once_flag descriptor_table_focus_2eproto_once; +const ::_pbi::DescriptorTable descriptor_table_focus_2eproto = { + false, false, 281, descriptor_table_protodef_focus_2eproto, + "focus.proto", + &descriptor_table_focus_2eproto_once, descriptor_table_focus_2eproto_deps, 1, 1, + schemas, file_default_instances, TableStruct_focus_2eproto::offsets, + file_level_metadata_focus_2eproto, file_level_enum_descriptors_focus_2eproto, + file_level_service_descriptors_focus_2eproto, +}; +PROTOBUF_ATTRIBUTE_WEAK const ::_pbi::DescriptorTable* descriptor_table_focus_2eproto_getter() { + return &descriptor_table_focus_2eproto; +} + +// Force running AddDescriptors() at dynamic initialization time. +PROTOBUF_ATTRIBUTE_INIT_PRIORITY2 static ::_pbi::AddDescriptorsRunner dynamic_init_dummy_focus_2eproto(&descriptor_table_focus_2eproto); +namespace focus { + +// =================================================================== + +class VersionResponse::_Internal { + public: +}; + +VersionResponse::VersionResponse(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { + SharedCtor(arena, is_message_owned); + // @@protoc_insertion_point(arena_constructor:focus.VersionResponse) +} +VersionResponse::VersionResponse(const VersionResponse& from) + : ::PROTOBUF_NAMESPACE_ID::Message() { + VersionResponse* const _this = this; (void)_this; + new (&_impl_) Impl_{ + decltype(_impl_.version_){} + , /*decltype(_impl_._cached_size_)*/{}}; + + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + _impl_.version_.InitDefault(); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.version_.Set("", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (!from._internal_version().empty()) { + _this->_impl_.version_.Set(from._internal_version(), + _this->GetArenaForAllocation()); + } + // @@protoc_insertion_point(copy_constructor:focus.VersionResponse) +} + +inline void VersionResponse::SharedCtor( + ::_pb::Arena* arena, bool is_message_owned) { + (void)arena; + (void)is_message_owned; + new (&_impl_) Impl_{ + decltype(_impl_.version_){} + , /*decltype(_impl_._cached_size_)*/{} + }; + _impl_.version_.InitDefault(); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.version_.Set("", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +} + +VersionResponse::~VersionResponse() { + // @@protoc_insertion_point(destructor:focus.VersionResponse) + if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) { + (void)arena; + return; + } + SharedDtor(); +} + +inline void VersionResponse::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + _impl_.version_.Destroy(); +} + +void VersionResponse::SetCachedSize(int size) const { + _impl_._cached_size_.Set(size); +} + +void VersionResponse::Clear() { +// @@protoc_insertion_point(message_clear_start:focus.VersionResponse) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + _impl_.version_.ClearToEmpty(); + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +const char* VersionResponse::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::_pbi::ReadTag(ptr, &tag); + switch (tag >> 3) { + // string version = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 10)) { + auto str = _internal_mutable_version(); + ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + CHK_(::_pbi::VerifyUTF8(str, "focus.VersionResponse.version")); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* VersionResponse::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:focus.VersionResponse) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + // string version = 1; + if (!this->_internal_version().empty()) { + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( + this->_internal_version().data(), static_cast(this->_internal_version().length()), + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, + "focus.VersionResponse.version"); + target = stream->WriteStringMaybeAliased( + 1, this->_internal_version(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:focus.VersionResponse) + return target; +} + +size_t VersionResponse::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:focus.VersionResponse) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // string version = 1; + if (!this->_internal_version().empty()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_version()); + } + + return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); +} + +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData VersionResponse::_class_data_ = { + ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck, + VersionResponse::MergeImpl +}; +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*VersionResponse::GetClassData() const { return &_class_data_; } + + +void VersionResponse::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) { + auto* const _this = static_cast(&to_msg); + auto& from = static_cast(from_msg); + // @@protoc_insertion_point(class_specific_merge_from_start:focus.VersionResponse) + GOOGLE_DCHECK_NE(&from, _this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (!from._internal_version().empty()) { + _this->_internal_set_version(from._internal_version()); + } + _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); +} + +void VersionResponse::CopyFrom(const VersionResponse& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:focus.VersionResponse) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool VersionResponse::IsInitialized() const { + return true; +} + +void VersionResponse::InternalSwap(VersionResponse* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &_impl_.version_, lhs_arena, + &other->_impl_.version_, rhs_arena + ); +} + +::PROTOBUF_NAMESPACE_ID::Metadata VersionResponse::GetMetadata() const { + return ::_pbi::AssignDescriptors( + &descriptor_table_focus_2eproto_getter, &descriptor_table_focus_2eproto_once, + file_level_metadata_focus_2eproto[0]); +} + +// @@protoc_insertion_point(namespace_scope) +} // namespace focus +PROTOBUF_NAMESPACE_OPEN +template<> PROTOBUF_NOINLINE ::focus::VersionResponse* +Arena::CreateMaybeMessage< ::focus::VersionResponse >(Arena* arena) { + return Arena::CreateMessageInternal< ::focus::VersionResponse >(arena); +} +PROTOBUF_NAMESPACE_CLOSE + +// @@protoc_insertion_point(global_scope) +#include diff --git a/internal/frontend/bridge-gui/bridgepp/bridgepp/FocusGRPC/focus.pb.h b/internal/frontend/bridge-gui/bridgepp/bridgepp/FocusGRPC/focus.pb.h new file mode 100644 index 00000000..53a7184f --- /dev/null +++ b/internal/frontend/bridge-gui/bridgepp/bridgepp/FocusGRPC/focus.pb.h @@ -0,0 +1,283 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: focus.proto + +#ifndef GOOGLE_PROTOBUF_INCLUDED_focus_2eproto +#define GOOGLE_PROTOBUF_INCLUDED_focus_2eproto + +#include +#include + +#include +#if PROTOBUF_VERSION < 3021000 +#error This file was generated by a newer version of protoc which is +#error incompatible with your Protocol Buffer headers. Please update +#error your headers. +#endif +#if 3021003 < PROTOBUF_MIN_PROTOC_VERSION +#error This file was generated by an older version of protoc which is +#error incompatible with your Protocol Buffer headers. Please +#error regenerate this file with a newer version of protoc. +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include // IWYU pragma: export +#include // IWYU pragma: export +#include +#include +// @@protoc_insertion_point(includes) +#include +#define PROTOBUF_INTERNAL_EXPORT_focus_2eproto +PROTOBUF_NAMESPACE_OPEN +namespace internal { +class AnyMetadata; +} // namespace internal +PROTOBUF_NAMESPACE_CLOSE + +// Internal implementation detail -- do not use these members. +struct TableStruct_focus_2eproto { + static const uint32_t offsets[]; +}; +extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_focus_2eproto; +namespace focus { +class VersionResponse; +struct VersionResponseDefaultTypeInternal; +extern VersionResponseDefaultTypeInternal _VersionResponse_default_instance_; +} // namespace focus +PROTOBUF_NAMESPACE_OPEN +template<> ::focus::VersionResponse* Arena::CreateMaybeMessage<::focus::VersionResponse>(Arena*); +PROTOBUF_NAMESPACE_CLOSE +namespace focus { + +// =================================================================== + +class VersionResponse final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:focus.VersionResponse) */ { + public: + inline VersionResponse() : VersionResponse(nullptr) {} + ~VersionResponse() override; + explicit PROTOBUF_CONSTEXPR VersionResponse(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + VersionResponse(const VersionResponse& from); + VersionResponse(VersionResponse&& from) noexcept + : VersionResponse() { + *this = ::std::move(from); + } + + inline VersionResponse& operator=(const VersionResponse& from) { + CopyFrom(from); + return *this; + } + inline VersionResponse& operator=(VersionResponse&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const VersionResponse& default_instance() { + return *internal_default_instance(); + } + static inline const VersionResponse* internal_default_instance() { + return reinterpret_cast( + &_VersionResponse_default_instance_); + } + static constexpr int kIndexInFileMessages = + 0; + + friend void swap(VersionResponse& a, VersionResponse& b) { + a.Swap(&b); + } + inline void Swap(VersionResponse* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(VersionResponse* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + VersionResponse* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const VersionResponse& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom( const VersionResponse& from) { + VersionResponse::MergeImpl(*this, from); + } + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); + public: + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(VersionResponse* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "focus.VersionResponse"; + } + protected: + explicit VersionResponse(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kVersionFieldNumber = 1, + }; + // string version = 1; + void clear_version(); + const std::string& version() const; + template + void set_version(ArgT0&& arg0, ArgT... args); + std::string* mutable_version(); + PROTOBUF_NODISCARD std::string* release_version(); + void set_allocated_version(std::string* version); + private: + const std::string& _internal_version() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_version(const std::string& value); + std::string* _internal_mutable_version(); + public: + + // @@protoc_insertion_point(class_scope:focus.VersionResponse) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + struct Impl_ { + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr version_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_focus_2eproto; +}; +// =================================================================== + + +// =================================================================== + +#ifdef __GNUC__ + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wstrict-aliasing" +#endif // __GNUC__ +// VersionResponse + +// string version = 1; +inline void VersionResponse::clear_version() { + _impl_.version_.ClearToEmpty(); +} +inline const std::string& VersionResponse::version() const { + // @@protoc_insertion_point(field_get:focus.VersionResponse.version) + return _internal_version(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void VersionResponse::set_version(ArgT0&& arg0, ArgT... args) { + + _impl_.version_.Set(static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:focus.VersionResponse.version) +} +inline std::string* VersionResponse::mutable_version() { + std::string* _s = _internal_mutable_version(); + // @@protoc_insertion_point(field_mutable:focus.VersionResponse.version) + return _s; +} +inline const std::string& VersionResponse::_internal_version() const { + return _impl_.version_.Get(); +} +inline void VersionResponse::_internal_set_version(const std::string& value) { + + _impl_.version_.Set(value, GetArenaForAllocation()); +} +inline std::string* VersionResponse::_internal_mutable_version() { + + return _impl_.version_.Mutable(GetArenaForAllocation()); +} +inline std::string* VersionResponse::release_version() { + // @@protoc_insertion_point(field_release:focus.VersionResponse.version) + return _impl_.version_.Release(); +} +inline void VersionResponse::set_allocated_version(std::string* version) { + if (version != nullptr) { + + } else { + + } + _impl_.version_.SetAllocated(version, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.version_.IsDefault()) { + _impl_.version_.Set("", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:focus.VersionResponse.version) +} + +#ifdef __GNUC__ + #pragma GCC diagnostic pop +#endif // __GNUC__ + +// @@protoc_insertion_point(namespace_scope) + +} // namespace focus + +// @@protoc_insertion_point(global_scope) + +#include +#endif // GOOGLE_PROTOBUF_INCLUDED_GOOGLE_PROTOBUF_INCLUDED_focus_2eproto