mirror of https://github.com/grpc/grpc.git
commit
2c2dd5c047
403 changed files with 11176 additions and 3384 deletions
@ -0,0 +1,3 @@ |
||||
# Security Policy |
||||
|
||||
For information on gRPC Security Policy and reporting potentional security issues, please see [gRPC CVE Process](https://github.com/grpc/proposal/blob/master/P4-grpc-cve-process.md). |
@ -0,0 +1,52 @@ |
||||
# Copyright 2021 the 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. |
||||
|
||||
# This is a list of llvm flags to be used when being built with use_strict_warning=1 |
||||
GRPC_LLVM_WARNING_FLAGS = [ |
||||
# Enable all & extra waninrgs |
||||
"-Wall", |
||||
"-Wextra", |
||||
# Consider warnings as errors |
||||
"-Werror", |
||||
# Ignore unknown warning flags |
||||
"-Wno-unknown-warning-option", |
||||
# A list of flags coming from internal build system |
||||
"-Wc++20-extensions", |
||||
"-Wctad-maybe-unsupported", |
||||
"-Wdeprecated-increment-bool", |
||||
"-Wfloat-overflow-conversion", |
||||
"-Wfloat-zero-conversion", |
||||
"-Wfor-loop-analysis", |
||||
"-Wformat-security", |
||||
"-Wgnu-redeclared-enum", |
||||
"-Winfinite-recursion", |
||||
"-Wliteral-conversion", |
||||
"-Wnon-virtual-dtor", |
||||
"-Woverloaded-virtual", |
||||
"-Wself-assign", |
||||
"-Wstring-conversion", |
||||
"-Wtautological-overlap-compare", |
||||
"-Wthread-safety-analysis", |
||||
"-Wthread-safety-beta", |
||||
"-Wunused-comparison", |
||||
"-Wvla", |
||||
# Exceptions but will be removed |
||||
"-Wno-deprecated-declarations", |
||||
"-Wno-unused-function", |
||||
] |
||||
|
||||
GRPC_DEFAULT_COPTS = select({ |
||||
"//:use_strict_warning": GRPC_LLVM_WARNING_FLAGS, |
||||
"//conditions:default": [], |
||||
}) |
@ -0,0 +1,123 @@ |
||||
# Copyright 2018 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. |
||||
# |
||||
# cmake build file for C++ route_guide example. |
||||
# Assumes protobuf and gRPC have been installed using cmake. |
||||
# See cmake_externalproject/CMakeLists.txt for all-in-one cmake build |
||||
# that automatically builds all the dependencies before building route_guide. |
||||
|
||||
cmake_minimum_required(VERSION 3.5.1) |
||||
|
||||
set (CMAKE_CXX_STANDARD 11) |
||||
|
||||
if(MSVC) |
||||
add_definitions(-D_WIN32_WINNT=0x600) |
||||
endif() |
||||
|
||||
find_package(Threads REQUIRED) |
||||
|
||||
if(GRPC_AS_SUBMODULE) |
||||
# One way to build a projects that uses gRPC is to just include the |
||||
# entire gRPC project tree via "add_subdirectory". |
||||
# This approach is very simple to use, but the are some potential |
||||
# disadvantages: |
||||
# * it includes gRPC's CMakeLists.txt directly into your build script |
||||
# without and that can make gRPC's internal setting interfere with your |
||||
# own build. |
||||
# * depending on what's installed on your system, the contents of submodules |
||||
# in gRPC's third_party/* might need to be available (and there might be |
||||
# additional prerequisites required to build them). Consider using |
||||
# the gRPC_*_PROVIDER options to fine-tune the expected behavior. |
||||
# |
||||
# A more robust approach to add dependency on gRPC is using |
||||
# cmake's ExternalProject_Add (see cmake_externalproject/CMakeLists.txt). |
||||
|
||||
# Include the gRPC's cmake build (normally grpc source code would live |
||||
# in a git submodule called "third_party/grpc", but this example lives in |
||||
# the same repository as gRPC sources, so we just look a few directories up) |
||||
add_subdirectory(../../.. ${CMAKE_CURRENT_BINARY_DIR}/grpc EXCLUDE_FROM_ALL) |
||||
message(STATUS "Using gRPC via add_subdirectory.") |
||||
|
||||
# After using add_subdirectory, we can now use the grpc targets directly from |
||||
# this build. |
||||
set(_PROTOBUF_LIBPROTOBUF libprotobuf) |
||||
set(_REFLECTION grpc++_reflection) |
||||
if(CMAKE_CROSSCOMPILING) |
||||
find_program(_PROTOBUF_PROTOC protoc) |
||||
else() |
||||
set(_PROTOBUF_PROTOC $<TARGET_FILE:protobuf::protoc>) |
||||
endif() |
||||
set(_GRPC_GRPCPP grpc++) |
||||
if(CMAKE_CROSSCOMPILING) |
||||
find_program(_GRPC_CPP_PLUGIN_EXECUTABLE grpc_cpp_plugin) |
||||
else() |
||||
set(_GRPC_CPP_PLUGIN_EXECUTABLE $<TARGET_FILE:grpc_cpp_plugin>) |
||||
endif() |
||||
elseif(GRPC_FETCHCONTENT) |
||||
# Another way is to use CMake's FetchContent module to clone gRPC at |
||||
# configure time. This makes gRPC's source code available to your project, |
||||
# similar to a git submodule. |
||||
message(STATUS "Using gRPC via add_subdirectory (FetchContent).") |
||||
include(FetchContent) |
||||
FetchContent_Declare( |
||||
grpc |
||||
GIT_REPOSITORY https://github.com/grpc/grpc.git |
||||
# when using gRPC, you will actually set this to an existing tag, such as |
||||
# v1.25.0, v1.26.0 etc.. |
||||
# For the purpose of testing, we override the tag used to the commit |
||||
# that's currently under test. |
||||
GIT_TAG vGRPC_TAG_VERSION_OF_YOUR_CHOICE) |
||||
FetchContent_MakeAvailable(grpc) |
||||
|
||||
# Since FetchContent uses add_subdirectory under the hood, we can use |
||||
# the grpc targets directly from this build. |
||||
set(_PROTOBUF_LIBPROTOBUF libprotobuf) |
||||
set(_REFLECTION grpc++_reflection) |
||||
set(_PROTOBUF_PROTOC $<TARGET_FILE:protoc>) |
||||
set(_GRPC_GRPCPP grpc++) |
||||
if(CMAKE_CROSSCOMPILING) |
||||
find_program(_GRPC_CPP_PLUGIN_EXECUTABLE grpc_cpp_plugin) |
||||
else() |
||||
set(_GRPC_CPP_PLUGIN_EXECUTABLE $<TARGET_FILE:grpc_cpp_plugin>) |
||||
endif() |
||||
else() |
||||
# This branch assumes that gRPC and all its dependencies are already installed |
||||
# on this system, so they can be located by find_package(). |
||||
|
||||
# Find Protobuf installation |
||||
# Looks for protobuf-config.cmake file installed by Protobuf's cmake installation. |
||||
set(protobuf_MODULE_COMPATIBLE TRUE) |
||||
find_package(Protobuf CONFIG REQUIRED) |
||||
message(STATUS "Using protobuf ${Protobuf_VERSION}") |
||||
|
||||
set(_PROTOBUF_LIBPROTOBUF protobuf::libprotobuf) |
||||
set(_REFLECTION gRPC::grpc++_reflection) |
||||
if(CMAKE_CROSSCOMPILING) |
||||
find_program(_PROTOBUF_PROTOC protoc) |
||||
else() |
||||
set(_PROTOBUF_PROTOC $<TARGET_FILE:protobuf::protoc>) |
||||
endif() |
||||
|
||||
# Find gRPC installation |
||||
# Looks for gRPCConfig.cmake file installed by gRPC's cmake installation. |
||||
find_package(gRPC CONFIG REQUIRED) |
||||
message(STATUS "Using gRPC ${gRPC_VERSION}") |
||||
|
||||
set(_GRPC_GRPCPP gRPC::grpc++) |
||||
if(CMAKE_CROSSCOMPILING) |
||||
find_program(_GRPC_CPP_PLUGIN_EXECUTABLE grpc_cpp_plugin) |
||||
else() |
||||
set(_GRPC_CPP_PLUGIN_EXECUTABLE $<TARGET_FILE:gRPC::grpc_cpp_plugin>) |
||||
endif() |
||||
endif() |
@ -1,160 +1,69 @@ |
||||
# Copyright 2018 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. |
||||
# |
||||
# cmake build file for C++ helloworld example. |
||||
# Assumes protobuf and gRPC have been installed using cmake. |
||||
# See cmake_externalproject/CMakeLists.txt for all-in-one cmake build |
||||
# that automatically builds all the dependencies before building helloworld. |
||||
|
||||
cmake_minimum_required(VERSION 3.5.1) |
||||
|
||||
project(HelloWorld C CXX) |
||||
|
||||
if(NOT MSVC) |
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") |
||||
else() |
||||
add_definitions(-D_WIN32_WINNT=0x600) |
||||
endif() |
||||
|
||||
find_package(Threads REQUIRED) |
||||
|
||||
if(GRPC_AS_SUBMODULE) |
||||
# One way to build a projects that uses gRPC is to just include the |
||||
# entire gRPC project tree via "add_subdirectory". |
||||
# This approach is very simple to use, but the are some potential |
||||
# disadvantages: |
||||
# * it includes gRPC's CMakeLists.txt directly into your build script |
||||
# without and that can make gRPC's internal setting interfere with your |
||||
# own build. |
||||
# * depending on what's installed on your system, the contents of submodules |
||||
# in gRPC's third_party/* might need to be available (and there might be |
||||
# additional prerequisites required to build them). Consider using |
||||
# the gRPC_*_PROVIDER options to fine-tune the expected behavior. |
||||
# |
||||
# A more robust approach to add dependency on gRPC is using |
||||
# cmake's ExternalProject_Add (see cmake_externalproject/CMakeLists.txt). |
||||
|
||||
# Include the gRPC's cmake build (normally grpc source code would live |
||||
# in a git submodule called "third_party/grpc", but this example lives in |
||||
# the same repository as gRPC sources, so we just look a few directories up) |
||||
add_subdirectory(../../.. ${CMAKE_CURRENT_BINARY_DIR}/grpc EXCLUDE_FROM_ALL) |
||||
message(STATUS "Using gRPC via add_subdirectory.") |
||||
|
||||
# After using add_subdirectory, we can now use the grpc targets directly from |
||||
# this build. |
||||
set(_PROTOBUF_LIBPROTOBUF libprotobuf) |
||||
set(_REFLECTION grpc++_reflection) |
||||
if(CMAKE_CROSSCOMPILING) |
||||
find_program(_PROTOBUF_PROTOC protoc) |
||||
else() |
||||
set(_PROTOBUF_PROTOC $<TARGET_FILE:protobuf::protoc>) |
||||
endif() |
||||
set(_GRPC_GRPCPP grpc++) |
||||
if(CMAKE_CROSSCOMPILING) |
||||
find_program(_GRPC_CPP_PLUGIN_EXECUTABLE grpc_cpp_plugin) |
||||
else() |
||||
set(_GRPC_CPP_PLUGIN_EXECUTABLE $<TARGET_FILE:grpc_cpp_plugin>) |
||||
endif() |
||||
elseif(GRPC_FETCHCONTENT) |
||||
# Another way is to use CMake's FetchContent module to clone gRPC at |
||||
# configure time. This makes gRPC's source code available to your project, |
||||
# similar to a git submodule. |
||||
message(STATUS "Using gRPC via add_subdirectory (FetchContent).") |
||||
include(FetchContent) |
||||
FetchContent_Declare( |
||||
grpc |
||||
GIT_REPOSITORY https://github.com/grpc/grpc.git |
||||
# when using gRPC, you will actually set this to an existing tag, such as |
||||
# v1.25.0, v1.26.0 etc.. |
||||
# For the purpose of testing, we override the tag used to the commit |
||||
# that's currently under test. |
||||
GIT_TAG vGRPC_TAG_VERSION_OF_YOUR_CHOICE) |
||||
FetchContent_MakeAvailable(grpc) |
||||
|
||||
# Since FetchContent uses add_subdirectory under the hood, we can use |
||||
# the grpc targets directly from this build. |
||||
set(_PROTOBUF_LIBPROTOBUF libprotobuf) |
||||
set(_REFLECTION grpc++_reflection) |
||||
set(_PROTOBUF_PROTOC $<TARGET_FILE:protoc>) |
||||
set(_GRPC_GRPCPP grpc++) |
||||
if(CMAKE_CROSSCOMPILING) |
||||
find_program(_GRPC_CPP_PLUGIN_EXECUTABLE grpc_cpp_plugin) |
||||
else() |
||||
set(_GRPC_CPP_PLUGIN_EXECUTABLE $<TARGET_FILE:grpc_cpp_plugin>) |
||||
endif() |
||||
else() |
||||
# This branch assumes that gRPC and all its dependencies are already installed |
||||
# on this system, so they can be located by find_package(). |
||||
|
||||
# Find Protobuf installation |
||||
# Looks for protobuf-config.cmake file installed by Protobuf's cmake installation. |
||||
set(protobuf_MODULE_COMPATIBLE TRUE) |
||||
find_package(Protobuf CONFIG REQUIRED) |
||||
message(STATUS "Using protobuf ${Protobuf_VERSION}") |
||||
|
||||
set(_PROTOBUF_LIBPROTOBUF protobuf::libprotobuf) |
||||
set(_REFLECTION gRPC::grpc++_reflection) |
||||
if(CMAKE_CROSSCOMPILING) |
||||
find_program(_PROTOBUF_PROTOC protoc) |
||||
else() |
||||
set(_PROTOBUF_PROTOC $<TARGET_FILE:protobuf::protoc>) |
||||
endif() |
||||
|
||||
# Find gRPC installation |
||||
# Looks for gRPCConfig.cmake file installed by gRPC's cmake installation. |
||||
find_package(gRPC CONFIG REQUIRED) |
||||
message(STATUS "Using gRPC ${gRPC_VERSION}") |
||||
|
||||
set(_GRPC_GRPCPP gRPC::grpc++) |
||||
if(CMAKE_CROSSCOMPILING) |
||||
find_program(_GRPC_CPP_PLUGIN_EXECUTABLE grpc_cpp_plugin) |
||||
else() |
||||
set(_GRPC_CPP_PLUGIN_EXECUTABLE $<TARGET_FILE:gRPC::grpc_cpp_plugin>) |
||||
endif() |
||||
endif() |
||||
|
||||
# Proto file |
||||
get_filename_component(hw_proto "../../protos/helloworld.proto" ABSOLUTE) |
||||
get_filename_component(hw_proto_path "${hw_proto}" PATH) |
||||
|
||||
# Generated sources |
||||
set(hw_proto_srcs "${CMAKE_CURRENT_BINARY_DIR}/helloworld.pb.cc") |
||||
set(hw_proto_hdrs "${CMAKE_CURRENT_BINARY_DIR}/helloworld.pb.h") |
||||
set(hw_grpc_srcs "${CMAKE_CURRENT_BINARY_DIR}/helloworld.grpc.pb.cc") |
||||
set(hw_grpc_hdrs "${CMAKE_CURRENT_BINARY_DIR}/helloworld.grpc.pb.h") |
||||
add_custom_command( |
||||
OUTPUT "${hw_proto_srcs}" "${hw_proto_hdrs}" "${hw_grpc_srcs}" "${hw_grpc_hdrs}" |
||||
COMMAND ${_PROTOBUF_PROTOC} |
||||
ARGS --grpc_out "${CMAKE_CURRENT_BINARY_DIR}" |
||||
--cpp_out "${CMAKE_CURRENT_BINARY_DIR}" |
||||
-I "${hw_proto_path}" |
||||
--plugin=protoc-gen-grpc="${_GRPC_CPP_PLUGIN_EXECUTABLE}" |
||||
"${hw_proto}" |
||||
DEPENDS "${hw_proto}") |
||||
|
||||
# Include generated *.pb.h files |
||||
include_directories("${CMAKE_CURRENT_BINARY_DIR}") |
||||
|
||||
# Targets greeter_[async_](client|server) |
||||
foreach(_target |
||||
greeter_client greeter_server |
||||
greeter_async_client greeter_async_client2 greeter_async_server) |
||||
add_executable(${_target} "${_target}.cc" |
||||
${hw_proto_srcs} |
||||
${hw_grpc_srcs}) |
||||
target_link_libraries(${_target} |
||||
${_REFLECTION} |
||||
${_GRPC_GRPCPP} |
||||
${_PROTOBUF_LIBPROTOBUF}) |
||||
endforeach() |
||||
# Copyright 2018 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. |
||||
# |
||||
# cmake build file for C++ helloworld example. |
||||
# Assumes protobuf and gRPC have been installed using cmake. |
||||
# See cmake_externalproject/CMakeLists.txt for all-in-one cmake build |
||||
# that automatically builds all the dependencies before building helloworld. |
||||
|
||||
cmake_minimum_required(VERSION 3.5.1) |
||||
|
||||
project(HelloWorld C CXX) |
||||
|
||||
include(../cmake/common.cmake) |
||||
|
||||
# Proto file |
||||
get_filename_component(hw_proto "../../protos/helloworld.proto" ABSOLUTE) |
||||
get_filename_component(hw_proto_path "${hw_proto}" PATH) |
||||
|
||||
# Generated sources |
||||
set(hw_proto_srcs "${CMAKE_CURRENT_BINARY_DIR}/helloworld.pb.cc") |
||||
set(hw_proto_hdrs "${CMAKE_CURRENT_BINARY_DIR}/helloworld.pb.h") |
||||
set(hw_grpc_srcs "${CMAKE_CURRENT_BINARY_DIR}/helloworld.grpc.pb.cc") |
||||
set(hw_grpc_hdrs "${CMAKE_CURRENT_BINARY_DIR}/helloworld.grpc.pb.h") |
||||
add_custom_command( |
||||
OUTPUT "${hw_proto_srcs}" "${hw_proto_hdrs}" "${hw_grpc_srcs}" "${hw_grpc_hdrs}" |
||||
COMMAND ${_PROTOBUF_PROTOC} |
||||
ARGS --grpc_out "${CMAKE_CURRENT_BINARY_DIR}" |
||||
--cpp_out "${CMAKE_CURRENT_BINARY_DIR}" |
||||
-I "${hw_proto_path}" |
||||
--plugin=protoc-gen-grpc="${_GRPC_CPP_PLUGIN_EXECUTABLE}" |
||||
"${hw_proto}" |
||||
DEPENDS "${hw_proto}") |
||||
|
||||
# Include generated *.pb.h files |
||||
include_directories("${CMAKE_CURRENT_BINARY_DIR}") |
||||
|
||||
# hw_grpc_proto |
||||
add_library(hw_grpc_proto |
||||
${hw_grpc_srcs} |
||||
${hw_grpc_hdrs} |
||||
${hw_proto_srcs} |
||||
${hw_proto_hdrs}) |
||||
target_link_libraries(hw_grpc_proto |
||||
${_REFLECTION} |
||||
${_GRPC_GRPCPP} |
||||
${_PROTOBUF_LIBPROTOBUF}) |
||||
|
||||
# Targets greeter_[async_](client|server) |
||||
foreach(_target |
||||
greeter_client greeter_server |
||||
greeter_async_client greeter_async_client2 greeter_async_server) |
||||
add_executable(${_target} "${_target}.cc") |
||||
target_link_libraries(${_target} |
||||
hw_grpc_proto |
||||
${_REFLECTION} |
||||
${_GRPC_GRPCPP} |
||||
${_PROTOBUF_LIBPROTOBUF}) |
||||
endforeach() |
||||
|
@ -0,0 +1,80 @@ |
||||
# Copyright 2018 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. |
||||
# |
||||
# cmake build file for C++ route_guide example. |
||||
# Assumes protobuf and gRPC have been installed using cmake. |
||||
# See cmake_externalproject/CMakeLists.txt for all-in-one cmake build |
||||
# that automatically builds all the dependencies before building route_guide. |
||||
|
||||
cmake_minimum_required(VERSION 3.5.1) |
||||
|
||||
project(RouteGuide C CXX) |
||||
|
||||
include(../cmake/common.cmake) |
||||
|
||||
# Proto file |
||||
get_filename_component(rg_proto "../../protos/route_guide.proto" ABSOLUTE) |
||||
get_filename_component(rg_proto_path "${rg_proto}" PATH) |
||||
|
||||
# Generated sources |
||||
set(rg_proto_srcs "${CMAKE_CURRENT_BINARY_DIR}/route_guide.pb.cc") |
||||
set(rg_proto_hdrs "${CMAKE_CURRENT_BINARY_DIR}/route_guide.pb.h") |
||||
set(rg_grpc_srcs "${CMAKE_CURRENT_BINARY_DIR}/route_guide.grpc.pb.cc") |
||||
set(rg_grpc_hdrs "${CMAKE_CURRENT_BINARY_DIR}/route_guide.grpc.pb.h") |
||||
add_custom_command( |
||||
OUTPUT "${rg_proto_srcs}" "${rg_proto_hdrs}" "${rg_grpc_srcs}" "${rg_grpc_hdrs}" |
||||
COMMAND ${_PROTOBUF_PROTOC} |
||||
ARGS --grpc_out "${CMAKE_CURRENT_BINARY_DIR}" |
||||
--cpp_out "${CMAKE_CURRENT_BINARY_DIR}" |
||||
-I "${rg_proto_path}" |
||||
--plugin=protoc-gen-grpc="${_GRPC_CPP_PLUGIN_EXECUTABLE}" |
||||
"${rg_proto}" |
||||
DEPENDS "${rg_proto}") |
||||
|
||||
# Include generated *.pb.h files |
||||
include_directories("${CMAKE_CURRENT_BINARY_DIR}") |
||||
|
||||
# rg_grpc_proto |
||||
add_library(rg_grpc_proto |
||||
${rg_grpc_srcs} |
||||
${rg_grpc_hdrs} |
||||
${rg_proto_srcs} |
||||
${rg_proto_hdrs}) |
||||
target_link_libraries(rg_grpc_proto |
||||
${_REFLECTION} |
||||
${_GRPC_GRPCPP} |
||||
${_PROTOBUF_LIBPROTOBUF}) |
||||
|
||||
# route_guide_helper |
||||
add_library(route_guide_helper |
||||
"helper.h" |
||||
"helper.cc") |
||||
target_link_libraries(route_guide_helper |
||||
rg_grpc_proto |
||||
${_REFLECTION} |
||||
${_GRPC_GRPCPP} |
||||
${_PROTOBUF_LIBPROTOBUF}) |
||||
|
||||
# Targets route_guide_(client|server) |
||||
foreach(_target |
||||
route_guide_client route_guide_server) |
||||
add_executable(${_target} |
||||
"${_target}.cc") |
||||
target_link_libraries(${_target} |
||||
rg_grpc_proto |
||||
route_guide_helper |
||||
${_REFLECTION} |
||||
${_GRPC_GRPCPP} |
||||
${_PROTOBUF_LIBPROTOBUF}) |
||||
endforeach() |
@ -0,0 +1,362 @@ |
||||
//
|
||||
// Copyright 2021 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 "src/core/ext/filters/client_channel/resolver_registry.h" |
||||
#include "src/core/ext/xds/xds_client.h" |
||||
#include "src/core/lib/gpr/env.h" |
||||
#include "src/core/lib/http/httpcli.h" |
||||
#include "src/core/lib/iomgr/polling_entity.h" |
||||
#include "src/core/lib/security/credentials/alts/check_gcp_environment.h" |
||||
|
||||
namespace grpc_core { |
||||
|
||||
namespace { |
||||
|
||||
class GoogleCloud2ProdResolver : public Resolver { |
||||
public: |
||||
explicit GoogleCloud2ProdResolver(ResolverArgs args); |
||||
|
||||
void StartLocked() override; |
||||
void RequestReresolutionLocked() override; |
||||
void ResetBackoffLocked() override; |
||||
void ShutdownLocked() override; |
||||
|
||||
private: |
||||
// Represents an HTTP request to the metadata server.
|
||||
class MetadataQuery : public InternallyRefCounted<MetadataQuery> { |
||||
public: |
||||
MetadataQuery(RefCountedPtr<GoogleCloud2ProdResolver> resolver, |
||||
const char* path, grpc_polling_entity* pollent); |
||||
~MetadataQuery() override; |
||||
|
||||
void Orphan() override; |
||||
|
||||
private: |
||||
static void OnHttpRequestDone(void* arg, grpc_error* error); |
||||
|
||||
// Calls OnDone() if not already called. Releases a ref.
|
||||
void MaybeCallOnDone(grpc_error* error); |
||||
|
||||
// If error is not GRPC_ERROR_NONE, then it's not safe to look at response.
|
||||
virtual void OnDone(GoogleCloud2ProdResolver* resolver, |
||||
const grpc_http_response* response, |
||||
grpc_error* error) = 0; |
||||
|
||||
RefCountedPtr<GoogleCloud2ProdResolver> resolver_; |
||||
grpc_httpcli_context context_; |
||||
grpc_httpcli_response response_; |
||||
grpc_closure on_done_; |
||||
Atomic<bool> on_done_called_{false}; |
||||
}; |
||||
|
||||
// A metadata server query to get the zone.
|
||||
class ZoneQuery : public MetadataQuery { |
||||
public: |
||||
ZoneQuery(RefCountedPtr<GoogleCloud2ProdResolver> resolver, |
||||
grpc_polling_entity* pollent); |
||||
|
||||
private: |
||||
void OnDone(GoogleCloud2ProdResolver* resolver, |
||||
const grpc_http_response* response, grpc_error* error) override; |
||||
}; |
||||
|
||||
// A metadata server query to get the IPv6 address.
|
||||
class IPv6Query : public MetadataQuery { |
||||
public: |
||||
IPv6Query(RefCountedPtr<GoogleCloud2ProdResolver> resolver, |
||||
grpc_polling_entity* pollent); |
||||
|
||||
private: |
||||
void OnDone(GoogleCloud2ProdResolver* resolver, |
||||
const grpc_http_response* response, grpc_error* error) override; |
||||
}; |
||||
|
||||
void ZoneQueryDone(std::string zone); |
||||
void IPv6QueryDone(bool ipv6_supported); |
||||
void StartXdsResolver(); |
||||
|
||||
std::shared_ptr<WorkSerializer> work_serializer_; |
||||
grpc_polling_entity pollent_; |
||||
bool using_dns_ = false; |
||||
OrphanablePtr<Resolver> child_resolver_; |
||||
|
||||
OrphanablePtr<ZoneQuery> zone_query_; |
||||
absl::optional<std::string> zone_; |
||||
|
||||
OrphanablePtr<IPv6Query> ipv6_query_; |
||||
absl::optional<bool> supports_ipv6_; |
||||
}; |
||||
|
||||
//
|
||||
// GoogleCloud2ProdResolver::MetadataQuery
|
||||
//
|
||||
|
||||
GoogleCloud2ProdResolver::MetadataQuery::MetadataQuery( |
||||
RefCountedPtr<GoogleCloud2ProdResolver> resolver, const char* path, |
||||
grpc_polling_entity* pollent) |
||||
: resolver_(std::move(resolver)) { |
||||
grpc_httpcli_context_init(&context_); |
||||
// Start HTTP request.
|
||||
GRPC_CLOSURE_INIT(&on_done_, OnHttpRequestDone, this, nullptr); |
||||
Ref().release(); // Ref held by callback.
|
||||
grpc_httpcli_request request; |
||||
memset(&request, 0, sizeof(grpc_httpcli_request)); |
||||
grpc_http_header header = {const_cast<char*>("Metadata-Flavor"), |
||||
const_cast<char*>("Google")}; |
||||
request.host = const_cast<char*>("metadata.google.internal"); |
||||
request.http.path = const_cast<char*>(path); |
||||
request.http.hdr_count = 1; |
||||
request.http.hdrs = &header; |
||||
grpc_resource_quota* resource_quota = |
||||
grpc_resource_quota_create("c2p_resolver"); |
||||
grpc_httpcli_get(&context_, pollent, resource_quota, &request, |
||||
ExecCtx::Get()->Now() + 10000, // 10s timeout
|
||||
&on_done_, &response_); |
||||
grpc_resource_quota_unref_internal(resource_quota); |
||||
} |
||||
|
||||
GoogleCloud2ProdResolver::MetadataQuery::~MetadataQuery() { |
||||
grpc_httpcli_context_destroy(&context_); |
||||
grpc_http_response_destroy(&response_); |
||||
} |
||||
|
||||
void GoogleCloud2ProdResolver::MetadataQuery::Orphan() { |
||||
// TODO(roth): Once the HTTP client library supports cancellation,
|
||||
// use that here.
|
||||
MaybeCallOnDone(GRPC_ERROR_CANCELLED); |
||||
} |
||||
|
||||
void GoogleCloud2ProdResolver::MetadataQuery::OnHttpRequestDone( |
||||
void* arg, grpc_error* error) { |
||||
auto* self = static_cast<MetadataQuery*>(arg); |
||||
self->MaybeCallOnDone(GRPC_ERROR_REF(error)); |
||||
} |
||||
|
||||
void GoogleCloud2ProdResolver::MetadataQuery::MaybeCallOnDone( |
||||
grpc_error* error) { |
||||
bool expected = false; |
||||
if (!on_done_called_.CompareExchangeStrong( |
||||
&expected, true, MemoryOrder::RELAXED, MemoryOrder::RELAXED)) { |
||||
// We've already called OnDone(), so just clean up.
|
||||
GRPC_ERROR_UNREF(error); |
||||
Unref(); |
||||
return; |
||||
} |
||||
// Hop back into WorkSerializer to call OnDone().
|
||||
// Note: We implicitly pass our ref to the callback here.
|
||||
resolver_->work_serializer_->Run( |
||||
[this, error]() { |
||||
OnDone(resolver_.get(), &response_, error); |
||||
Unref(); |
||||
}, |
||||
DEBUG_LOCATION); |
||||
} |
||||
|
||||
//
|
||||
// GoogleCloud2ProdResolver::ZoneQuery
|
||||
//
|
||||
|
||||
GoogleCloud2ProdResolver::ZoneQuery::ZoneQuery( |
||||
RefCountedPtr<GoogleCloud2ProdResolver> resolver, |
||||
grpc_polling_entity* pollent) |
||||
: MetadataQuery(std::move(resolver), "/computeMetadata/v1/instance/zone", |
||||
pollent) {} |
||||
|
||||
void GoogleCloud2ProdResolver::ZoneQuery::OnDone( |
||||
GoogleCloud2ProdResolver* resolver, const grpc_http_response* response, |
||||
grpc_error* error) { |
||||
if (error != GRPC_ERROR_NONE) { |
||||
gpr_log(GPR_ERROR, "error fetching zone from metadata server: %s", |
||||
grpc_error_string(error)); |
||||
} |
||||
std::string zone; |
||||
if (error == GRPC_ERROR_NONE && response->status == 200) { |
||||
absl::string_view body(response->body, response->body_length); |
||||
size_t i = body.find_last_of('/'); |
||||
if (i == body.npos) { |
||||
gpr_log(GPR_ERROR, "could not parse zone from metadata server: %s", |
||||
std::string(body).c_str()); |
||||
} else { |
||||
zone = std::string(body.substr(i)); |
||||
} |
||||
} |
||||
resolver->ZoneQueryDone(std::move(zone)); |
||||
GRPC_ERROR_UNREF(error); |
||||
} |
||||
|
||||
//
|
||||
// GoogleCloud2ProdResolver::IPv6Query
|
||||
//
|
||||
|
||||
GoogleCloud2ProdResolver::IPv6Query::IPv6Query( |
||||
RefCountedPtr<GoogleCloud2ProdResolver> resolver, |
||||
grpc_polling_entity* pollent) |
||||
: MetadataQuery(std::move(resolver), |
||||
"/computeMetadata/v1/instance/network-interfaces/0/ipv6s", |
||||
pollent) {} |
||||
|
||||
void GoogleCloud2ProdResolver::IPv6Query::OnDone( |
||||
GoogleCloud2ProdResolver* resolver, const grpc_http_response* response, |
||||
grpc_error* error) { |
||||
if (error != GRPC_ERROR_NONE) { |
||||
gpr_log(GPR_ERROR, "error fetching IPv6 address from metadata server: %s", |
||||
grpc_error_string(error)); |
||||
} |
||||
resolver->IPv6QueryDone(error == GRPC_ERROR_NONE && response->status == 200); |
||||
GRPC_ERROR_UNREF(error); |
||||
} |
||||
|
||||
//
|
||||
// GoogleCloud2ProdResolver
|
||||
//
|
||||
|
||||
GoogleCloud2ProdResolver::GoogleCloud2ProdResolver(ResolverArgs args) |
||||
: work_serializer_(std::move(args.work_serializer)), |
||||
pollent_(grpc_polling_entity_create_from_pollset_set(args.pollset_set)) { |
||||
absl::string_view name_to_resolve = absl::StripPrefix(args.uri.path(), "/"); |
||||
// If we're not running on GCP, we can't use DirectPath, so delegate
|
||||
// to the DNS resolver.
|
||||
if (!grpc_alts_is_running_on_gcp() || |
||||
// If the client is already using xDS, we can't use it here, because
|
||||
// they may be talking to a completely different xDS server than we
|
||||
// want to.
|
||||
// TODO(roth): When we implement xDS federation, remove this constraint.
|
||||
UniquePtr<char>(gpr_getenv("GRPC_XDS_BOOTSTRAP")) != nullptr || |
||||
UniquePtr<char>(gpr_getenv("GRPC_XDS_BOOTSTRAP_CONFIG")) != nullptr) { |
||||
using_dns_ = true; |
||||
child_resolver_ = ResolverRegistry::CreateResolver( |
||||
absl::StrCat("dns:", name_to_resolve).c_str(), args.args, |
||||
args.pollset_set, work_serializer_, std::move(args.result_handler)); |
||||
GPR_ASSERT(child_resolver_ != nullptr); |
||||
return; |
||||
} |
||||
// Create xds resolver.
|
||||
child_resolver_ = ResolverRegistry::CreateResolver( |
||||
absl::StrCat("xds:", name_to_resolve).c_str(), args.args, |
||||
args.pollset_set, work_serializer_, std::move(args.result_handler)); |
||||
GPR_ASSERT(child_resolver_ != nullptr); |
||||
} |
||||
|
||||
void GoogleCloud2ProdResolver::StartLocked() { |
||||
if (using_dns_) { |
||||
child_resolver_->StartLocked(); |
||||
return; |
||||
} |
||||
// Using xDS. Start metadata server queries.
|
||||
zone_query_ = MakeOrphanable<ZoneQuery>(Ref(), &pollent_); |
||||
ipv6_query_ = MakeOrphanable<IPv6Query>(Ref(), &pollent_); |
||||
} |
||||
|
||||
void GoogleCloud2ProdResolver::RequestReresolutionLocked() { |
||||
if (child_resolver_ != nullptr) { |
||||
child_resolver_->RequestReresolutionLocked(); |
||||
} |
||||
} |
||||
|
||||
void GoogleCloud2ProdResolver::ResetBackoffLocked() { |
||||
if (child_resolver_ != nullptr) { |
||||
child_resolver_->ResetBackoffLocked(); |
||||
} |
||||
} |
||||
|
||||
void GoogleCloud2ProdResolver::ShutdownLocked() { |
||||
zone_query_.reset(); |
||||
ipv6_query_.reset(); |
||||
child_resolver_.reset(); |
||||
} |
||||
|
||||
void GoogleCloud2ProdResolver::ZoneQueryDone(std::string zone) { |
||||
zone_query_.reset(); |
||||
zone_ = std::move(zone); |
||||
if (supports_ipv6_.has_value()) StartXdsResolver(); |
||||
} |
||||
|
||||
void GoogleCloud2ProdResolver::IPv6QueryDone(bool ipv6_supported) { |
||||
ipv6_query_.reset(); |
||||
supports_ipv6_ = ipv6_supported; |
||||
if (zone_.has_value()) StartXdsResolver(); |
||||
} |
||||
|
||||
void GoogleCloud2ProdResolver::StartXdsResolver() { |
||||
// Construct bootstrap JSON.
|
||||
Json::Object node = { |
||||
{"id", "C2P"}, |
||||
}; |
||||
if (!zone_->empty()) { |
||||
node["locality"] = Json::Object{ |
||||
{"zone", *zone_}, |
||||
}; |
||||
}; |
||||
if (*supports_ipv6_) { |
||||
node["metadata"] = Json::Object{ |
||||
{"TRAFFICDIRECTOR_DIRECTPATH_C2P_IPV6_CAPABLE", true}, |
||||
}; |
||||
} |
||||
Json bootstrap = Json::Object{ |
||||
{"xds_servers", |
||||
Json::Array{ |
||||
Json::Object{ |
||||
{"server_uri", "directpath-trafficdirector.googleapis.com"}, |
||||
{"channel_creds", |
||||
Json::Array{ |
||||
Json::Object{ |
||||
{"type", "google_default"}, |
||||
}, |
||||
}}, |
||||
}, |
||||
}}, |
||||
{"node", std::move(node)}, |
||||
}; |
||||
// Inject bootstrap JSON as fallback config.
|
||||
internal::SetXdsFallbackBootstrapConfig(bootstrap.Dump().c_str()); |
||||
// Now start xDS resolver.
|
||||
child_resolver_->StartLocked(); |
||||
} |
||||
|
||||
//
|
||||
// Factory
|
||||
//
|
||||
|
||||
class GoogleCloud2ProdResolverFactory : public ResolverFactory { |
||||
public: |
||||
bool IsValidUri(const URI& uri) const override { |
||||
if (GPR_UNLIKELY(!uri.authority().empty())) { |
||||
gpr_log(GPR_ERROR, "google-c2p URI scheme does not support authorities"); |
||||
return false; |
||||
} |
||||
return true; |
||||
} |
||||
|
||||
OrphanablePtr<Resolver> CreateResolver(ResolverArgs args) const override { |
||||
if (!IsValidUri(args.uri)) return nullptr; |
||||
return MakeOrphanable<GoogleCloud2ProdResolver>(std::move(args)); |
||||
} |
||||
|
||||
const char* scheme() const override { return "google-c2p"; } |
||||
}; |
||||
|
||||
} // namespace
|
||||
|
||||
void GoogleCloud2ProdResolverInit() { |
||||
ResolverRegistry::Builder::RegisterResolverFactory( |
||||
absl::make_unique<GoogleCloud2ProdResolverFactory>()); |
||||
} |
||||
|
||||
void GoogleCloud2ProdResolverShutdown() {} |
||||
|
||||
} // namespace grpc_core
|
@ -0,0 +1,29 @@ |
||||
/* This file was generated by upbc (the upb compiler) from the input
|
||||
* file: |
||||
* |
||||
* envoy/extensions/clusters/aggregate/v3/cluster.proto |
||||
* |
||||
* Do not edit -- your changes will be discarded when the file is |
||||
* regenerated. */ |
||||
|
||||
#include <stddef.h> |
||||
#include "upb/msg.h" |
||||
#include "envoy/extensions/clusters/aggregate/v3/cluster.upb.h" |
||||
#include "udpa/annotations/status.upb.h" |
||||
#include "udpa/annotations/versioning.upb.h" |
||||
#include "validate/validate.upb.h" |
||||
|
||||
#include "upb/port_def.inc" |
||||
|
||||
static const upb_msglayout_field envoy_extensions_clusters_aggregate_v3_ClusterConfig__fields[1] = { |
||||
{1, UPB_SIZE(0, 0), 0, 0, 9, 3}, |
||||
}; |
||||
|
||||
const upb_msglayout envoy_extensions_clusters_aggregate_v3_ClusterConfig_msginit = { |
||||
NULL, |
||||
&envoy_extensions_clusters_aggregate_v3_ClusterConfig__fields[0], |
||||
UPB_SIZE(8, 8), 1, false, 255, |
||||
}; |
||||
|
||||
#include "upb/port_undef.inc" |
||||
|
@ -0,0 +1,67 @@ |
||||
/* This file was generated by upbc (the upb compiler) from the input
|
||||
* file: |
||||
* |
||||
* envoy/extensions/clusters/aggregate/v3/cluster.proto |
||||
* |
||||
* Do not edit -- your changes will be discarded when the file is |
||||
* regenerated. */ |
||||
|
||||
#ifndef ENVOY_EXTENSIONS_CLUSTERS_AGGREGATE_V3_CLUSTER_PROTO_UPB_H_ |
||||
#define ENVOY_EXTENSIONS_CLUSTERS_AGGREGATE_V3_CLUSTER_PROTO_UPB_H_ |
||||
|
||||
#include "upb/msg.h" |
||||
#include "upb/decode.h" |
||||
#include "upb/decode_fast.h" |
||||
#include "upb/encode.h" |
||||
|
||||
#include "upb/port_def.inc" |
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
struct envoy_extensions_clusters_aggregate_v3_ClusterConfig; |
||||
typedef struct envoy_extensions_clusters_aggregate_v3_ClusterConfig envoy_extensions_clusters_aggregate_v3_ClusterConfig; |
||||
extern const upb_msglayout envoy_extensions_clusters_aggregate_v3_ClusterConfig_msginit; |
||||
|
||||
|
||||
/* envoy.extensions.clusters.aggregate.v3.ClusterConfig */ |
||||
|
||||
UPB_INLINE envoy_extensions_clusters_aggregate_v3_ClusterConfig *envoy_extensions_clusters_aggregate_v3_ClusterConfig_new(upb_arena *arena) { |
||||
return (envoy_extensions_clusters_aggregate_v3_ClusterConfig *)_upb_msg_new(&envoy_extensions_clusters_aggregate_v3_ClusterConfig_msginit, arena); |
||||
} |
||||
UPB_INLINE envoy_extensions_clusters_aggregate_v3_ClusterConfig *envoy_extensions_clusters_aggregate_v3_ClusterConfig_parse(const char *buf, size_t size, |
||||
upb_arena *arena) { |
||||
envoy_extensions_clusters_aggregate_v3_ClusterConfig *ret = envoy_extensions_clusters_aggregate_v3_ClusterConfig_new(arena); |
||||
return (ret && upb_decode(buf, size, ret, &envoy_extensions_clusters_aggregate_v3_ClusterConfig_msginit, arena)) ? ret : NULL; |
||||
} |
||||
UPB_INLINE envoy_extensions_clusters_aggregate_v3_ClusterConfig *envoy_extensions_clusters_aggregate_v3_ClusterConfig_parse_ex(const char *buf, size_t size, |
||||
upb_arena *arena, int options) { |
||||
envoy_extensions_clusters_aggregate_v3_ClusterConfig *ret = envoy_extensions_clusters_aggregate_v3_ClusterConfig_new(arena); |
||||
return (ret && _upb_decode(buf, size, ret, &envoy_extensions_clusters_aggregate_v3_ClusterConfig_msginit, arena, options)) |
||||
? ret : NULL; |
||||
} |
||||
UPB_INLINE char *envoy_extensions_clusters_aggregate_v3_ClusterConfig_serialize(const envoy_extensions_clusters_aggregate_v3_ClusterConfig *msg, upb_arena *arena, size_t *len) { |
||||
return upb_encode(msg, &envoy_extensions_clusters_aggregate_v3_ClusterConfig_msginit, arena, len); |
||||
} |
||||
|
||||
UPB_INLINE upb_strview const* envoy_extensions_clusters_aggregate_v3_ClusterConfig_clusters(const envoy_extensions_clusters_aggregate_v3_ClusterConfig *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(0, 0), len); } |
||||
|
||||
UPB_INLINE upb_strview* envoy_extensions_clusters_aggregate_v3_ClusterConfig_mutable_clusters(envoy_extensions_clusters_aggregate_v3_ClusterConfig *msg, size_t *len) { |
||||
return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(0, 0), len); |
||||
} |
||||
UPB_INLINE upb_strview* envoy_extensions_clusters_aggregate_v3_ClusterConfig_resize_clusters(envoy_extensions_clusters_aggregate_v3_ClusterConfig *msg, size_t len, upb_arena *arena) { |
||||
return (upb_strview*)_upb_array_resize_accessor2(msg, UPB_SIZE(0, 0), len, UPB_SIZE(3, 4), arena); |
||||
} |
||||
UPB_INLINE bool envoy_extensions_clusters_aggregate_v3_ClusterConfig_add_clusters(envoy_extensions_clusters_aggregate_v3_ClusterConfig *msg, upb_strview val, upb_arena *arena) { |
||||
return _upb_array_append_accessor2(msg, UPB_SIZE(0, 0), UPB_SIZE(3, 4), &val, |
||||
arena); |
||||
} |
||||
|
||||
#ifdef __cplusplus |
||||
} /* extern "C" */ |
||||
#endif |
||||
|
||||
#include "upb/port_undef.inc" |
||||
|
||||
#endif /* ENVOY_EXTENSIONS_CLUSTERS_AGGREGATE_V3_CLUSTER_PROTO_UPB_H_ */ |
@ -0,0 +1,85 @@ |
||||
/* This file was generated by upbc (the upb compiler) from the input
|
||||
* file: |
||||
* |
||||
* src/proto/grpc/auth/v1/authz_policy.proto |
||||
* |
||||
* Do not edit -- your changes will be discarded when the file is |
||||
* regenerated. */ |
||||
|
||||
#include <stddef.h> |
||||
#include "upb/msg.h" |
||||
#include "src/proto/grpc/auth/v1/authz_policy.upb.h" |
||||
|
||||
#include "upb/port_def.inc" |
||||
|
||||
static const upb_msglayout_field grpc_auth_v1_Peer__fields[1] = { |
||||
{1, UPB_SIZE(0, 0), 0, 0, 9, 3}, |
||||
}; |
||||
|
||||
const upb_msglayout grpc_auth_v1_Peer_msginit = { |
||||
NULL, |
||||
&grpc_auth_v1_Peer__fields[0], |
||||
UPB_SIZE(8, 8), 1, false, 255, |
||||
}; |
||||
|
||||
static const upb_msglayout_field grpc_auth_v1_Header__fields[2] = { |
||||
{1, UPB_SIZE(0, 0), 0, 0, 9, 1}, |
||||
{2, UPB_SIZE(8, 16), 0, 0, 9, 3}, |
||||
}; |
||||
|
||||
const upb_msglayout grpc_auth_v1_Header_msginit = { |
||||
NULL, |
||||
&grpc_auth_v1_Header__fields[0], |
||||
UPB_SIZE(16, 32), 2, false, 255, |
||||
}; |
||||
|
||||
static const upb_msglayout *const grpc_auth_v1_Request_submsgs[1] = { |
||||
&grpc_auth_v1_Header_msginit, |
||||
}; |
||||
|
||||
static const upb_msglayout_field grpc_auth_v1_Request__fields[2] = { |
||||
{1, UPB_SIZE(0, 0), 0, 0, 9, 3}, |
||||
{3, UPB_SIZE(4, 8), 0, 0, 11, 3}, |
||||
}; |
||||
|
||||
const upb_msglayout grpc_auth_v1_Request_msginit = { |
||||
&grpc_auth_v1_Request_submsgs[0], |
||||
&grpc_auth_v1_Request__fields[0], |
||||
UPB_SIZE(8, 16), 2, false, 255, |
||||
}; |
||||
|
||||
static const upb_msglayout *const grpc_auth_v1_Rule_submsgs[2] = { |
||||
&grpc_auth_v1_Peer_msginit, |
||||
&grpc_auth_v1_Request_msginit, |
||||
}; |
||||
|
||||
static const upb_msglayout_field grpc_auth_v1_Rule__fields[3] = { |
||||
{1, UPB_SIZE(4, 8), 0, 0, 9, 1}, |
||||
{2, UPB_SIZE(12, 24), 1, 0, 11, 1}, |
||||
{3, UPB_SIZE(16, 32), 2, 1, 11, 1}, |
||||
}; |
||||
|
||||
const upb_msglayout grpc_auth_v1_Rule_msginit = { |
||||
&grpc_auth_v1_Rule_submsgs[0], |
||||
&grpc_auth_v1_Rule__fields[0], |
||||
UPB_SIZE(24, 48), 3, false, 255, |
||||
}; |
||||
|
||||
static const upb_msglayout *const grpc_auth_v1_AuthorizationPolicy_submsgs[1] = { |
||||
&grpc_auth_v1_Rule_msginit, |
||||
}; |
||||
|
||||
static const upb_msglayout_field grpc_auth_v1_AuthorizationPolicy__fields[3] = { |
||||
{1, UPB_SIZE(0, 0), 0, 0, 9, 1}, |
||||
{2, UPB_SIZE(8, 16), 0, 0, 11, 3}, |
||||
{3, UPB_SIZE(12, 24), 0, 0, 11, 3}, |
||||
}; |
||||
|
||||
const upb_msglayout grpc_auth_v1_AuthorizationPolicy_msginit = { |
||||
&grpc_auth_v1_AuthorizationPolicy_submsgs[0], |
||||
&grpc_auth_v1_AuthorizationPolicy__fields[0], |
||||
UPB_SIZE(16, 32), 3, false, 255, |
||||
}; |
||||
|
||||
#include "upb/port_undef.inc" |
||||
|
@ -0,0 +1,276 @@ |
||||
/* This file was generated by upbc (the upb compiler) from the input
|
||||
* file: |
||||
* |
||||
* src/proto/grpc/auth/v1/authz_policy.proto |
||||
* |
||||
* Do not edit -- your changes will be discarded when the file is |
||||
* regenerated. */ |
||||
|
||||
#ifndef SRC_PROTO_GRPC_AUTH_V1_AUTHZ_POLICY_PROTO_UPB_H_ |
||||
#define SRC_PROTO_GRPC_AUTH_V1_AUTHZ_POLICY_PROTO_UPB_H_ |
||||
|
||||
#include "upb/msg.h" |
||||
#include "upb/decode.h" |
||||
#include "upb/decode_fast.h" |
||||
#include "upb/encode.h" |
||||
|
||||
#include "upb/port_def.inc" |
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
struct grpc_auth_v1_Peer; |
||||
struct grpc_auth_v1_Header; |
||||
struct grpc_auth_v1_Request; |
||||
struct grpc_auth_v1_Rule; |
||||
struct grpc_auth_v1_AuthorizationPolicy; |
||||
typedef struct grpc_auth_v1_Peer grpc_auth_v1_Peer; |
||||
typedef struct grpc_auth_v1_Header grpc_auth_v1_Header; |
||||
typedef struct grpc_auth_v1_Request grpc_auth_v1_Request; |
||||
typedef struct grpc_auth_v1_Rule grpc_auth_v1_Rule; |
||||
typedef struct grpc_auth_v1_AuthorizationPolicy grpc_auth_v1_AuthorizationPolicy; |
||||
extern const upb_msglayout grpc_auth_v1_Peer_msginit; |
||||
extern const upb_msglayout grpc_auth_v1_Header_msginit; |
||||
extern const upb_msglayout grpc_auth_v1_Request_msginit; |
||||
extern const upb_msglayout grpc_auth_v1_Rule_msginit; |
||||
extern const upb_msglayout grpc_auth_v1_AuthorizationPolicy_msginit; |
||||
|
||||
|
||||
/* grpc.auth.v1.Peer */ |
||||
|
||||
UPB_INLINE grpc_auth_v1_Peer *grpc_auth_v1_Peer_new(upb_arena *arena) { |
||||
return (grpc_auth_v1_Peer *)_upb_msg_new(&grpc_auth_v1_Peer_msginit, arena); |
||||
} |
||||
UPB_INLINE grpc_auth_v1_Peer *grpc_auth_v1_Peer_parse(const char *buf, size_t size, |
||||
upb_arena *arena) { |
||||
grpc_auth_v1_Peer *ret = grpc_auth_v1_Peer_new(arena); |
||||
return (ret && upb_decode(buf, size, ret, &grpc_auth_v1_Peer_msginit, arena)) ? ret : NULL; |
||||
} |
||||
UPB_INLINE grpc_auth_v1_Peer *grpc_auth_v1_Peer_parse_ex(const char *buf, size_t size, |
||||
upb_arena *arena, int options) { |
||||
grpc_auth_v1_Peer *ret = grpc_auth_v1_Peer_new(arena); |
||||
return (ret && _upb_decode(buf, size, ret, &grpc_auth_v1_Peer_msginit, arena, options)) |
||||
? ret : NULL; |
||||
} |
||||
UPB_INLINE char *grpc_auth_v1_Peer_serialize(const grpc_auth_v1_Peer *msg, upb_arena *arena, size_t *len) { |
||||
return upb_encode(msg, &grpc_auth_v1_Peer_msginit, arena, len); |
||||
} |
||||
|
||||
UPB_INLINE upb_strview const* grpc_auth_v1_Peer_principals(const grpc_auth_v1_Peer *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(0, 0), len); } |
||||
|
||||
UPB_INLINE upb_strview* grpc_auth_v1_Peer_mutable_principals(grpc_auth_v1_Peer *msg, size_t *len) { |
||||
return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(0, 0), len); |
||||
} |
||||
UPB_INLINE upb_strview* grpc_auth_v1_Peer_resize_principals(grpc_auth_v1_Peer *msg, size_t len, upb_arena *arena) { |
||||
return (upb_strview*)_upb_array_resize_accessor2(msg, UPB_SIZE(0, 0), len, UPB_SIZE(3, 4), arena); |
||||
} |
||||
UPB_INLINE bool grpc_auth_v1_Peer_add_principals(grpc_auth_v1_Peer *msg, upb_strview val, upb_arena *arena) { |
||||
return _upb_array_append_accessor2(msg, UPB_SIZE(0, 0), UPB_SIZE(3, 4), &val, |
||||
arena); |
||||
} |
||||
|
||||
/* grpc.auth.v1.Header */ |
||||
|
||||
UPB_INLINE grpc_auth_v1_Header *grpc_auth_v1_Header_new(upb_arena *arena) { |
||||
return (grpc_auth_v1_Header *)_upb_msg_new(&grpc_auth_v1_Header_msginit, arena); |
||||
} |
||||
UPB_INLINE grpc_auth_v1_Header *grpc_auth_v1_Header_parse(const char *buf, size_t size, |
||||
upb_arena *arena) { |
||||
grpc_auth_v1_Header *ret = grpc_auth_v1_Header_new(arena); |
||||
return (ret && upb_decode(buf, size, ret, &grpc_auth_v1_Header_msginit, arena)) ? ret : NULL; |
||||
} |
||||
UPB_INLINE grpc_auth_v1_Header *grpc_auth_v1_Header_parse_ex(const char *buf, size_t size, |
||||
upb_arena *arena, int options) { |
||||
grpc_auth_v1_Header *ret = grpc_auth_v1_Header_new(arena); |
||||
return (ret && _upb_decode(buf, size, ret, &grpc_auth_v1_Header_msginit, arena, options)) |
||||
? ret : NULL; |
||||
} |
||||
UPB_INLINE char *grpc_auth_v1_Header_serialize(const grpc_auth_v1_Header *msg, upb_arena *arena, size_t *len) { |
||||
return upb_encode(msg, &grpc_auth_v1_Header_msginit, arena, len); |
||||
} |
||||
|
||||
UPB_INLINE upb_strview grpc_auth_v1_Header_key(const grpc_auth_v1_Header *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(0, 0), upb_strview); } |
||||
UPB_INLINE upb_strview const* grpc_auth_v1_Header_values(const grpc_auth_v1_Header *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(8, 16), len); } |
||||
|
||||
UPB_INLINE void grpc_auth_v1_Header_set_key(grpc_auth_v1_Header *msg, upb_strview value) { |
||||
*UPB_PTR_AT(msg, UPB_SIZE(0, 0), upb_strview) = value; |
||||
} |
||||
UPB_INLINE upb_strview* grpc_auth_v1_Header_mutable_values(grpc_auth_v1_Header *msg, size_t *len) { |
||||
return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(8, 16), len); |
||||
} |
||||
UPB_INLINE upb_strview* grpc_auth_v1_Header_resize_values(grpc_auth_v1_Header *msg, size_t len, upb_arena *arena) { |
||||
return (upb_strview*)_upb_array_resize_accessor2(msg, UPB_SIZE(8, 16), len, UPB_SIZE(3, 4), arena); |
||||
} |
||||
UPB_INLINE bool grpc_auth_v1_Header_add_values(grpc_auth_v1_Header *msg, upb_strview val, upb_arena *arena) { |
||||
return _upb_array_append_accessor2(msg, UPB_SIZE(8, 16), UPB_SIZE(3, 4), &val, |
||||
arena); |
||||
} |
||||
|
||||
/* grpc.auth.v1.Request */ |
||||
|
||||
UPB_INLINE grpc_auth_v1_Request *grpc_auth_v1_Request_new(upb_arena *arena) { |
||||
return (grpc_auth_v1_Request *)_upb_msg_new(&grpc_auth_v1_Request_msginit, arena); |
||||
} |
||||
UPB_INLINE grpc_auth_v1_Request *grpc_auth_v1_Request_parse(const char *buf, size_t size, |
||||
upb_arena *arena) { |
||||
grpc_auth_v1_Request *ret = grpc_auth_v1_Request_new(arena); |
||||
return (ret && upb_decode(buf, size, ret, &grpc_auth_v1_Request_msginit, arena)) ? ret : NULL; |
||||
} |
||||
UPB_INLINE grpc_auth_v1_Request *grpc_auth_v1_Request_parse_ex(const char *buf, size_t size, |
||||
upb_arena *arena, int options) { |
||||
grpc_auth_v1_Request *ret = grpc_auth_v1_Request_new(arena); |
||||
return (ret && _upb_decode(buf, size, ret, &grpc_auth_v1_Request_msginit, arena, options)) |
||||
? ret : NULL; |
||||
} |
||||
UPB_INLINE char *grpc_auth_v1_Request_serialize(const grpc_auth_v1_Request *msg, upb_arena *arena, size_t *len) { |
||||
return upb_encode(msg, &grpc_auth_v1_Request_msginit, arena, len); |
||||
} |
||||
|
||||
UPB_INLINE upb_strview const* grpc_auth_v1_Request_paths(const grpc_auth_v1_Request *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(0, 0), len); } |
||||
UPB_INLINE bool grpc_auth_v1_Request_has_headers(const grpc_auth_v1_Request *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(4, 8)); } |
||||
UPB_INLINE const grpc_auth_v1_Header* const* grpc_auth_v1_Request_headers(const grpc_auth_v1_Request *msg, size_t *len) { return (const grpc_auth_v1_Header* const*)_upb_array_accessor(msg, UPB_SIZE(4, 8), len); } |
||||
|
||||
UPB_INLINE upb_strview* grpc_auth_v1_Request_mutable_paths(grpc_auth_v1_Request *msg, size_t *len) { |
||||
return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(0, 0), len); |
||||
} |
||||
UPB_INLINE upb_strview* grpc_auth_v1_Request_resize_paths(grpc_auth_v1_Request *msg, size_t len, upb_arena *arena) { |
||||
return (upb_strview*)_upb_array_resize_accessor2(msg, UPB_SIZE(0, 0), len, UPB_SIZE(3, 4), arena); |
||||
} |
||||
UPB_INLINE bool grpc_auth_v1_Request_add_paths(grpc_auth_v1_Request *msg, upb_strview val, upb_arena *arena) { |
||||
return _upb_array_append_accessor2(msg, UPB_SIZE(0, 0), UPB_SIZE(3, 4), &val, |
||||
arena); |
||||
} |
||||
UPB_INLINE grpc_auth_v1_Header** grpc_auth_v1_Request_mutable_headers(grpc_auth_v1_Request *msg, size_t *len) { |
||||
return (grpc_auth_v1_Header**)_upb_array_mutable_accessor(msg, UPB_SIZE(4, 8), len); |
||||
} |
||||
UPB_INLINE grpc_auth_v1_Header** grpc_auth_v1_Request_resize_headers(grpc_auth_v1_Request *msg, size_t len, upb_arena *arena) { |
||||
return (grpc_auth_v1_Header**)_upb_array_resize_accessor2(msg, UPB_SIZE(4, 8), len, UPB_SIZE(2, 3), arena); |
||||
} |
||||
UPB_INLINE struct grpc_auth_v1_Header* grpc_auth_v1_Request_add_headers(grpc_auth_v1_Request *msg, upb_arena *arena) { |
||||
struct grpc_auth_v1_Header* sub = (struct grpc_auth_v1_Header*)_upb_msg_new(&grpc_auth_v1_Header_msginit, arena); |
||||
bool ok = _upb_array_append_accessor2( |
||||
msg, UPB_SIZE(4, 8), UPB_SIZE(2, 3), &sub, arena); |
||||
if (!ok) return NULL; |
||||
return sub; |
||||
} |
||||
|
||||
/* grpc.auth.v1.Rule */ |
||||
|
||||
UPB_INLINE grpc_auth_v1_Rule *grpc_auth_v1_Rule_new(upb_arena *arena) { |
||||
return (grpc_auth_v1_Rule *)_upb_msg_new(&grpc_auth_v1_Rule_msginit, arena); |
||||
} |
||||
UPB_INLINE grpc_auth_v1_Rule *grpc_auth_v1_Rule_parse(const char *buf, size_t size, |
||||
upb_arena *arena) { |
||||
grpc_auth_v1_Rule *ret = grpc_auth_v1_Rule_new(arena); |
||||
return (ret && upb_decode(buf, size, ret, &grpc_auth_v1_Rule_msginit, arena)) ? ret : NULL; |
||||
} |
||||
UPB_INLINE grpc_auth_v1_Rule *grpc_auth_v1_Rule_parse_ex(const char *buf, size_t size, |
||||
upb_arena *arena, int options) { |
||||
grpc_auth_v1_Rule *ret = grpc_auth_v1_Rule_new(arena); |
||||
return (ret && _upb_decode(buf, size, ret, &grpc_auth_v1_Rule_msginit, arena, options)) |
||||
? ret : NULL; |
||||
} |
||||
UPB_INLINE char *grpc_auth_v1_Rule_serialize(const grpc_auth_v1_Rule *msg, upb_arena *arena, size_t *len) { |
||||
return upb_encode(msg, &grpc_auth_v1_Rule_msginit, arena, len); |
||||
} |
||||
|
||||
UPB_INLINE upb_strview grpc_auth_v1_Rule_name(const grpc_auth_v1_Rule *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(4, 8), upb_strview); } |
||||
UPB_INLINE bool grpc_auth_v1_Rule_has_source(const grpc_auth_v1_Rule *msg) { return _upb_hasbit(msg, 1); } |
||||
UPB_INLINE const grpc_auth_v1_Peer* grpc_auth_v1_Rule_source(const grpc_auth_v1_Rule *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(12, 24), const grpc_auth_v1_Peer*); } |
||||
UPB_INLINE bool grpc_auth_v1_Rule_has_request(const grpc_auth_v1_Rule *msg) { return _upb_hasbit(msg, 2); } |
||||
UPB_INLINE const grpc_auth_v1_Request* grpc_auth_v1_Rule_request(const grpc_auth_v1_Rule *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(16, 32), const grpc_auth_v1_Request*); } |
||||
|
||||
UPB_INLINE void grpc_auth_v1_Rule_set_name(grpc_auth_v1_Rule *msg, upb_strview value) { |
||||
*UPB_PTR_AT(msg, UPB_SIZE(4, 8), upb_strview) = value; |
||||
} |
||||
UPB_INLINE void grpc_auth_v1_Rule_set_source(grpc_auth_v1_Rule *msg, grpc_auth_v1_Peer* value) { |
||||
_upb_sethas(msg, 1); |
||||
*UPB_PTR_AT(msg, UPB_SIZE(12, 24), grpc_auth_v1_Peer*) = value; |
||||
} |
||||
UPB_INLINE struct grpc_auth_v1_Peer* grpc_auth_v1_Rule_mutable_source(grpc_auth_v1_Rule *msg, upb_arena *arena) { |
||||
struct grpc_auth_v1_Peer* sub = (struct grpc_auth_v1_Peer*)grpc_auth_v1_Rule_source(msg); |
||||
if (sub == NULL) { |
||||
sub = (struct grpc_auth_v1_Peer*)_upb_msg_new(&grpc_auth_v1_Peer_msginit, arena); |
||||
if (!sub) return NULL; |
||||
grpc_auth_v1_Rule_set_source(msg, sub); |
||||
} |
||||
return sub; |
||||
} |
||||
UPB_INLINE void grpc_auth_v1_Rule_set_request(grpc_auth_v1_Rule *msg, grpc_auth_v1_Request* value) { |
||||
_upb_sethas(msg, 2); |
||||
*UPB_PTR_AT(msg, UPB_SIZE(16, 32), grpc_auth_v1_Request*) = value; |
||||
} |
||||
UPB_INLINE struct grpc_auth_v1_Request* grpc_auth_v1_Rule_mutable_request(grpc_auth_v1_Rule *msg, upb_arena *arena) { |
||||
struct grpc_auth_v1_Request* sub = (struct grpc_auth_v1_Request*)grpc_auth_v1_Rule_request(msg); |
||||
if (sub == NULL) { |
||||
sub = (struct grpc_auth_v1_Request*)_upb_msg_new(&grpc_auth_v1_Request_msginit, arena); |
||||
if (!sub) return NULL; |
||||
grpc_auth_v1_Rule_set_request(msg, sub); |
||||
} |
||||
return sub; |
||||
} |
||||
|
||||
/* grpc.auth.v1.AuthorizationPolicy */ |
||||
|
||||
UPB_INLINE grpc_auth_v1_AuthorizationPolicy *grpc_auth_v1_AuthorizationPolicy_new(upb_arena *arena) { |
||||
return (grpc_auth_v1_AuthorizationPolicy *)_upb_msg_new(&grpc_auth_v1_AuthorizationPolicy_msginit, arena); |
||||
} |
||||
UPB_INLINE grpc_auth_v1_AuthorizationPolicy *grpc_auth_v1_AuthorizationPolicy_parse(const char *buf, size_t size, |
||||
upb_arena *arena) { |
||||
grpc_auth_v1_AuthorizationPolicy *ret = grpc_auth_v1_AuthorizationPolicy_new(arena); |
||||
return (ret && upb_decode(buf, size, ret, &grpc_auth_v1_AuthorizationPolicy_msginit, arena)) ? ret : NULL; |
||||
} |
||||
UPB_INLINE grpc_auth_v1_AuthorizationPolicy *grpc_auth_v1_AuthorizationPolicy_parse_ex(const char *buf, size_t size, |
||||
upb_arena *arena, int options) { |
||||
grpc_auth_v1_AuthorizationPolicy *ret = grpc_auth_v1_AuthorizationPolicy_new(arena); |
||||
return (ret && _upb_decode(buf, size, ret, &grpc_auth_v1_AuthorizationPolicy_msginit, arena, options)) |
||||
? ret : NULL; |
||||
} |
||||
UPB_INLINE char *grpc_auth_v1_AuthorizationPolicy_serialize(const grpc_auth_v1_AuthorizationPolicy *msg, upb_arena *arena, size_t *len) { |
||||
return upb_encode(msg, &grpc_auth_v1_AuthorizationPolicy_msginit, arena, len); |
||||
} |
||||
|
||||
UPB_INLINE upb_strview grpc_auth_v1_AuthorizationPolicy_name(const grpc_auth_v1_AuthorizationPolicy *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(0, 0), upb_strview); } |
||||
UPB_INLINE bool grpc_auth_v1_AuthorizationPolicy_has_deny_rules(const grpc_auth_v1_AuthorizationPolicy *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(8, 16)); } |
||||
UPB_INLINE const grpc_auth_v1_Rule* const* grpc_auth_v1_AuthorizationPolicy_deny_rules(const grpc_auth_v1_AuthorizationPolicy *msg, size_t *len) { return (const grpc_auth_v1_Rule* const*)_upb_array_accessor(msg, UPB_SIZE(8, 16), len); } |
||||
UPB_INLINE bool grpc_auth_v1_AuthorizationPolicy_has_allow_rules(const grpc_auth_v1_AuthorizationPolicy *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(12, 24)); } |
||||
UPB_INLINE const grpc_auth_v1_Rule* const* grpc_auth_v1_AuthorizationPolicy_allow_rules(const grpc_auth_v1_AuthorizationPolicy *msg, size_t *len) { return (const grpc_auth_v1_Rule* const*)_upb_array_accessor(msg, UPB_SIZE(12, 24), len); } |
||||
|
||||
UPB_INLINE void grpc_auth_v1_AuthorizationPolicy_set_name(grpc_auth_v1_AuthorizationPolicy *msg, upb_strview value) { |
||||
*UPB_PTR_AT(msg, UPB_SIZE(0, 0), upb_strview) = value; |
||||
} |
||||
UPB_INLINE grpc_auth_v1_Rule** grpc_auth_v1_AuthorizationPolicy_mutable_deny_rules(grpc_auth_v1_AuthorizationPolicy *msg, size_t *len) { |
||||
return (grpc_auth_v1_Rule**)_upb_array_mutable_accessor(msg, UPB_SIZE(8, 16), len); |
||||
} |
||||
UPB_INLINE grpc_auth_v1_Rule** grpc_auth_v1_AuthorizationPolicy_resize_deny_rules(grpc_auth_v1_AuthorizationPolicy *msg, size_t len, upb_arena *arena) { |
||||
return (grpc_auth_v1_Rule**)_upb_array_resize_accessor2(msg, UPB_SIZE(8, 16), len, UPB_SIZE(2, 3), arena); |
||||
} |
||||
UPB_INLINE struct grpc_auth_v1_Rule* grpc_auth_v1_AuthorizationPolicy_add_deny_rules(grpc_auth_v1_AuthorizationPolicy *msg, upb_arena *arena) { |
||||
struct grpc_auth_v1_Rule* sub = (struct grpc_auth_v1_Rule*)_upb_msg_new(&grpc_auth_v1_Rule_msginit, arena); |
||||
bool ok = _upb_array_append_accessor2( |
||||
msg, UPB_SIZE(8, 16), UPB_SIZE(2, 3), &sub, arena); |
||||
if (!ok) return NULL; |
||||
return sub; |
||||
} |
||||
UPB_INLINE grpc_auth_v1_Rule** grpc_auth_v1_AuthorizationPolicy_mutable_allow_rules(grpc_auth_v1_AuthorizationPolicy *msg, size_t *len) { |
||||
return (grpc_auth_v1_Rule**)_upb_array_mutable_accessor(msg, UPB_SIZE(12, 24), len); |
||||
} |
||||
UPB_INLINE grpc_auth_v1_Rule** grpc_auth_v1_AuthorizationPolicy_resize_allow_rules(grpc_auth_v1_AuthorizationPolicy *msg, size_t len, upb_arena *arena) { |
||||
return (grpc_auth_v1_Rule**)_upb_array_resize_accessor2(msg, UPB_SIZE(12, 24), len, UPB_SIZE(2, 3), arena); |
||||
} |
||||
UPB_INLINE struct grpc_auth_v1_Rule* grpc_auth_v1_AuthorizationPolicy_add_allow_rules(grpc_auth_v1_AuthorizationPolicy *msg, upb_arena *arena) { |
||||
struct grpc_auth_v1_Rule* sub = (struct grpc_auth_v1_Rule*)_upb_msg_new(&grpc_auth_v1_Rule_msginit, arena); |
||||
bool ok = _upb_array_append_accessor2( |
||||
msg, UPB_SIZE(12, 24), UPB_SIZE(2, 3), &sub, arena); |
||||
if (!ok) return NULL; |
||||
return sub; |
||||
} |
||||
|
||||
#ifdef __cplusplus |
||||
} /* extern "C" */ |
||||
#endif |
||||
|
||||
#include "upb/port_undef.inc" |
||||
|
||||
#endif /* SRC_PROTO_GRPC_AUTH_V1_AUTHZ_POLICY_PROTO_UPB_H_ */ |
@ -0,0 +1,51 @@ |
||||
/* This file was generated by upbc (the upb compiler) from the input
|
||||
* file: |
||||
* |
||||
* envoy/extensions/clusters/aggregate/v3/cluster.proto |
||||
* |
||||
* Do not edit -- your changes will be discarded when the file is |
||||
* regenerated. */ |
||||
|
||||
#include "upb/def.h" |
||||
#include "envoy/extensions/clusters/aggregate/v3/cluster.upbdefs.h" |
||||
|
||||
extern upb_def_init udpa_annotations_status_proto_upbdefinit; |
||||
extern upb_def_init udpa_annotations_versioning_proto_upbdefinit; |
||||
extern upb_def_init validate_validate_proto_upbdefinit; |
||||
extern const upb_msglayout envoy_extensions_clusters_aggregate_v3_ClusterConfig_msginit; |
||||
|
||||
static const upb_msglayout *layouts[1] = { |
||||
&envoy_extensions_clusters_aggregate_v3_ClusterConfig_msginit, |
||||
}; |
||||
|
||||
static const char descriptor[389] = {'\n', '4', 'e', 'n', 'v', 'o', 'y', '/', 'e', 'x', 't', 'e', 'n', 's', 'i', 'o', 'n', 's', '/', 'c', 'l', 'u', 's', 't', 'e',
|
||||
'r', 's', '/', 'a', 'g', 'g', 'r', 'e', 'g', 'a', 't', 'e', '/', 'v', '3', '/', 'c', 'l', 'u', 's', 't', 'e', 'r', '.', 'p',
|
||||
'r', 'o', 't', 'o', '\022', '&', 'e', 'n', 'v', 'o', 'y', '.', 'e', 'x', 't', 'e', 'n', 's', 'i', 'o', 'n', 's', '.', 'c', 'l',
|
||||
'u', 's', 't', 'e', 'r', 's', '.', 'a', 'g', 'g', 'r', 'e', 'g', 'a', 't', 'e', '.', 'v', '3', '\032', '\035', 'u', 'd', 'p', 'a',
|
||||
'/', 'a', 'n', 'n', 'o', 't', 'a', 't', 'i', 'o', 'n', 's', '/', 's', 't', 'a', 't', 'u', 's', '.', 'p', 'r', 'o', 't', 'o',
|
||||
'\032', '!', 'u', 'd', 'p', 'a', '/', 'a', 'n', 'n', 'o', 't', 'a', 't', 'i', 'o', 'n', 's', '/', 'v', 'e', 'r', 's', 'i', 'o',
|
||||
'n', 'i', 'n', 'g', '.', 'p', 'r', 'o', 't', 'o', '\032', '\027', 'v', 'a', 'l', 'i', 'd', 'a', 't', 'e', '/', 'v', 'a', 'l', 'i',
|
||||
'd', 'a', 't', 'e', '.', 'p', 'r', 'o', 't', 'o', '\"', 'r', '\n', '\r', 'C', 'l', 'u', 's', 't', 'e', 'r', 'C', 'o', 'n', 'f',
|
||||
'i', 'g', '\022', '$', '\n', '\010', 'c', 'l', 'u', 's', 't', 'e', 'r', 's', '\030', '\001', ' ', '\003', '(', '\t', 'B', '\010', '\372', 'B', '\005',
|
||||
'\222', '\001', '\002', '\010', '\001', 'R', '\010', 'c', 'l', 'u', 's', 't', 'e', 'r', 's', ':', ';', '\232', '\305', '\210', '\036', '6', '\n', '4', 'e',
|
||||
'n', 'v', 'o', 'y', '.', 'c', 'o', 'n', 'f', 'i', 'g', '.', 'c', 'l', 'u', 's', 't', 'e', 'r', '.', 'a', 'g', 'g', 'r', 'e',
|
||||
'g', 'a', 't', 'e', '.', 'v', '2', 'a', 'l', 'p', 'h', 'a', '.', 'C', 'l', 'u', 's', 't', 'e', 'r', 'C', 'o', 'n', 'f', 'i',
|
||||
'g', 'B', 'N', '\n', '4', 'i', 'o', '.', 'e', 'n', 'v', 'o', 'y', 'p', 'r', 'o', 'x', 'y', '.', 'e', 'n', 'v', 'o', 'y', '.',
|
||||
'e', 'x', 't', 'e', 'n', 's', 'i', 'o', 'n', 's', '.', 'c', 'l', 'u', 's', 't', 'e', 'r', 's', '.', 'a', 'g', 'g', 'r', 'e',
|
||||
'g', 'a', 't', 'e', '.', 'v', '3', 'B', '\014', 'C', 'l', 'u', 's', 't', 'e', 'r', 'P', 'r', 'o', 't', 'o', 'P', '\001', '\272', '\200',
|
||||
'\310', '\321', '\006', '\002', '\020', '\002', 'b', '\006', 'p', 'r', 'o', 't', 'o', '3',
|
||||
}; |
||||
|
||||
static upb_def_init *deps[4] = { |
||||
&udpa_annotations_status_proto_upbdefinit, |
||||
&udpa_annotations_versioning_proto_upbdefinit, |
||||
&validate_validate_proto_upbdefinit, |
||||
NULL |
||||
}; |
||||
|
||||
upb_def_init envoy_extensions_clusters_aggregate_v3_cluster_proto_upbdefinit = { |
||||
deps, |
||||
layouts, |
||||
"envoy/extensions/clusters/aggregate/v3/cluster.proto", |
||||
UPB_STRVIEW_INIT(descriptor, 389) |
||||
}; |
@ -0,0 +1,35 @@ |
||||
/* This file was generated by upbc (the upb compiler) from the input
|
||||
* file: |
||||
* |
||||
* envoy/extensions/clusters/aggregate/v3/cluster.proto |
||||
* |
||||
* Do not edit -- your changes will be discarded when the file is |
||||
* regenerated. */ |
||||
|
||||
#ifndef ENVOY_EXTENSIONS_CLUSTERS_AGGREGATE_V3_CLUSTER_PROTO_UPBDEFS_H_ |
||||
#define ENVOY_EXTENSIONS_CLUSTERS_AGGREGATE_V3_CLUSTER_PROTO_UPBDEFS_H_ |
||||
|
||||
#include "upb/def.h" |
||||
#include "upb/port_def.inc" |
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
#include "upb/def.h" |
||||
|
||||
#include "upb/port_def.inc" |
||||
|
||||
extern upb_def_init envoy_extensions_clusters_aggregate_v3_cluster_proto_upbdefinit; |
||||
|
||||
UPB_INLINE const upb_msgdef *envoy_extensions_clusters_aggregate_v3_ClusterConfig_getmsgdef(upb_symtab *s) { |
||||
_upb_symtab_loaddefinit(s, &envoy_extensions_clusters_aggregate_v3_cluster_proto_upbdefinit); |
||||
return upb_symtab_lookupmsg(s, "envoy.extensions.clusters.aggregate.v3.ClusterConfig"); |
||||
} |
||||
|
||||
#ifdef __cplusplus |
||||
} /* extern "C" */ |
||||
#endif |
||||
|
||||
#include "upb/port_undef.inc" |
||||
|
||||
#endif /* ENVOY_EXTENSIONS_CLUSTERS_AGGREGATE_V3_CLUSTER_PROTO_UPBDEFS_H_ */ |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue