server_helper.cc
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2015 gRPC authors.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
20 
21 #include <memory>
22 
23 #include "absl/flags/declare.h"
24 #include "absl/flags/flag.h"
25 
27 
31 
32 ABSL_DECLARE_FLAG(bool, use_alts);
33 ABSL_DECLARE_FLAG(bool, use_tls);
35 
36 namespace grpc {
37 namespace testing {
38 
39 std::shared_ptr<ServerCredentials> CreateInteropServerCredentials() {
40  if (!absl::GetFlag(FLAGS_custom_credentials_type).empty()) {
42  absl::GetFlag(FLAGS_custom_credentials_type));
43  } else if (absl::GetFlag(FLAGS_use_alts)) {
45  } else if (absl::GetFlag(FLAGS_use_tls)) {
47  } else {
50  }
51 }
52 
55  : context_(context) {}
56 
60 }
61 
65 }
66 
72 }
73 
74 std::shared_ptr<const AuthContext>
76  return context_.auth_context();
77 }
78 
80  return context_.IsCancelled();
81 }
82 
83 } // namespace testing
84 } // namespace grpc
test_credentials_provider.h
grpc::testing::kTlsCredentialsType
const char kTlsCredentialsType[]
Definition: test_credentials_provider.h:34
grpc::testing::InteropServerContextInspector::WasCompressed
bool WasCompressed() const
Definition: server_helper.cc:67
testing
Definition: aws_request_signer_test.cc:25
grpc::ServerContext
Definition: grpcpp/impl/codegen/server_context.h:566
grpc::ServerContextBase::call_
CallWrapper call_
Definition: grpcpp/impl/codegen/server_context.h:463
grpc
Definition: grpcpp/alarm.h:33
grpc::ServerContextBase::CallWrapper::call
grpc_call * call
Definition: grpcpp/impl/codegen/server_context.h:456
ABSL_DECLARE_FLAG
ABSL_DECLARE_FLAG(bool, use_alts)
server_helper.h
grpc_compression_algorithm
grpc_compression_algorithm
Definition: compression_types.h:60
call_test_only.h
testing::internal::string
::std::string string
Definition: bloaty/third_party/protobuf/third_party/googletest/googletest/include/gtest/internal/gtest-port.h:881
grpc::testing::InteropServerContextInspector::context_
const grpc::ServerContext & context_
Definition: server_helper.h:49
grpc::testing::InteropServerContextInspector::GetAuthContext
std::shared_ptr< const AuthContext > GetAuthContext() const
Definition: server_helper.cc:75
uint32_t
unsigned int uint32_t
Definition: stdint-msvc2008.h:80
grpc::testing::kInsecureCredentialsType
const char kInsecureCredentialsType[]
Definition: test_credentials_provider.h:31
grpc::testing::CredentialsProvider::GetServerCredentials
virtual std::shared_ptr< ServerCredentials > GetServerCredentials(const std::string &type)=0
context_
ScopedContext * context_
Definition: filter_fuzzer.cc:559
grpc::testing::InteropServerContextInspector::GetCallCompressionAlgorithm
grpc_compression_algorithm GetCallCompressionAlgorithm() const
Definition: server_helper.cc:58
grpc_call_test_only_get_compression_algorithm
grpc_compression_algorithm grpc_call_test_only_get_compression_algorithm(grpc_call *call)
Definition: call.cc:1810
custom_credentials_type
std::string custom_credentials_type("INSECURE_CREDENTIALS")
absl::GetFlag
ABSL_MUST_USE_RESULT T GetFlag(const absl::Flag< T > &flag)
Definition: abseil-cpp/absl/flags/flag.h:98
grpc::testing::InteropServerContextInspector::IsCancelled
bool IsCancelled() const
Definition: server_helper.cc:79
grpc_call_test_only_get_message_flags
uint32_t grpc_call_test_only_get_message_flags(grpc_call *call)
Definition: call.cc:1815
grpc::testing::InteropServerContextInspector::InteropServerContextInspector
InteropServerContextInspector(const grpc::ServerContext &context)
Definition: server_helper.cc:53
grpc::testing::kAltsCredentialsType
const char kAltsCredentialsType[]
Definition: test_credentials_provider.h:35
grpc::ServerContext::IsCancelled
bool IsCancelled() const
Definition: server_context.cc:355
server_credentials.h
google_benchmark.example.empty
def empty(state)
Definition: example.py:31
GRPC_WRITE_INTERNAL_COMPRESS
#define GRPC_WRITE_INTERNAL_COMPRESS
Definition: transport.h:75
grpc::testing::CreateInteropServerCredentials
std::shared_ptr< ServerCredentials > CreateInteropServerCredentials()
Definition: server_helper.cc:39
grpc::testing::GetCredentialsProvider
CredentialsProvider * GetCredentialsProvider()
Definition: test_credentials_provider.cc:169
GRPC_WRITE_INTERNAL_TEST_ONLY_WAS_COMPRESSED
#define GRPC_WRITE_INTERNAL_TEST_ONLY_WAS_COMPRESSED
Definition: transport.h:79
grpc_call_test_only_get_encodings_accepted_by_peer
uint32_t grpc_call_test_only_get_encodings_accepted_by_peer(grpc_call *call)
Definition: call.cc:1819
transport.h
context
grpc::ClientContext context
Definition: istio_echo_server_lib.cc:61
grpc::ServerContext::auth_context
std::shared_ptr< const grpc::AuthContext > auth_context() const
Definition: grpcpp/impl/codegen/server_context.h:271
grpc::testing::InteropServerContextInspector::GetEncodingsAcceptedByClient
uint32_t GetEncodingsAcceptedByClient() const
Definition: server_helper.cc:62


grpc
Author(s):
autogenerated on Thu Mar 13 2025 03:01:17