mirror of https://github.com/grpc/grpc.git
commit
86518a33af
224 changed files with 2380 additions and 1071 deletions
@ -1,43 +0,0 @@ |
||||
//
|
||||
//
|
||||
// Copyright 2016 gRPC authors.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
//
|
||||
|
||||
#include <grpc/support/port_platform.h> |
||||
|
||||
#include <string.h> |
||||
|
||||
// Provide a wrapped memcpy for targets that need to be backwards
|
||||
// compatible with older libc's.
|
||||
//
|
||||
// Enable by setting LDFLAGS=-Wl,-wrap,memcpy when linking.
|
||||
//
|
||||
|
||||
extern "C" { |
||||
#ifdef __linux__ |
||||
#if defined(__x86_64__) && !defined(GPR_MUSL_LIBC_COMPAT) && \ |
||||
!defined(__ANDROID__) |
||||
__asm__(".symver memcpy,memcpy@GLIBC_2.2.5"); |
||||
void* __wrap_memcpy(void* destination, const void* source, size_t num) { |
||||
return memcpy(destination, source, num); |
||||
} |
||||
#else // !__x86_64__
|
||||
void* __wrap_memcpy(void* destination, const void* source, size_t num) { |
||||
return memmove(destination, source, num); |
||||
} |
||||
#endif |
||||
#endif |
||||
} |
@ -0,0 +1,79 @@ |
||||
// Copyright 2024 gRPC authors.
|
||||
//
|
||||
// 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.
|
||||
|
||||
#include "src/cpp/ext/chaotic_good.h" |
||||
|
||||
#include <memory> |
||||
|
||||
#include <grpc/grpc.h> |
||||
|
||||
#include "src/core/ext/transport/chaotic_good/client/chaotic_good_connector.h" |
||||
#include "src/core/ext/transport/chaotic_good/server/chaotic_good_server.h" |
||||
#include "src/core/lib/gprpp/crash.h" |
||||
|
||||
namespace grpc { |
||||
|
||||
namespace { |
||||
|
||||
class ChaoticGoodInsecureChannelCredentialsImpl final |
||||
: public ChannelCredentials { |
||||
public: |
||||
std::shared_ptr<Channel> CreateChannelImpl( |
||||
const grpc::string& target, const grpc::ChannelArguments& args) override { |
||||
return CreateChannelWithInterceptors(target, args, {}); |
||||
} |
||||
|
||||
std::shared_ptr<Channel> CreateChannelWithInterceptors( |
||||
const grpc::string& target, const grpc::ChannelArguments& args, |
||||
std::vector< |
||||
std::unique_ptr<experimental::ClientInterceptorFactoryInterface>> |
||||
interceptor_creators) override { |
||||
grpc_channel_args channel_args; |
||||
args.SetChannelArgs(&channel_args); |
||||
auto channel = grpc::CreateChannelInternal( |
||||
"", grpc_chaotic_good_channel_create(target.c_str(), &channel_args), |
||||
std::move(interceptor_creators)); |
||||
return channel; |
||||
} |
||||
|
||||
SecureChannelCredentials* AsSecureCredentials() override { return nullptr; } |
||||
|
||||
private: |
||||
bool IsInsecure() const override { return true; } |
||||
}; |
||||
|
||||
class ChaoticGoodInsecureServerCredentialsImpl final |
||||
: public ServerCredentials { |
||||
public: |
||||
int AddPortToServer(const std::string& addr, grpc_server* server) override { |
||||
return grpc_server_add_chaotic_good_port(server, addr.c_str()); |
||||
} |
||||
|
||||
void SetAuthMetadataProcessor( |
||||
const std::shared_ptr<AuthMetadataProcessor>&) override { |
||||
grpc_core::Crash("Not supported on insecure server credentials"); |
||||
} |
||||
}; |
||||
|
||||
} // namespace
|
||||
|
||||
std::shared_ptr<ChannelCredentials> ChaoticGoodInsecureChannelCredentials() { |
||||
return std::make_shared<ChaoticGoodInsecureChannelCredentialsImpl>(); |
||||
} |
||||
|
||||
std::shared_ptr<ServerCredentials> ChaoticGoodInsecureServerCredentials() { |
||||
return std::make_shared<ChaoticGoodInsecureServerCredentialsImpl>(); |
||||
} |
||||
|
||||
} // namespace grpc
|
@ -0,0 +1,30 @@ |
||||
// Copyright 2024 gRPC authors.
|
||||
//
|
||||
// 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.
|
||||
|
||||
#ifndef GRPC_SRC_CPP_EXT_CHAOTIC_GOOD_H |
||||
#define GRPC_SRC_CPP_EXT_CHAOTIC_GOOD_H |
||||
|
||||
#include <memory> |
||||
|
||||
#include <grpcpp/security/credentials.h> |
||||
#include <grpcpp/security/server_credentials.h> |
||||
|
||||
namespace grpc { |
||||
|
||||
std::shared_ptr<ChannelCredentials> ChaoticGoodInsecureChannelCredentials(); |
||||
std::shared_ptr<ServerCredentials> ChaoticGoodInsecureServerCredentials(); |
||||
|
||||
} // namespace grpc
|
||||
|
||||
#endif // GRPC_SRC_CPP_EXT_CHAOTIC_GOOD_H
|
@ -1,7 +1,7 @@ |
||||
<!-- This file is generated --> |
||||
<Project> |
||||
<PropertyGroup> |
||||
<GrpcCsharpVersion>2.62.0-dev</GrpcCsharpVersion> |
||||
<GrpcCsharpVersion>2.63.0-dev</GrpcCsharpVersion> |
||||
<GoogleProtobufVersion>3.25.1</GoogleProtobufVersion> |
||||
</PropertyGroup> |
||||
</Project> |
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue