alpn_test.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 <grpc/support/log.h>
22 
24 
25 static void test_alpn_success(void) {
28 }
29 
30 static void test_alpn_failure(void) {
33 }
34 
35 // First index in ALPN supported version list of a given protocol. Returns a
36 // value one beyond the last valid element index if not found.
37 static size_t alpn_version_index(const char* version, size_t size) {
38  size_t i;
39  for (i = 0; i < grpc_chttp2_num_alpn_versions(); ++i) {
41  return i;
42  }
43  }
44  return i;
45 }
46 
47 static void test_alpn_grpc_before_h2(void) {
48  // grpc-exp is preferred over h2.
49  GPR_ASSERT(alpn_version_index("grpc-exp", 8) < alpn_version_index("h2", 2));
50 }
51 
52 int main(int argc, char** argv) {
57  return 0;
58 }
log.h
generate.env
env
Definition: generate.py:37
grpc_chttp2_is_alpn_version_supported
int grpc_chttp2_is_alpn_version_supported(const char *version, size_t size)
Definition: src/core/ext/transport/chttp2/alpn/alpn.cc:30
grpc_chttp2_get_alpn_version_index
const char * grpc_chttp2_get_alpn_version_index(size_t i)
Definition: src/core/ext/transport/chttp2/alpn/alpn.cc:42
alpn_version_index
static size_t alpn_version_index(const char *version, size_t size)
Definition: alpn_test.cc:37
version
Definition: version.py:1
main
int main(int argc, char **argv)
Definition: alpn_test.cc:52
grpc_chttp2_num_alpn_versions
size_t grpc_chttp2_num_alpn_versions(void)
Definition: src/core/ext/transport/chttp2/alpn/alpn.cc:38
GPR_ASSERT
#define GPR_ASSERT(x)
Definition: include/grpc/impl/codegen/log.h:94
alpn.h
test_config.h
test_alpn_failure
static void test_alpn_failure(void)
Definition: alpn_test.cc:30
grpc::testing::TestEnvironment
Definition: test/core/util/test_config.h:54
test_alpn_grpc_before_h2
static void test_alpn_grpc_before_h2(void)
Definition: alpn_test.cc:47
size
voidpf void uLong size
Definition: bloaty/third_party/zlib/contrib/minizip/ioapi.h:136
test_alpn_success
static void test_alpn_success(void)
Definition: alpn_test.cc:25
i
uint64_t i
Definition: abseil-cpp/absl/container/btree_benchmark.cc:230


grpc
Author(s):
autogenerated on Fri May 16 2025 02:57:40