Debian Codegraph @

test/core/end2end/fixtures/h2_tls_simple.cc

raw
1 /*
2 *
3 * Copyright 2018 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 #include <string.h>
20
21 #include <string>
22
23 #include <grpc/grpc.h>
24
25 #include "src/core/lib/gprpp/global_config_generic.h"
26 #include "src/core/lib/gprpp/host_port.h"
27 #include "src/core/lib/security/security_connector/ssl_utils_config.h"
28 #include "test/core/end2end/end2end_tests.h"
29 #include "test/core/end2end/fixtures/h2_tls_common.h"
30 #include "test/core/util/port.h"
31 #include "test/core/util/test_config.h"
32
33 static grpc_end2end_test_fixture chttp2_create_fixture_simple_fullstack(
34 const grpc_channel_args*, const grpc_channel_args*) {
35 grpc_end2end_test_fixture f;
36 int port = grpc_pick_unused_port_or_die();
37 fullstack_secure_fixture_data* ffd = new fullstack_secure_fixture_data();
38 memset(&f, 0, sizeof(f));
39 ffd->localaddr = grpc_core::JoinHostPort("localhost", port);
40 SetTlsVersion(ffd, SecurityPrimitives::TlsVersion::V_12);
41 SetCertificateProvider(ffd,
42 SecurityPrimitives::ProviderType::STATIC_PROVIDER);
43 SetCertificateVerifier(
44 ffd, SecurityPrimitives::VerifierType::EXTERNAL_SYNC_VERIFIER);
45 f.fixture_data = ffd;
46 f.cq = grpc_completion_queue_create_for_next(nullptr);
47 return f;
48 }
49
50 static grpc_end2end_test_config config = {
51 // client: static data provider + sync external verifier
52 // server: static data provider + sync external verifier
53 // extra: TLS 1.2
54 "chttp2/simple_ssl_fullstack",
55 kH2TLSFeatureMask,
56 "foo.test.google.fr",
57 chttp2_create_fixture_simple_fullstack,
58 chttp2_init_client,
59 chttp2_init_server,
60 chttp2_tear_down_secure_fullstack,
61 };
62
63 int main(int argc, char** argv) {
64 grpc::testing::TestEnvironment env(&argc, argv);
65 grpc_end2end_tests_pre_init();
66 GPR_GLOBAL_CONFIG_SET(grpc_default_ssl_roots_file_path, CA_CERT_PATH);
67 grpc_init();
68 grpc_end2end_tests(argc, argv, config);
69 grpc_shutdown();
70 return 0;
71 }