server_helper.h
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 
19 #ifndef GRPC_TEST_CPP_INTEROP_SERVER_HELPER_H
20 #define GRPC_TEST_CPP_INTEROP_SERVER_HELPER_H
21 
22 #include <condition_variable>
23 #include <memory>
24 
25 #include <grpc/compression.h>
26 #include <grpc/impl/codegen/atm.h>
28 #include <grpcpp/server.h>
29 #include <grpcpp/server_builder.h>
30 #include <grpcpp/server_context.h>
31 
32 namespace grpc {
33 namespace testing {
34 
35 std::shared_ptr<ServerCredentials> CreateInteropServerCredentials();
36 
38  public:
40 
41  // Inspector methods, able to peek inside ServerContext, follow.
42  std::shared_ptr<const AuthContext> GetAuthContext() const;
43  bool IsCancelled() const;
46  bool WasCompressed() const;
47 
48  private:
50 };
51 
52 namespace interop {
53 
54 extern gpr_atm g_got_sigint;
55 
58  std::condition_variable condition;
59  bool server_started = false;
60 };
61 
65 void RunServer(const std::shared_ptr<ServerCredentials>& creds);
66 
73 void RunServer(const std::shared_ptr<ServerCredentials>& creds, int port,
74  ServerStartedCondition* server_started_condition);
75 
80 void RunServer(
81  const std::shared_ptr<ServerCredentials>& creds,
82  std::unique_ptr<std::vector<std::unique_ptr<ServerBuilderOption>>>
84 
91 // variable, and condition used to notify when the server has started.
92 void RunServer(
93  const std::shared_ptr<ServerCredentials>& creds, const int port,
94  ServerStartedCondition* server_started_condition,
95  std::unique_ptr<std::vector<std::unique_ptr<grpc::ServerBuilderOption>>>
97 
98 } // namespace interop
99 } // namespace testing
100 } // namespace grpc
101 
102 #endif // GRPC_TEST_CPP_INTEROP_SERVER_HELPER_H
compression.h
grpc::testing::InteropServerContextInspector::WasCompressed
bool WasCompressed() const
Definition: server_helper.cc:67
testing
Definition: aws_request_signer_test.cc:25
atm.h
grpc::ServerContext
Definition: grpcpp/impl/codegen/server_context.h:566
grpc
Definition: grpcpp/alarm.h:33
mutex
static uv_mutex_t mutex
Definition: threadpool.c:34
grpc_compression_algorithm
grpc_compression_algorithm
Definition: compression_types.h:60
grpc::testing::InteropServerContextInspector::context_
const grpc::ServerContext & context_
Definition: server_helper.h:49
grpc::testing::interop::ServerStartedCondition::server_started
bool server_started
Definition: server_helper.h:59
grpc::testing::InteropServerContextInspector::GetAuthContext
std::shared_ptr< const AuthContext > GetAuthContext() const
Definition: server_helper.cc:75
grpc::testing::interop::g_got_sigint
gpr_atm g_got_sigint
Definition: interop_server_bootstrap.cc:25
uint32_t
unsigned int uint32_t
Definition: stdint-msvc2008.h:80
grpc::testing::interop::ServerStartedCondition::condition
std::condition_variable condition
Definition: server_helper.h:58
grpc::testing::interop::RunServer
void RunServer(const std::shared_ptr< ServerCredentials > &creds)
Definition: interop_server.cc:320
grpc::testing::InteropServerContextInspector::GetCallCompressionAlgorithm
grpc_compression_algorithm GetCallCompressionAlgorithm() const
Definition: server_helper.cc:58
grpc::testing::InteropServerContextInspector::IsCancelled
bool IsCancelled() const
Definition: server_helper.cc:79
grpc::testing::InteropServerContextInspector::InteropServerContextInspector
InteropServerContextInspector(const grpc::ServerContext &context)
Definition: server_helper.cc:53
server_credentials.h
tests.unit._exit_scenarios.port
port
Definition: _exit_scenarios.py:179
grpc.beta.implementations.server_options
def server_options(multi_method_implementation=None, request_deserializers=None, response_serializers=None, thread_pool=None, thread_pool_size=None, default_timeout=None, maximum_timeout=None)
Definition: implementations.py:258
gpr_atm
intptr_t gpr_atm
Definition: impl/codegen/atm_gcc_atomic.h:32
grpc::testing::CreateInteropServerCredentials
std::shared_ptr< ServerCredentials > CreateInteropServerCredentials()
Definition: server_helper.cc:39
server_context.h
grpc::testing::interop::ServerStartedCondition
Definition: server_helper.h:56
context
grpc::ClientContext context
Definition: istio_echo_server_lib.cc:61
server.h
grpc::testing::InteropServerContextInspector::GetEncodingsAcceptedByClient
uint32_t GetEncodingsAcceptedByClient() const
Definition: server_helper.cc:62
grpc::testing::InteropServerContextInspector
Definition: server_helper.h:37
server_builder.h
grpc::testing::interop::ServerStartedCondition::mutex
std::mutex mutex
Definition: server_helper.h:57


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