Merge remote-tracking branch 'upstream/master' into feature/reinstate-rbe-windows

pull/18397/head
Bill Feng 6 years ago
commit 6050990f89
  1. 73
      BUILD
  2. 4
      bazel/grpc_deps.bzl
  3. 12
      doc/naming.md
  4. 2
      examples/cpp/helloworld/README.md
  5. 2
      examples/csharp/HelloworldLegacyCsproj/README.md
  6. 47
      include/grpcpp/impl/codegen/client_callback.h
  7. 1
      include/grpcpp/impl/codegen/interceptor_common.h
  8. 43
      include/grpcpp/impl/codegen/server_callback.h
  9. 3
      include/grpcpp/impl/codegen/server_context.h
  10. 26
      include/grpcpp/opencensus.h
  11. 51
      include/grpcpp/opencensus_impl.h
  12. 19
      src/core/ext/filters/client_channel/client_channel.cc
  13. 60
      src/core/ext/filters/client_channel/lb_policy.cc
  14. 240
      src/core/ext/filters/client_channel/lb_policy.h
  15. 278
      src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc
  16. 2
      src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc
  17. 6
      src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc
  18. 5
      src/core/ext/filters/client_channel/lb_policy/xds/xds.cc
  19. 47
      src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc
  20. 110
      src/core/ext/upb-generated/envoy/api/v2/core/address.upb.c
  21. 325
      src/core/ext/upb-generated/envoy/api/v2/core/address.upb.h
  22. 179
      src/core/ext/upb-generated/envoy/api/v2/core/base.upb.c
  23. 507
      src/core/ext/upb-generated/envoy/api/v2/core/base.upb.h
  24. 144
      src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.c
  25. 559
      src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.h
  26. 123
      src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c
  27. 359
      src/core/ext/upb-generated/envoy/api/v2/discovery.upb.h
  28. 39
      src/core/ext/upb-generated/envoy/type/percent.upb.c
  29. 88
      src/core/ext/upb-generated/envoy/type/percent.upb.h
  30. 39
      src/core/ext/upb-generated/envoy/type/range.upb.c
  31. 86
      src/core/ext/upb-generated/envoy/type/range.upb.h
  32. 17
      src/core/ext/upb-generated/gogoproto/gogo.upb.c
  33. 32
      src/core/ext/upb-generated/gogoproto/gogo.upb.h
  34. 18
      src/core/ext/upb-generated/google/api/annotations.upb.c
  35. 32
      src/core/ext/upb-generated/google/api/annotations.upb.h
  36. 66
      src/core/ext/upb-generated/google/api/http.upb.c
  37. 191
      src/core/ext/upb-generated/google/api/http.upb.h
  38. 33
      src/core/ext/upb-generated/google/rpc/status.upb.c
  39. 75
      src/core/ext/upb-generated/google/rpc/status.upb.h
  40. 443
      src/core/ext/upb-generated/validate/validate.upb.c
  41. 2038
      src/core/ext/upb-generated/validate/validate.upb.h
  42. 2
      src/core/lib/gprpp/atomic.h
  43. 1
      src/core/lib/http/httpcli_security_connector.cc
  44. 6
      src/core/lib/iomgr/internal_errqueue.cc
  45. 5
      src/core/lib/security/security_connector/ssl/ssl_security_connector.cc
  46. 24
      src/core/lib/security/security_connector/tls/spiffe_security_connector.cc
  47. 11
      src/core/lib/surface/call.cc
  48. 2
      src/core/tsi/ssl_transport_security.cc
  49. 65
      src/cpp/ext/filters/census/grpc_plugin.cc
  50. 6
      src/cpp/ext/filters/census/grpc_plugin.h
  51. 32
      src/cpp/ext/filters/census/views.cc
  52. 33
      src/cpp/server/server_context.cc
  53. 10
      src/csharp/Grpc.Tools/build/_protobuf/Google.Protobuf.Tools.targets
  54. 2
      src/csharp/experimental/README.md
  55. 9
      src/csharp/experimental/build_native_ext_for_ios.sh
  56. 14
      src/php/tests/unit_tests/InterceptorTest.php
  57. 6
      src/python/grpcio/grpc/__init__.py
  58. 16
      src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi
  59. 2
      src/python/grpcio/grpc/_cython/_cygrpc/time.pxd.pxi
  60. 13
      src/python/grpcio/grpc/_cython/_cygrpc/time.pyx.pxi
  61. 4
      src/python/grpcio_tests/commands.py
  62. 8
      src/python/grpcio_tests/tests/unit/_cython/_channel_test.py
  63. 2
      src/ruby/qps/proxy-worker.rb
  64. 3
      templates/tools/dockerfile/interoptest/grpc_interop_aspnetcore/Dockerfile.template
  65. 8
      templates/tools/dockerfile/interoptest/grpc_interop_aspnetcore/build_interop.sh.template
  66. 6
      test/core/end2end/fixtures/h2_spiffe.cc
  67. 8
      test/core/iomgr/ios/CFStreamTests/CFStreamEndpointTests.mm
  68. 13
      test/core/iomgr/ios/CFStreamTests/CFStreamTests.xcodeproj/project.pbxproj
  69. 1
      test/core/iomgr/ios/CFStreamTests/run_tests.sh
  70. 4
      test/core/util/test_lb_policies.cc
  71. 4
      test/cpp/end2end/BUILD
  72. 76
      test/cpp/end2end/client_callback_end2end_test.cc
  73. 78
      test/cpp/end2end/end2end_test.cc
  74. 760
      test/cpp/end2end/grpclb_end2end_test.cc
  75. 80
      test/cpp/end2end/test_service_impl.cc
  76. 14
      test/cpp/end2end/test_service_impl.h
  77. 396
      test/cpp/end2end/xds_end2end_test.cc
  78. 2
      test/cpp/ext/filters/census/stats_plugin_end2end_test.cc
  79. 88
      test/cpp/interop/client.cc
  80. 15
      test/cpp/interop/client_helper.cc
  81. 42
      test/cpp/interop/client_helper.h
  82. 6
      test/cpp/microbenchmarks/bm_opencensus_plugin.cc
  83. 122
      test/cpp/util/create_test_channel.cc
  84. 32
      test/cpp/util/create_test_channel.h
  85. 15
      tools/codegen/core/gen_upb_api.sh
  86. 17
      tools/distrib/check_copyright.py
  87. 17
      tools/distrib/check_include_guards.py
  88. 3
      tools/dockerfile/interoptest/grpc_interop_aspnetcore/Dockerfile
  89. 8
      tools/dockerfile/interoptest/grpc_interop_aspnetcore/build_interop.sh
  90. 2
      tools/run_tests/performance/build_performance_php7.sh

73
BUILD

@ -2283,7 +2283,6 @@ grpc_cc_library(
],
hdrs = [
"include/grpcpp/opencensus.h",
"include/grpcpp/opencensus_impl.h",
"src/cpp/ext/filters/census/channel_filter.h",
"src/cpp/ext/filters/census/client_filter.h",
"src/cpp/ext/filters/census/context.h",
@ -2314,22 +2313,92 @@ grpc_cc_library(
#TODO: Get this into build.yaml once we start using it.
grpc_cc_library(
name = "google_protobuf_upb",
name = "envoy_ads_upb",
srcs = [
"src/core/ext/upb-generated/envoy/api/v2/core/address.upb.c",
"src/core/ext/upb-generated/envoy/api/v2/core/base.upb.c",
"src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.c",
"src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c",
],
hdrs = [
"src/core/ext/upb-generated/envoy/api/v2/core/address.upb.h",
"src/core/ext/upb-generated/envoy/api/v2/core/base.upb.h",
"src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.h",
"src/core/ext/upb-generated/envoy/api/v2/discovery.upb.h",
],
language = "c++",
external_deps = [
"upb_lib",
],
deps = [
":google_api_upb",
":proto_gen_validate_upb",
":envoy_type_upb",
]
)
grpc_cc_library(
name = "envoy_type_upb",
srcs = [
"src/core/ext/upb-generated/envoy/type/percent.upb.c",
"src/core/ext/upb-generated/envoy/type/range.upb.c",
],
hdrs = [
"src/core/ext/upb-generated/envoy/type/percent.upb.h",
"src/core/ext/upb-generated/envoy/type/range.upb.h",
],
language = "c++",
external_deps = [
"upb_lib",
],
deps = [
":google_api_upb",
":proto_gen_validate_upb"
]
)
grpc_cc_library(
name = "proto_gen_validate_upb",
srcs = [
"src/core/ext/upb-generated/gogoproto/gogo.upb.c",
"src/core/ext/upb-generated/validate/validate.upb.c",
],
hdrs = [
"src/core/ext/upb-generated/gogoproto/gogo.upb.h",
"src/core/ext/upb-generated/validate/validate.upb.h",
],
language = "c++",
external_deps = [
"upb_lib",
],
deps = [
":google_api_upb",
]
)
grpc_cc_library(
name = "google_api_upb",
srcs = [
"src/core/ext/upb-generated/google/api/annotations.upb.c",
"src/core/ext/upb-generated/google/api/http.upb.c",
"src/core/ext/upb-generated/google/protobuf/any.upb.c",
"src/core/ext/upb-generated/google/protobuf/descriptor.upb.c",
"src/core/ext/upb-generated/google/protobuf/duration.upb.c",
"src/core/ext/upb-generated/google/protobuf/struct.upb.c",
"src/core/ext/upb-generated/google/protobuf/timestamp.upb.c",
"src/core/ext/upb-generated/google/protobuf/wrappers.upb.c",
"src/core/ext/upb-generated/google/rpc/status.upb.c",
],
hdrs = [
"src/core/ext/upb-generated/google/api/annotations.upb.h",
"src/core/ext/upb-generated/google/api/http.upb.h",
"src/core/ext/upb-generated/google/protobuf/any.upb.h",
"src/core/ext/upb-generated/google/protobuf/descriptor.upb.h",
"src/core/ext/upb-generated/google/protobuf/duration.upb.h",
"src/core/ext/upb-generated/google/protobuf/struct.upb.h",
"src/core/ext/upb-generated/google/protobuf/timestamp.upb.h",
"src/core/ext/upb-generated/google/protobuf/wrappers.upb.h",
"src/core/ext/upb-generated/google/rpc/status.upb.h",
],
language = "c++",
external_deps = [

@ -195,8 +195,8 @@ def grpc_deps():
if "io_opencensus_cpp" not in native.existing_rules():
http_archive(
name = "io_opencensus_cpp",
strip_prefix = "opencensus-cpp-03dff0352522983ffdee48cedbf87cbe37f1bb7f",
url = "https://github.com/census-instrumentation/opencensus-cpp/archive/03dff0352522983ffdee48cedbf87cbe37f1bb7f.tar.gz",
strip_prefix = "opencensus-cpp-9b1e354e89bf3d92aedc00af45b418ce870f3d77",
url = "https://github.com/census-instrumentation/opencensus-cpp/archive/9b1e354e89bf3d92aedc00af45b418ce870f3d77.tar.gz",
)
if "upb" not in native.existing_rules():

@ -67,14 +67,10 @@ Resolvers should be able to contact the authority and get a resolution
that they return back to the gRPC client library. The returned contents
include:
- A list of resolved addresses, each of which has three attributes:
- The address itself, including both IP address and port.
- A boolean indicating whether the address is a backend address (i.e.,
the address to use to contact the server directly) or a balancer
address (for cases where [external load balancing](load-balancing.md)
is in use).
- The name of the balancer, if the address is a balancer address.
This will be used to perform peer authorization.
- A list of resolved addresses (both IP address and port). Each address
may have a set of arbitrary attributes (key/value pairs) associated with
it, which can be used to communicate information from the resolver to the
[load balancing](load-balancing.md) policy.
- A [service config](service_config.md).
The plugin API allows the resolvers to continuously watch an endpoint

@ -98,7 +98,7 @@ $ protoc -I ../../protos/ --cpp_out=. ../../protos/helloworld.proto
```
- Create a stub. A stub implements the rpc methods of a service and in the
generated code, a method is provided to created a stub with a channel:
generated code, a method is provided to create a stub with a channel:
```cpp
auto stub = helloworld::Greeter::NewStub(channel);

@ -6,7 +6,7 @@ BACKGROUND
This is a different version of the helloworld example, using the "classic" .csproj
files, the only format supported by VS2013 (and older versions of mono).
You can still use gRPC with the classic .csproj files, but [using the new-style
.csproj projects](../helloworld/README.md) (supported by VS2015 Update3 and above,
.csproj projects](../Helloworld/README.md) (supported by VS2017 v15.3 and above,
and dotnet SDK) is recommended.
Example projects depend on the [Grpc](https://www.nuget.org/packages/Grpc/),

@ -112,6 +112,8 @@ class ClientCallbackReaderWriter {
virtual void Write(const Request* req, WriteOptions options) = 0;
virtual void WritesDone() = 0;
virtual void Read(Response* resp) = 0;
virtual void AddHold(int holds) = 0;
virtual void RemoveHold() = 0;
protected:
void BindReactor(ClientBidiReactor<Request, Response>* reactor) {
@ -125,6 +127,8 @@ class ClientCallbackReader {
virtual ~ClientCallbackReader() {}
virtual void StartCall() = 0;
virtual void Read(Response* resp) = 0;
virtual void AddHold(int holds) = 0;
virtual void RemoveHold() = 0;
protected:
void BindReactor(ClientReadReactor<Response>* reactor) {
@ -144,6 +148,9 @@ class ClientCallbackWriter {
}
virtual void WritesDone() = 0;
virtual void AddHold(int holds) = 0;
virtual void RemoveHold() = 0;
protected:
void BindReactor(ClientWriteReactor<Request>* reactor) {
reactor->BindWriter(this);
@ -174,6 +181,29 @@ class ClientBidiReactor {
}
void StartWritesDone() { stream_->WritesDone(); }
/// Holds are needed if (and only if) this stream has operations that take
/// place on it after StartCall but from outside one of the reactions
/// (OnReadDone, etc). This is _not_ a common use of the streaming API.
///
/// Holds must be added before calling StartCall. If a stream still has a hold
/// in place, its resources will not be destroyed even if the status has
/// already come in from the wire and there are currently no active callbacks
/// outstanding. Similarly, the stream will not call OnDone if there are still
/// holds on it.
///
/// For example, if a StartRead or StartWrite operation is going to be
/// initiated from elsewhere in the application, the application should call
/// AddHold or AddMultipleHolds before StartCall. If there is going to be,
/// for example, a read-flow and a write-flow taking place outside the
/// reactions, then call AddMultipleHolds(2) before StartCall. When the
/// application knows that it won't issue any more Read operations (such as
/// when a read comes back as not ok), it should issue a RemoveHold(). It
/// should also call RemoveHold() again after it does StartWriteLast or
/// StartWritesDone that indicates that there will be no more Write ops.
void AddHold() { AddMultipleHolds(1); }
void AddMultipleHolds(int holds) { stream_->AddHold(holds); }
void RemoveHold() { stream_->RemoveHold(); }
private:
friend class ClientCallbackReaderWriter<Request, Response>;
void BindStream(ClientCallbackReaderWriter<Request, Response>* stream) {
@ -193,6 +223,10 @@ class ClientReadReactor {
void StartCall() { reader_->StartCall(); }
void StartRead(Response* resp) { reader_->Read(resp); }
void AddHold() { AddMultipleHolds(1); }
void AddMultipleHolds(int holds) { reader_->AddHold(holds); }
void RemoveHold() { reader_->RemoveHold(); }
private:
friend class ClientCallbackReader<Response>;
void BindReader(ClientCallbackReader<Response>* reader) { reader_ = reader; }
@ -218,6 +252,10 @@ class ClientWriteReactor {
}
void StartWritesDone() { writer_->WritesDone(); }
void AddHold() { AddMultipleHolds(1); }
void AddMultipleHolds(int holds) { writer_->AddHold(holds); }
void RemoveHold() { writer_->RemoveHold(); }
private:
friend class ClientCallbackWriter<Request>;
void BindWriter(ClientCallbackWriter<Request>* writer) { writer_ = writer; }
@ -374,6 +412,9 @@ class ClientCallbackReaderWriterImpl
}
}
virtual void AddHold(int holds) override { callbacks_outstanding_ += holds; }
virtual void RemoveHold() override { MaybeFinish(); }
private:
friend class ClientCallbackReaderWriterFactory<Request, Response>;
@ -509,6 +550,9 @@ class ClientCallbackReaderImpl
}
}
virtual void AddHold(int holds) override { callbacks_outstanding_ += holds; }
virtual void RemoveHold() override { MaybeFinish(); }
private:
friend class ClientCallbackReaderFactory<Response>;
@ -677,6 +721,9 @@ class ClientCallbackWriterImpl
}
}
virtual void AddHold(int holds) override { callbacks_outstanding_ += holds; }
virtual void RemoveHold() override { MaybeFinish(); }
private:
friend class ClientCallbackWriterFactory<Request>;

@ -403,7 +403,6 @@ class InterceptorBatchMethodsImpl
grpc_status_code* code_ = nullptr;
grpc::string* error_details_ = nullptr;
grpc::string* error_message_ = nullptr;
Status send_status_;
std::multimap<grpc::string, grpc::string>* send_trailing_metadata_ = nullptr;

@ -69,6 +69,40 @@ class ServerCallbackRpcController {
// Allow the method handler to push out the initial metadata before
// the response and status are ready
virtual void SendInitialMetadata(std::function<void(bool)>) = 0;
/// SetCancelCallback passes in a callback to be called when the RPC is
/// canceled for whatever reason (streaming calls have OnCancel instead). This
/// is an advanced and uncommon use with several important restrictions. This
/// function may not be called more than once on the same RPC.
///
/// If code calls SetCancelCallback on an RPC, it must also call
/// ClearCancelCallback before calling Finish on the RPC controller. That
/// method makes sure that no cancellation callback is executed for this RPC
/// beyond the point of its return. ClearCancelCallback may be called even if
/// SetCancelCallback was not called for this RPC, and it may be called
/// multiple times. It _must_ be called if SetCancelCallback was called for
/// this RPC.
///
/// The callback should generally be lightweight and nonblocking and primarily
/// concerned with clearing application state related to the RPC or causing
/// operations (such as cancellations) to happen on dependent RPCs.
///
/// If the RPC is already canceled at the time that SetCancelCallback is
/// called, the callback is invoked immediately.
///
/// The cancellation callback may be executed concurrently with the method
/// handler that invokes it but will certainly not issue or execute after the
/// return of ClearCancelCallback. If ClearCancelCallback is invoked while the
/// callback is already executing, the callback will complete its execution
/// before ClearCancelCallback takes effect.
///
/// To preserve the orderings described above, the callback may be called
/// under a lock that is also used for ClearCancelCallback and
/// ServerContext::IsCancelled, so the callback CANNOT call either of those
/// operations on this RPC or any other function that causes those operations
/// to be called before the callback completes.
virtual void SetCancelCallback(std::function<void()> callback) = 0;
virtual void ClearCancelCallback() = 0;
};
// NOTE: The actual streaming object classes are provided
@ -349,6 +383,15 @@ class CallbackUnaryHandler : public MethodHandler {
call_.PerformOps(&meta_ops_);
}
// Neither SetCancelCallback nor ClearCancelCallback should affect the
// callbacks_outstanding_ count since they are paired and both must precede
// the invocation of Finish (if they are used at all)
void SetCancelCallback(std::function<void()> callback) override {
ctx_->SetCancelCallback(std::move(callback));
}
void ClearCancelCallback() override { ctx_->ClearCancelCallback(); }
private:
friend class CallbackUnaryHandler<RequestType, ResponseType>;

@ -329,6 +329,9 @@ class ServerContext {
uint32_t initial_metadata_flags() const { return 0; }
void SetCancelCallback(std::function<void()> callback);
void ClearCancelCallback();
experimental::ServerRpcInfo* set_server_rpc_info(
const char* method, internal::RpcMethod::RpcType type,
const std::vector<

@ -19,6 +19,30 @@
#ifndef GRPCPP_OPENCENSUS_H
#define GRPCPP_OPENCENSUS_H
#include "grpcpp/opencensus_impl.h"
#include "opencensus/trace/span.h"
namespace grpc {
// These symbols in this file will not be included in the binary unless
// grpc_opencensus_plugin build target was added as a dependency. At the moment
// it is only setup to be built with Bazel.
// Registers the OpenCensus plugin with gRPC, so that it will be used for future
// RPCs. This must be called before any views are created.
void RegisterOpenCensusPlugin();
// RPC stats definitions, defined by
// https://github.com/census-instrumentation/opencensus-specs/blob/master/stats/gRPC.md
// Registers the cumulative gRPC views so that they will be exported by any
// registered stats exporter. For on-task stats, construct a View using the
// ViewDescriptors below.
void RegisterOpenCensusViewsForExport();
class ServerContext;
// Returns the tracing Span for the current RPC.
::opencensus::trace::Span GetSpanFromServerContext(ServerContext* context);
} // namespace grpc
#endif // GRPCPP_OPENCENSUS_H

@ -1,51 +0,0 @@
/*
*
* Copyright 2019 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.
*
*/
#ifndef GRPCPP_OPENCENSUS_IMPL_H
#define GRPCPP_OPENCENSUS_IMPL_H
#include "opencensus/trace/span.h"
namespace grpc {
class ServerContext;
}
namespace grpc_impl {
// These symbols in this file will not be included in the binary unless
// grpc_opencensus_plugin build target was added as a dependency. At the moment
// it is only setup to be built with Bazel.
// Registers the OpenCensus plugin with gRPC, so that it will be used for future
// RPCs. This must be called before any views are created.
void RegisterOpenCensusPlugin();
// RPC stats definitions, defined by
// https://github.com/census-instrumentation/opencensus-specs/blob/master/stats/gRPC.md
// Registers the cumulative gRPC views so that they will be exported by any
// registered stats exporter. For on-task stats, construct a View using the
// ViewDescriptors below.
void RegisterOpenCensusViewsForExport();
// Returns the tracing Span for the current RPC.
::opencensus::trace::Span GetSpanFromServerContext(
grpc::ServerContext* context);
} // namespace grpc_impl
#endif // GRPCPP_OPENCENSUS_IMPL_H

@ -94,7 +94,7 @@ grpc_core::TraceFlag grpc_client_channel_routing_trace(
struct external_connectivity_watcher;
struct QueuedPick {
LoadBalancingPolicy::PickState pick;
LoadBalancingPolicy::PickArgs pick;
grpc_call_element* elem;
QueuedPick* next = nullptr;
};
@ -298,7 +298,7 @@ static grpc_error* do_ping_locked(channel_data* chand, grpc_transport_op* op) {
GRPC_ERROR_UNREF(error);
return new_error;
}
LoadBalancingPolicy::PickState pick;
LoadBalancingPolicy::PickArgs pick;
chand->picker->Pick(&pick, &error);
if (pick.connected_subchannel != nullptr) {
pick.connected_subchannel->Ping(op->send_ping.on_initiate,
@ -931,7 +931,7 @@ static void free_cached_send_op_data_for_completed_batch(
//
void maybe_inject_recv_trailing_metadata_ready_for_lb(
const LoadBalancingPolicy::PickState& pick,
const LoadBalancingPolicy::PickArgs& pick,
grpc_transport_stream_op_batch* batch) {
if (pick.recv_trailing_metadata_ready != nullptr) {
*pick.original_recv_trailing_metadata_ready =
@ -2635,14 +2635,13 @@ static void maybe_apply_service_config_to_call_locked(grpc_call_element* elem) {
}
}
static const char* pick_result_name(
LoadBalancingPolicy::SubchannelPicker::PickResult result) {
static const char* pick_result_name(LoadBalancingPolicy::PickResult result) {
switch (result) {
case LoadBalancingPolicy::SubchannelPicker::PICK_COMPLETE:
case LoadBalancingPolicy::PICK_COMPLETE:
return "COMPLETE";
case LoadBalancingPolicy::SubchannelPicker::PICK_QUEUE:
case LoadBalancingPolicy::PICK_QUEUE:
return "QUEUE";
case LoadBalancingPolicy::SubchannelPicker::PICK_TRANSIENT_FAILURE:
case LoadBalancingPolicy::PICK_TRANSIENT_FAILURE:
return "TRANSIENT_FAILURE";
}
GPR_UNREACHABLE_CODE(return "UNKNOWN");
@ -2692,7 +2691,7 @@ static void start_pick_locked(void* arg, grpc_error* error) {
grpc_error_string(error));
}
switch (pick_result) {
case LoadBalancingPolicy::SubchannelPicker::PICK_TRANSIENT_FAILURE:
case LoadBalancingPolicy::PICK_TRANSIENT_FAILURE:
// If we're shutting down, fail all RPCs.
if (chand->disconnect_error != GRPC_ERROR_NONE) {
GRPC_ERROR_UNREF(error);
@ -2724,7 +2723,7 @@ static void start_pick_locked(void* arg, grpc_error* error) {
// picker.
GRPC_ERROR_UNREF(error);
// Fallthrough
case LoadBalancingPolicy::SubchannelPicker::PICK_QUEUE:
case LoadBalancingPolicy::PICK_QUEUE:
if (!calld->pick_queued) add_call_to_queued_picks_locked(elem);
break;
default: // PICK_COMPLETE

@ -28,6 +28,10 @@ grpc_core::DebugOnlyTraceFlag grpc_trace_lb_policy_refcount(
namespace grpc_core {
//
// LoadBalancingPolicy
//
LoadBalancingPolicy::LoadBalancingPolicy(Args args, intptr_t initial_refcount)
: InternallyRefCounted(&grpc_trace_lb_policy_refcount, initial_refcount),
combiner_(GRPC_COMBINER_REF(args.combiner, "lb_policy")),
@ -39,6 +43,26 @@ LoadBalancingPolicy::~LoadBalancingPolicy() {
GRPC_COMBINER_UNREF(combiner_, "lb_policy");
}
void LoadBalancingPolicy::Orphan() {
// Invoke ShutdownAndUnrefLocked() inside of the combiner.
// TODO(roth): Is this actually needed? We should already be in the
// combiner here. Note that if we directly call ShutdownLocked(),
// then we can probably remove the hack whereby the helper is
// destroyed at shutdown instead of at destruction.
GRPC_CLOSURE_SCHED(
GRPC_CLOSURE_CREATE(&LoadBalancingPolicy::ShutdownAndUnrefLocked, this,
grpc_combiner_scheduler(combiner_)),
GRPC_ERROR_NONE);
}
void LoadBalancingPolicy::ShutdownAndUnrefLocked(void* arg,
grpc_error* ignored) {
LoadBalancingPolicy* policy = static_cast<LoadBalancingPolicy*>(arg);
policy->ShutdownLocked();
policy->channel_control_helper_.reset();
policy->Unref();
}
grpc_json* LoadBalancingPolicy::ParseLoadBalancingConfig(
const grpc_json* lb_config_array) {
if (lb_config_array == nullptr || lb_config_array->type != GRPC_JSON_ARRAY) {
@ -65,4 +89,40 @@ grpc_json* LoadBalancingPolicy::ParseLoadBalancingConfig(
return nullptr;
}
//
// LoadBalancingPolicy::QueuePicker
//
LoadBalancingPolicy::PickResult LoadBalancingPolicy::QueuePicker::Pick(
PickArgs* pick, grpc_error** error) {
// We invoke the parent's ExitIdleLocked() via a closure instead
// of doing it directly here, for two reasons:
// 1. ExitIdleLocked() may cause the policy's state to change and
// a new picker to be delivered to the channel. If that new
// picker is delivered before ExitIdleLocked() returns, then by
// the time this function returns, the pick will already have
// been processed, and we'll be trying to re-process the same
// pick again, leading to a crash.
// 2. In a subsequent PR, we will split the data plane and control
// plane synchronization into separate combiners, at which
// point this will need to hop from the data plane combiner into
// the control plane combiner.
if (!exit_idle_called_) {
exit_idle_called_ = true;
parent_->Ref().release(); // ref held by closure.
GRPC_CLOSURE_SCHED(
GRPC_CLOSURE_CREATE(&CallExitIdle, parent_.get(),
grpc_combiner_scheduler(parent_->combiner())),
GRPC_ERROR_NONE);
}
return PICK_QUEUE;
}
void LoadBalancingPolicy::QueuePicker::CallExitIdle(void* arg,
grpc_error* error) {
LoadBalancingPolicy* parent = static_cast<LoadBalancingPolicy*>(arg);
parent->ExitIdleLocked();
parent->Unref();
}
} // namespace grpc_core

@ -37,6 +37,36 @@ namespace grpc_core {
/// Interface for load balancing policies.
///
/// The following concepts are used here:
///
/// Channel: An abstraction that manages connections to backend servers
/// on behalf of a client application. The application creates a channel
/// for a given server name and then sends RPCs on it, and the channel
/// figures out which backend server to send each RPC to. A channel
/// contains a resolver, a load balancing policy (or a tree of LB policies),
/// and a set of one or more subchannels.
///
/// Subchannel: A subchannel represents a connection to one backend server.
/// The LB policy decides which subchannels to create, manages the
/// connectivity state of those subchannels, and decides which subchannel
/// to send any given RPC to.
///
/// Resolver: A plugin that takes a gRPC server URI and resolves it to a
/// list of one or more addresses and a service config, as described
/// in https://github.com/grpc/grpc/blob/master/doc/naming.md. See
/// resolver.h for the resolver API.
///
/// Load Balancing (LB) Policy: A plugin that takes a list of addresses
/// from the resolver, maintains and manages a subchannel for each
/// backend address, and decides which subchannel to send each RPC on.
/// An LB policy has two parts:
/// - A LoadBalancingPolicy, which deals with the control plane work of
/// managing subchannels.
/// - A SubchannelPicker, which handles the data plane work of
/// determining which subchannel a given RPC should be sent on.
/// LoadBalacingPolicy API.
///
/// Note: All methods with a "Locked" suffix must be called from the
/// combiner passed to the constructor.
///
@ -46,36 +76,70 @@ namespace grpc_core {
// interested_parties() hooks from the API.
class LoadBalancingPolicy : public InternallyRefCounted<LoadBalancingPolicy> {
public:
/// State used for an LB pick.
struct PickState {
/// Arguments used when picking a subchannel for an RPC.
struct PickArgs {
///
/// Input parameters.
///
/// Initial metadata associated with the picking call.
/// This is both an input and output parameter; the LB policy may
/// use metadata here to influence its routing decision, and it may
/// add new metadata here to be sent with the call to the chosen backend.
/// The LB policy may use the existing metadata to influence its routing
/// decision, and it may add new metadata elements to be sent with the
/// call to the chosen backend.
// TODO(roth): Provide a more generic metadata API here.
grpc_metadata_batch* initial_metadata = nullptr;
/// Storage for LB token in \a initial_metadata, or nullptr if not used.
// TODO(roth): Remove this from the API. Maybe have the LB policy
// allocate this on the arena instead?
grpc_linked_mdelem lb_token_mdelem_storage;
///
/// Output parameters.
///
/// Will be set to the selected subchannel, or nullptr on failure or when
/// the LB policy decides to drop the call.
RefCountedPtr<ConnectedSubchannel> connected_subchannel;
/// Callback set by lb policy to be notified of trailing metadata.
/// The callback must be scheduled on grpc_schedule_on_exec_ctx.
// TODO(roth): Provide a cleaner callback API.
grpc_closure* recv_trailing_metadata_ready = nullptr;
/// The address that will be set to point to the original
/// recv_trailing_metadata_ready callback, to be invoked by the LB
/// policy's recv_trailing_metadata_ready callback when complete.
/// Must be non-null if recv_trailing_metadata_ready is non-null.
// TODO(roth): Consider making the recv_trailing_metadata closure a
// synchronous callback, in which case it is not responsible for
// chaining to the next callback, so this can be removed from the API.
grpc_closure** original_recv_trailing_metadata_ready = nullptr;
/// If this is not nullptr, then the client channel will point it to the
/// call's trailing metadata before invoking recv_trailing_metadata_ready.
/// If this is nullptr, then the callback will still be called.
/// The lb does not have ownership of the metadata.
// TODO(roth): If we make this a synchronous callback, then this can
// be passed to the callback as a parameter and can be removed from
// the API here.
grpc_metadata_batch** recv_trailing_metadata = nullptr;
/// Will be set to the selected subchannel, or nullptr on failure or when
/// the LB policy decides to drop the call.
RefCountedPtr<ConnectedSubchannel> connected_subchannel;
};
/// A picker is the object used to actual perform picks.
/// The result of picking a subchannel for an RPC.
enum PickResult {
// Pick complete. If connected_subchannel is non-null, client channel
// can immediately proceed with the call on connected_subchannel;
// otherwise, call should be dropped.
PICK_COMPLETE,
// Pick cannot be completed until something changes on the control
// plane. Client channel will queue the pick and try again the
// next time the picker is updated.
PICK_QUEUE,
// LB policy is in transient failure. If the pick is wait_for_ready,
// client channel will wait for the next picker and try again;
// otherwise, the call will be failed immediately (although it may
// be retried if the client channel is configured to do so).
// The Pick() method will set its error parameter if this value is
// returned.
PICK_TRANSIENT_FAILURE,
};
/// A subchannel picker is the object used to pick the subchannel to
/// use for a given RPC.
///
/// Pickers are intended to encapsulate all of the state and logic
/// needed on the data plane (i.e., to actually process picks for
@ -92,90 +156,14 @@ class LoadBalancingPolicy : public InternallyRefCounted<LoadBalancingPolicy> {
// synchronization mechanisms, to avoid lock contention between the two.
class SubchannelPicker {
public:
enum PickResult {
// Pick complete. If connected_subchannel is non-null, client channel
// can immediately proceed with the call on connected_subchannel;
// otherwise, call should be dropped.
PICK_COMPLETE,
// Pick cannot be completed until something changes on the control
// plane. Client channel will queue the pick and try again the
// next time the picker is updated.
PICK_QUEUE,
// LB policy is in transient failure. If the pick is wait_for_ready,
// client channel will wait for the next picker and try again;
// otherwise, the call will be failed immediately (although it may
// be retried if the client channel is configured to do so).
// The Pick() method will set its error parameter if this value is
// returned.
PICK_TRANSIENT_FAILURE,
};
SubchannelPicker() = default;
virtual ~SubchannelPicker() = default;
virtual PickResult Pick(PickState* pick, grpc_error** error) GRPC_ABSTRACT;
virtual PickResult Pick(PickArgs* pick, grpc_error** error) GRPC_ABSTRACT;
GRPC_ABSTRACT_BASE_CLASS
};
// A picker that returns PICK_QUEUE for all picks.
// Also calls the parent LB policy's ExitIdleLocked() method when the
// first pick is seen.
class QueuePicker : public SubchannelPicker {
public:
explicit QueuePicker(RefCountedPtr<LoadBalancingPolicy> parent)
: parent_(std::move(parent)) {}
PickResult Pick(PickState* pick, grpc_error** error) override {
// We invoke the parent's ExitIdleLocked() via a closure instead
// of doing it directly here, for two reasons:
// 1. ExitIdleLocked() may cause the policy's state to change and
// a new picker to be delivered to the channel. If that new
// picker is delivered before ExitIdleLocked() returns, then by
// the time this function returns, the pick will already have
// been processed, and we'll be trying to re-process the same
// pick again, leading to a crash.
// 2. In a subsequent PR, we will split the data plane and control
// plane synchronization into separate combiners, at which
// point this will need to hop from the data plane combiner into
// the control plane combiner.
if (!exit_idle_called_) {
exit_idle_called_ = true;
parent_->Ref().release(); // ref held by closure.
GRPC_CLOSURE_SCHED(
GRPC_CLOSURE_CREATE(&CallExitIdle, parent_.get(),
grpc_combiner_scheduler(parent_->combiner())),
GRPC_ERROR_NONE);
}
return PICK_QUEUE;
}
private:
static void CallExitIdle(void* arg, grpc_error* error) {
LoadBalancingPolicy* parent = static_cast<LoadBalancingPolicy*>(arg);
parent->ExitIdleLocked();
parent->Unref();
}
RefCountedPtr<LoadBalancingPolicy> parent_;
bool exit_idle_called_ = false;
};
// A picker that returns PICK_TRANSIENT_FAILURE for all picks.
class TransientFailurePicker : public SubchannelPicker {
public:
explicit TransientFailurePicker(grpc_error* error) : error_(error) {}
~TransientFailurePicker() { GRPC_ERROR_UNREF(error_); }
PickResult Pick(PickState* pick, grpc_error** error) override {
*error = GRPC_ERROR_REF(error_);
return PICK_TRANSIENT_FAILURE;
}
private:
grpc_error* error_;
};
/// A proxy object used by the LB policy to communicate with the client
/// channel.
class ChannelControlHelper {
@ -188,6 +176,8 @@ class LoadBalancingPolicy : public InternallyRefCounted<LoadBalancingPolicy> {
GRPC_ABSTRACT;
/// Creates a channel with the specified target and channel args.
/// This can be used in cases where the LB policy needs to create a
/// channel for its own use (e.g., to talk to an external load balancer).
virtual grpc_channel* CreateChannel(
const char* target, const grpc_channel_args& args) GRPC_ABSTRACT;
@ -203,7 +193,8 @@ class LoadBalancingPolicy : public InternallyRefCounted<LoadBalancingPolicy> {
GRPC_ABSTRACT_BASE_CLASS
};
// Configuration for an LB policy instance.
/// Configuration for an LB policy instance.
// TODO(roth): Find a better JSON representation for this API.
class Config : public RefCounted<Config> {
public:
Config(const grpc_json* lb_config,
@ -234,9 +225,13 @@ class LoadBalancingPolicy : public InternallyRefCounted<LoadBalancingPolicy> {
/// their constructor.
UniquePtr<ChannelControlHelper> channel_control_helper;
/// Channel args.
// TODO(roth): Find a better channel args representation for this API.
const grpc_channel_args* args = nullptr;
};
explicit LoadBalancingPolicy(Args args, intptr_t initial_refcount = 1);
virtual ~LoadBalancingPolicy();
// Not copyable nor movable.
LoadBalancingPolicy(const LoadBalancingPolicy&) = delete;
LoadBalancingPolicy& operator=(const LoadBalancingPolicy&) = delete;
@ -262,40 +257,62 @@ class LoadBalancingPolicy : public InternallyRefCounted<LoadBalancingPolicy> {
virtual void ResetBackoffLocked() GRPC_ABSTRACT;
/// Populates child_subchannels and child_channels with the uuids of this
/// LB policy's referenced children. This is not invoked from the
/// client_channel's combiner. The implementation is responsible for
/// providing its own synchronization.
/// LB policy's referenced children.
///
/// This is not invoked from the client_channel's combiner. The
/// implementation is responsible for providing its own synchronization.
virtual void FillChildRefsForChannelz(
channelz::ChildRefsList* child_subchannels,
channelz::ChildRefsList* child_channels) GRPC_ABSTRACT;
void Orphan() override {
// Invoke ShutdownAndUnrefLocked() inside of the combiner.
GRPC_CLOSURE_SCHED(
GRPC_CLOSURE_CREATE(&LoadBalancingPolicy::ShutdownAndUnrefLocked, this,
grpc_combiner_scheduler(combiner_)),
GRPC_ERROR_NONE);
void set_channelz_node(
RefCountedPtr<channelz::ClientChannelNode> channelz_node) {
channelz_node_ = std::move(channelz_node);
}
grpc_pollset_set* interested_parties() const { return interested_parties_; }
void Orphan() override;
/// Returns the JSON node of policy (with both policy name and config content)
/// given the JSON node of a LoadBalancingConfig array.
static grpc_json* ParseLoadBalancingConfig(const grpc_json* lb_config_array);
grpc_pollset_set* interested_parties() const { return interested_parties_; }
// A picker that returns PICK_QUEUE for all picks.
// Also calls the parent LB policy's ExitIdleLocked() method when the
// first pick is seen.
class QueuePicker : public SubchannelPicker {
public:
explicit QueuePicker(RefCountedPtr<LoadBalancingPolicy> parent)
: parent_(std::move(parent)) {}
void set_channelz_node(
RefCountedPtr<channelz::ClientChannelNode> channelz_node) {
channelz_node_ = std::move(channelz_node);
}
PickResult Pick(PickArgs* pick, grpc_error** error) override;
GRPC_ABSTRACT_BASE_CLASS
private:
static void CallExitIdle(void* arg, grpc_error* error);
protected:
GPRC_ALLOW_CLASS_TO_USE_NON_PUBLIC_DELETE
RefCountedPtr<LoadBalancingPolicy> parent_;
bool exit_idle_called_ = false;
};
explicit LoadBalancingPolicy(Args args, intptr_t initial_refcount = 1);
virtual ~LoadBalancingPolicy();
// A picker that returns PICK_TRANSIENT_FAILURE for all picks.
class TransientFailurePicker : public SubchannelPicker {
public:
explicit TransientFailurePicker(grpc_error* error) : error_(error) {}
~TransientFailurePicker() override { GRPC_ERROR_UNREF(error_); }
PickResult Pick(PickArgs* pick, grpc_error** error) override {
*error = GRPC_ERROR_REF(error_);
return PICK_TRANSIENT_FAILURE;
}
private:
grpc_error* error_;
};
GRPC_ABSTRACT_BASE_CLASS
protected:
grpc_combiner* combiner() const { return combiner_; }
// Note: LB policies MUST NOT call any method on the helper from their
@ -309,18 +326,11 @@ class LoadBalancingPolicy : public InternallyRefCounted<LoadBalancingPolicy> {
return channelz_node_.get();
}
/// Shuts down the policy. Any pending picks that have not been
/// handed off to a new policy via HandOffPendingPicksLocked() will be
/// failed.
/// Shuts down the policy.
virtual void ShutdownLocked() GRPC_ABSTRACT;
private:
static void ShutdownAndUnrefLocked(void* arg, grpc_error* ignored) {
LoadBalancingPolicy* policy = static_cast<LoadBalancingPolicy*>(arg);
policy->ShutdownLocked();
policy->channel_control_helper_.reset();
policy->Unref();
}
static void ShutdownAndUnrefLocked(void* arg, grpc_error* ignored);
/// Combiner under which LB policy actions take place.
grpc_combiner* combiner_;

@ -148,6 +148,7 @@ class GrpcLb : public LoadBalancingPolicy {
GrpcLbClientStats* client_stats() const { return client_stats_.get(); }
bool seen_initial_response() const { return seen_initial_response_; }
bool seen_serverlist() const { return seen_serverlist_; }
private:
// So Delete() can access our private dtor.
@ -188,6 +189,7 @@ class GrpcLb : public LoadBalancingPolicy {
grpc_byte_buffer* recv_message_payload_ = nullptr;
grpc_closure lb_on_balancer_message_received_;
bool seen_initial_response_ = false;
bool seen_serverlist_ = false;
// recv_trailing_metadata
grpc_closure lb_on_balancer_status_received_;
@ -252,7 +254,7 @@ class GrpcLb : public LoadBalancingPolicy {
child_picker_(std::move(child_picker)),
client_stats_(std::move(client_stats)) {}
PickResult Pick(PickState* pick, grpc_error** error) override;
PickResult Pick(PickArgs* pick, grpc_error** error) override;
private:
// Storing the address for logging, but not holding a ref.
@ -297,10 +299,14 @@ class GrpcLb : public LoadBalancingPolicy {
void ParseLbConfig(Config* grpclb_config);
static void OnBalancerChannelConnectivityChangedLocked(void* arg,
grpc_error* error);
void CancelBalancerChannelConnectivityWatchLocked();
// Methods for dealing with fallback state.
void MaybeEnterFallbackModeAfterStartup();
static void OnFallbackTimerLocked(void* arg, grpc_error* error);
// Methods for dealing with the balancer call.
void StartBalancerCallLocked();
static void OnFallbackTimerLocked(void* arg, grpc_error* error);
void StartBalancerCallRetryTimerLocked();
static void OnBalancerCallRetryTimerLocked(void* arg, grpc_error* error);
@ -325,9 +331,6 @@ class GrpcLb : public LoadBalancingPolicy {
gpr_atm lb_channel_uuid_ = 0;
// Response generator to inject address updates into lb_channel_.
RefCountedPtr<FakeResolverResponseGenerator> response_generator_;
// Connectivity state notification.
grpc_connectivity_state lb_channel_connectivity_ = GRPC_CHANNEL_IDLE;
grpc_closure lb_channel_on_connectivity_changed_;
// The data associated with the current LB call. It holds a ref to this LB
// policy. It's initialized every time we query for backends. It's reset to
@ -347,15 +350,19 @@ class GrpcLb : public LoadBalancingPolicy {
// such response has arrived.
RefCountedPtr<Serverlist> serverlist_;
// Timeout in milliseconds for before using fallback backend addresses.
// 0 means not using fallback.
int lb_fallback_timeout_ms_ = 0;
// Whether we're in fallback mode.
bool fallback_mode_ = false;
// The backend addresses from the resolver.
UniquePtr<ServerAddressList> fallback_backend_addresses_;
// Fallback timer.
bool fallback_timer_callback_pending_ = false;
ServerAddressList fallback_backend_addresses_;
// State for fallback-at-startup checks.
// Timeout after startup after which we will go into fallback mode if
// we have not received a serverlist from the balancer.
int fallback_at_startup_timeout_ = 0;
bool fallback_at_startup_checks_pending_ = false;
grpc_timer lb_fallback_timer_;
grpc_closure lb_on_fallback_;
grpc_connectivity_state lb_channel_connectivity_ = GRPC_CHANNEL_IDLE;
grpc_closure lb_channel_on_connectivity_changed_;
// Lock held when modifying the value of child_policy_ or
// pending_child_policy_.
@ -367,6 +374,8 @@ class GrpcLb : public LoadBalancingPolicy {
OrphanablePtr<LoadBalancingPolicy> pending_child_policy_;
// The child policy config.
RefCountedPtr<Config> child_policy_config_;
// Child policy in state READY.
bool child_policy_ready_ = false;
};
//
@ -531,8 +540,7 @@ const char* GrpcLb::Serverlist::ShouldDrop() {
// GrpcLb::Picker
//
GrpcLb::Picker::PickResult GrpcLb::Picker::Pick(PickState* pick,
grpc_error** error) {
GrpcLb::PickResult GrpcLb::Picker::Pick(PickArgs* pick, grpc_error** error) {
// Check if we should drop the call.
const char* drop_token = serverlist_->ShouldDrop();
if (drop_token != nullptr) {
@ -635,6 +643,10 @@ void GrpcLb::Helper::UpdateState(grpc_connectivity_state state,
GRPC_ERROR_UNREF(state_error);
return;
}
// Record whether child policy reports READY.
parent_->child_policy_ready_ = state == GRPC_CHANNEL_READY;
// Enter fallback mode if needed.
parent_->MaybeEnterFallbackModeAfterStartup();
// There are three cases to consider here:
// 1. We're in fallback mode. In this case, we're always going to use
// the child policy's result, so we pass its picker through as-is.
@ -687,15 +699,15 @@ void GrpcLb::Helper::UpdateState(grpc_connectivity_state state,
void GrpcLb::Helper::RequestReresolution() {
if (parent_->shutting_down_) return;
// If there is a pending child policy, ignore re-resolution requests
// from the current child policy (or any outdated child).
if (parent_->pending_child_policy_ != nullptr && !CalledByPendingChild()) {
return;
}
const LoadBalancingPolicy* latest_child_policy =
parent_->pending_child_policy_ != nullptr
? parent_->pending_child_policy_.get()
: parent_->child_policy_.get();
if (child_ != latest_child_policy) return;
if (grpc_lb_glb_trace.enabled()) {
gpr_log(GPR_INFO,
"[grpclb %p] Re-resolution requested from child policy (%p).",
parent_.get(), child_);
"[grpclb %p] Re-resolution requested from %schild policy (%p).",
parent_.get(), CalledByPendingChild() ? "pending " : "", child_);
}
// If we are talking to a balancer, we expect to get updated addresses
// from the balancer, so we can ignore the re-resolution request from
@ -791,7 +803,8 @@ void GrpcLb::BalancerCallState::StartQuery() {
grpc_op* op = ops;
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = 0;
op->flags = GRPC_INITIAL_METADATA_WAIT_FOR_READY |
GRPC_INITIAL_METADATA_WAIT_FOR_READY_EXPLICITLY_SET;
op->reserved = nullptr;
op++;
// Op: send request message.
@ -1014,16 +1027,14 @@ void GrpcLb::BalancerCallState::OnBalancerMessageReceivedLocked(
grpclb_policy, lb_calld, serverlist->num_servers,
serverlist_text.get());
}
lb_calld->seen_serverlist_ = true;
// Start sending client load report only after we start using the
// serverlist returned from the current LB call.
if (lb_calld->client_stats_report_interval_ > 0 &&
lb_calld->client_stats_ == nullptr) {
lb_calld->client_stats_ = MakeRefCounted<GrpcLbClientStats>();
// TODO(roth): We currently track this ref manually. Once the
// ClosureRef API is ready, we should pass the RefCountedPtr<> along
// with the callback.
auto self = lb_calld->Ref(DEBUG_LOCATION, "client_load_report");
self.release();
// Ref held by callback.
lb_calld->Ref(DEBUG_LOCATION, "client_load_report").release();
lb_calld->ScheduleNextClientLoadReportLocked();
}
// Check if the serverlist differs from the previous one.
@ -1036,18 +1047,36 @@ void GrpcLb::BalancerCallState::OnBalancerMessageReceivedLocked(
grpclb_policy, lb_calld);
}
} else { // New serverlist.
if (grpclb_policy->serverlist_ == nullptr) {
// Dispose of the fallback.
if (grpclb_policy->child_policy_ != nullptr) {
gpr_log(GPR_INFO,
"[grpclb %p] Received response from balancer; exiting "
"fallback mode",
grpclb_policy);
}
grpclb_policy->fallback_backend_addresses_.reset();
if (grpclb_policy->fallback_timer_callback_pending_) {
grpc_timer_cancel(&grpclb_policy->lb_fallback_timer_);
}
// Dispose of the fallback.
// TODO(roth): Ideally, we should stay in fallback mode until we
// know that we can reach at least one of the backends in the new
// serverlist. Unfortunately, we can't do that, since we need to
// send the new addresses to the child policy in order to determine
// if they are reachable, and if we don't exit fallback mode now,
// CreateOrUpdateChildPolicyLocked() will use the fallback
// addresses instead of the addresses from the new serverlist.
// However, if we can't reach any of the servers in the new
// serverlist, then the child policy will never switch away from
// the fallback addresses, but the grpclb policy will still think
// that we're not in fallback mode, which means that we won't send
// updates to the child policy when the fallback addresses are
// updated by the resolver. This is sub-optimal, but the only way
// to fix it is to maintain a completely separate child policy for
// fallback mode, and that's more work than we want to put into
// the grpclb implementation at this point, since we're deprecating
// it in favor of the xds policy. We will implement this the
// right way in the xds policy instead.
if (grpclb_policy->fallback_mode_) {
gpr_log(GPR_INFO,
"[grpclb %p] Received response from balancer; exiting "
"fallback mode",
grpclb_policy);
grpclb_policy->fallback_mode_ = false;
}
if (grpclb_policy->fallback_at_startup_checks_pending_) {
grpclb_policy->fallback_at_startup_checks_pending_ = false;
grpc_timer_cancel(&grpclb_policy->lb_fallback_timer_);
grpclb_policy->CancelBalancerChannelConnectivityWatchLocked();
}
// Update the serverlist in the GrpcLb instance. This serverlist
// instance will be destroyed either upon the next update or when the
@ -1103,6 +1132,24 @@ void GrpcLb::BalancerCallState::OnBalancerStatusReceivedLocked(
// we want to retry connecting. Otherwise, we have deliberately ended this
// call and no further action is required.
if (lb_calld == grpclb_policy->lb_calld_.get()) {
// If we did not receive a serverlist and the fallback-at-startup checks
// are pending, go into fallback mode immediately. This short-circuits
// the timeout for the fallback-at-startup case.
if (!lb_calld->seen_serverlist_ &&
grpclb_policy->fallback_at_startup_checks_pending_) {
gpr_log(GPR_INFO,
"[grpclb %p] balancer call finished without receiving "
"serverlist; entering fallback mode",
grpclb_policy);
grpclb_policy->fallback_at_startup_checks_pending_ = false;
grpc_timer_cancel(&grpclb_policy->lb_fallback_timer_);
grpclb_policy->CancelBalancerChannelConnectivityWatchLocked();
grpclb_policy->fallback_mode_ = true;
grpclb_policy->CreateOrUpdateChildPolicyLocked();
} else {
// This handles the fallback-after-startup case.
grpclb_policy->MaybeEnterFallbackModeAfterStartup();
}
grpclb_policy->lb_calld_.reset();
GPR_ASSERT(!grpclb_policy->shutting_down_);
grpclb_policy->channel_control_helper()->RequestReresolution();
@ -1234,6 +1281,8 @@ GrpcLb::GrpcLb(Args args)
.set_max_backoff(GRPC_GRPCLB_RECONNECT_MAX_BACKOFF_SECONDS *
1000)) {
// Initialization.
GRPC_CLOSURE_INIT(&lb_on_fallback_, &GrpcLb::OnFallbackTimerLocked, this,
grpc_combiner_scheduler(combiner()));
GRPC_CLOSURE_INIT(&lb_channel_on_connectivity_changed_,
&GrpcLb::OnBalancerChannelConnectivityChangedLocked, this,
grpc_combiner_scheduler(args.combiner));
@ -1254,9 +1303,9 @@ GrpcLb::GrpcLb(Args args)
// Record LB call timeout.
arg = grpc_channel_args_find(args.args, GRPC_ARG_GRPCLB_CALL_TIMEOUT_MS);
lb_call_timeout_ms_ = grpc_channel_arg_get_integer(arg, {0, 0, INT_MAX});
// Record fallback timeout.
// Record fallback-at-startup timeout.
arg = grpc_channel_args_find(args.args, GRPC_ARG_GRPCLB_FALLBACK_TIMEOUT_MS);
lb_fallback_timeout_ms_ = grpc_channel_arg_get_integer(
fallback_at_startup_timeout_ = grpc_channel_arg_get_integer(
arg, {GRPC_GRPCLB_DEFAULT_FALLBACK_TIMEOUT_MS, 0, INT_MAX});
}
@ -1272,8 +1321,9 @@ void GrpcLb::ShutdownLocked() {
if (retry_timer_callback_pending_) {
grpc_timer_cancel(&lb_call_retry_timer_);
}
if (fallback_timer_callback_pending_) {
if (fallback_at_startup_checks_pending_) {
grpc_timer_cancel(&lb_fallback_timer_);
CancelBalancerChannelConnectivityWatchLocked();
}
if (child_policy_ != nullptr) {
grpc_pollset_set_del_pollset_set(child_policy_->interested_parties(),
@ -1345,31 +1395,28 @@ void GrpcLb::UpdateLocked(const grpc_channel_args& args,
ProcessChannelArgsLocked(args);
// Update the existing child policy.
if (child_policy_ != nullptr) CreateOrUpdateChildPolicyLocked();
// If this is the initial update, start the fallback timer.
// If this is the initial update, start the fallback-at-startup checks
// and the balancer call.
if (is_initial_update) {
if (lb_fallback_timeout_ms_ > 0 && serverlist_ == nullptr &&
!fallback_timer_callback_pending_) {
grpc_millis deadline = ExecCtx::Get()->Now() + lb_fallback_timeout_ms_;
Ref(DEBUG_LOCATION, "on_fallback_timer").release(); // Ref for callback
GRPC_CLOSURE_INIT(&lb_on_fallback_, &GrpcLb::OnFallbackTimerLocked, this,
grpc_combiner_scheduler(combiner()));
fallback_timer_callback_pending_ = true;
grpc_timer_init(&lb_fallback_timer_, deadline, &lb_on_fallback_);
// Start watching the channel's connectivity state. If the channel
// goes into state TRANSIENT_FAILURE, we go into fallback mode even if
// the fallback timeout has not elapsed.
grpc_channel_element* client_channel_elem =
grpc_channel_stack_last_element(
grpc_channel_get_channel_stack(lb_channel_));
GPR_ASSERT(client_channel_elem->filter == &grpc_client_channel_filter);
// Ref held by callback.
Ref(DEBUG_LOCATION, "watch_lb_channel_connectivity").release();
grpc_client_channel_watch_connectivity_state(
client_channel_elem,
grpc_polling_entity_create_from_pollset_set(interested_parties()),
&lb_channel_connectivity_, &lb_channel_on_connectivity_changed_,
nullptr);
}
fallback_at_startup_checks_pending_ = true;
// Start timer.
grpc_millis deadline = ExecCtx::Get()->Now() + fallback_at_startup_timeout_;
Ref(DEBUG_LOCATION, "on_fallback_timer").release(); // Ref for callback
grpc_timer_init(&lb_fallback_timer_, deadline, &lb_on_fallback_);
// Start watching the channel's connectivity state. If the channel
// goes into state TRANSIENT_FAILURE before the timer fires, we go into
// fallback mode even if the fallback timeout has not elapsed.
grpc_channel_element* client_channel_elem = grpc_channel_stack_last_element(
grpc_channel_get_channel_stack(lb_channel_));
GPR_ASSERT(client_channel_elem->filter == &grpc_client_channel_filter);
// Ref held by callback.
Ref(DEBUG_LOCATION, "watch_lb_channel_connectivity").release();
grpc_client_channel_watch_connectivity_state(
client_channel_elem,
grpc_polling_entity_create_from_pollset_set(interested_parties()),
&lb_channel_connectivity_, &lb_channel_on_connectivity_changed_,
nullptr);
// Start balancer call.
StartBalancerCallLocked();
}
}
@ -1379,16 +1426,15 @@ void GrpcLb::UpdateLocked(const grpc_channel_args& args,
//
// Returns the backend addresses extracted from the given addresses.
UniquePtr<ServerAddressList> ExtractBackendAddresses(
const ServerAddressList& addresses) {
ServerAddressList ExtractBackendAddresses(const ServerAddressList& addresses) {
void* lb_token = (void*)GRPC_MDELEM_LB_TOKEN_EMPTY.payload;
grpc_arg arg = grpc_channel_arg_pointer_create(
const_cast<char*>(GRPC_ARG_GRPCLB_ADDRESS_LB_TOKEN), lb_token,
&lb_token_arg_vtable);
auto backend_addresses = MakeUnique<ServerAddressList>();
ServerAddressList backend_addresses;
for (size_t i = 0; i < addresses.size(); ++i) {
if (!addresses[i].IsBalancer()) {
backend_addresses->emplace_back(
backend_addresses.emplace_back(
addresses[i].address(),
grpc_channel_args_copy_and_add(addresses[i].args(), &arg, 1));
}
@ -1463,7 +1509,7 @@ void GrpcLb::ParseLbConfig(Config* grpclb_config) {
void GrpcLb::OnBalancerChannelConnectivityChangedLocked(void* arg,
grpc_error* error) {
GrpcLb* self = static_cast<GrpcLb*>(arg);
if (!self->shutting_down_ && self->fallback_timer_callback_pending_) {
if (!self->shutting_down_ && self->fallback_at_startup_checks_pending_) {
if (self->lb_channel_connectivity_ != GRPC_CHANNEL_TRANSIENT_FAILURE) {
// Not in TRANSIENT_FAILURE. Renew connectivity watch.
grpc_channel_element* client_channel_elem =
@ -1484,13 +1530,25 @@ void GrpcLb::OnBalancerChannelConnectivityChangedLocked(void* arg,
"[grpclb %p] balancer channel in state TRANSIENT_FAILURE; "
"entering fallback mode",
self);
self->fallback_at_startup_checks_pending_ = false;
grpc_timer_cancel(&self->lb_fallback_timer_);
self->fallback_mode_ = true;
self->CreateOrUpdateChildPolicyLocked();
}
// Done watching connectivity state, so drop ref.
self->Unref(DEBUG_LOCATION, "watch_lb_channel_connectivity");
}
void GrpcLb::CancelBalancerChannelConnectivityWatchLocked() {
grpc_channel_element* client_channel_elem = grpc_channel_stack_last_element(
grpc_channel_get_channel_stack(lb_channel_));
GPR_ASSERT(client_channel_elem->filter == &grpc_client_channel_filter);
grpc_client_channel_watch_connectivity_state(
client_channel_elem,
grpc_polling_entity_create_from_pollset_set(interested_parties()),
nullptr, &lb_channel_on_connectivity_changed_, nullptr);
}
//
// code for balancer channel and call
//
@ -1509,32 +1567,6 @@ void GrpcLb::StartBalancerCallLocked() {
lb_calld_->StartQuery();
}
void GrpcLb::OnFallbackTimerLocked(void* arg, grpc_error* error) {
GrpcLb* grpclb_policy = static_cast<GrpcLb*>(arg);
grpclb_policy->fallback_timer_callback_pending_ = false;
// If we receive a serverlist after the timer fires but before this callback
// actually runs, don't fall back.
if (grpclb_policy->serverlist_ == nullptr && !grpclb_policy->shutting_down_ &&
error == GRPC_ERROR_NONE) {
gpr_log(GPR_INFO,
"[grpclb %p] No response from balancer after fallback timeout; "
"entering fallback mode",
grpclb_policy);
GPR_ASSERT(grpclb_policy->fallback_backend_addresses_ != nullptr);
grpclb_policy->CreateOrUpdateChildPolicyLocked();
// Cancel connectivity watch, since we no longer need it.
grpc_channel_element* client_channel_elem = grpc_channel_stack_last_element(
grpc_channel_get_channel_stack(grpclb_policy->lb_channel_));
GPR_ASSERT(client_channel_elem->filter == &grpc_client_channel_filter);
grpc_client_channel_watch_connectivity_state(
client_channel_elem,
grpc_polling_entity_create_from_pollset_set(
grpclb_policy->interested_parties()),
nullptr, &grpclb_policy->lb_channel_on_connectivity_changed_, nullptr);
}
grpclb_policy->Unref(DEBUG_LOCATION, "on_fallback_timer");
}
void GrpcLb::StartBalancerCallRetryTimerLocked() {
grpc_millis next_try = lb_call_backoff_.NextAttemptTime();
if (grpc_lb_glb_trace.enabled()) {
@ -1573,6 +1605,46 @@ void GrpcLb::OnBalancerCallRetryTimerLocked(void* arg, grpc_error* error) {
grpclb_policy->Unref(DEBUG_LOCATION, "on_balancer_call_retry_timer");
}
//
// code for handling fallback mode
//
void GrpcLb::MaybeEnterFallbackModeAfterStartup() {
// Enter fallback mode if all of the following are true:
// - We are not currently in fallback mode.
// - We are not currently waiting for the initial fallback timeout.
// - We are not currently in contact with the balancer.
// - The child policy is not in state READY.
if (!fallback_mode_ && !fallback_at_startup_checks_pending_ &&
(lb_calld_ == nullptr || !lb_calld_->seen_serverlist()) &&
!child_policy_ready_) {
gpr_log(GPR_INFO,
"[grpclb %p] lost contact with balancer and backends from "
"most recent serverlist; entering fallback mode",
this);
fallback_mode_ = true;
CreateOrUpdateChildPolicyLocked();
}
}
void GrpcLb::OnFallbackTimerLocked(void* arg, grpc_error* error) {
GrpcLb* grpclb_policy = static_cast<GrpcLb*>(arg);
// If we receive a serverlist after the timer fires but before this callback
// actually runs, don't fall back.
if (grpclb_policy->fallback_at_startup_checks_pending_ &&
!grpclb_policy->shutting_down_ && error == GRPC_ERROR_NONE) {
gpr_log(GPR_INFO,
"[grpclb %p] No response from balancer after fallback timeout; "
"entering fallback mode",
grpclb_policy);
grpclb_policy->fallback_at_startup_checks_pending_ = false;
grpclb_policy->CancelBalancerChannelConnectivityWatchLocked();
grpclb_policy->fallback_mode_ = true;
grpclb_policy->CreateOrUpdateChildPolicyLocked();
}
grpclb_policy->Unref(DEBUG_LOCATION, "on_fallback_timer");
}
//
// code for interacting with the child policy
//
@ -1581,18 +1653,14 @@ grpc_channel_args* GrpcLb::CreateChildPolicyArgsLocked() {
ServerAddressList tmp_addresses;
ServerAddressList* addresses = &tmp_addresses;
bool is_backend_from_grpclb_load_balancer = false;
if (serverlist_ != nullptr) {
if (fallback_mode_) {
// Note: If fallback backend address list is empty, the child policy
// will go into state TRANSIENT_FAILURE.
addresses = &fallback_backend_addresses_;
} else {
tmp_addresses = serverlist_->GetServerAddressList(
lb_calld_ == nullptr ? nullptr : lb_calld_->client_stats());
is_backend_from_grpclb_load_balancer = true;
} else {
// If CreateOrUpdateChildPolicyLocked() is invoked when we haven't
// received any serverlist from the balancer, we use the fallback backends
// returned by the resolver. Note that the fallback backend list may be
// empty, in which case the new round_robin policy will keep the requested
// picks pending.
GPR_ASSERT(fallback_backend_addresses_ != nullptr);
addresses = fallback_backend_addresses_.get();
}
GPR_ASSERT(addresses != nullptr);
// Replace the server address list in the channel args that we pass down to

@ -117,7 +117,7 @@ class PickFirst : public LoadBalancingPolicy {
explicit Picker(RefCountedPtr<ConnectedSubchannel> connected_subchannel)
: connected_subchannel_(std::move(connected_subchannel)) {}
PickResult Pick(PickState* pick, grpc_error** error) override {
PickResult Pick(PickArgs* pick, grpc_error** error) override {
pick->connected_subchannel = connected_subchannel_;
return PICK_COMPLETE;
}

@ -156,7 +156,7 @@ class RoundRobin : public LoadBalancingPolicy {
public:
Picker(RoundRobin* parent, RoundRobinSubchannelList* subchannel_list);
PickResult Pick(PickState* pick, grpc_error** error) override;
PickResult Pick(PickArgs* pick, grpc_error** error) override;
private:
// Using pointer value only, no ref held -- do not dereference!
@ -227,8 +227,8 @@ RoundRobin::Picker::Picker(RoundRobin* parent,
}
}
RoundRobin::Picker::PickResult RoundRobin::Picker::Pick(PickState* pick,
grpc_error** error) {
RoundRobin::PickResult RoundRobin::Picker::Pick(PickArgs* pick,
grpc_error** error) {
last_picked_index_ = (last_picked_index_ + 1) % subchannels_.size();
if (grpc_lb_round_robin_trace.enabled()) {
gpr_log(GPR_INFO,

@ -260,7 +260,7 @@ class XdsLb : public LoadBalancingPolicy {
: child_picker_(std::move(child_picker)),
client_stats_(std::move(client_stats)) {}
PickResult Pick(PickState* pick, grpc_error** error) override;
PickResult Pick(PickArgs* pick, grpc_error** error) override;
private:
UniquePtr<SubchannelPicker> child_picker_;
@ -366,8 +366,7 @@ class XdsLb : public LoadBalancingPolicy {
// XdsLb::Picker
//
XdsLb::Picker::PickResult XdsLb::Picker::Pick(PickState* pick,
grpc_error** error) {
XdsLb::PickResult XdsLb::Picker::Pick(PickArgs* pick, grpc_error** error) {
// TODO(roth): Add support for drop handling.
// Forward pick to child policy.
PickResult result = child_picker_->Pick(pick, error);

@ -67,9 +67,7 @@ struct grpc_ares_request {
/** number of ongoing queries */
size_t pending_queries;
/** is there at least one successful query, set in on_done_cb */
bool success;
/** the errors explaining the request failure, set in on_done_cb */
/** the errors explaining query failures, appended to in query callbacks */
grpc_error* error;
};
@ -145,6 +143,10 @@ void grpc_ares_complete_request_locked(grpc_ares_request* r) {
ServerAddressList* addresses = r->addresses_out->get();
if (addresses != nullptr) {
grpc_cares_wrapper_address_sorting_sort(addresses);
GRPC_ERROR_UNREF(r->error);
r->error = GRPC_ERROR_NONE;
// TODO(apolcyn): allow c-ares to return a service config
// with no addresses along side it
}
GRPC_CLOSURE_SCHED(r->on_done, r->error);
}
@ -175,9 +177,9 @@ static void on_hostbyname_done_locked(void* arg, int status, int timeouts,
static_cast<grpc_ares_hostbyname_request*>(arg);
grpc_ares_request* r = hr->parent_request;
if (status == ARES_SUCCESS) {
GRPC_ERROR_UNREF(r->error);
r->error = GRPC_ERROR_NONE;
r->success = true;
GRPC_CARES_TRACE_LOG(
"request:%p on_hostbyname_done_locked host=%s ARES_SUCCESS", r,
hr->host);
if (*r->addresses_out == nullptr) {
*r->addresses_out = grpc_core::MakeUnique<ServerAddressList>();
}
@ -229,17 +231,15 @@ static void on_hostbyname_done_locked(void* arg, int status, int timeouts,
}
}
}
} else if (!r->success) {
} else {
char* error_msg;
gpr_asprintf(&error_msg, "C-ares status is not ARES_SUCCESS: %s",
ares_strerror(status));
GRPC_CARES_TRACE_LOG("request:%p on_hostbyname_done_locked host=%s %s", r,
hr->host, error_msg);
grpc_error* error = GRPC_ERROR_CREATE_FROM_COPIED_STRING(error_msg);
gpr_free(error_msg);
if (r->error == GRPC_ERROR_NONE) {
r->error = error;
} else {
r->error = grpc_error_add_child(error, r->error);
}
r->error = grpc_error_add_child(error, r->error);
}
destroy_hostbyname_request_locked(hr);
}
@ -247,9 +247,8 @@ static void on_hostbyname_done_locked(void* arg, int status, int timeouts,
static void on_srv_query_done_locked(void* arg, int status, int timeouts,
unsigned char* abuf, int alen) {
grpc_ares_request* r = static_cast<grpc_ares_request*>(arg);
GRPC_CARES_TRACE_LOG("request:%p on_query_srv_done_locked", r);
if (status == ARES_SUCCESS) {
GRPC_CARES_TRACE_LOG("request:%p on_query_srv_done_locked ARES_SUCCESS", r);
GRPC_CARES_TRACE_LOG("request:%p on_srv_query_done_locked ARES_SUCCESS", r);
struct ares_srv_reply* reply;
const int parse_status = ares_parse_srv_reply(abuf, alen, &reply);
if (parse_status == ARES_SUCCESS) {
@ -273,17 +272,15 @@ static void on_srv_query_done_locked(void* arg, int status, int timeouts,
if (reply != nullptr) {
ares_free_data(reply);
}
} else if (!r->success) {
} else {
char* error_msg;
gpr_asprintf(&error_msg, "C-ares status is not ARES_SUCCESS: %s",
ares_strerror(status));
GRPC_CARES_TRACE_LOG("request:%p on_srv_query_done_locked %s", r,
error_msg);
grpc_error* error = GRPC_ERROR_CREATE_FROM_COPIED_STRING(error_msg);
gpr_free(error_msg);
if (r->error == GRPC_ERROR_NONE) {
r->error = error;
} else {
r->error = grpc_error_add_child(error, r->error);
}
r->error = grpc_error_add_child(error, r->error);
}
grpc_ares_request_unref_locked(r);
}
@ -294,12 +291,12 @@ static void on_txt_done_locked(void* arg, int status, int timeouts,
unsigned char* buf, int len) {
char* error_msg;
grpc_ares_request* r = static_cast<grpc_ares_request*>(arg);
GRPC_CARES_TRACE_LOG("request:%p on_txt_done_locked", r);
const size_t prefix_len = sizeof(g_service_config_attribute_prefix) - 1;
struct ares_txt_ext* result = nullptr;
struct ares_txt_ext* reply = nullptr;
grpc_error* error = GRPC_ERROR_NONE;
if (status != ARES_SUCCESS) goto fail;
GRPC_CARES_TRACE_LOG("request:%p on_txt_done_locked ARES_SUCCESS", r);
status = ares_parse_txt_reply_ext(buf, len, &reply);
if (status != ARES_SUCCESS) goto fail;
// Find service config in TXT record.
@ -337,12 +334,9 @@ fail:
gpr_asprintf(&error_msg, "C-ares TXT lookup status is not ARES_SUCCESS: %s",
ares_strerror(status));
error = GRPC_ERROR_CREATE_FROM_COPIED_STRING(error_msg);
GRPC_CARES_TRACE_LOG("request:%p on_txt_done_locked %s", r, error_msg);
gpr_free(error_msg);
if (r->error == GRPC_ERROR_NONE) {
r->error = error;
} else {
r->error = grpc_error_add_child(error, r->error);
}
r->error = grpc_error_add_child(error, r->error);
done:
grpc_ares_request_unref_locked(r);
}
@ -534,7 +528,6 @@ static grpc_ares_request* grpc_dns_lookup_ares_locked_impl(
r->on_done = on_done;
r->addresses_out = addrs;
r->service_config_json_out = service_config_json;
r->success = false;
r->error = GRPC_ERROR_NONE;
r->pending_queries = 0;
GRPC_CARES_TRACE_LOG(

@ -0,0 +1,110 @@
/* This file was generated by upbc (the upb compiler) from the input
* file:
*
* envoy/api/v2/core/address.proto
*
* Do not edit -- your changes will be discarded when the file is
* regenerated. */
#include <stddef.h>
#include "upb/msg.h"
#include "envoy/api/v2/core/address.upb.h"
#include "envoy/api/v2/core/base.upb.h"
#include "google/protobuf/wrappers.upb.h"
#include "validate/validate.upb.h"
#include "gogoproto/gogo.upb.h"
#include "upb/port_def.inc"
static const upb_msglayout_field envoy_api_v2_core_Pipe__fields[1] = {
{1, UPB_SIZE(0, 0), 0, 0, 9, 1},
};
const upb_msglayout envoy_api_v2_core_Pipe_msginit = {
NULL,
&envoy_api_v2_core_Pipe__fields[0],
UPB_SIZE(8, 16), 1, false,
};
static const upb_msglayout_field envoy_api_v2_core_SocketAddress__fields[6] = {
{1, UPB_SIZE(0, 0), 0, 0, 14, 1},
{2, UPB_SIZE(12, 16), 0, 0, 9, 1},
{3, UPB_SIZE(28, 48), UPB_SIZE(-37, -65), 0, 13, 1},
{4, UPB_SIZE(28, 48), UPB_SIZE(-37, -65), 0, 9, 1},
{5, UPB_SIZE(20, 32), 0, 0, 9, 1},
{6, UPB_SIZE(8, 8), 0, 0, 8, 1},
};
const upb_msglayout envoy_api_v2_core_SocketAddress_msginit = {
NULL,
&envoy_api_v2_core_SocketAddress__fields[0],
UPB_SIZE(40, 80), 6, false,
};
static const upb_msglayout *const envoy_api_v2_core_TcpKeepalive_submsgs[3] = {
&google_protobuf_UInt32Value_msginit,
};
static const upb_msglayout_field envoy_api_v2_core_TcpKeepalive__fields[3] = {
{1, UPB_SIZE(0, 0), 0, 0, 11, 1},
{2, UPB_SIZE(4, 8), 0, 0, 11, 1},
{3, UPB_SIZE(8, 16), 0, 0, 11, 1},
};
const upb_msglayout envoy_api_v2_core_TcpKeepalive_msginit = {
&envoy_api_v2_core_TcpKeepalive_submsgs[0],
&envoy_api_v2_core_TcpKeepalive__fields[0],
UPB_SIZE(12, 24), 3, false,
};
static const upb_msglayout *const envoy_api_v2_core_BindConfig_submsgs[3] = {
&envoy_api_v2_core_SocketAddress_msginit,
&envoy_api_v2_core_SocketOption_msginit,
&google_protobuf_BoolValue_msginit,
};
static const upb_msglayout_field envoy_api_v2_core_BindConfig__fields[3] = {
{1, UPB_SIZE(0, 0), 0, 0, 11, 1},
{2, UPB_SIZE(4, 8), 0, 2, 11, 1},
{3, UPB_SIZE(8, 16), 0, 1, 11, 3},
};
const upb_msglayout envoy_api_v2_core_BindConfig_msginit = {
&envoy_api_v2_core_BindConfig_submsgs[0],
&envoy_api_v2_core_BindConfig__fields[0],
UPB_SIZE(12, 24), 3, false,
};
static const upb_msglayout *const envoy_api_v2_core_Address_submsgs[2] = {
&envoy_api_v2_core_Pipe_msginit,
&envoy_api_v2_core_SocketAddress_msginit,
};
static const upb_msglayout_field envoy_api_v2_core_Address__fields[2] = {
{1, UPB_SIZE(0, 0), UPB_SIZE(-5, -9), 1, 11, 1},
{2, UPB_SIZE(0, 0), UPB_SIZE(-5, -9), 0, 11, 1},
};
const upb_msglayout envoy_api_v2_core_Address_msginit = {
&envoy_api_v2_core_Address_submsgs[0],
&envoy_api_v2_core_Address__fields[0],
UPB_SIZE(8, 16), 2, false,
};
static const upb_msglayout *const envoy_api_v2_core_CidrRange_submsgs[1] = {
&google_protobuf_UInt32Value_msginit,
};
static const upb_msglayout_field envoy_api_v2_core_CidrRange__fields[2] = {
{1, UPB_SIZE(0, 0), 0, 0, 9, 1},
{2, UPB_SIZE(8, 16), 0, 0, 11, 1},
};
const upb_msglayout envoy_api_v2_core_CidrRange_msginit = {
&envoy_api_v2_core_CidrRange_submsgs[0],
&envoy_api_v2_core_CidrRange__fields[0],
UPB_SIZE(16, 32), 2, false,
};
#include "upb/port_undef.inc"

@ -0,0 +1,325 @@
/* This file was generated by upbc (the upb compiler) from the input
* file:
*
* envoy/api/v2/core/address.proto
*
* Do not edit -- your changes will be discarded when the file is
* regenerated. */
#ifndef ENVOY_API_V2_CORE_ADDRESS_PROTO_UPB_H_
#define ENVOY_API_V2_CORE_ADDRESS_PROTO_UPB_H_
#include "upb/generated_util.h"
#include "upb/msg.h"
#include "upb/decode.h"
#include "upb/encode.h"
#include "upb/port_def.inc"
#ifdef __cplusplus
extern "C" {
#endif
struct envoy_api_v2_core_Pipe;
struct envoy_api_v2_core_SocketAddress;
struct envoy_api_v2_core_TcpKeepalive;
struct envoy_api_v2_core_BindConfig;
struct envoy_api_v2_core_Address;
struct envoy_api_v2_core_CidrRange;
typedef struct envoy_api_v2_core_Pipe envoy_api_v2_core_Pipe;
typedef struct envoy_api_v2_core_SocketAddress envoy_api_v2_core_SocketAddress;
typedef struct envoy_api_v2_core_TcpKeepalive envoy_api_v2_core_TcpKeepalive;
typedef struct envoy_api_v2_core_BindConfig envoy_api_v2_core_BindConfig;
typedef struct envoy_api_v2_core_Address envoy_api_v2_core_Address;
typedef struct envoy_api_v2_core_CidrRange envoy_api_v2_core_CidrRange;
extern const upb_msglayout envoy_api_v2_core_Pipe_msginit;
extern const upb_msglayout envoy_api_v2_core_SocketAddress_msginit;
extern const upb_msglayout envoy_api_v2_core_TcpKeepalive_msginit;
extern const upb_msglayout envoy_api_v2_core_BindConfig_msginit;
extern const upb_msglayout envoy_api_v2_core_Address_msginit;
extern const upb_msglayout envoy_api_v2_core_CidrRange_msginit;
struct google_protobuf_UInt32Value;
struct google_protobuf_BoolValue;
struct envoy_api_v2_core_SocketOption;
extern const upb_msglayout google_protobuf_UInt32Value_msginit;
extern const upb_msglayout google_protobuf_BoolValue_msginit;
extern const upb_msglayout envoy_api_v2_core_SocketOption_msginit;
/* Enums */
typedef enum {
envoy_api_v2_core_SocketAddress_TCP = 0,
envoy_api_v2_core_SocketAddress_UDP = 1
} envoy_api_v2_core_SocketAddress_Protocol;
/* envoy.api.v2.core.Pipe */
UPB_INLINE envoy_api_v2_core_Pipe *envoy_api_v2_core_Pipe_new(upb_arena *arena) {
return (envoy_api_v2_core_Pipe *)upb_msg_new(&envoy_api_v2_core_Pipe_msginit, arena);
}
UPB_INLINE envoy_api_v2_core_Pipe *envoy_api_v2_core_Pipe_parsenew(upb_strview buf, upb_arena *arena) {
envoy_api_v2_core_Pipe *ret = envoy_api_v2_core_Pipe_new(arena);
return (ret && upb_decode(buf, ret, &envoy_api_v2_core_Pipe_msginit)) ? ret : NULL;
}
UPB_INLINE char *envoy_api_v2_core_Pipe_serialize(const envoy_api_v2_core_Pipe *msg, upb_arena *arena, size_t *len) {
return upb_encode(msg, &envoy_api_v2_core_Pipe_msginit, arena, len);
}
UPB_INLINE upb_strview envoy_api_v2_core_Pipe_path(const envoy_api_v2_core_Pipe *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); }
UPB_INLINE void envoy_api_v2_core_Pipe_set_path(envoy_api_v2_core_Pipe *msg, upb_strview value) {
UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value;
}
/* envoy.api.v2.core.SocketAddress */
UPB_INLINE envoy_api_v2_core_SocketAddress *envoy_api_v2_core_SocketAddress_new(upb_arena *arena) {
return (envoy_api_v2_core_SocketAddress *)upb_msg_new(&envoy_api_v2_core_SocketAddress_msginit, arena);
}
UPB_INLINE envoy_api_v2_core_SocketAddress *envoy_api_v2_core_SocketAddress_parsenew(upb_strview buf, upb_arena *arena) {
envoy_api_v2_core_SocketAddress *ret = envoy_api_v2_core_SocketAddress_new(arena);
return (ret && upb_decode(buf, ret, &envoy_api_v2_core_SocketAddress_msginit)) ? ret : NULL;
}
UPB_INLINE char *envoy_api_v2_core_SocketAddress_serialize(const envoy_api_v2_core_SocketAddress *msg, upb_arena *arena, size_t *len) {
return upb_encode(msg, &envoy_api_v2_core_SocketAddress_msginit, arena, len);
}
typedef enum {
envoy_api_v2_core_SocketAddress_port_specifier_port_value = 3,
envoy_api_v2_core_SocketAddress_port_specifier_named_port = 4,
envoy_api_v2_core_SocketAddress_port_specifier_NOT_SET = 0,
} envoy_api_v2_core_SocketAddress_port_specifier_oneofcases;
UPB_INLINE envoy_api_v2_core_SocketAddress_port_specifier_oneofcases envoy_api_v2_core_SocketAddress_port_specifier_case(const envoy_api_v2_core_SocketAddress* msg) { return UPB_FIELD_AT(msg, int, UPB_SIZE(36, 64)); }
UPB_INLINE envoy_api_v2_core_SocketAddress_Protocol envoy_api_v2_core_SocketAddress_protocol(const envoy_api_v2_core_SocketAddress *msg) { return UPB_FIELD_AT(msg, envoy_api_v2_core_SocketAddress_Protocol, UPB_SIZE(0, 0)); }
UPB_INLINE upb_strview envoy_api_v2_core_SocketAddress_address(const envoy_api_v2_core_SocketAddress *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(12, 16)); }
UPB_INLINE bool envoy_api_v2_core_SocketAddress_has_port_value(const envoy_api_v2_core_SocketAddress *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(36, 64), 3); }
UPB_INLINE uint32_t envoy_api_v2_core_SocketAddress_port_value(const envoy_api_v2_core_SocketAddress *msg) { return UPB_READ_ONEOF(msg, uint32_t, UPB_SIZE(28, 48), UPB_SIZE(36, 64), 3, 0); }
UPB_INLINE bool envoy_api_v2_core_SocketAddress_has_named_port(const envoy_api_v2_core_SocketAddress *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(36, 64), 4); }
UPB_INLINE upb_strview envoy_api_v2_core_SocketAddress_named_port(const envoy_api_v2_core_SocketAddress *msg) { return UPB_READ_ONEOF(msg, upb_strview, UPB_SIZE(28, 48), UPB_SIZE(36, 64), 4, upb_strview_make("", strlen(""))); }
UPB_INLINE upb_strview envoy_api_v2_core_SocketAddress_resolver_name(const envoy_api_v2_core_SocketAddress *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(20, 32)); }
UPB_INLINE bool envoy_api_v2_core_SocketAddress_ipv4_compat(const envoy_api_v2_core_SocketAddress *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(8, 8)); }
UPB_INLINE void envoy_api_v2_core_SocketAddress_set_protocol(envoy_api_v2_core_SocketAddress *msg, envoy_api_v2_core_SocketAddress_Protocol value) {
UPB_FIELD_AT(msg, envoy_api_v2_core_SocketAddress_Protocol, UPB_SIZE(0, 0)) = value;
}
UPB_INLINE void envoy_api_v2_core_SocketAddress_set_address(envoy_api_v2_core_SocketAddress *msg, upb_strview value) {
UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(12, 16)) = value;
}
UPB_INLINE void envoy_api_v2_core_SocketAddress_set_port_value(envoy_api_v2_core_SocketAddress *msg, uint32_t value) {
UPB_WRITE_ONEOF(msg, uint32_t, UPB_SIZE(28, 48), value, UPB_SIZE(36, 64), 3);
}
UPB_INLINE void envoy_api_v2_core_SocketAddress_set_named_port(envoy_api_v2_core_SocketAddress *msg, upb_strview value) {
UPB_WRITE_ONEOF(msg, upb_strview, UPB_SIZE(28, 48), value, UPB_SIZE(36, 64), 4);
}
UPB_INLINE void envoy_api_v2_core_SocketAddress_set_resolver_name(envoy_api_v2_core_SocketAddress *msg, upb_strview value) {
UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(20, 32)) = value;
}
UPB_INLINE void envoy_api_v2_core_SocketAddress_set_ipv4_compat(envoy_api_v2_core_SocketAddress *msg, bool value) {
UPB_FIELD_AT(msg, bool, UPB_SIZE(8, 8)) = value;
}
/* envoy.api.v2.core.TcpKeepalive */
UPB_INLINE envoy_api_v2_core_TcpKeepalive *envoy_api_v2_core_TcpKeepalive_new(upb_arena *arena) {
return (envoy_api_v2_core_TcpKeepalive *)upb_msg_new(&envoy_api_v2_core_TcpKeepalive_msginit, arena);
}
UPB_INLINE envoy_api_v2_core_TcpKeepalive *envoy_api_v2_core_TcpKeepalive_parsenew(upb_strview buf, upb_arena *arena) {
envoy_api_v2_core_TcpKeepalive *ret = envoy_api_v2_core_TcpKeepalive_new(arena);
return (ret && upb_decode(buf, ret, &envoy_api_v2_core_TcpKeepalive_msginit)) ? ret : NULL;
}
UPB_INLINE char *envoy_api_v2_core_TcpKeepalive_serialize(const envoy_api_v2_core_TcpKeepalive *msg, upb_arena *arena, size_t *len) {
return upb_encode(msg, &envoy_api_v2_core_TcpKeepalive_msginit, arena, len);
}
UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_core_TcpKeepalive_keepalive_probes(const envoy_api_v2_core_TcpKeepalive *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(0, 0)); }
UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_core_TcpKeepalive_keepalive_time(const envoy_api_v2_core_TcpKeepalive *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(4, 8)); }
UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_core_TcpKeepalive_keepalive_interval(const envoy_api_v2_core_TcpKeepalive *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(8, 16)); }
UPB_INLINE void envoy_api_v2_core_TcpKeepalive_set_keepalive_probes(envoy_api_v2_core_TcpKeepalive *msg, struct google_protobuf_UInt32Value* value) {
UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(0, 0)) = value;
}
UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_core_TcpKeepalive_mutable_keepalive_probes(envoy_api_v2_core_TcpKeepalive *msg, upb_arena *arena) {
struct google_protobuf_UInt32Value* sub = (struct google_protobuf_UInt32Value*)envoy_api_v2_core_TcpKeepalive_keepalive_probes(msg);
if (sub == NULL) {
sub = (struct google_protobuf_UInt32Value*)upb_msg_new(&google_protobuf_UInt32Value_msginit, arena);
if (!sub) return NULL;
envoy_api_v2_core_TcpKeepalive_set_keepalive_probes(msg, sub);
}
return sub;
}
UPB_INLINE void envoy_api_v2_core_TcpKeepalive_set_keepalive_time(envoy_api_v2_core_TcpKeepalive *msg, struct google_protobuf_UInt32Value* value) {
UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(4, 8)) = value;
}
UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_core_TcpKeepalive_mutable_keepalive_time(envoy_api_v2_core_TcpKeepalive *msg, upb_arena *arena) {
struct google_protobuf_UInt32Value* sub = (struct google_protobuf_UInt32Value*)envoy_api_v2_core_TcpKeepalive_keepalive_time(msg);
if (sub == NULL) {
sub = (struct google_protobuf_UInt32Value*)upb_msg_new(&google_protobuf_UInt32Value_msginit, arena);
if (!sub) return NULL;
envoy_api_v2_core_TcpKeepalive_set_keepalive_time(msg, sub);
}
return sub;
}
UPB_INLINE void envoy_api_v2_core_TcpKeepalive_set_keepalive_interval(envoy_api_v2_core_TcpKeepalive *msg, struct google_protobuf_UInt32Value* value) {
UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(8, 16)) = value;
}
UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_core_TcpKeepalive_mutable_keepalive_interval(envoy_api_v2_core_TcpKeepalive *msg, upb_arena *arena) {
struct google_protobuf_UInt32Value* sub = (struct google_protobuf_UInt32Value*)envoy_api_v2_core_TcpKeepalive_keepalive_interval(msg);
if (sub == NULL) {
sub = (struct google_protobuf_UInt32Value*)upb_msg_new(&google_protobuf_UInt32Value_msginit, arena);
if (!sub) return NULL;
envoy_api_v2_core_TcpKeepalive_set_keepalive_interval(msg, sub);
}
return sub;
}
/* envoy.api.v2.core.BindConfig */
UPB_INLINE envoy_api_v2_core_BindConfig *envoy_api_v2_core_BindConfig_new(upb_arena *arena) {
return (envoy_api_v2_core_BindConfig *)upb_msg_new(&envoy_api_v2_core_BindConfig_msginit, arena);
}
UPB_INLINE envoy_api_v2_core_BindConfig *envoy_api_v2_core_BindConfig_parsenew(upb_strview buf, upb_arena *arena) {
envoy_api_v2_core_BindConfig *ret = envoy_api_v2_core_BindConfig_new(arena);
return (ret && upb_decode(buf, ret, &envoy_api_v2_core_BindConfig_msginit)) ? ret : NULL;
}
UPB_INLINE char *envoy_api_v2_core_BindConfig_serialize(const envoy_api_v2_core_BindConfig *msg, upb_arena *arena, size_t *len) {
return upb_encode(msg, &envoy_api_v2_core_BindConfig_msginit, arena, len);
}
UPB_INLINE const envoy_api_v2_core_SocketAddress* envoy_api_v2_core_BindConfig_source_address(const envoy_api_v2_core_BindConfig *msg) { return UPB_FIELD_AT(msg, const envoy_api_v2_core_SocketAddress*, UPB_SIZE(0, 0)); }
UPB_INLINE const struct google_protobuf_BoolValue* envoy_api_v2_core_BindConfig_freebind(const envoy_api_v2_core_BindConfig *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_BoolValue*, UPB_SIZE(4, 8)); }
UPB_INLINE const struct envoy_api_v2_core_SocketOption* const* envoy_api_v2_core_BindConfig_socket_options(const envoy_api_v2_core_BindConfig *msg, size_t *len) { return (const struct envoy_api_v2_core_SocketOption* const*)_upb_array_accessor(msg, UPB_SIZE(8, 16), len); }
UPB_INLINE void envoy_api_v2_core_BindConfig_set_source_address(envoy_api_v2_core_BindConfig *msg, envoy_api_v2_core_SocketAddress* value) {
UPB_FIELD_AT(msg, envoy_api_v2_core_SocketAddress*, UPB_SIZE(0, 0)) = value;
}
UPB_INLINE struct envoy_api_v2_core_SocketAddress* envoy_api_v2_core_BindConfig_mutable_source_address(envoy_api_v2_core_BindConfig *msg, upb_arena *arena) {
struct envoy_api_v2_core_SocketAddress* sub = (struct envoy_api_v2_core_SocketAddress*)envoy_api_v2_core_BindConfig_source_address(msg);
if (sub == NULL) {
sub = (struct envoy_api_v2_core_SocketAddress*)upb_msg_new(&envoy_api_v2_core_SocketAddress_msginit, arena);
if (!sub) return NULL;
envoy_api_v2_core_BindConfig_set_source_address(msg, sub);
}
return sub;
}
UPB_INLINE void envoy_api_v2_core_BindConfig_set_freebind(envoy_api_v2_core_BindConfig *msg, struct google_protobuf_BoolValue* value) {
UPB_FIELD_AT(msg, struct google_protobuf_BoolValue*, UPB_SIZE(4, 8)) = value;
}
UPB_INLINE struct google_protobuf_BoolValue* envoy_api_v2_core_BindConfig_mutable_freebind(envoy_api_v2_core_BindConfig *msg, upb_arena *arena) {
struct google_protobuf_BoolValue* sub = (struct google_protobuf_BoolValue*)envoy_api_v2_core_BindConfig_freebind(msg);
if (sub == NULL) {
sub = (struct google_protobuf_BoolValue*)upb_msg_new(&google_protobuf_BoolValue_msginit, arena);
if (!sub) return NULL;
envoy_api_v2_core_BindConfig_set_freebind(msg, sub);
}
return sub;
}
UPB_INLINE struct envoy_api_v2_core_SocketOption** envoy_api_v2_core_BindConfig_mutable_socket_options(envoy_api_v2_core_BindConfig *msg, size_t *len) {
return (struct envoy_api_v2_core_SocketOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(8, 16), len);
}
UPB_INLINE struct envoy_api_v2_core_SocketOption** envoy_api_v2_core_BindConfig_resize_socket_options(envoy_api_v2_core_BindConfig *msg, size_t len, upb_arena *arena) {
return (struct envoy_api_v2_core_SocketOption**)_upb_array_resize_accessor(msg, UPB_SIZE(8, 16), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
}
UPB_INLINE struct envoy_api_v2_core_SocketOption* envoy_api_v2_core_BindConfig_add_socket_options(envoy_api_v2_core_BindConfig *msg, upb_arena *arena) {
struct envoy_api_v2_core_SocketOption* sub = (struct envoy_api_v2_core_SocketOption*)upb_msg_new(&envoy_api_v2_core_SocketOption_msginit, arena);
bool ok = _upb_array_append_accessor(
msg, UPB_SIZE(8, 16), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
if (!ok) return NULL;
return sub;
}
/* envoy.api.v2.core.Address */
UPB_INLINE envoy_api_v2_core_Address *envoy_api_v2_core_Address_new(upb_arena *arena) {
return (envoy_api_v2_core_Address *)upb_msg_new(&envoy_api_v2_core_Address_msginit, arena);
}
UPB_INLINE envoy_api_v2_core_Address *envoy_api_v2_core_Address_parsenew(upb_strview buf, upb_arena *arena) {
envoy_api_v2_core_Address *ret = envoy_api_v2_core_Address_new(arena);
return (ret && upb_decode(buf, ret, &envoy_api_v2_core_Address_msginit)) ? ret : NULL;
}
UPB_INLINE char *envoy_api_v2_core_Address_serialize(const envoy_api_v2_core_Address *msg, upb_arena *arena, size_t *len) {
return upb_encode(msg, &envoy_api_v2_core_Address_msginit, arena, len);
}
typedef enum {
envoy_api_v2_core_Address_address_socket_address = 1,
envoy_api_v2_core_Address_address_pipe = 2,
envoy_api_v2_core_Address_address_NOT_SET = 0,
} envoy_api_v2_core_Address_address_oneofcases;
UPB_INLINE envoy_api_v2_core_Address_address_oneofcases envoy_api_v2_core_Address_address_case(const envoy_api_v2_core_Address* msg) { return UPB_FIELD_AT(msg, int, UPB_SIZE(4, 8)); }
UPB_INLINE bool envoy_api_v2_core_Address_has_socket_address(const envoy_api_v2_core_Address *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(4, 8), 1); }
UPB_INLINE const envoy_api_v2_core_SocketAddress* envoy_api_v2_core_Address_socket_address(const envoy_api_v2_core_Address *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_core_SocketAddress*, UPB_SIZE(0, 0), UPB_SIZE(4, 8), 1, NULL); }
UPB_INLINE bool envoy_api_v2_core_Address_has_pipe(const envoy_api_v2_core_Address *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(4, 8), 2); }
UPB_INLINE const envoy_api_v2_core_Pipe* envoy_api_v2_core_Address_pipe(const envoy_api_v2_core_Address *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_core_Pipe*, UPB_SIZE(0, 0), UPB_SIZE(4, 8), 2, NULL); }
UPB_INLINE void envoy_api_v2_core_Address_set_socket_address(envoy_api_v2_core_Address *msg, envoy_api_v2_core_SocketAddress* value) {
UPB_WRITE_ONEOF(msg, envoy_api_v2_core_SocketAddress*, UPB_SIZE(0, 0), value, UPB_SIZE(4, 8), 1);
}
UPB_INLINE struct envoy_api_v2_core_SocketAddress* envoy_api_v2_core_Address_mutable_socket_address(envoy_api_v2_core_Address *msg, upb_arena *arena) {
struct envoy_api_v2_core_SocketAddress* sub = (struct envoy_api_v2_core_SocketAddress*)envoy_api_v2_core_Address_socket_address(msg);
if (sub == NULL) {
sub = (struct envoy_api_v2_core_SocketAddress*)upb_msg_new(&envoy_api_v2_core_SocketAddress_msginit, arena);
if (!sub) return NULL;
envoy_api_v2_core_Address_set_socket_address(msg, sub);
}
return sub;
}
UPB_INLINE void envoy_api_v2_core_Address_set_pipe(envoy_api_v2_core_Address *msg, envoy_api_v2_core_Pipe* value) {
UPB_WRITE_ONEOF(msg, envoy_api_v2_core_Pipe*, UPB_SIZE(0, 0), value, UPB_SIZE(4, 8), 2);
}
UPB_INLINE struct envoy_api_v2_core_Pipe* envoy_api_v2_core_Address_mutable_pipe(envoy_api_v2_core_Address *msg, upb_arena *arena) {
struct envoy_api_v2_core_Pipe* sub = (struct envoy_api_v2_core_Pipe*)envoy_api_v2_core_Address_pipe(msg);
if (sub == NULL) {
sub = (struct envoy_api_v2_core_Pipe*)upb_msg_new(&envoy_api_v2_core_Pipe_msginit, arena);
if (!sub) return NULL;
envoy_api_v2_core_Address_set_pipe(msg, sub);
}
return sub;
}
/* envoy.api.v2.core.CidrRange */
UPB_INLINE envoy_api_v2_core_CidrRange *envoy_api_v2_core_CidrRange_new(upb_arena *arena) {
return (envoy_api_v2_core_CidrRange *)upb_msg_new(&envoy_api_v2_core_CidrRange_msginit, arena);
}
UPB_INLINE envoy_api_v2_core_CidrRange *envoy_api_v2_core_CidrRange_parsenew(upb_strview buf, upb_arena *arena) {
envoy_api_v2_core_CidrRange *ret = envoy_api_v2_core_CidrRange_new(arena);
return (ret && upb_decode(buf, ret, &envoy_api_v2_core_CidrRange_msginit)) ? ret : NULL;
}
UPB_INLINE char *envoy_api_v2_core_CidrRange_serialize(const envoy_api_v2_core_CidrRange *msg, upb_arena *arena, size_t *len) {
return upb_encode(msg, &envoy_api_v2_core_CidrRange_msginit, arena, len);
}
UPB_INLINE upb_strview envoy_api_v2_core_CidrRange_address_prefix(const envoy_api_v2_core_CidrRange *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); }
UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_core_CidrRange_prefix_len(const envoy_api_v2_core_CidrRange *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(8, 16)); }
UPB_INLINE void envoy_api_v2_core_CidrRange_set_address_prefix(envoy_api_v2_core_CidrRange *msg, upb_strview value) {
UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value;
}
UPB_INLINE void envoy_api_v2_core_CidrRange_set_prefix_len(envoy_api_v2_core_CidrRange *msg, struct google_protobuf_UInt32Value* value) {
UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(8, 16)) = value;
}
UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_core_CidrRange_mutable_prefix_len(envoy_api_v2_core_CidrRange *msg, upb_arena *arena) {
struct google_protobuf_UInt32Value* sub = (struct google_protobuf_UInt32Value*)envoy_api_v2_core_CidrRange_prefix_len(msg);
if (sub == NULL) {
sub = (struct google_protobuf_UInt32Value*)upb_msg_new(&google_protobuf_UInt32Value_msginit, arena);
if (!sub) return NULL;
envoy_api_v2_core_CidrRange_set_prefix_len(msg, sub);
}
return sub;
}
#ifdef __cplusplus
} /* extern "C" */
#endif
#include "upb/port_undef.inc"
#endif /* ENVOY_API_V2_CORE_ADDRESS_PROTO_UPB_H_ */

@ -0,0 +1,179 @@
/* This file was generated by upbc (the upb compiler) from the input
* file:
*
* envoy/api/v2/core/base.proto
*
* Do not edit -- your changes will be discarded when the file is
* regenerated. */
#include <stddef.h>
#include "upb/msg.h"
#include "envoy/api/v2/core/base.upb.h"
#include "google/protobuf/any.upb.h"
#include "google/protobuf/struct.upb.h"
#include "google/protobuf/wrappers.upb.h"
#include "validate/validate.upb.h"
#include "gogoproto/gogo.upb.h"
#include "envoy/type/percent.upb.h"
#include "upb/port_def.inc"
static const upb_msglayout_field envoy_api_v2_core_Locality__fields[3] = {
{1, UPB_SIZE(0, 0), 0, 0, 9, 1},
{2, UPB_SIZE(8, 16), 0, 0, 9, 1},
{3, UPB_SIZE(16, 32), 0, 0, 9, 1},
};
const upb_msglayout envoy_api_v2_core_Locality_msginit = {
NULL,
&envoy_api_v2_core_Locality__fields[0],
UPB_SIZE(24, 48), 3, false,
};
static const upb_msglayout *const envoy_api_v2_core_Node_submsgs[2] = {
&envoy_api_v2_core_Locality_msginit,
&google_protobuf_Struct_msginit,
};
static const upb_msglayout_field envoy_api_v2_core_Node__fields[5] = {
{1, UPB_SIZE(0, 0), 0, 0, 9, 1},
{2, UPB_SIZE(8, 16), 0, 0, 9, 1},
{3, UPB_SIZE(24, 48), 0, 1, 11, 1},
{4, UPB_SIZE(28, 56), 0, 0, 11, 1},
{5, UPB_SIZE(16, 32), 0, 0, 9, 1},
};
const upb_msglayout envoy_api_v2_core_Node_msginit = {
&envoy_api_v2_core_Node_submsgs[0],
&envoy_api_v2_core_Node__fields[0],
UPB_SIZE(32, 64), 5, false,
};
static const upb_msglayout *const envoy_api_v2_core_Metadata_submsgs[1] = {
&envoy_api_v2_core_Metadata_FilterMetadataEntry_msginit,
};
static const upb_msglayout_field envoy_api_v2_core_Metadata__fields[1] = {
{1, UPB_SIZE(0, 0), 0, 0, 11, 3},
};
const upb_msglayout envoy_api_v2_core_Metadata_msginit = {
&envoy_api_v2_core_Metadata_submsgs[0],
&envoy_api_v2_core_Metadata__fields[0],
UPB_SIZE(4, 8), 1, false,
};
static const upb_msglayout *const envoy_api_v2_core_Metadata_FilterMetadataEntry_submsgs[1] = {
&google_protobuf_Struct_msginit,
};
static const upb_msglayout_field envoy_api_v2_core_Metadata_FilterMetadataEntry__fields[2] = {
{1, UPB_SIZE(0, 0), 0, 0, 9, 1},
{2, UPB_SIZE(8, 16), 0, 0, 11, 1},
};
const upb_msglayout envoy_api_v2_core_Metadata_FilterMetadataEntry_msginit = {
&envoy_api_v2_core_Metadata_FilterMetadataEntry_submsgs[0],
&envoy_api_v2_core_Metadata_FilterMetadataEntry__fields[0],
UPB_SIZE(16, 32), 2, false,
};
static const upb_msglayout_field envoy_api_v2_core_RuntimeUInt32__fields[2] = {
{2, UPB_SIZE(0, 0), 0, 0, 13, 1},
{3, UPB_SIZE(4, 8), 0, 0, 9, 1},
};
const upb_msglayout envoy_api_v2_core_RuntimeUInt32_msginit = {
NULL,
&envoy_api_v2_core_RuntimeUInt32__fields[0],
UPB_SIZE(16, 32), 2, false,
};
static const upb_msglayout_field envoy_api_v2_core_HeaderValue__fields[2] = {
{1, UPB_SIZE(0, 0), 0, 0, 9, 1},
{2, UPB_SIZE(8, 16), 0, 0, 9, 1},
};
const upb_msglayout envoy_api_v2_core_HeaderValue_msginit = {
NULL,
&envoy_api_v2_core_HeaderValue__fields[0],
UPB_SIZE(16, 32), 2, false,
};
static const upb_msglayout *const envoy_api_v2_core_HeaderValueOption_submsgs[2] = {
&envoy_api_v2_core_HeaderValue_msginit,
&google_protobuf_BoolValue_msginit,
};
static const upb_msglayout_field envoy_api_v2_core_HeaderValueOption__fields[2] = {
{1, UPB_SIZE(0, 0), 0, 0, 11, 1},
{2, UPB_SIZE(4, 8), 0, 1, 11, 1},
};
const upb_msglayout envoy_api_v2_core_HeaderValueOption_msginit = {
&envoy_api_v2_core_HeaderValueOption_submsgs[0],
&envoy_api_v2_core_HeaderValueOption__fields[0],
UPB_SIZE(8, 16), 2, false,
};
static const upb_msglayout_field envoy_api_v2_core_DataSource__fields[3] = {
{1, UPB_SIZE(0, 0), UPB_SIZE(-9, -17), 0, 9, 1},
{2, UPB_SIZE(0, 0), UPB_SIZE(-9, -17), 0, 12, 1},
{3, UPB_SIZE(0, 0), UPB_SIZE(-9, -17), 0, 9, 1},
};
const upb_msglayout envoy_api_v2_core_DataSource_msginit = {
NULL,
&envoy_api_v2_core_DataSource__fields[0],
UPB_SIZE(16, 32), 3, false,
};
static const upb_msglayout *const envoy_api_v2_core_TransportSocket_submsgs[2] = {
&google_protobuf_Any_msginit,
&google_protobuf_Struct_msginit,
};
static const upb_msglayout_field envoy_api_v2_core_TransportSocket__fields[3] = {
{1, UPB_SIZE(0, 0), 0, 0, 9, 1},
{2, UPB_SIZE(8, 16), UPB_SIZE(-13, -25), 1, 11, 1},
{3, UPB_SIZE(8, 16), UPB_SIZE(-13, -25), 0, 11, 1},
};
const upb_msglayout envoy_api_v2_core_TransportSocket_msginit = {
&envoy_api_v2_core_TransportSocket_submsgs[0],
&envoy_api_v2_core_TransportSocket__fields[0],
UPB_SIZE(16, 32), 3, false,
};
static const upb_msglayout_field envoy_api_v2_core_SocketOption__fields[6] = {
{1, UPB_SIZE(24, 24), 0, 0, 9, 1},
{2, UPB_SIZE(0, 0), 0, 0, 3, 1},
{3, UPB_SIZE(8, 8), 0, 0, 3, 1},
{4, UPB_SIZE(32, 40), UPB_SIZE(-41, -57), 0, 3, 1},
{5, UPB_SIZE(32, 40), UPB_SIZE(-41, -57), 0, 12, 1},
{6, UPB_SIZE(16, 16), 0, 0, 14, 1},
};
const upb_msglayout envoy_api_v2_core_SocketOption_msginit = {
NULL,
&envoy_api_v2_core_SocketOption__fields[0],
UPB_SIZE(48, 64), 6, false,
};
static const upb_msglayout *const envoy_api_v2_core_RuntimeFractionalPercent_submsgs[1] = {
&envoy_type_FractionalPercent_msginit,
};
static const upb_msglayout_field envoy_api_v2_core_RuntimeFractionalPercent__fields[2] = {
{1, UPB_SIZE(8, 16), 0, 0, 11, 1},
{2, UPB_SIZE(0, 0), 0, 0, 9, 1},
};
const upb_msglayout envoy_api_v2_core_RuntimeFractionalPercent_msginit = {
&envoy_api_v2_core_RuntimeFractionalPercent_submsgs[0],
&envoy_api_v2_core_RuntimeFractionalPercent__fields[0],
UPB_SIZE(16, 32), 2, false,
};
#include "upb/port_undef.inc"

@ -0,0 +1,507 @@
/* This file was generated by upbc (the upb compiler) from the input
* file:
*
* envoy/api/v2/core/base.proto
*
* Do not edit -- your changes will be discarded when the file is
* regenerated. */
#ifndef ENVOY_API_V2_CORE_BASE_PROTO_UPB_H_
#define ENVOY_API_V2_CORE_BASE_PROTO_UPB_H_
#include "upb/generated_util.h"
#include "upb/msg.h"
#include "upb/decode.h"
#include "upb/encode.h"
#include "upb/port_def.inc"
#ifdef __cplusplus
extern "C" {
#endif
struct envoy_api_v2_core_Locality;
struct envoy_api_v2_core_Node;
struct envoy_api_v2_core_Metadata;
struct envoy_api_v2_core_Metadata_FilterMetadataEntry;
struct envoy_api_v2_core_RuntimeUInt32;
struct envoy_api_v2_core_HeaderValue;
struct envoy_api_v2_core_HeaderValueOption;
struct envoy_api_v2_core_DataSource;
struct envoy_api_v2_core_TransportSocket;
struct envoy_api_v2_core_SocketOption;
struct envoy_api_v2_core_RuntimeFractionalPercent;
typedef struct envoy_api_v2_core_Locality envoy_api_v2_core_Locality;
typedef struct envoy_api_v2_core_Node envoy_api_v2_core_Node;
typedef struct envoy_api_v2_core_Metadata envoy_api_v2_core_Metadata;
typedef struct envoy_api_v2_core_Metadata_FilterMetadataEntry envoy_api_v2_core_Metadata_FilterMetadataEntry;
typedef struct envoy_api_v2_core_RuntimeUInt32 envoy_api_v2_core_RuntimeUInt32;
typedef struct envoy_api_v2_core_HeaderValue envoy_api_v2_core_HeaderValue;
typedef struct envoy_api_v2_core_HeaderValueOption envoy_api_v2_core_HeaderValueOption;
typedef struct envoy_api_v2_core_DataSource envoy_api_v2_core_DataSource;
typedef struct envoy_api_v2_core_TransportSocket envoy_api_v2_core_TransportSocket;
typedef struct envoy_api_v2_core_SocketOption envoy_api_v2_core_SocketOption;
typedef struct envoy_api_v2_core_RuntimeFractionalPercent envoy_api_v2_core_RuntimeFractionalPercent;
extern const upb_msglayout envoy_api_v2_core_Locality_msginit;
extern const upb_msglayout envoy_api_v2_core_Node_msginit;
extern const upb_msglayout envoy_api_v2_core_Metadata_msginit;
extern const upb_msglayout envoy_api_v2_core_Metadata_FilterMetadataEntry_msginit;
extern const upb_msglayout envoy_api_v2_core_RuntimeUInt32_msginit;
extern const upb_msglayout envoy_api_v2_core_HeaderValue_msginit;
extern const upb_msglayout envoy_api_v2_core_HeaderValueOption_msginit;
extern const upb_msglayout envoy_api_v2_core_DataSource_msginit;
extern const upb_msglayout envoy_api_v2_core_TransportSocket_msginit;
extern const upb_msglayout envoy_api_v2_core_SocketOption_msginit;
extern const upb_msglayout envoy_api_v2_core_RuntimeFractionalPercent_msginit;
struct google_protobuf_Any;
struct google_protobuf_Struct;
struct google_protobuf_BoolValue;
struct envoy_type_FractionalPercent;
extern const upb_msglayout google_protobuf_Any_msginit;
extern const upb_msglayout google_protobuf_Struct_msginit;
extern const upb_msglayout google_protobuf_BoolValue_msginit;
extern const upb_msglayout envoy_type_FractionalPercent_msginit;
/* Enums */
typedef enum {
envoy_api_v2_core_METHOD_UNSPECIFIED = 0,
envoy_api_v2_core_GET = 1,
envoy_api_v2_core_HEAD = 2,
envoy_api_v2_core_POST = 3,
envoy_api_v2_core_PUT = 4,
envoy_api_v2_core_DELETE = 5,
envoy_api_v2_core_CONNECT = 6,
envoy_api_v2_core_OPTIONS = 7,
envoy_api_v2_core_TRACE = 8
} envoy_api_v2_core_RequestMethod;
typedef enum {
envoy_api_v2_core_DEFAULT = 0,
envoy_api_v2_core_HIGH = 1
} envoy_api_v2_core_RoutingPriority;
typedef enum {
envoy_api_v2_core_SocketOption_STATE_PREBIND = 0,
envoy_api_v2_core_SocketOption_STATE_BOUND = 1,
envoy_api_v2_core_SocketOption_STATE_LISTENING = 2
} envoy_api_v2_core_SocketOption_SocketState;
/* envoy.api.v2.core.Locality */
UPB_INLINE envoy_api_v2_core_Locality *envoy_api_v2_core_Locality_new(upb_arena *arena) {
return (envoy_api_v2_core_Locality *)upb_msg_new(&envoy_api_v2_core_Locality_msginit, arena);
}
UPB_INLINE envoy_api_v2_core_Locality *envoy_api_v2_core_Locality_parsenew(upb_strview buf, upb_arena *arena) {
envoy_api_v2_core_Locality *ret = envoy_api_v2_core_Locality_new(arena);
return (ret && upb_decode(buf, ret, &envoy_api_v2_core_Locality_msginit)) ? ret : NULL;
}
UPB_INLINE char *envoy_api_v2_core_Locality_serialize(const envoy_api_v2_core_Locality *msg, upb_arena *arena, size_t *len) {
return upb_encode(msg, &envoy_api_v2_core_Locality_msginit, arena, len);
}
UPB_INLINE upb_strview envoy_api_v2_core_Locality_region(const envoy_api_v2_core_Locality *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); }
UPB_INLINE upb_strview envoy_api_v2_core_Locality_zone(const envoy_api_v2_core_Locality *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 16)); }
UPB_INLINE upb_strview envoy_api_v2_core_Locality_sub_zone(const envoy_api_v2_core_Locality *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(16, 32)); }
UPB_INLINE void envoy_api_v2_core_Locality_set_region(envoy_api_v2_core_Locality *msg, upb_strview value) {
UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value;
}
UPB_INLINE void envoy_api_v2_core_Locality_set_zone(envoy_api_v2_core_Locality *msg, upb_strview value) {
UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 16)) = value;
}
UPB_INLINE void envoy_api_v2_core_Locality_set_sub_zone(envoy_api_v2_core_Locality *msg, upb_strview value) {
UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(16, 32)) = value;
}
/* envoy.api.v2.core.Node */
UPB_INLINE envoy_api_v2_core_Node *envoy_api_v2_core_Node_new(upb_arena *arena) {
return (envoy_api_v2_core_Node *)upb_msg_new(&envoy_api_v2_core_Node_msginit, arena);
}
UPB_INLINE envoy_api_v2_core_Node *envoy_api_v2_core_Node_parsenew(upb_strview buf, upb_arena *arena) {
envoy_api_v2_core_Node *ret = envoy_api_v2_core_Node_new(arena);
return (ret && upb_decode(buf, ret, &envoy_api_v2_core_Node_msginit)) ? ret : NULL;
}
UPB_INLINE char *envoy_api_v2_core_Node_serialize(const envoy_api_v2_core_Node *msg, upb_arena *arena, size_t *len) {
return upb_encode(msg, &envoy_api_v2_core_Node_msginit, arena, len);
}
UPB_INLINE upb_strview envoy_api_v2_core_Node_id(const envoy_api_v2_core_Node *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); }
UPB_INLINE upb_strview envoy_api_v2_core_Node_cluster(const envoy_api_v2_core_Node *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 16)); }
UPB_INLINE const struct google_protobuf_Struct* envoy_api_v2_core_Node_metadata(const envoy_api_v2_core_Node *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Struct*, UPB_SIZE(24, 48)); }
UPB_INLINE const envoy_api_v2_core_Locality* envoy_api_v2_core_Node_locality(const envoy_api_v2_core_Node *msg) { return UPB_FIELD_AT(msg, const envoy_api_v2_core_Locality*, UPB_SIZE(28, 56)); }
UPB_INLINE upb_strview envoy_api_v2_core_Node_build_version(const envoy_api_v2_core_Node *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(16, 32)); }
UPB_INLINE void envoy_api_v2_core_Node_set_id(envoy_api_v2_core_Node *msg, upb_strview value) {
UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value;
}
UPB_INLINE void envoy_api_v2_core_Node_set_cluster(envoy_api_v2_core_Node *msg, upb_strview value) {
UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 16)) = value;
}
UPB_INLINE void envoy_api_v2_core_Node_set_metadata(envoy_api_v2_core_Node *msg, struct google_protobuf_Struct* value) {
UPB_FIELD_AT(msg, struct google_protobuf_Struct*, UPB_SIZE(24, 48)) = value;
}
UPB_INLINE struct google_protobuf_Struct* envoy_api_v2_core_Node_mutable_metadata(envoy_api_v2_core_Node *msg, upb_arena *arena) {
struct google_protobuf_Struct* sub = (struct google_protobuf_Struct*)envoy_api_v2_core_Node_metadata(msg);
if (sub == NULL) {
sub = (struct google_protobuf_Struct*)upb_msg_new(&google_protobuf_Struct_msginit, arena);
if (!sub) return NULL;
envoy_api_v2_core_Node_set_metadata(msg, sub);
}
return sub;
}
UPB_INLINE void envoy_api_v2_core_Node_set_locality(envoy_api_v2_core_Node *msg, envoy_api_v2_core_Locality* value) {
UPB_FIELD_AT(msg, envoy_api_v2_core_Locality*, UPB_SIZE(28, 56)) = value;
}
UPB_INLINE struct envoy_api_v2_core_Locality* envoy_api_v2_core_Node_mutable_locality(envoy_api_v2_core_Node *msg, upb_arena *arena) {
struct envoy_api_v2_core_Locality* sub = (struct envoy_api_v2_core_Locality*)envoy_api_v2_core_Node_locality(msg);
if (sub == NULL) {
sub = (struct envoy_api_v2_core_Locality*)upb_msg_new(&envoy_api_v2_core_Locality_msginit, arena);
if (!sub) return NULL;
envoy_api_v2_core_Node_set_locality(msg, sub);
}
return sub;
}
UPB_INLINE void envoy_api_v2_core_Node_set_build_version(envoy_api_v2_core_Node *msg, upb_strview value) {
UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(16, 32)) = value;
}
/* envoy.api.v2.core.Metadata */
UPB_INLINE envoy_api_v2_core_Metadata *envoy_api_v2_core_Metadata_new(upb_arena *arena) {
return (envoy_api_v2_core_Metadata *)upb_msg_new(&envoy_api_v2_core_Metadata_msginit, arena);
}
UPB_INLINE envoy_api_v2_core_Metadata *envoy_api_v2_core_Metadata_parsenew(upb_strview buf, upb_arena *arena) {
envoy_api_v2_core_Metadata *ret = envoy_api_v2_core_Metadata_new(arena);
return (ret && upb_decode(buf, ret, &envoy_api_v2_core_Metadata_msginit)) ? ret : NULL;
}
UPB_INLINE char *envoy_api_v2_core_Metadata_serialize(const envoy_api_v2_core_Metadata *msg, upb_arena *arena, size_t *len) {
return upb_encode(msg, &envoy_api_v2_core_Metadata_msginit, arena, len);
}
UPB_INLINE const envoy_api_v2_core_Metadata_FilterMetadataEntry* const* envoy_api_v2_core_Metadata_filter_metadata(const envoy_api_v2_core_Metadata *msg, size_t *len) { return (const envoy_api_v2_core_Metadata_FilterMetadataEntry* const*)_upb_array_accessor(msg, UPB_SIZE(0, 0), len); }
UPB_INLINE envoy_api_v2_core_Metadata_FilterMetadataEntry** envoy_api_v2_core_Metadata_mutable_filter_metadata(envoy_api_v2_core_Metadata *msg, size_t *len) {
return (envoy_api_v2_core_Metadata_FilterMetadataEntry**)_upb_array_mutable_accessor(msg, UPB_SIZE(0, 0), len);
}
UPB_INLINE envoy_api_v2_core_Metadata_FilterMetadataEntry** envoy_api_v2_core_Metadata_resize_filter_metadata(envoy_api_v2_core_Metadata *msg, size_t len, upb_arena *arena) {
return (envoy_api_v2_core_Metadata_FilterMetadataEntry**)_upb_array_resize_accessor(msg, UPB_SIZE(0, 0), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
}
UPB_INLINE struct envoy_api_v2_core_Metadata_FilterMetadataEntry* envoy_api_v2_core_Metadata_add_filter_metadata(envoy_api_v2_core_Metadata *msg, upb_arena *arena) {
struct envoy_api_v2_core_Metadata_FilterMetadataEntry* sub = (struct envoy_api_v2_core_Metadata_FilterMetadataEntry*)upb_msg_new(&envoy_api_v2_core_Metadata_FilterMetadataEntry_msginit, arena);
bool ok = _upb_array_append_accessor(
msg, UPB_SIZE(0, 0), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
if (!ok) return NULL;
return sub;
}
/* envoy.api.v2.core.Metadata.FilterMetadataEntry */
UPB_INLINE envoy_api_v2_core_Metadata_FilterMetadataEntry *envoy_api_v2_core_Metadata_FilterMetadataEntry_new(upb_arena *arena) {
return (envoy_api_v2_core_Metadata_FilterMetadataEntry *)upb_msg_new(&envoy_api_v2_core_Metadata_FilterMetadataEntry_msginit, arena);
}
UPB_INLINE envoy_api_v2_core_Metadata_FilterMetadataEntry *envoy_api_v2_core_Metadata_FilterMetadataEntry_parsenew(upb_strview buf, upb_arena *arena) {
envoy_api_v2_core_Metadata_FilterMetadataEntry *ret = envoy_api_v2_core_Metadata_FilterMetadataEntry_new(arena);
return (ret && upb_decode(buf, ret, &envoy_api_v2_core_Metadata_FilterMetadataEntry_msginit)) ? ret : NULL;
}
UPB_INLINE char *envoy_api_v2_core_Metadata_FilterMetadataEntry_serialize(const envoy_api_v2_core_Metadata_FilterMetadataEntry *msg, upb_arena *arena, size_t *len) {
return upb_encode(msg, &envoy_api_v2_core_Metadata_FilterMetadataEntry_msginit, arena, len);
}
UPB_INLINE upb_strview envoy_api_v2_core_Metadata_FilterMetadataEntry_key(const envoy_api_v2_core_Metadata_FilterMetadataEntry *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); }
UPB_INLINE const struct google_protobuf_Struct* envoy_api_v2_core_Metadata_FilterMetadataEntry_value(const envoy_api_v2_core_Metadata_FilterMetadataEntry *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Struct*, UPB_SIZE(8, 16)); }
UPB_INLINE void envoy_api_v2_core_Metadata_FilterMetadataEntry_set_key(envoy_api_v2_core_Metadata_FilterMetadataEntry *msg, upb_strview value) {
UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value;
}
UPB_INLINE void envoy_api_v2_core_Metadata_FilterMetadataEntry_set_value(envoy_api_v2_core_Metadata_FilterMetadataEntry *msg, struct google_protobuf_Struct* value) {
UPB_FIELD_AT(msg, struct google_protobuf_Struct*, UPB_SIZE(8, 16)) = value;
}
UPB_INLINE struct google_protobuf_Struct* envoy_api_v2_core_Metadata_FilterMetadataEntry_mutable_value(envoy_api_v2_core_Metadata_FilterMetadataEntry *msg, upb_arena *arena) {
struct google_protobuf_Struct* sub = (struct google_protobuf_Struct*)envoy_api_v2_core_Metadata_FilterMetadataEntry_value(msg);
if (sub == NULL) {
sub = (struct google_protobuf_Struct*)upb_msg_new(&google_protobuf_Struct_msginit, arena);
if (!sub) return NULL;
envoy_api_v2_core_Metadata_FilterMetadataEntry_set_value(msg, sub);
}
return sub;
}
/* envoy.api.v2.core.RuntimeUInt32 */
UPB_INLINE envoy_api_v2_core_RuntimeUInt32 *envoy_api_v2_core_RuntimeUInt32_new(upb_arena *arena) {
return (envoy_api_v2_core_RuntimeUInt32 *)upb_msg_new(&envoy_api_v2_core_RuntimeUInt32_msginit, arena);
}
UPB_INLINE envoy_api_v2_core_RuntimeUInt32 *envoy_api_v2_core_RuntimeUInt32_parsenew(upb_strview buf, upb_arena *arena) {
envoy_api_v2_core_RuntimeUInt32 *ret = envoy_api_v2_core_RuntimeUInt32_new(arena);
return (ret && upb_decode(buf, ret, &envoy_api_v2_core_RuntimeUInt32_msginit)) ? ret : NULL;
}
UPB_INLINE char *envoy_api_v2_core_RuntimeUInt32_serialize(const envoy_api_v2_core_RuntimeUInt32 *msg, upb_arena *arena, size_t *len) {
return upb_encode(msg, &envoy_api_v2_core_RuntimeUInt32_msginit, arena, len);
}
UPB_INLINE uint32_t envoy_api_v2_core_RuntimeUInt32_default_value(const envoy_api_v2_core_RuntimeUInt32 *msg) { return UPB_FIELD_AT(msg, uint32_t, UPB_SIZE(0, 0)); }
UPB_INLINE upb_strview envoy_api_v2_core_RuntimeUInt32_runtime_key(const envoy_api_v2_core_RuntimeUInt32 *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)); }
UPB_INLINE void envoy_api_v2_core_RuntimeUInt32_set_default_value(envoy_api_v2_core_RuntimeUInt32 *msg, uint32_t value) {
UPB_FIELD_AT(msg, uint32_t, UPB_SIZE(0, 0)) = value;
}
UPB_INLINE void envoy_api_v2_core_RuntimeUInt32_set_runtime_key(envoy_api_v2_core_RuntimeUInt32 *msg, upb_strview value) {
UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)) = value;
}
/* envoy.api.v2.core.HeaderValue */
UPB_INLINE envoy_api_v2_core_HeaderValue *envoy_api_v2_core_HeaderValue_new(upb_arena *arena) {
return (envoy_api_v2_core_HeaderValue *)upb_msg_new(&envoy_api_v2_core_HeaderValue_msginit, arena);
}
UPB_INLINE envoy_api_v2_core_HeaderValue *envoy_api_v2_core_HeaderValue_parsenew(upb_strview buf, upb_arena *arena) {
envoy_api_v2_core_HeaderValue *ret = envoy_api_v2_core_HeaderValue_new(arena);
return (ret && upb_decode(buf, ret, &envoy_api_v2_core_HeaderValue_msginit)) ? ret : NULL;
}
UPB_INLINE char *envoy_api_v2_core_HeaderValue_serialize(const envoy_api_v2_core_HeaderValue *msg, upb_arena *arena, size_t *len) {
return upb_encode(msg, &envoy_api_v2_core_HeaderValue_msginit, arena, len);
}
UPB_INLINE upb_strview envoy_api_v2_core_HeaderValue_key(const envoy_api_v2_core_HeaderValue *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); }
UPB_INLINE upb_strview envoy_api_v2_core_HeaderValue_value(const envoy_api_v2_core_HeaderValue *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 16)); }
UPB_INLINE void envoy_api_v2_core_HeaderValue_set_key(envoy_api_v2_core_HeaderValue *msg, upb_strview value) {
UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value;
}
UPB_INLINE void envoy_api_v2_core_HeaderValue_set_value(envoy_api_v2_core_HeaderValue *msg, upb_strview value) {
UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 16)) = value;
}
/* envoy.api.v2.core.HeaderValueOption */
UPB_INLINE envoy_api_v2_core_HeaderValueOption *envoy_api_v2_core_HeaderValueOption_new(upb_arena *arena) {
return (envoy_api_v2_core_HeaderValueOption *)upb_msg_new(&envoy_api_v2_core_HeaderValueOption_msginit, arena);
}
UPB_INLINE envoy_api_v2_core_HeaderValueOption *envoy_api_v2_core_HeaderValueOption_parsenew(upb_strview buf, upb_arena *arena) {
envoy_api_v2_core_HeaderValueOption *ret = envoy_api_v2_core_HeaderValueOption_new(arena);
return (ret && upb_decode(buf, ret, &envoy_api_v2_core_HeaderValueOption_msginit)) ? ret : NULL;
}
UPB_INLINE char *envoy_api_v2_core_HeaderValueOption_serialize(const envoy_api_v2_core_HeaderValueOption *msg, upb_arena *arena, size_t *len) {
return upb_encode(msg, &envoy_api_v2_core_HeaderValueOption_msginit, arena, len);
}
UPB_INLINE const envoy_api_v2_core_HeaderValue* envoy_api_v2_core_HeaderValueOption_header(const envoy_api_v2_core_HeaderValueOption *msg) { return UPB_FIELD_AT(msg, const envoy_api_v2_core_HeaderValue*, UPB_SIZE(0, 0)); }
UPB_INLINE const struct google_protobuf_BoolValue* envoy_api_v2_core_HeaderValueOption_append(const envoy_api_v2_core_HeaderValueOption *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_BoolValue*, UPB_SIZE(4, 8)); }
UPB_INLINE void envoy_api_v2_core_HeaderValueOption_set_header(envoy_api_v2_core_HeaderValueOption *msg, envoy_api_v2_core_HeaderValue* value) {
UPB_FIELD_AT(msg, envoy_api_v2_core_HeaderValue*, UPB_SIZE(0, 0)) = value;
}
UPB_INLINE struct envoy_api_v2_core_HeaderValue* envoy_api_v2_core_HeaderValueOption_mutable_header(envoy_api_v2_core_HeaderValueOption *msg, upb_arena *arena) {
struct envoy_api_v2_core_HeaderValue* sub = (struct envoy_api_v2_core_HeaderValue*)envoy_api_v2_core_HeaderValueOption_header(msg);
if (sub == NULL) {
sub = (struct envoy_api_v2_core_HeaderValue*)upb_msg_new(&envoy_api_v2_core_HeaderValue_msginit, arena);
if (!sub) return NULL;
envoy_api_v2_core_HeaderValueOption_set_header(msg, sub);
}
return sub;
}
UPB_INLINE void envoy_api_v2_core_HeaderValueOption_set_append(envoy_api_v2_core_HeaderValueOption *msg, struct google_protobuf_BoolValue* value) {
UPB_FIELD_AT(msg, struct google_protobuf_BoolValue*, UPB_SIZE(4, 8)) = value;
}
UPB_INLINE struct google_protobuf_BoolValue* envoy_api_v2_core_HeaderValueOption_mutable_append(envoy_api_v2_core_HeaderValueOption *msg, upb_arena *arena) {
struct google_protobuf_BoolValue* sub = (struct google_protobuf_BoolValue*)envoy_api_v2_core_HeaderValueOption_append(msg);
if (sub == NULL) {
sub = (struct google_protobuf_BoolValue*)upb_msg_new(&google_protobuf_BoolValue_msginit, arena);
if (!sub) return NULL;
envoy_api_v2_core_HeaderValueOption_set_append(msg, sub);
}
return sub;
}
/* envoy.api.v2.core.DataSource */
UPB_INLINE envoy_api_v2_core_DataSource *envoy_api_v2_core_DataSource_new(upb_arena *arena) {
return (envoy_api_v2_core_DataSource *)upb_msg_new(&envoy_api_v2_core_DataSource_msginit, arena);
}
UPB_INLINE envoy_api_v2_core_DataSource *envoy_api_v2_core_DataSource_parsenew(upb_strview buf, upb_arena *arena) {
envoy_api_v2_core_DataSource *ret = envoy_api_v2_core_DataSource_new(arena);
return (ret && upb_decode(buf, ret, &envoy_api_v2_core_DataSource_msginit)) ? ret : NULL;
}
UPB_INLINE char *envoy_api_v2_core_DataSource_serialize(const envoy_api_v2_core_DataSource *msg, upb_arena *arena, size_t *len) {
return upb_encode(msg, &envoy_api_v2_core_DataSource_msginit, arena, len);
}
typedef enum {
envoy_api_v2_core_DataSource_specifier_filename = 1,
envoy_api_v2_core_DataSource_specifier_inline_bytes = 2,
envoy_api_v2_core_DataSource_specifier_inline_string = 3,
envoy_api_v2_core_DataSource_specifier_NOT_SET = 0,
} envoy_api_v2_core_DataSource_specifier_oneofcases;
UPB_INLINE envoy_api_v2_core_DataSource_specifier_oneofcases envoy_api_v2_core_DataSource_specifier_case(const envoy_api_v2_core_DataSource* msg) { return UPB_FIELD_AT(msg, int, UPB_SIZE(8, 16)); }
UPB_INLINE bool envoy_api_v2_core_DataSource_has_filename(const envoy_api_v2_core_DataSource *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(8, 16), 1); }
UPB_INLINE upb_strview envoy_api_v2_core_DataSource_filename(const envoy_api_v2_core_DataSource *msg) { return UPB_READ_ONEOF(msg, upb_strview, UPB_SIZE(0, 0), UPB_SIZE(8, 16), 1, upb_strview_make("", strlen(""))); }
UPB_INLINE bool envoy_api_v2_core_DataSource_has_inline_bytes(const envoy_api_v2_core_DataSource *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(8, 16), 2); }
UPB_INLINE upb_strview envoy_api_v2_core_DataSource_inline_bytes(const envoy_api_v2_core_DataSource *msg) { return UPB_READ_ONEOF(msg, upb_strview, UPB_SIZE(0, 0), UPB_SIZE(8, 16), 2, upb_strview_make("", strlen(""))); }
UPB_INLINE bool envoy_api_v2_core_DataSource_has_inline_string(const envoy_api_v2_core_DataSource *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(8, 16), 3); }
UPB_INLINE upb_strview envoy_api_v2_core_DataSource_inline_string(const envoy_api_v2_core_DataSource *msg) { return UPB_READ_ONEOF(msg, upb_strview, UPB_SIZE(0, 0), UPB_SIZE(8, 16), 3, upb_strview_make("", strlen(""))); }
UPB_INLINE void envoy_api_v2_core_DataSource_set_filename(envoy_api_v2_core_DataSource *msg, upb_strview value) {
UPB_WRITE_ONEOF(msg, upb_strview, UPB_SIZE(0, 0), value, UPB_SIZE(8, 16), 1);
}
UPB_INLINE void envoy_api_v2_core_DataSource_set_inline_bytes(envoy_api_v2_core_DataSource *msg, upb_strview value) {
UPB_WRITE_ONEOF(msg, upb_strview, UPB_SIZE(0, 0), value, UPB_SIZE(8, 16), 2);
}
UPB_INLINE void envoy_api_v2_core_DataSource_set_inline_string(envoy_api_v2_core_DataSource *msg, upb_strview value) {
UPB_WRITE_ONEOF(msg, upb_strview, UPB_SIZE(0, 0), value, UPB_SIZE(8, 16), 3);
}
/* envoy.api.v2.core.TransportSocket */
UPB_INLINE envoy_api_v2_core_TransportSocket *envoy_api_v2_core_TransportSocket_new(upb_arena *arena) {
return (envoy_api_v2_core_TransportSocket *)upb_msg_new(&envoy_api_v2_core_TransportSocket_msginit, arena);
}
UPB_INLINE envoy_api_v2_core_TransportSocket *envoy_api_v2_core_TransportSocket_parsenew(upb_strview buf, upb_arena *arena) {
envoy_api_v2_core_TransportSocket *ret = envoy_api_v2_core_TransportSocket_new(arena);
return (ret && upb_decode(buf, ret, &envoy_api_v2_core_TransportSocket_msginit)) ? ret : NULL;
}
UPB_INLINE char *envoy_api_v2_core_TransportSocket_serialize(const envoy_api_v2_core_TransportSocket *msg, upb_arena *arena, size_t *len) {
return upb_encode(msg, &envoy_api_v2_core_TransportSocket_msginit, arena, len);
}
typedef enum {
envoy_api_v2_core_TransportSocket_config_type_config = 2,
envoy_api_v2_core_TransportSocket_config_type_typed_config = 3,
envoy_api_v2_core_TransportSocket_config_type_NOT_SET = 0,
} envoy_api_v2_core_TransportSocket_config_type_oneofcases;
UPB_INLINE envoy_api_v2_core_TransportSocket_config_type_oneofcases envoy_api_v2_core_TransportSocket_config_type_case(const envoy_api_v2_core_TransportSocket* msg) { return UPB_FIELD_AT(msg, int, UPB_SIZE(12, 24)); }
UPB_INLINE upb_strview envoy_api_v2_core_TransportSocket_name(const envoy_api_v2_core_TransportSocket *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); }
UPB_INLINE bool envoy_api_v2_core_TransportSocket_has_config(const envoy_api_v2_core_TransportSocket *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(12, 24), 2); }
UPB_INLINE const struct google_protobuf_Struct* envoy_api_v2_core_TransportSocket_config(const envoy_api_v2_core_TransportSocket *msg) { return UPB_READ_ONEOF(msg, const struct google_protobuf_Struct*, UPB_SIZE(8, 16), UPB_SIZE(12, 24), 2, NULL); }
UPB_INLINE bool envoy_api_v2_core_TransportSocket_has_typed_config(const envoy_api_v2_core_TransportSocket *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(12, 24), 3); }
UPB_INLINE const struct google_protobuf_Any* envoy_api_v2_core_TransportSocket_typed_config(const envoy_api_v2_core_TransportSocket *msg) { return UPB_READ_ONEOF(msg, const struct google_protobuf_Any*, UPB_SIZE(8, 16), UPB_SIZE(12, 24), 3, NULL); }
UPB_INLINE void envoy_api_v2_core_TransportSocket_set_name(envoy_api_v2_core_TransportSocket *msg, upb_strview value) {
UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value;
}
UPB_INLINE void envoy_api_v2_core_TransportSocket_set_config(envoy_api_v2_core_TransportSocket *msg, struct google_protobuf_Struct* value) {
UPB_WRITE_ONEOF(msg, struct google_protobuf_Struct*, UPB_SIZE(8, 16), value, UPB_SIZE(12, 24), 2);
}
UPB_INLINE struct google_protobuf_Struct* envoy_api_v2_core_TransportSocket_mutable_config(envoy_api_v2_core_TransportSocket *msg, upb_arena *arena) {
struct google_protobuf_Struct* sub = (struct google_protobuf_Struct*)envoy_api_v2_core_TransportSocket_config(msg);
if (sub == NULL) {
sub = (struct google_protobuf_Struct*)upb_msg_new(&google_protobuf_Struct_msginit, arena);
if (!sub) return NULL;
envoy_api_v2_core_TransportSocket_set_config(msg, sub);
}
return sub;
}
UPB_INLINE void envoy_api_v2_core_TransportSocket_set_typed_config(envoy_api_v2_core_TransportSocket *msg, struct google_protobuf_Any* value) {
UPB_WRITE_ONEOF(msg, struct google_protobuf_Any*, UPB_SIZE(8, 16), value, UPB_SIZE(12, 24), 3);
}
UPB_INLINE struct google_protobuf_Any* envoy_api_v2_core_TransportSocket_mutable_typed_config(envoy_api_v2_core_TransportSocket *msg, upb_arena *arena) {
struct google_protobuf_Any* sub = (struct google_protobuf_Any*)envoy_api_v2_core_TransportSocket_typed_config(msg);
if (sub == NULL) {
sub = (struct google_protobuf_Any*)upb_msg_new(&google_protobuf_Any_msginit, arena);
if (!sub) return NULL;
envoy_api_v2_core_TransportSocket_set_typed_config(msg, sub);
}
return sub;
}
/* envoy.api.v2.core.SocketOption */
UPB_INLINE envoy_api_v2_core_SocketOption *envoy_api_v2_core_SocketOption_new(upb_arena *arena) {
return (envoy_api_v2_core_SocketOption *)upb_msg_new(&envoy_api_v2_core_SocketOption_msginit, arena);
}
UPB_INLINE envoy_api_v2_core_SocketOption *envoy_api_v2_core_SocketOption_parsenew(upb_strview buf, upb_arena *arena) {
envoy_api_v2_core_SocketOption *ret = envoy_api_v2_core_SocketOption_new(arena);
return (ret && upb_decode(buf, ret, &envoy_api_v2_core_SocketOption_msginit)) ? ret : NULL;
}
UPB_INLINE char *envoy_api_v2_core_SocketOption_serialize(const envoy_api_v2_core_SocketOption *msg, upb_arena *arena, size_t *len) {
return upb_encode(msg, &envoy_api_v2_core_SocketOption_msginit, arena, len);
}
typedef enum {
envoy_api_v2_core_SocketOption_value_int_value = 4,
envoy_api_v2_core_SocketOption_value_buf_value = 5,
envoy_api_v2_core_SocketOption_value_NOT_SET = 0,
} envoy_api_v2_core_SocketOption_value_oneofcases;
UPB_INLINE envoy_api_v2_core_SocketOption_value_oneofcases envoy_api_v2_core_SocketOption_value_case(const envoy_api_v2_core_SocketOption* msg) { return UPB_FIELD_AT(msg, int, UPB_SIZE(40, 56)); }
UPB_INLINE upb_strview envoy_api_v2_core_SocketOption_description(const envoy_api_v2_core_SocketOption *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(24, 24)); }
UPB_INLINE int64_t envoy_api_v2_core_SocketOption_level(const envoy_api_v2_core_SocketOption *msg) { return UPB_FIELD_AT(msg, int64_t, UPB_SIZE(0, 0)); }
UPB_INLINE int64_t envoy_api_v2_core_SocketOption_name(const envoy_api_v2_core_SocketOption *msg) { return UPB_FIELD_AT(msg, int64_t, UPB_SIZE(8, 8)); }
UPB_INLINE bool envoy_api_v2_core_SocketOption_has_int_value(const envoy_api_v2_core_SocketOption *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(40, 56), 4); }
UPB_INLINE int64_t envoy_api_v2_core_SocketOption_int_value(const envoy_api_v2_core_SocketOption *msg) { return UPB_READ_ONEOF(msg, int64_t, UPB_SIZE(32, 40), UPB_SIZE(40, 56), 4, 0); }
UPB_INLINE bool envoy_api_v2_core_SocketOption_has_buf_value(const envoy_api_v2_core_SocketOption *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(40, 56), 5); }
UPB_INLINE upb_strview envoy_api_v2_core_SocketOption_buf_value(const envoy_api_v2_core_SocketOption *msg) { return UPB_READ_ONEOF(msg, upb_strview, UPB_SIZE(32, 40), UPB_SIZE(40, 56), 5, upb_strview_make("", strlen(""))); }
UPB_INLINE envoy_api_v2_core_SocketOption_SocketState envoy_api_v2_core_SocketOption_state(const envoy_api_v2_core_SocketOption *msg) { return UPB_FIELD_AT(msg, envoy_api_v2_core_SocketOption_SocketState, UPB_SIZE(16, 16)); }
UPB_INLINE void envoy_api_v2_core_SocketOption_set_description(envoy_api_v2_core_SocketOption *msg, upb_strview value) {
UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(24, 24)) = value;
}
UPB_INLINE void envoy_api_v2_core_SocketOption_set_level(envoy_api_v2_core_SocketOption *msg, int64_t value) {
UPB_FIELD_AT(msg, int64_t, UPB_SIZE(0, 0)) = value;
}
UPB_INLINE void envoy_api_v2_core_SocketOption_set_name(envoy_api_v2_core_SocketOption *msg, int64_t value) {
UPB_FIELD_AT(msg, int64_t, UPB_SIZE(8, 8)) = value;
}
UPB_INLINE void envoy_api_v2_core_SocketOption_set_int_value(envoy_api_v2_core_SocketOption *msg, int64_t value) {
UPB_WRITE_ONEOF(msg, int64_t, UPB_SIZE(32, 40), value, UPB_SIZE(40, 56), 4);
}
UPB_INLINE void envoy_api_v2_core_SocketOption_set_buf_value(envoy_api_v2_core_SocketOption *msg, upb_strview value) {
UPB_WRITE_ONEOF(msg, upb_strview, UPB_SIZE(32, 40), value, UPB_SIZE(40, 56), 5);
}
UPB_INLINE void envoy_api_v2_core_SocketOption_set_state(envoy_api_v2_core_SocketOption *msg, envoy_api_v2_core_SocketOption_SocketState value) {
UPB_FIELD_AT(msg, envoy_api_v2_core_SocketOption_SocketState, UPB_SIZE(16, 16)) = value;
}
/* envoy.api.v2.core.RuntimeFractionalPercent */
UPB_INLINE envoy_api_v2_core_RuntimeFractionalPercent *envoy_api_v2_core_RuntimeFractionalPercent_new(upb_arena *arena) {
return (envoy_api_v2_core_RuntimeFractionalPercent *)upb_msg_new(&envoy_api_v2_core_RuntimeFractionalPercent_msginit, arena);
}
UPB_INLINE envoy_api_v2_core_RuntimeFractionalPercent *envoy_api_v2_core_RuntimeFractionalPercent_parsenew(upb_strview buf, upb_arena *arena) {
envoy_api_v2_core_RuntimeFractionalPercent *ret = envoy_api_v2_core_RuntimeFractionalPercent_new(arena);
return (ret && upb_decode(buf, ret, &envoy_api_v2_core_RuntimeFractionalPercent_msginit)) ? ret : NULL;
}
UPB_INLINE char *envoy_api_v2_core_RuntimeFractionalPercent_serialize(const envoy_api_v2_core_RuntimeFractionalPercent *msg, upb_arena *arena, size_t *len) {
return upb_encode(msg, &envoy_api_v2_core_RuntimeFractionalPercent_msginit, arena, len);
}
UPB_INLINE const struct envoy_type_FractionalPercent* envoy_api_v2_core_RuntimeFractionalPercent_default_value(const envoy_api_v2_core_RuntimeFractionalPercent *msg) { return UPB_FIELD_AT(msg, const struct envoy_type_FractionalPercent*, UPB_SIZE(8, 16)); }
UPB_INLINE upb_strview envoy_api_v2_core_RuntimeFractionalPercent_runtime_key(const envoy_api_v2_core_RuntimeFractionalPercent *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); }
UPB_INLINE void envoy_api_v2_core_RuntimeFractionalPercent_set_default_value(envoy_api_v2_core_RuntimeFractionalPercent *msg, struct envoy_type_FractionalPercent* value) {
UPB_FIELD_AT(msg, struct envoy_type_FractionalPercent*, UPB_SIZE(8, 16)) = value;
}
UPB_INLINE struct envoy_type_FractionalPercent* envoy_api_v2_core_RuntimeFractionalPercent_mutable_default_value(envoy_api_v2_core_RuntimeFractionalPercent *msg, upb_arena *arena) {
struct envoy_type_FractionalPercent* sub = (struct envoy_type_FractionalPercent*)envoy_api_v2_core_RuntimeFractionalPercent_default_value(msg);
if (sub == NULL) {
sub = (struct envoy_type_FractionalPercent*)upb_msg_new(&envoy_type_FractionalPercent_msginit, arena);
if (!sub) return NULL;
envoy_api_v2_core_RuntimeFractionalPercent_set_default_value(msg, sub);
}
return sub;
}
UPB_INLINE void envoy_api_v2_core_RuntimeFractionalPercent_set_runtime_key(envoy_api_v2_core_RuntimeFractionalPercent *msg, upb_strview value) {
UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value;
}
#ifdef __cplusplus
} /* extern "C" */
#endif
#include "upb/port_undef.inc"
#endif /* ENVOY_API_V2_CORE_BASE_PROTO_UPB_H_ */

@ -0,0 +1,144 @@
/* This file was generated by upbc (the upb compiler) from the input
* file:
*
* envoy/api/v2/core/health_check.proto
*
* Do not edit -- your changes will be discarded when the file is
* regenerated. */
#include <stddef.h>
#include "upb/msg.h"
#include "envoy/api/v2/core/health_check.upb.h"
#include "envoy/api/v2/core/base.upb.h"
#include "google/protobuf/any.upb.h"
#include "google/protobuf/duration.upb.h"
#include "google/protobuf/struct.upb.h"
#include "google/protobuf/wrappers.upb.h"
#include "validate/validate.upb.h"
#include "gogoproto/gogo.upb.h"
#include "upb/port_def.inc"
static const upb_msglayout *const envoy_api_v2_core_HealthCheck_submsgs[15] = {
&envoy_api_v2_core_HealthCheck_CustomHealthCheck_msginit,
&envoy_api_v2_core_HealthCheck_GrpcHealthCheck_msginit,
&envoy_api_v2_core_HealthCheck_HttpHealthCheck_msginit,
&envoy_api_v2_core_HealthCheck_TcpHealthCheck_msginit,
&google_protobuf_BoolValue_msginit,
&google_protobuf_Duration_msginit,
&google_protobuf_UInt32Value_msginit,
};
static const upb_msglayout_field envoy_api_v2_core_HealthCheck__fields[17] = {
{1, UPB_SIZE(12, 24), 0, 5, 11, 1},
{2, UPB_SIZE(16, 32), 0, 5, 11, 1},
{3, UPB_SIZE(20, 40), 0, 5, 11, 1},
{4, UPB_SIZE(24, 48), 0, 6, 11, 1},
{5, UPB_SIZE(28, 56), 0, 6, 11, 1},
{6, UPB_SIZE(32, 64), 0, 6, 11, 1},
{7, UPB_SIZE(36, 72), 0, 4, 11, 1},
{8, UPB_SIZE(56, 112), UPB_SIZE(-61, -121), 2, 11, 1},
{9, UPB_SIZE(56, 112), UPB_SIZE(-61, -121), 3, 11, 1},
{11, UPB_SIZE(56, 112), UPB_SIZE(-61, -121), 1, 11, 1},
{12, UPB_SIZE(40, 80), 0, 5, 11, 1},
{13, UPB_SIZE(56, 112), UPB_SIZE(-61, -121), 0, 11, 1},
{14, UPB_SIZE(44, 88), 0, 5, 11, 1},
{15, UPB_SIZE(48, 96), 0, 5, 11, 1},
{16, UPB_SIZE(52, 104), 0, 5, 11, 1},
{17, UPB_SIZE(4, 8), 0, 0, 9, 1},
{18, UPB_SIZE(0, 0), 0, 0, 13, 1},
};
const upb_msglayout envoy_api_v2_core_HealthCheck_msginit = {
&envoy_api_v2_core_HealthCheck_submsgs[0],
&envoy_api_v2_core_HealthCheck__fields[0],
UPB_SIZE(64, 128), 17, false,
};
static const upb_msglayout_field envoy_api_v2_core_HealthCheck_Payload__fields[2] = {
{1, UPB_SIZE(0, 0), UPB_SIZE(-9, -17), 0, 9, 1},
{2, UPB_SIZE(0, 0), UPB_SIZE(-9, -17), 0, 12, 1},
};
const upb_msglayout envoy_api_v2_core_HealthCheck_Payload_msginit = {
NULL,
&envoy_api_v2_core_HealthCheck_Payload__fields[0],
UPB_SIZE(16, 32), 2, false,
};
static const upb_msglayout *const envoy_api_v2_core_HealthCheck_HttpHealthCheck_submsgs[3] = {
&envoy_api_v2_core_HeaderValueOption_msginit,
&envoy_api_v2_core_HealthCheck_Payload_msginit,
};
static const upb_msglayout_field envoy_api_v2_core_HealthCheck_HttpHealthCheck__fields[8] = {
{1, UPB_SIZE(4, 8), 0, 0, 9, 1},
{2, UPB_SIZE(12, 24), 0, 0, 9, 1},
{3, UPB_SIZE(28, 56), 0, 1, 11, 1},
{4, UPB_SIZE(32, 64), 0, 1, 11, 1},
{5, UPB_SIZE(20, 40), 0, 0, 9, 1},
{6, UPB_SIZE(36, 72), 0, 0, 11, 3},
{7, UPB_SIZE(0, 0), 0, 0, 8, 1},
{8, UPB_SIZE(40, 80), 0, 0, 9, 3},
};
const upb_msglayout envoy_api_v2_core_HealthCheck_HttpHealthCheck_msginit = {
&envoy_api_v2_core_HealthCheck_HttpHealthCheck_submsgs[0],
&envoy_api_v2_core_HealthCheck_HttpHealthCheck__fields[0],
UPB_SIZE(48, 96), 8, false,
};
static const upb_msglayout *const envoy_api_v2_core_HealthCheck_TcpHealthCheck_submsgs[2] = {
&envoy_api_v2_core_HealthCheck_Payload_msginit,
};
static const upb_msglayout_field envoy_api_v2_core_HealthCheck_TcpHealthCheck__fields[2] = {
{1, UPB_SIZE(0, 0), 0, 0, 11, 1},
{2, UPB_SIZE(4, 8), 0, 0, 11, 3},
};
const upb_msglayout envoy_api_v2_core_HealthCheck_TcpHealthCheck_msginit = {
&envoy_api_v2_core_HealthCheck_TcpHealthCheck_submsgs[0],
&envoy_api_v2_core_HealthCheck_TcpHealthCheck__fields[0],
UPB_SIZE(8, 16), 2, false,
};
static const upb_msglayout_field envoy_api_v2_core_HealthCheck_RedisHealthCheck__fields[1] = {
{1, UPB_SIZE(0, 0), 0, 0, 9, 1},
};
const upb_msglayout envoy_api_v2_core_HealthCheck_RedisHealthCheck_msginit = {
NULL,
&envoy_api_v2_core_HealthCheck_RedisHealthCheck__fields[0],
UPB_SIZE(8, 16), 1, false,
};
static const upb_msglayout_field envoy_api_v2_core_HealthCheck_GrpcHealthCheck__fields[1] = {
{1, UPB_SIZE(0, 0), 0, 0, 9, 1},
};
const upb_msglayout envoy_api_v2_core_HealthCheck_GrpcHealthCheck_msginit = {
NULL,
&envoy_api_v2_core_HealthCheck_GrpcHealthCheck__fields[0],
UPB_SIZE(8, 16), 1, false,
};
static const upb_msglayout *const envoy_api_v2_core_HealthCheck_CustomHealthCheck_submsgs[2] = {
&google_protobuf_Any_msginit,
&google_protobuf_Struct_msginit,
};
static const upb_msglayout_field envoy_api_v2_core_HealthCheck_CustomHealthCheck__fields[3] = {
{1, UPB_SIZE(0, 0), 0, 0, 9, 1},
{2, UPB_SIZE(8, 16), UPB_SIZE(-13, -25), 1, 11, 1},
{3, UPB_SIZE(8, 16), UPB_SIZE(-13, -25), 0, 11, 1},
};
const upb_msglayout envoy_api_v2_core_HealthCheck_CustomHealthCheck_msginit = {
&envoy_api_v2_core_HealthCheck_CustomHealthCheck_submsgs[0],
&envoy_api_v2_core_HealthCheck_CustomHealthCheck__fields[0],
UPB_SIZE(16, 32), 3, false,
};
#include "upb/port_undef.inc"

@ -0,0 +1,559 @@
/* This file was generated by upbc (the upb compiler) from the input
* file:
*
* envoy/api/v2/core/health_check.proto
*
* Do not edit -- your changes will be discarded when the file is
* regenerated. */
#ifndef ENVOY_API_V2_CORE_HEALTH_CHECK_PROTO_UPB_H_
#define ENVOY_API_V2_CORE_HEALTH_CHECK_PROTO_UPB_H_
#include "upb/generated_util.h"
#include "upb/msg.h"
#include "upb/decode.h"
#include "upb/encode.h"
#include "upb/port_def.inc"
#ifdef __cplusplus
extern "C" {
#endif
struct envoy_api_v2_core_HealthCheck;
struct envoy_api_v2_core_HealthCheck_Payload;
struct envoy_api_v2_core_HealthCheck_HttpHealthCheck;
struct envoy_api_v2_core_HealthCheck_TcpHealthCheck;
struct envoy_api_v2_core_HealthCheck_RedisHealthCheck;
struct envoy_api_v2_core_HealthCheck_GrpcHealthCheck;
struct envoy_api_v2_core_HealthCheck_CustomHealthCheck;
typedef struct envoy_api_v2_core_HealthCheck envoy_api_v2_core_HealthCheck;
typedef struct envoy_api_v2_core_HealthCheck_Payload envoy_api_v2_core_HealthCheck_Payload;
typedef struct envoy_api_v2_core_HealthCheck_HttpHealthCheck envoy_api_v2_core_HealthCheck_HttpHealthCheck;
typedef struct envoy_api_v2_core_HealthCheck_TcpHealthCheck envoy_api_v2_core_HealthCheck_TcpHealthCheck;
typedef struct envoy_api_v2_core_HealthCheck_RedisHealthCheck envoy_api_v2_core_HealthCheck_RedisHealthCheck;
typedef struct envoy_api_v2_core_HealthCheck_GrpcHealthCheck envoy_api_v2_core_HealthCheck_GrpcHealthCheck;
typedef struct envoy_api_v2_core_HealthCheck_CustomHealthCheck envoy_api_v2_core_HealthCheck_CustomHealthCheck;
extern const upb_msglayout envoy_api_v2_core_HealthCheck_msginit;
extern const upb_msglayout envoy_api_v2_core_HealthCheck_Payload_msginit;
extern const upb_msglayout envoy_api_v2_core_HealthCheck_HttpHealthCheck_msginit;
extern const upb_msglayout envoy_api_v2_core_HealthCheck_TcpHealthCheck_msginit;
extern const upb_msglayout envoy_api_v2_core_HealthCheck_RedisHealthCheck_msginit;
extern const upb_msglayout envoy_api_v2_core_HealthCheck_GrpcHealthCheck_msginit;
extern const upb_msglayout envoy_api_v2_core_HealthCheck_CustomHealthCheck_msginit;
struct google_protobuf_Any;
struct google_protobuf_Struct;
struct google_protobuf_UInt32Value;
struct google_protobuf_BoolValue;
struct google_protobuf_Duration;
struct envoy_api_v2_core_HeaderValueOption;
extern const upb_msglayout google_protobuf_Any_msginit;
extern const upb_msglayout google_protobuf_Struct_msginit;
extern const upb_msglayout google_protobuf_UInt32Value_msginit;
extern const upb_msglayout google_protobuf_BoolValue_msginit;
extern const upb_msglayout google_protobuf_Duration_msginit;
extern const upb_msglayout envoy_api_v2_core_HeaderValueOption_msginit;
/* Enums */
typedef enum {
envoy_api_v2_core_UNKNOWN = 0,
envoy_api_v2_core_HEALTHY = 1,
envoy_api_v2_core_UNHEALTHY = 2,
envoy_api_v2_core_DRAINING = 3,
envoy_api_v2_core_TIMEOUT = 4
} envoy_api_v2_core_HealthStatus;
/* envoy.api.v2.core.HealthCheck */
UPB_INLINE envoy_api_v2_core_HealthCheck *envoy_api_v2_core_HealthCheck_new(upb_arena *arena) {
return (envoy_api_v2_core_HealthCheck *)upb_msg_new(&envoy_api_v2_core_HealthCheck_msginit, arena);
}
UPB_INLINE envoy_api_v2_core_HealthCheck *envoy_api_v2_core_HealthCheck_parsenew(upb_strview buf, upb_arena *arena) {
envoy_api_v2_core_HealthCheck *ret = envoy_api_v2_core_HealthCheck_new(arena);
return (ret && upb_decode(buf, ret, &envoy_api_v2_core_HealthCheck_msginit)) ? ret : NULL;
}
UPB_INLINE char *envoy_api_v2_core_HealthCheck_serialize(const envoy_api_v2_core_HealthCheck *msg, upb_arena *arena, size_t *len) {
return upb_encode(msg, &envoy_api_v2_core_HealthCheck_msginit, arena, len);
}
typedef enum {
envoy_api_v2_core_HealthCheck_health_checker_http_health_check = 8,
envoy_api_v2_core_HealthCheck_health_checker_tcp_health_check = 9,
envoy_api_v2_core_HealthCheck_health_checker_grpc_health_check = 11,
envoy_api_v2_core_HealthCheck_health_checker_custom_health_check = 13,
envoy_api_v2_core_HealthCheck_health_checker_NOT_SET = 0,
} envoy_api_v2_core_HealthCheck_health_checker_oneofcases;
UPB_INLINE envoy_api_v2_core_HealthCheck_health_checker_oneofcases envoy_api_v2_core_HealthCheck_health_checker_case(const envoy_api_v2_core_HealthCheck* msg) { return UPB_FIELD_AT(msg, int, UPB_SIZE(60, 120)); }
UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_timeout(const envoy_api_v2_core_HealthCheck *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(12, 24)); }
UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_interval(const envoy_api_v2_core_HealthCheck *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(16, 32)); }
UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_interval_jitter(const envoy_api_v2_core_HealthCheck *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(20, 40)); }
UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_core_HealthCheck_unhealthy_threshold(const envoy_api_v2_core_HealthCheck *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(24, 48)); }
UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_core_HealthCheck_healthy_threshold(const envoy_api_v2_core_HealthCheck *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(28, 56)); }
UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_core_HealthCheck_alt_port(const envoy_api_v2_core_HealthCheck *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(32, 64)); }
UPB_INLINE const struct google_protobuf_BoolValue* envoy_api_v2_core_HealthCheck_reuse_connection(const envoy_api_v2_core_HealthCheck *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_BoolValue*, UPB_SIZE(36, 72)); }
UPB_INLINE bool envoy_api_v2_core_HealthCheck_has_http_health_check(const envoy_api_v2_core_HealthCheck *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(60, 120), 8); }
UPB_INLINE const envoy_api_v2_core_HealthCheck_HttpHealthCheck* envoy_api_v2_core_HealthCheck_http_health_check(const envoy_api_v2_core_HealthCheck *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_core_HealthCheck_HttpHealthCheck*, UPB_SIZE(56, 112), UPB_SIZE(60, 120), 8, NULL); }
UPB_INLINE bool envoy_api_v2_core_HealthCheck_has_tcp_health_check(const envoy_api_v2_core_HealthCheck *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(60, 120), 9); }
UPB_INLINE const envoy_api_v2_core_HealthCheck_TcpHealthCheck* envoy_api_v2_core_HealthCheck_tcp_health_check(const envoy_api_v2_core_HealthCheck *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_core_HealthCheck_TcpHealthCheck*, UPB_SIZE(56, 112), UPB_SIZE(60, 120), 9, NULL); }
UPB_INLINE bool envoy_api_v2_core_HealthCheck_has_grpc_health_check(const envoy_api_v2_core_HealthCheck *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(60, 120), 11); }
UPB_INLINE const envoy_api_v2_core_HealthCheck_GrpcHealthCheck* envoy_api_v2_core_HealthCheck_grpc_health_check(const envoy_api_v2_core_HealthCheck *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_core_HealthCheck_GrpcHealthCheck*, UPB_SIZE(56, 112), UPB_SIZE(60, 120), 11, NULL); }
UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_no_traffic_interval(const envoy_api_v2_core_HealthCheck *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(40, 80)); }
UPB_INLINE bool envoy_api_v2_core_HealthCheck_has_custom_health_check(const envoy_api_v2_core_HealthCheck *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(60, 120), 13); }
UPB_INLINE const envoy_api_v2_core_HealthCheck_CustomHealthCheck* envoy_api_v2_core_HealthCheck_custom_health_check(const envoy_api_v2_core_HealthCheck *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_core_HealthCheck_CustomHealthCheck*, UPB_SIZE(56, 112), UPB_SIZE(60, 120), 13, NULL); }
UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_unhealthy_interval(const envoy_api_v2_core_HealthCheck *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(44, 88)); }
UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_unhealthy_edge_interval(const envoy_api_v2_core_HealthCheck *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(48, 96)); }
UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_healthy_edge_interval(const envoy_api_v2_core_HealthCheck *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(52, 104)); }
UPB_INLINE upb_strview envoy_api_v2_core_HealthCheck_event_log_path(const envoy_api_v2_core_HealthCheck *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)); }
UPB_INLINE uint32_t envoy_api_v2_core_HealthCheck_interval_jitter_percent(const envoy_api_v2_core_HealthCheck *msg) { return UPB_FIELD_AT(msg, uint32_t, UPB_SIZE(0, 0)); }
UPB_INLINE void envoy_api_v2_core_HealthCheck_set_timeout(envoy_api_v2_core_HealthCheck *msg, struct google_protobuf_Duration* value) {
UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(12, 24)) = value;
}
UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_mutable_timeout(envoy_api_v2_core_HealthCheck *msg, upb_arena *arena) {
struct google_protobuf_Duration* sub = (struct google_protobuf_Duration*)envoy_api_v2_core_HealthCheck_timeout(msg);
if (sub == NULL) {
sub = (struct google_protobuf_Duration*)upb_msg_new(&google_protobuf_Duration_msginit, arena);
if (!sub) return NULL;
envoy_api_v2_core_HealthCheck_set_timeout(msg, sub);
}
return sub;
}
UPB_INLINE void envoy_api_v2_core_HealthCheck_set_interval(envoy_api_v2_core_HealthCheck *msg, struct google_protobuf_Duration* value) {
UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(16, 32)) = value;
}
UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_mutable_interval(envoy_api_v2_core_HealthCheck *msg, upb_arena *arena) {
struct google_protobuf_Duration* sub = (struct google_protobuf_Duration*)envoy_api_v2_core_HealthCheck_interval(msg);
if (sub == NULL) {
sub = (struct google_protobuf_Duration*)upb_msg_new(&google_protobuf_Duration_msginit, arena);
if (!sub) return NULL;
envoy_api_v2_core_HealthCheck_set_interval(msg, sub);
}
return sub;
}
UPB_INLINE void envoy_api_v2_core_HealthCheck_set_interval_jitter(envoy_api_v2_core_HealthCheck *msg, struct google_protobuf_Duration* value) {
UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(20, 40)) = value;
}
UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_mutable_interval_jitter(envoy_api_v2_core_HealthCheck *msg, upb_arena *arena) {
struct google_protobuf_Duration* sub = (struct google_protobuf_Duration*)envoy_api_v2_core_HealthCheck_interval_jitter(msg);
if (sub == NULL) {
sub = (struct google_protobuf_Duration*)upb_msg_new(&google_protobuf_Duration_msginit, arena);
if (!sub) return NULL;
envoy_api_v2_core_HealthCheck_set_interval_jitter(msg, sub);
}
return sub;
}
UPB_INLINE void envoy_api_v2_core_HealthCheck_set_unhealthy_threshold(envoy_api_v2_core_HealthCheck *msg, struct google_protobuf_UInt32Value* value) {
UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(24, 48)) = value;
}
UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_core_HealthCheck_mutable_unhealthy_threshold(envoy_api_v2_core_HealthCheck *msg, upb_arena *arena) {
struct google_protobuf_UInt32Value* sub = (struct google_protobuf_UInt32Value*)envoy_api_v2_core_HealthCheck_unhealthy_threshold(msg);
if (sub == NULL) {
sub = (struct google_protobuf_UInt32Value*)upb_msg_new(&google_protobuf_UInt32Value_msginit, arena);
if (!sub) return NULL;
envoy_api_v2_core_HealthCheck_set_unhealthy_threshold(msg, sub);
}
return sub;
}
UPB_INLINE void envoy_api_v2_core_HealthCheck_set_healthy_threshold(envoy_api_v2_core_HealthCheck *msg, struct google_protobuf_UInt32Value* value) {
UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(28, 56)) = value;
}
UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_core_HealthCheck_mutable_healthy_threshold(envoy_api_v2_core_HealthCheck *msg, upb_arena *arena) {
struct google_protobuf_UInt32Value* sub = (struct google_protobuf_UInt32Value*)envoy_api_v2_core_HealthCheck_healthy_threshold(msg);
if (sub == NULL) {
sub = (struct google_protobuf_UInt32Value*)upb_msg_new(&google_protobuf_UInt32Value_msginit, arena);
if (!sub) return NULL;
envoy_api_v2_core_HealthCheck_set_healthy_threshold(msg, sub);
}
return sub;
}
UPB_INLINE void envoy_api_v2_core_HealthCheck_set_alt_port(envoy_api_v2_core_HealthCheck *msg, struct google_protobuf_UInt32Value* value) {
UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(32, 64)) = value;
}
UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_core_HealthCheck_mutable_alt_port(envoy_api_v2_core_HealthCheck *msg, upb_arena *arena) {
struct google_protobuf_UInt32Value* sub = (struct google_protobuf_UInt32Value*)envoy_api_v2_core_HealthCheck_alt_port(msg);
if (sub == NULL) {
sub = (struct google_protobuf_UInt32Value*)upb_msg_new(&google_protobuf_UInt32Value_msginit, arena);
if (!sub) return NULL;
envoy_api_v2_core_HealthCheck_set_alt_port(msg, sub);
}
return sub;
}
UPB_INLINE void envoy_api_v2_core_HealthCheck_set_reuse_connection(envoy_api_v2_core_HealthCheck *msg, struct google_protobuf_BoolValue* value) {
UPB_FIELD_AT(msg, struct google_protobuf_BoolValue*, UPB_SIZE(36, 72)) = value;
}
UPB_INLINE struct google_protobuf_BoolValue* envoy_api_v2_core_HealthCheck_mutable_reuse_connection(envoy_api_v2_core_HealthCheck *msg, upb_arena *arena) {
struct google_protobuf_BoolValue* sub = (struct google_protobuf_BoolValue*)envoy_api_v2_core_HealthCheck_reuse_connection(msg);
if (sub == NULL) {
sub = (struct google_protobuf_BoolValue*)upb_msg_new(&google_protobuf_BoolValue_msginit, arena);
if (!sub) return NULL;
envoy_api_v2_core_HealthCheck_set_reuse_connection(msg, sub);
}
return sub;
}
UPB_INLINE void envoy_api_v2_core_HealthCheck_set_http_health_check(envoy_api_v2_core_HealthCheck *msg, envoy_api_v2_core_HealthCheck_HttpHealthCheck* value) {
UPB_WRITE_ONEOF(msg, envoy_api_v2_core_HealthCheck_HttpHealthCheck*, UPB_SIZE(56, 112), value, UPB_SIZE(60, 120), 8);
}
UPB_INLINE struct envoy_api_v2_core_HealthCheck_HttpHealthCheck* envoy_api_v2_core_HealthCheck_mutable_http_health_check(envoy_api_v2_core_HealthCheck *msg, upb_arena *arena) {
struct envoy_api_v2_core_HealthCheck_HttpHealthCheck* sub = (struct envoy_api_v2_core_HealthCheck_HttpHealthCheck*)envoy_api_v2_core_HealthCheck_http_health_check(msg);
if (sub == NULL) {
sub = (struct envoy_api_v2_core_HealthCheck_HttpHealthCheck*)upb_msg_new(&envoy_api_v2_core_HealthCheck_HttpHealthCheck_msginit, arena);
if (!sub) return NULL;
envoy_api_v2_core_HealthCheck_set_http_health_check(msg, sub);
}
return sub;
}
UPB_INLINE void envoy_api_v2_core_HealthCheck_set_tcp_health_check(envoy_api_v2_core_HealthCheck *msg, envoy_api_v2_core_HealthCheck_TcpHealthCheck* value) {
UPB_WRITE_ONEOF(msg, envoy_api_v2_core_HealthCheck_TcpHealthCheck*, UPB_SIZE(56, 112), value, UPB_SIZE(60, 120), 9);
}
UPB_INLINE struct envoy_api_v2_core_HealthCheck_TcpHealthCheck* envoy_api_v2_core_HealthCheck_mutable_tcp_health_check(envoy_api_v2_core_HealthCheck *msg, upb_arena *arena) {
struct envoy_api_v2_core_HealthCheck_TcpHealthCheck* sub = (struct envoy_api_v2_core_HealthCheck_TcpHealthCheck*)envoy_api_v2_core_HealthCheck_tcp_health_check(msg);
if (sub == NULL) {
sub = (struct envoy_api_v2_core_HealthCheck_TcpHealthCheck*)upb_msg_new(&envoy_api_v2_core_HealthCheck_TcpHealthCheck_msginit, arena);
if (!sub) return NULL;
envoy_api_v2_core_HealthCheck_set_tcp_health_check(msg, sub);
}
return sub;
}
UPB_INLINE void envoy_api_v2_core_HealthCheck_set_grpc_health_check(envoy_api_v2_core_HealthCheck *msg, envoy_api_v2_core_HealthCheck_GrpcHealthCheck* value) {
UPB_WRITE_ONEOF(msg, envoy_api_v2_core_HealthCheck_GrpcHealthCheck*, UPB_SIZE(56, 112), value, UPB_SIZE(60, 120), 11);
}
UPB_INLINE struct envoy_api_v2_core_HealthCheck_GrpcHealthCheck* envoy_api_v2_core_HealthCheck_mutable_grpc_health_check(envoy_api_v2_core_HealthCheck *msg, upb_arena *arena) {
struct envoy_api_v2_core_HealthCheck_GrpcHealthCheck* sub = (struct envoy_api_v2_core_HealthCheck_GrpcHealthCheck*)envoy_api_v2_core_HealthCheck_grpc_health_check(msg);
if (sub == NULL) {
sub = (struct envoy_api_v2_core_HealthCheck_GrpcHealthCheck*)upb_msg_new(&envoy_api_v2_core_HealthCheck_GrpcHealthCheck_msginit, arena);
if (!sub) return NULL;
envoy_api_v2_core_HealthCheck_set_grpc_health_check(msg, sub);
}
return sub;
}
UPB_INLINE void envoy_api_v2_core_HealthCheck_set_no_traffic_interval(envoy_api_v2_core_HealthCheck *msg, struct google_protobuf_Duration* value) {
UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(40, 80)) = value;
}
UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_mutable_no_traffic_interval(envoy_api_v2_core_HealthCheck *msg, upb_arena *arena) {
struct google_protobuf_Duration* sub = (struct google_protobuf_Duration*)envoy_api_v2_core_HealthCheck_no_traffic_interval(msg);
if (sub == NULL) {
sub = (struct google_protobuf_Duration*)upb_msg_new(&google_protobuf_Duration_msginit, arena);
if (!sub) return NULL;
envoy_api_v2_core_HealthCheck_set_no_traffic_interval(msg, sub);
}
return sub;
}
UPB_INLINE void envoy_api_v2_core_HealthCheck_set_custom_health_check(envoy_api_v2_core_HealthCheck *msg, envoy_api_v2_core_HealthCheck_CustomHealthCheck* value) {
UPB_WRITE_ONEOF(msg, envoy_api_v2_core_HealthCheck_CustomHealthCheck*, UPB_SIZE(56, 112), value, UPB_SIZE(60, 120), 13);
}
UPB_INLINE struct envoy_api_v2_core_HealthCheck_CustomHealthCheck* envoy_api_v2_core_HealthCheck_mutable_custom_health_check(envoy_api_v2_core_HealthCheck *msg, upb_arena *arena) {
struct envoy_api_v2_core_HealthCheck_CustomHealthCheck* sub = (struct envoy_api_v2_core_HealthCheck_CustomHealthCheck*)envoy_api_v2_core_HealthCheck_custom_health_check(msg);
if (sub == NULL) {
sub = (struct envoy_api_v2_core_HealthCheck_CustomHealthCheck*)upb_msg_new(&envoy_api_v2_core_HealthCheck_CustomHealthCheck_msginit, arena);
if (!sub) return NULL;
envoy_api_v2_core_HealthCheck_set_custom_health_check(msg, sub);
}
return sub;
}
UPB_INLINE void envoy_api_v2_core_HealthCheck_set_unhealthy_interval(envoy_api_v2_core_HealthCheck *msg, struct google_protobuf_Duration* value) {
UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(44, 88)) = value;
}
UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_mutable_unhealthy_interval(envoy_api_v2_core_HealthCheck *msg, upb_arena *arena) {
struct google_protobuf_Duration* sub = (struct google_protobuf_Duration*)envoy_api_v2_core_HealthCheck_unhealthy_interval(msg);
if (sub == NULL) {
sub = (struct google_protobuf_Duration*)upb_msg_new(&google_protobuf_Duration_msginit, arena);
if (!sub) return NULL;
envoy_api_v2_core_HealthCheck_set_unhealthy_interval(msg, sub);
}
return sub;
}
UPB_INLINE void envoy_api_v2_core_HealthCheck_set_unhealthy_edge_interval(envoy_api_v2_core_HealthCheck *msg, struct google_protobuf_Duration* value) {
UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(48, 96)) = value;
}
UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_mutable_unhealthy_edge_interval(envoy_api_v2_core_HealthCheck *msg, upb_arena *arena) {
struct google_protobuf_Duration* sub = (struct google_protobuf_Duration*)envoy_api_v2_core_HealthCheck_unhealthy_edge_interval(msg);
if (sub == NULL) {
sub = (struct google_protobuf_Duration*)upb_msg_new(&google_protobuf_Duration_msginit, arena);
if (!sub) return NULL;
envoy_api_v2_core_HealthCheck_set_unhealthy_edge_interval(msg, sub);
}
return sub;
}
UPB_INLINE void envoy_api_v2_core_HealthCheck_set_healthy_edge_interval(envoy_api_v2_core_HealthCheck *msg, struct google_protobuf_Duration* value) {
UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(52, 104)) = value;
}
UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_mutable_healthy_edge_interval(envoy_api_v2_core_HealthCheck *msg, upb_arena *arena) {
struct google_protobuf_Duration* sub = (struct google_protobuf_Duration*)envoy_api_v2_core_HealthCheck_healthy_edge_interval(msg);
if (sub == NULL) {
sub = (struct google_protobuf_Duration*)upb_msg_new(&google_protobuf_Duration_msginit, arena);
if (!sub) return NULL;
envoy_api_v2_core_HealthCheck_set_healthy_edge_interval(msg, sub);
}
return sub;
}
UPB_INLINE void envoy_api_v2_core_HealthCheck_set_event_log_path(envoy_api_v2_core_HealthCheck *msg, upb_strview value) {
UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)) = value;
}
UPB_INLINE void envoy_api_v2_core_HealthCheck_set_interval_jitter_percent(envoy_api_v2_core_HealthCheck *msg, uint32_t value) {
UPB_FIELD_AT(msg, uint32_t, UPB_SIZE(0, 0)) = value;
}
/* envoy.api.v2.core.HealthCheck.Payload */
UPB_INLINE envoy_api_v2_core_HealthCheck_Payload *envoy_api_v2_core_HealthCheck_Payload_new(upb_arena *arena) {
return (envoy_api_v2_core_HealthCheck_Payload *)upb_msg_new(&envoy_api_v2_core_HealthCheck_Payload_msginit, arena);
}
UPB_INLINE envoy_api_v2_core_HealthCheck_Payload *envoy_api_v2_core_HealthCheck_Payload_parsenew(upb_strview buf, upb_arena *arena) {
envoy_api_v2_core_HealthCheck_Payload *ret = envoy_api_v2_core_HealthCheck_Payload_new(arena);
return (ret && upb_decode(buf, ret, &envoy_api_v2_core_HealthCheck_Payload_msginit)) ? ret : NULL;
}
UPB_INLINE char *envoy_api_v2_core_HealthCheck_Payload_serialize(const envoy_api_v2_core_HealthCheck_Payload *msg, upb_arena *arena, size_t *len) {
return upb_encode(msg, &envoy_api_v2_core_HealthCheck_Payload_msginit, arena, len);
}
typedef enum {
envoy_api_v2_core_HealthCheck_Payload_payload_text = 1,
envoy_api_v2_core_HealthCheck_Payload_payload_binary = 2,
envoy_api_v2_core_HealthCheck_Payload_payload_NOT_SET = 0,
} envoy_api_v2_core_HealthCheck_Payload_payload_oneofcases;
UPB_INLINE envoy_api_v2_core_HealthCheck_Payload_payload_oneofcases envoy_api_v2_core_HealthCheck_Payload_payload_case(const envoy_api_v2_core_HealthCheck_Payload* msg) { return UPB_FIELD_AT(msg, int, UPB_SIZE(8, 16)); }
UPB_INLINE bool envoy_api_v2_core_HealthCheck_Payload_has_text(const envoy_api_v2_core_HealthCheck_Payload *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(8, 16), 1); }
UPB_INLINE upb_strview envoy_api_v2_core_HealthCheck_Payload_text(const envoy_api_v2_core_HealthCheck_Payload *msg) { return UPB_READ_ONEOF(msg, upb_strview, UPB_SIZE(0, 0), UPB_SIZE(8, 16), 1, upb_strview_make("", strlen(""))); }
UPB_INLINE bool envoy_api_v2_core_HealthCheck_Payload_has_binary(const envoy_api_v2_core_HealthCheck_Payload *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(8, 16), 2); }
UPB_INLINE upb_strview envoy_api_v2_core_HealthCheck_Payload_binary(const envoy_api_v2_core_HealthCheck_Payload *msg) { return UPB_READ_ONEOF(msg, upb_strview, UPB_SIZE(0, 0), UPB_SIZE(8, 16), 2, upb_strview_make("", strlen(""))); }
UPB_INLINE void envoy_api_v2_core_HealthCheck_Payload_set_text(envoy_api_v2_core_HealthCheck_Payload *msg, upb_strview value) {
UPB_WRITE_ONEOF(msg, upb_strview, UPB_SIZE(0, 0), value, UPB_SIZE(8, 16), 1);
}
UPB_INLINE void envoy_api_v2_core_HealthCheck_Payload_set_binary(envoy_api_v2_core_HealthCheck_Payload *msg, upb_strview value) {
UPB_WRITE_ONEOF(msg, upb_strview, UPB_SIZE(0, 0), value, UPB_SIZE(8, 16), 2);
}
/* envoy.api.v2.core.HealthCheck.HttpHealthCheck */
UPB_INLINE envoy_api_v2_core_HealthCheck_HttpHealthCheck *envoy_api_v2_core_HealthCheck_HttpHealthCheck_new(upb_arena *arena) {
return (envoy_api_v2_core_HealthCheck_HttpHealthCheck *)upb_msg_new(&envoy_api_v2_core_HealthCheck_HttpHealthCheck_msginit, arena);
}
UPB_INLINE envoy_api_v2_core_HealthCheck_HttpHealthCheck *envoy_api_v2_core_HealthCheck_HttpHealthCheck_parsenew(upb_strview buf, upb_arena *arena) {
envoy_api_v2_core_HealthCheck_HttpHealthCheck *ret = envoy_api_v2_core_HealthCheck_HttpHealthCheck_new(arena);
return (ret && upb_decode(buf, ret, &envoy_api_v2_core_HealthCheck_HttpHealthCheck_msginit)) ? ret : NULL;
}
UPB_INLINE char *envoy_api_v2_core_HealthCheck_HttpHealthCheck_serialize(const envoy_api_v2_core_HealthCheck_HttpHealthCheck *msg, upb_arena *arena, size_t *len) {
return upb_encode(msg, &envoy_api_v2_core_HealthCheck_HttpHealthCheck_msginit, arena, len);
}
UPB_INLINE upb_strview envoy_api_v2_core_HealthCheck_HttpHealthCheck_host(const envoy_api_v2_core_HealthCheck_HttpHealthCheck *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)); }
UPB_INLINE upb_strview envoy_api_v2_core_HealthCheck_HttpHealthCheck_path(const envoy_api_v2_core_HealthCheck_HttpHealthCheck *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(12, 24)); }
UPB_INLINE const envoy_api_v2_core_HealthCheck_Payload* envoy_api_v2_core_HealthCheck_HttpHealthCheck_send(const envoy_api_v2_core_HealthCheck_HttpHealthCheck *msg) { return UPB_FIELD_AT(msg, const envoy_api_v2_core_HealthCheck_Payload*, UPB_SIZE(28, 56)); }
UPB_INLINE const envoy_api_v2_core_HealthCheck_Payload* envoy_api_v2_core_HealthCheck_HttpHealthCheck_receive(const envoy_api_v2_core_HealthCheck_HttpHealthCheck *msg) { return UPB_FIELD_AT(msg, const envoy_api_v2_core_HealthCheck_Payload*, UPB_SIZE(32, 64)); }
UPB_INLINE upb_strview envoy_api_v2_core_HealthCheck_HttpHealthCheck_service_name(const envoy_api_v2_core_HealthCheck_HttpHealthCheck *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(20, 40)); }
UPB_INLINE const struct envoy_api_v2_core_HeaderValueOption* const* envoy_api_v2_core_HealthCheck_HttpHealthCheck_request_headers_to_add(const envoy_api_v2_core_HealthCheck_HttpHealthCheck *msg, size_t *len) { return (const struct envoy_api_v2_core_HeaderValueOption* const*)_upb_array_accessor(msg, UPB_SIZE(36, 72), len); }
UPB_INLINE bool envoy_api_v2_core_HealthCheck_HttpHealthCheck_use_http2(const envoy_api_v2_core_HealthCheck_HttpHealthCheck *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(0, 0)); }
UPB_INLINE upb_strview const* envoy_api_v2_core_HealthCheck_HttpHealthCheck_request_headers_to_remove(const envoy_api_v2_core_HealthCheck_HttpHealthCheck *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(40, 80), len); }
UPB_INLINE void envoy_api_v2_core_HealthCheck_HttpHealthCheck_set_host(envoy_api_v2_core_HealthCheck_HttpHealthCheck *msg, upb_strview value) {
UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)) = value;
}
UPB_INLINE void envoy_api_v2_core_HealthCheck_HttpHealthCheck_set_path(envoy_api_v2_core_HealthCheck_HttpHealthCheck *msg, upb_strview value) {
UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(12, 24)) = value;
}
UPB_INLINE void envoy_api_v2_core_HealthCheck_HttpHealthCheck_set_send(envoy_api_v2_core_HealthCheck_HttpHealthCheck *msg, envoy_api_v2_core_HealthCheck_Payload* value) {
UPB_FIELD_AT(msg, envoy_api_v2_core_HealthCheck_Payload*, UPB_SIZE(28, 56)) = value;
}
UPB_INLINE struct envoy_api_v2_core_HealthCheck_Payload* envoy_api_v2_core_HealthCheck_HttpHealthCheck_mutable_send(envoy_api_v2_core_HealthCheck_HttpHealthCheck *msg, upb_arena *arena) {
struct envoy_api_v2_core_HealthCheck_Payload* sub = (struct envoy_api_v2_core_HealthCheck_Payload*)envoy_api_v2_core_HealthCheck_HttpHealthCheck_send(msg);
if (sub == NULL) {
sub = (struct envoy_api_v2_core_HealthCheck_Payload*)upb_msg_new(&envoy_api_v2_core_HealthCheck_Payload_msginit, arena);
if (!sub) return NULL;
envoy_api_v2_core_HealthCheck_HttpHealthCheck_set_send(msg, sub);
}
return sub;
}
UPB_INLINE void envoy_api_v2_core_HealthCheck_HttpHealthCheck_set_receive(envoy_api_v2_core_HealthCheck_HttpHealthCheck *msg, envoy_api_v2_core_HealthCheck_Payload* value) {
UPB_FIELD_AT(msg, envoy_api_v2_core_HealthCheck_Payload*, UPB_SIZE(32, 64)) = value;
}
UPB_INLINE struct envoy_api_v2_core_HealthCheck_Payload* envoy_api_v2_core_HealthCheck_HttpHealthCheck_mutable_receive(envoy_api_v2_core_HealthCheck_HttpHealthCheck *msg, upb_arena *arena) {
struct envoy_api_v2_core_HealthCheck_Payload* sub = (struct envoy_api_v2_core_HealthCheck_Payload*)envoy_api_v2_core_HealthCheck_HttpHealthCheck_receive(msg);
if (sub == NULL) {
sub = (struct envoy_api_v2_core_HealthCheck_Payload*)upb_msg_new(&envoy_api_v2_core_HealthCheck_Payload_msginit, arena);
if (!sub) return NULL;
envoy_api_v2_core_HealthCheck_HttpHealthCheck_set_receive(msg, sub);
}
return sub;
}
UPB_INLINE void envoy_api_v2_core_HealthCheck_HttpHealthCheck_set_service_name(envoy_api_v2_core_HealthCheck_HttpHealthCheck *msg, upb_strview value) {
UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(20, 40)) = value;
}
UPB_INLINE struct envoy_api_v2_core_HeaderValueOption** envoy_api_v2_core_HealthCheck_HttpHealthCheck_mutable_request_headers_to_add(envoy_api_v2_core_HealthCheck_HttpHealthCheck *msg, size_t *len) {
return (struct envoy_api_v2_core_HeaderValueOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(36, 72), len);
}
UPB_INLINE struct envoy_api_v2_core_HeaderValueOption** envoy_api_v2_core_HealthCheck_HttpHealthCheck_resize_request_headers_to_add(envoy_api_v2_core_HealthCheck_HttpHealthCheck *msg, size_t len, upb_arena *arena) {
return (struct envoy_api_v2_core_HeaderValueOption**)_upb_array_resize_accessor(msg, UPB_SIZE(36, 72), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
}
UPB_INLINE struct envoy_api_v2_core_HeaderValueOption* envoy_api_v2_core_HealthCheck_HttpHealthCheck_add_request_headers_to_add(envoy_api_v2_core_HealthCheck_HttpHealthCheck *msg, upb_arena *arena) {
struct envoy_api_v2_core_HeaderValueOption* sub = (struct envoy_api_v2_core_HeaderValueOption*)upb_msg_new(&envoy_api_v2_core_HeaderValueOption_msginit, arena);
bool ok = _upb_array_append_accessor(
msg, UPB_SIZE(36, 72), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
if (!ok) return NULL;
return sub;
}
UPB_INLINE void envoy_api_v2_core_HealthCheck_HttpHealthCheck_set_use_http2(envoy_api_v2_core_HealthCheck_HttpHealthCheck *msg, bool value) {
UPB_FIELD_AT(msg, bool, UPB_SIZE(0, 0)) = value;
}
UPB_INLINE upb_strview* envoy_api_v2_core_HealthCheck_HttpHealthCheck_mutable_request_headers_to_remove(envoy_api_v2_core_HealthCheck_HttpHealthCheck *msg, size_t *len) {
return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(40, 80), len);
}
UPB_INLINE upb_strview* envoy_api_v2_core_HealthCheck_HttpHealthCheck_resize_request_headers_to_remove(envoy_api_v2_core_HealthCheck_HttpHealthCheck *msg, size_t len, upb_arena *arena) {
return (upb_strview*)_upb_array_resize_accessor(msg, UPB_SIZE(40, 80), len, UPB_SIZE(8, 16), UPB_TYPE_STRING, arena);
}
UPB_INLINE bool envoy_api_v2_core_HealthCheck_HttpHealthCheck_add_request_headers_to_remove(envoy_api_v2_core_HealthCheck_HttpHealthCheck *msg, upb_strview val, upb_arena *arena) {
return _upb_array_append_accessor(
msg, UPB_SIZE(40, 80), UPB_SIZE(8, 16), UPB_TYPE_STRING, &val, arena);
}
/* envoy.api.v2.core.HealthCheck.TcpHealthCheck */
UPB_INLINE envoy_api_v2_core_HealthCheck_TcpHealthCheck *envoy_api_v2_core_HealthCheck_TcpHealthCheck_new(upb_arena *arena) {
return (envoy_api_v2_core_HealthCheck_TcpHealthCheck *)upb_msg_new(&envoy_api_v2_core_HealthCheck_TcpHealthCheck_msginit, arena);
}
UPB_INLINE envoy_api_v2_core_HealthCheck_TcpHealthCheck *envoy_api_v2_core_HealthCheck_TcpHealthCheck_parsenew(upb_strview buf, upb_arena *arena) {
envoy_api_v2_core_HealthCheck_TcpHealthCheck *ret = envoy_api_v2_core_HealthCheck_TcpHealthCheck_new(arena);
return (ret && upb_decode(buf, ret, &envoy_api_v2_core_HealthCheck_TcpHealthCheck_msginit)) ? ret : NULL;
}
UPB_INLINE char *envoy_api_v2_core_HealthCheck_TcpHealthCheck_serialize(const envoy_api_v2_core_HealthCheck_TcpHealthCheck *msg, upb_arena *arena, size_t *len) {
return upb_encode(msg, &envoy_api_v2_core_HealthCheck_TcpHealthCheck_msginit, arena, len);
}
UPB_INLINE const envoy_api_v2_core_HealthCheck_Payload* envoy_api_v2_core_HealthCheck_TcpHealthCheck_send(const envoy_api_v2_core_HealthCheck_TcpHealthCheck *msg) { return UPB_FIELD_AT(msg, const envoy_api_v2_core_HealthCheck_Payload*, UPB_SIZE(0, 0)); }
UPB_INLINE const envoy_api_v2_core_HealthCheck_Payload* const* envoy_api_v2_core_HealthCheck_TcpHealthCheck_receive(const envoy_api_v2_core_HealthCheck_TcpHealthCheck *msg, size_t *len) { return (const envoy_api_v2_core_HealthCheck_Payload* const*)_upb_array_accessor(msg, UPB_SIZE(4, 8), len); }
UPB_INLINE void envoy_api_v2_core_HealthCheck_TcpHealthCheck_set_send(envoy_api_v2_core_HealthCheck_TcpHealthCheck *msg, envoy_api_v2_core_HealthCheck_Payload* value) {
UPB_FIELD_AT(msg, envoy_api_v2_core_HealthCheck_Payload*, UPB_SIZE(0, 0)) = value;
}
UPB_INLINE struct envoy_api_v2_core_HealthCheck_Payload* envoy_api_v2_core_HealthCheck_TcpHealthCheck_mutable_send(envoy_api_v2_core_HealthCheck_TcpHealthCheck *msg, upb_arena *arena) {
struct envoy_api_v2_core_HealthCheck_Payload* sub = (struct envoy_api_v2_core_HealthCheck_Payload*)envoy_api_v2_core_HealthCheck_TcpHealthCheck_send(msg);
if (sub == NULL) {
sub = (struct envoy_api_v2_core_HealthCheck_Payload*)upb_msg_new(&envoy_api_v2_core_HealthCheck_Payload_msginit, arena);
if (!sub) return NULL;
envoy_api_v2_core_HealthCheck_TcpHealthCheck_set_send(msg, sub);
}
return sub;
}
UPB_INLINE envoy_api_v2_core_HealthCheck_Payload** envoy_api_v2_core_HealthCheck_TcpHealthCheck_mutable_receive(envoy_api_v2_core_HealthCheck_TcpHealthCheck *msg, size_t *len) {
return (envoy_api_v2_core_HealthCheck_Payload**)_upb_array_mutable_accessor(msg, UPB_SIZE(4, 8), len);
}
UPB_INLINE envoy_api_v2_core_HealthCheck_Payload** envoy_api_v2_core_HealthCheck_TcpHealthCheck_resize_receive(envoy_api_v2_core_HealthCheck_TcpHealthCheck *msg, size_t len, upb_arena *arena) {
return (envoy_api_v2_core_HealthCheck_Payload**)_upb_array_resize_accessor(msg, UPB_SIZE(4, 8), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
}
UPB_INLINE struct envoy_api_v2_core_HealthCheck_Payload* envoy_api_v2_core_HealthCheck_TcpHealthCheck_add_receive(envoy_api_v2_core_HealthCheck_TcpHealthCheck *msg, upb_arena *arena) {
struct envoy_api_v2_core_HealthCheck_Payload* sub = (struct envoy_api_v2_core_HealthCheck_Payload*)upb_msg_new(&envoy_api_v2_core_HealthCheck_Payload_msginit, arena);
bool ok = _upb_array_append_accessor(
msg, UPB_SIZE(4, 8), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
if (!ok) return NULL;
return sub;
}
/* envoy.api.v2.core.HealthCheck.RedisHealthCheck */
UPB_INLINE envoy_api_v2_core_HealthCheck_RedisHealthCheck *envoy_api_v2_core_HealthCheck_RedisHealthCheck_new(upb_arena *arena) {
return (envoy_api_v2_core_HealthCheck_RedisHealthCheck *)upb_msg_new(&envoy_api_v2_core_HealthCheck_RedisHealthCheck_msginit, arena);
}
UPB_INLINE envoy_api_v2_core_HealthCheck_RedisHealthCheck *envoy_api_v2_core_HealthCheck_RedisHealthCheck_parsenew(upb_strview buf, upb_arena *arena) {
envoy_api_v2_core_HealthCheck_RedisHealthCheck *ret = envoy_api_v2_core_HealthCheck_RedisHealthCheck_new(arena);
return (ret && upb_decode(buf, ret, &envoy_api_v2_core_HealthCheck_RedisHealthCheck_msginit)) ? ret : NULL;
}
UPB_INLINE char *envoy_api_v2_core_HealthCheck_RedisHealthCheck_serialize(const envoy_api_v2_core_HealthCheck_RedisHealthCheck *msg, upb_arena *arena, size_t *len) {
return upb_encode(msg, &envoy_api_v2_core_HealthCheck_RedisHealthCheck_msginit, arena, len);
}
UPB_INLINE upb_strview envoy_api_v2_core_HealthCheck_RedisHealthCheck_key(const envoy_api_v2_core_HealthCheck_RedisHealthCheck *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); }
UPB_INLINE void envoy_api_v2_core_HealthCheck_RedisHealthCheck_set_key(envoy_api_v2_core_HealthCheck_RedisHealthCheck *msg, upb_strview value) {
UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value;
}
/* envoy.api.v2.core.HealthCheck.GrpcHealthCheck */
UPB_INLINE envoy_api_v2_core_HealthCheck_GrpcHealthCheck *envoy_api_v2_core_HealthCheck_GrpcHealthCheck_new(upb_arena *arena) {
return (envoy_api_v2_core_HealthCheck_GrpcHealthCheck *)upb_msg_new(&envoy_api_v2_core_HealthCheck_GrpcHealthCheck_msginit, arena);
}
UPB_INLINE envoy_api_v2_core_HealthCheck_GrpcHealthCheck *envoy_api_v2_core_HealthCheck_GrpcHealthCheck_parsenew(upb_strview buf, upb_arena *arena) {
envoy_api_v2_core_HealthCheck_GrpcHealthCheck *ret = envoy_api_v2_core_HealthCheck_GrpcHealthCheck_new(arena);
return (ret && upb_decode(buf, ret, &envoy_api_v2_core_HealthCheck_GrpcHealthCheck_msginit)) ? ret : NULL;
}
UPB_INLINE char *envoy_api_v2_core_HealthCheck_GrpcHealthCheck_serialize(const envoy_api_v2_core_HealthCheck_GrpcHealthCheck *msg, upb_arena *arena, size_t *len) {
return upb_encode(msg, &envoy_api_v2_core_HealthCheck_GrpcHealthCheck_msginit, arena, len);
}
UPB_INLINE upb_strview envoy_api_v2_core_HealthCheck_GrpcHealthCheck_service_name(const envoy_api_v2_core_HealthCheck_GrpcHealthCheck *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); }
UPB_INLINE void envoy_api_v2_core_HealthCheck_GrpcHealthCheck_set_service_name(envoy_api_v2_core_HealthCheck_GrpcHealthCheck *msg, upb_strview value) {
UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value;
}
/* envoy.api.v2.core.HealthCheck.CustomHealthCheck */
UPB_INLINE envoy_api_v2_core_HealthCheck_CustomHealthCheck *envoy_api_v2_core_HealthCheck_CustomHealthCheck_new(upb_arena *arena) {
return (envoy_api_v2_core_HealthCheck_CustomHealthCheck *)upb_msg_new(&envoy_api_v2_core_HealthCheck_CustomHealthCheck_msginit, arena);
}
UPB_INLINE envoy_api_v2_core_HealthCheck_CustomHealthCheck *envoy_api_v2_core_HealthCheck_CustomHealthCheck_parsenew(upb_strview buf, upb_arena *arena) {
envoy_api_v2_core_HealthCheck_CustomHealthCheck *ret = envoy_api_v2_core_HealthCheck_CustomHealthCheck_new(arena);
return (ret && upb_decode(buf, ret, &envoy_api_v2_core_HealthCheck_CustomHealthCheck_msginit)) ? ret : NULL;
}
UPB_INLINE char *envoy_api_v2_core_HealthCheck_CustomHealthCheck_serialize(const envoy_api_v2_core_HealthCheck_CustomHealthCheck *msg, upb_arena *arena, size_t *len) {
return upb_encode(msg, &envoy_api_v2_core_HealthCheck_CustomHealthCheck_msginit, arena, len);
}
typedef enum {
envoy_api_v2_core_HealthCheck_CustomHealthCheck_config_type_config = 2,
envoy_api_v2_core_HealthCheck_CustomHealthCheck_config_type_typed_config = 3,
envoy_api_v2_core_HealthCheck_CustomHealthCheck_config_type_NOT_SET = 0,
} envoy_api_v2_core_HealthCheck_CustomHealthCheck_config_type_oneofcases;
UPB_INLINE envoy_api_v2_core_HealthCheck_CustomHealthCheck_config_type_oneofcases envoy_api_v2_core_HealthCheck_CustomHealthCheck_config_type_case(const envoy_api_v2_core_HealthCheck_CustomHealthCheck* msg) { return UPB_FIELD_AT(msg, int, UPB_SIZE(12, 24)); }
UPB_INLINE upb_strview envoy_api_v2_core_HealthCheck_CustomHealthCheck_name(const envoy_api_v2_core_HealthCheck_CustomHealthCheck *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); }
UPB_INLINE bool envoy_api_v2_core_HealthCheck_CustomHealthCheck_has_config(const envoy_api_v2_core_HealthCheck_CustomHealthCheck *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(12, 24), 2); }
UPB_INLINE const struct google_protobuf_Struct* envoy_api_v2_core_HealthCheck_CustomHealthCheck_config(const envoy_api_v2_core_HealthCheck_CustomHealthCheck *msg) { return UPB_READ_ONEOF(msg, const struct google_protobuf_Struct*, UPB_SIZE(8, 16), UPB_SIZE(12, 24), 2, NULL); }
UPB_INLINE bool envoy_api_v2_core_HealthCheck_CustomHealthCheck_has_typed_config(const envoy_api_v2_core_HealthCheck_CustomHealthCheck *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(12, 24), 3); }
UPB_INLINE const struct google_protobuf_Any* envoy_api_v2_core_HealthCheck_CustomHealthCheck_typed_config(const envoy_api_v2_core_HealthCheck_CustomHealthCheck *msg) { return UPB_READ_ONEOF(msg, const struct google_protobuf_Any*, UPB_SIZE(8, 16), UPB_SIZE(12, 24), 3, NULL); }
UPB_INLINE void envoy_api_v2_core_HealthCheck_CustomHealthCheck_set_name(envoy_api_v2_core_HealthCheck_CustomHealthCheck *msg, upb_strview value) {
UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value;
}
UPB_INLINE void envoy_api_v2_core_HealthCheck_CustomHealthCheck_set_config(envoy_api_v2_core_HealthCheck_CustomHealthCheck *msg, struct google_protobuf_Struct* value) {
UPB_WRITE_ONEOF(msg, struct google_protobuf_Struct*, UPB_SIZE(8, 16), value, UPB_SIZE(12, 24), 2);
}
UPB_INLINE struct google_protobuf_Struct* envoy_api_v2_core_HealthCheck_CustomHealthCheck_mutable_config(envoy_api_v2_core_HealthCheck_CustomHealthCheck *msg, upb_arena *arena) {
struct google_protobuf_Struct* sub = (struct google_protobuf_Struct*)envoy_api_v2_core_HealthCheck_CustomHealthCheck_config(msg);
if (sub == NULL) {
sub = (struct google_protobuf_Struct*)upb_msg_new(&google_protobuf_Struct_msginit, arena);
if (!sub) return NULL;
envoy_api_v2_core_HealthCheck_CustomHealthCheck_set_config(msg, sub);
}
return sub;
}
UPB_INLINE void envoy_api_v2_core_HealthCheck_CustomHealthCheck_set_typed_config(envoy_api_v2_core_HealthCheck_CustomHealthCheck *msg, struct google_protobuf_Any* value) {
UPB_WRITE_ONEOF(msg, struct google_protobuf_Any*, UPB_SIZE(8, 16), value, UPB_SIZE(12, 24), 3);
}
UPB_INLINE struct google_protobuf_Any* envoy_api_v2_core_HealthCheck_CustomHealthCheck_mutable_typed_config(envoy_api_v2_core_HealthCheck_CustomHealthCheck *msg, upb_arena *arena) {
struct google_protobuf_Any* sub = (struct google_protobuf_Any*)envoy_api_v2_core_HealthCheck_CustomHealthCheck_typed_config(msg);
if (sub == NULL) {
sub = (struct google_protobuf_Any*)upb_msg_new(&google_protobuf_Any_msginit, arena);
if (!sub) return NULL;
envoy_api_v2_core_HealthCheck_CustomHealthCheck_set_typed_config(msg, sub);
}
return sub;
}
#ifdef __cplusplus
} /* extern "C" */
#endif
#include "upb/port_undef.inc"
#endif /* ENVOY_API_V2_CORE_HEALTH_CHECK_PROTO_UPB_H_ */

@ -0,0 +1,123 @@
/* This file was generated by upbc (the upb compiler) from the input
* file:
*
* envoy/api/v2/discovery.proto
*
* Do not edit -- your changes will be discarded when the file is
* regenerated. */
#include <stddef.h>
#include "upb/msg.h"
#include "envoy/api/v2/discovery.upb.h"
#include "envoy/api/v2/core/base.upb.h"
#include "google/protobuf/any.upb.h"
#include "google/rpc/status.upb.h"
#include "gogoproto/gogo.upb.h"
#include "upb/port_def.inc"
static const upb_msglayout *const envoy_api_v2_DiscoveryRequest_submsgs[2] = {
&envoy_api_v2_core_Node_msginit,
&google_rpc_Status_msginit,
};
static const upb_msglayout_field envoy_api_v2_DiscoveryRequest__fields[6] = {
{1, UPB_SIZE(0, 0), 0, 0, 9, 1},
{2, UPB_SIZE(24, 48), 0, 0, 11, 1},
{3, UPB_SIZE(32, 64), 0, 0, 9, 3},
{4, UPB_SIZE(8, 16), 0, 0, 9, 1},
{5, UPB_SIZE(16, 32), 0, 0, 9, 1},
{6, UPB_SIZE(28, 56), 0, 1, 11, 1},
};
const upb_msglayout envoy_api_v2_DiscoveryRequest_msginit = {
&envoy_api_v2_DiscoveryRequest_submsgs[0],
&envoy_api_v2_DiscoveryRequest__fields[0],
UPB_SIZE(40, 80), 6, false,
};
static const upb_msglayout *const envoy_api_v2_DiscoveryResponse_submsgs[1] = {
&google_protobuf_Any_msginit,
};
static const upb_msglayout_field envoy_api_v2_DiscoveryResponse__fields[5] = {
{1, UPB_SIZE(4, 8), 0, 0, 9, 1},
{2, UPB_SIZE(28, 56), 0, 0, 11, 3},
{3, UPB_SIZE(0, 0), 0, 0, 8, 1},
{4, UPB_SIZE(12, 24), 0, 0, 9, 1},
{5, UPB_SIZE(20, 40), 0, 0, 9, 1},
};
const upb_msglayout envoy_api_v2_DiscoveryResponse_msginit = {
&envoy_api_v2_DiscoveryResponse_submsgs[0],
&envoy_api_v2_DiscoveryResponse__fields[0],
UPB_SIZE(32, 64), 5, false,
};
static const upb_msglayout *const envoy_api_v2_IncrementalDiscoveryRequest_submsgs[3] = {
&envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry_msginit,
&envoy_api_v2_core_Node_msginit,
&google_rpc_Status_msginit,
};
static const upb_msglayout_field envoy_api_v2_IncrementalDiscoveryRequest__fields[7] = {
{1, UPB_SIZE(16, 32), 0, 1, 11, 1},
{2, UPB_SIZE(0, 0), 0, 0, 9, 1},
{3, UPB_SIZE(24, 48), 0, 0, 9, 3},
{4, UPB_SIZE(28, 56), 0, 0, 9, 3},
{5, UPB_SIZE(32, 64), 0, 0, 11, 3},
{6, UPB_SIZE(8, 16), 0, 0, 9, 1},
{7, UPB_SIZE(20, 40), 0, 2, 11, 1},
};
const upb_msglayout envoy_api_v2_IncrementalDiscoveryRequest_msginit = {
&envoy_api_v2_IncrementalDiscoveryRequest_submsgs[0],
&envoy_api_v2_IncrementalDiscoveryRequest__fields[0],
UPB_SIZE(40, 80), 7, false,
};
static const upb_msglayout_field envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry__fields[2] = {
{1, UPB_SIZE(0, 0), 0, 0, 9, 1},
{2, UPB_SIZE(8, 16), 0, 0, 9, 1},
};
const upb_msglayout envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry_msginit = {
NULL,
&envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry__fields[0],
UPB_SIZE(16, 32), 2, false,
};
static const upb_msglayout *const envoy_api_v2_IncrementalDiscoveryResponse_submsgs[1] = {
&envoy_api_v2_Resource_msginit,
};
static const upb_msglayout_field envoy_api_v2_IncrementalDiscoveryResponse__fields[4] = {
{1, UPB_SIZE(0, 0), 0, 0, 9, 1},
{2, UPB_SIZE(16, 32), 0, 0, 11, 3},
{5, UPB_SIZE(8, 16), 0, 0, 9, 1},
{6, UPB_SIZE(20, 40), 0, 0, 9, 3},
};
const upb_msglayout envoy_api_v2_IncrementalDiscoveryResponse_msginit = {
&envoy_api_v2_IncrementalDiscoveryResponse_submsgs[0],
&envoy_api_v2_IncrementalDiscoveryResponse__fields[0],
UPB_SIZE(24, 48), 4, false,
};
static const upb_msglayout *const envoy_api_v2_Resource_submsgs[1] = {
&google_protobuf_Any_msginit,
};
static const upb_msglayout_field envoy_api_v2_Resource__fields[2] = {
{1, UPB_SIZE(0, 0), 0, 0, 9, 1},
{2, UPB_SIZE(8, 16), 0, 0, 11, 1},
};
const upb_msglayout envoy_api_v2_Resource_msginit = {
&envoy_api_v2_Resource_submsgs[0],
&envoy_api_v2_Resource__fields[0],
UPB_SIZE(16, 32), 2, false,
};
#include "upb/port_undef.inc"

@ -0,0 +1,359 @@
/* This file was generated by upbc (the upb compiler) from the input
* file:
*
* envoy/api/v2/discovery.proto
*
* Do not edit -- your changes will be discarded when the file is
* regenerated. */
#ifndef ENVOY_API_V2_DISCOVERY_PROTO_UPB_H_
#define ENVOY_API_V2_DISCOVERY_PROTO_UPB_H_
#include "upb/generated_util.h"
#include "upb/msg.h"
#include "upb/decode.h"
#include "upb/encode.h"
#include "upb/port_def.inc"
#ifdef __cplusplus
extern "C" {
#endif
struct envoy_api_v2_DiscoveryRequest;
struct envoy_api_v2_DiscoveryResponse;
struct envoy_api_v2_IncrementalDiscoveryRequest;
struct envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry;
struct envoy_api_v2_IncrementalDiscoveryResponse;
struct envoy_api_v2_Resource;
typedef struct envoy_api_v2_DiscoveryRequest envoy_api_v2_DiscoveryRequest;
typedef struct envoy_api_v2_DiscoveryResponse envoy_api_v2_DiscoveryResponse;
typedef struct envoy_api_v2_IncrementalDiscoveryRequest envoy_api_v2_IncrementalDiscoveryRequest;
typedef struct envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry;
typedef struct envoy_api_v2_IncrementalDiscoveryResponse envoy_api_v2_IncrementalDiscoveryResponse;
typedef struct envoy_api_v2_Resource envoy_api_v2_Resource;
extern const upb_msglayout envoy_api_v2_DiscoveryRequest_msginit;
extern const upb_msglayout envoy_api_v2_DiscoveryResponse_msginit;
extern const upb_msglayout envoy_api_v2_IncrementalDiscoveryRequest_msginit;
extern const upb_msglayout envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry_msginit;
extern const upb_msglayout envoy_api_v2_IncrementalDiscoveryResponse_msginit;
extern const upb_msglayout envoy_api_v2_Resource_msginit;
struct google_protobuf_Any;
struct envoy_api_v2_core_Node;
struct google_rpc_Status;
extern const upb_msglayout google_protobuf_Any_msginit;
extern const upb_msglayout envoy_api_v2_core_Node_msginit;
extern const upb_msglayout google_rpc_Status_msginit;
/* Enums */
/* envoy.api.v2.DiscoveryRequest */
UPB_INLINE envoy_api_v2_DiscoveryRequest *envoy_api_v2_DiscoveryRequest_new(upb_arena *arena) {
return (envoy_api_v2_DiscoveryRequest *)upb_msg_new(&envoy_api_v2_DiscoveryRequest_msginit, arena);
}
UPB_INLINE envoy_api_v2_DiscoveryRequest *envoy_api_v2_DiscoveryRequest_parsenew(upb_strview buf, upb_arena *arena) {
envoy_api_v2_DiscoveryRequest *ret = envoy_api_v2_DiscoveryRequest_new(arena);
return (ret && upb_decode(buf, ret, &envoy_api_v2_DiscoveryRequest_msginit)) ? ret : NULL;
}
UPB_INLINE char *envoy_api_v2_DiscoveryRequest_serialize(const envoy_api_v2_DiscoveryRequest *msg, upb_arena *arena, size_t *len) {
return upb_encode(msg, &envoy_api_v2_DiscoveryRequest_msginit, arena, len);
}
UPB_INLINE upb_strview envoy_api_v2_DiscoveryRequest_version_info(const envoy_api_v2_DiscoveryRequest *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); }
UPB_INLINE const struct envoy_api_v2_core_Node* envoy_api_v2_DiscoveryRequest_node(const envoy_api_v2_DiscoveryRequest *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_core_Node*, UPB_SIZE(24, 48)); }
UPB_INLINE upb_strview const* envoy_api_v2_DiscoveryRequest_resource_names(const envoy_api_v2_DiscoveryRequest *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(32, 64), len); }
UPB_INLINE upb_strview envoy_api_v2_DiscoveryRequest_type_url(const envoy_api_v2_DiscoveryRequest *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 16)); }
UPB_INLINE upb_strview envoy_api_v2_DiscoveryRequest_response_nonce(const envoy_api_v2_DiscoveryRequest *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(16, 32)); }
UPB_INLINE const struct google_rpc_Status* envoy_api_v2_DiscoveryRequest_error_detail(const envoy_api_v2_DiscoveryRequest *msg) { return UPB_FIELD_AT(msg, const struct google_rpc_Status*, UPB_SIZE(28, 56)); }
UPB_INLINE void envoy_api_v2_DiscoveryRequest_set_version_info(envoy_api_v2_DiscoveryRequest *msg, upb_strview value) {
UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value;
}
UPB_INLINE void envoy_api_v2_DiscoveryRequest_set_node(envoy_api_v2_DiscoveryRequest *msg, struct envoy_api_v2_core_Node* value) {
UPB_FIELD_AT(msg, struct envoy_api_v2_core_Node*, UPB_SIZE(24, 48)) = value;
}
UPB_INLINE struct envoy_api_v2_core_Node* envoy_api_v2_DiscoveryRequest_mutable_node(envoy_api_v2_DiscoveryRequest *msg, upb_arena *arena) {
struct envoy_api_v2_core_Node* sub = (struct envoy_api_v2_core_Node*)envoy_api_v2_DiscoveryRequest_node(msg);
if (sub == NULL) {
sub = (struct envoy_api_v2_core_Node*)upb_msg_new(&envoy_api_v2_core_Node_msginit, arena);
if (!sub) return NULL;
envoy_api_v2_DiscoveryRequest_set_node(msg, sub);
}
return sub;
}
UPB_INLINE upb_strview* envoy_api_v2_DiscoveryRequest_mutable_resource_names(envoy_api_v2_DiscoveryRequest *msg, size_t *len) {
return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(32, 64), len);
}
UPB_INLINE upb_strview* envoy_api_v2_DiscoveryRequest_resize_resource_names(envoy_api_v2_DiscoveryRequest *msg, size_t len, upb_arena *arena) {
return (upb_strview*)_upb_array_resize_accessor(msg, UPB_SIZE(32, 64), len, UPB_SIZE(8, 16), UPB_TYPE_STRING, arena);
}
UPB_INLINE bool envoy_api_v2_DiscoveryRequest_add_resource_names(envoy_api_v2_DiscoveryRequest *msg, upb_strview val, upb_arena *arena) {
return _upb_array_append_accessor(
msg, UPB_SIZE(32, 64), UPB_SIZE(8, 16), UPB_TYPE_STRING, &val, arena);
}
UPB_INLINE void envoy_api_v2_DiscoveryRequest_set_type_url(envoy_api_v2_DiscoveryRequest *msg, upb_strview value) {
UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 16)) = value;
}
UPB_INLINE void envoy_api_v2_DiscoveryRequest_set_response_nonce(envoy_api_v2_DiscoveryRequest *msg, upb_strview value) {
UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(16, 32)) = value;
}
UPB_INLINE void envoy_api_v2_DiscoveryRequest_set_error_detail(envoy_api_v2_DiscoveryRequest *msg, struct google_rpc_Status* value) {
UPB_FIELD_AT(msg, struct google_rpc_Status*, UPB_SIZE(28, 56)) = value;
}
UPB_INLINE struct google_rpc_Status* envoy_api_v2_DiscoveryRequest_mutable_error_detail(envoy_api_v2_DiscoveryRequest *msg, upb_arena *arena) {
struct google_rpc_Status* sub = (struct google_rpc_Status*)envoy_api_v2_DiscoveryRequest_error_detail(msg);
if (sub == NULL) {
sub = (struct google_rpc_Status*)upb_msg_new(&google_rpc_Status_msginit, arena);
if (!sub) return NULL;
envoy_api_v2_DiscoveryRequest_set_error_detail(msg, sub);
}
return sub;
}
/* envoy.api.v2.DiscoveryResponse */
UPB_INLINE envoy_api_v2_DiscoveryResponse *envoy_api_v2_DiscoveryResponse_new(upb_arena *arena) {
return (envoy_api_v2_DiscoveryResponse *)upb_msg_new(&envoy_api_v2_DiscoveryResponse_msginit, arena);
}
UPB_INLINE envoy_api_v2_DiscoveryResponse *envoy_api_v2_DiscoveryResponse_parsenew(upb_strview buf, upb_arena *arena) {
envoy_api_v2_DiscoveryResponse *ret = envoy_api_v2_DiscoveryResponse_new(arena);
return (ret && upb_decode(buf, ret, &envoy_api_v2_DiscoveryResponse_msginit)) ? ret : NULL;
}
UPB_INLINE char *envoy_api_v2_DiscoveryResponse_serialize(const envoy_api_v2_DiscoveryResponse *msg, upb_arena *arena, size_t *len) {
return upb_encode(msg, &envoy_api_v2_DiscoveryResponse_msginit, arena, len);
}
UPB_INLINE upb_strview envoy_api_v2_DiscoveryResponse_version_info(const envoy_api_v2_DiscoveryResponse *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)); }
UPB_INLINE const struct google_protobuf_Any* const* envoy_api_v2_DiscoveryResponse_resources(const envoy_api_v2_DiscoveryResponse *msg, size_t *len) { return (const struct google_protobuf_Any* const*)_upb_array_accessor(msg, UPB_SIZE(28, 56), len); }
UPB_INLINE bool envoy_api_v2_DiscoveryResponse_canary(const envoy_api_v2_DiscoveryResponse *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(0, 0)); }
UPB_INLINE upb_strview envoy_api_v2_DiscoveryResponse_type_url(const envoy_api_v2_DiscoveryResponse *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(12, 24)); }
UPB_INLINE upb_strview envoy_api_v2_DiscoveryResponse_nonce(const envoy_api_v2_DiscoveryResponse *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(20, 40)); }
UPB_INLINE void envoy_api_v2_DiscoveryResponse_set_version_info(envoy_api_v2_DiscoveryResponse *msg, upb_strview value) {
UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)) = value;
}
UPB_INLINE struct google_protobuf_Any** envoy_api_v2_DiscoveryResponse_mutable_resources(envoy_api_v2_DiscoveryResponse *msg, size_t *len) {
return (struct google_protobuf_Any**)_upb_array_mutable_accessor(msg, UPB_SIZE(28, 56), len);
}
UPB_INLINE struct google_protobuf_Any** envoy_api_v2_DiscoveryResponse_resize_resources(envoy_api_v2_DiscoveryResponse *msg, size_t len, upb_arena *arena) {
return (struct google_protobuf_Any**)_upb_array_resize_accessor(msg, UPB_SIZE(28, 56), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
}
UPB_INLINE struct google_protobuf_Any* envoy_api_v2_DiscoveryResponse_add_resources(envoy_api_v2_DiscoveryResponse *msg, upb_arena *arena) {
struct google_protobuf_Any* sub = (struct google_protobuf_Any*)upb_msg_new(&google_protobuf_Any_msginit, arena);
bool ok = _upb_array_append_accessor(
msg, UPB_SIZE(28, 56), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
if (!ok) return NULL;
return sub;
}
UPB_INLINE void envoy_api_v2_DiscoveryResponse_set_canary(envoy_api_v2_DiscoveryResponse *msg, bool value) {
UPB_FIELD_AT(msg, bool, UPB_SIZE(0, 0)) = value;
}
UPB_INLINE void envoy_api_v2_DiscoveryResponse_set_type_url(envoy_api_v2_DiscoveryResponse *msg, upb_strview value) {
UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(12, 24)) = value;
}
UPB_INLINE void envoy_api_v2_DiscoveryResponse_set_nonce(envoy_api_v2_DiscoveryResponse *msg, upb_strview value) {
UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(20, 40)) = value;
}
/* envoy.api.v2.IncrementalDiscoveryRequest */
UPB_INLINE envoy_api_v2_IncrementalDiscoveryRequest *envoy_api_v2_IncrementalDiscoveryRequest_new(upb_arena *arena) {
return (envoy_api_v2_IncrementalDiscoveryRequest *)upb_msg_new(&envoy_api_v2_IncrementalDiscoveryRequest_msginit, arena);
}
UPB_INLINE envoy_api_v2_IncrementalDiscoveryRequest *envoy_api_v2_IncrementalDiscoveryRequest_parsenew(upb_strview buf, upb_arena *arena) {
envoy_api_v2_IncrementalDiscoveryRequest *ret = envoy_api_v2_IncrementalDiscoveryRequest_new(arena);
return (ret && upb_decode(buf, ret, &envoy_api_v2_IncrementalDiscoveryRequest_msginit)) ? ret : NULL;
}
UPB_INLINE char *envoy_api_v2_IncrementalDiscoveryRequest_serialize(const envoy_api_v2_IncrementalDiscoveryRequest *msg, upb_arena *arena, size_t *len) {
return upb_encode(msg, &envoy_api_v2_IncrementalDiscoveryRequest_msginit, arena, len);
}
UPB_INLINE const struct envoy_api_v2_core_Node* envoy_api_v2_IncrementalDiscoveryRequest_node(const envoy_api_v2_IncrementalDiscoveryRequest *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_core_Node*, UPB_SIZE(16, 32)); }
UPB_INLINE upb_strview envoy_api_v2_IncrementalDiscoveryRequest_type_url(const envoy_api_v2_IncrementalDiscoveryRequest *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); }
UPB_INLINE upb_strview const* envoy_api_v2_IncrementalDiscoveryRequest_resource_names_subscribe(const envoy_api_v2_IncrementalDiscoveryRequest *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(24, 48), len); }
UPB_INLINE upb_strview const* envoy_api_v2_IncrementalDiscoveryRequest_resource_names_unsubscribe(const envoy_api_v2_IncrementalDiscoveryRequest *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(28, 56), len); }
UPB_INLINE const envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry* const* envoy_api_v2_IncrementalDiscoveryRequest_initial_resource_versions(const envoy_api_v2_IncrementalDiscoveryRequest *msg, size_t *len) { return (const envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry* const*)_upb_array_accessor(msg, UPB_SIZE(32, 64), len); }
UPB_INLINE upb_strview envoy_api_v2_IncrementalDiscoveryRequest_response_nonce(const envoy_api_v2_IncrementalDiscoveryRequest *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 16)); }
UPB_INLINE const struct google_rpc_Status* envoy_api_v2_IncrementalDiscoveryRequest_error_detail(const envoy_api_v2_IncrementalDiscoveryRequest *msg) { return UPB_FIELD_AT(msg, const struct google_rpc_Status*, UPB_SIZE(20, 40)); }
UPB_INLINE void envoy_api_v2_IncrementalDiscoveryRequest_set_node(envoy_api_v2_IncrementalDiscoveryRequest *msg, struct envoy_api_v2_core_Node* value) {
UPB_FIELD_AT(msg, struct envoy_api_v2_core_Node*, UPB_SIZE(16, 32)) = value;
}
UPB_INLINE struct envoy_api_v2_core_Node* envoy_api_v2_IncrementalDiscoveryRequest_mutable_node(envoy_api_v2_IncrementalDiscoveryRequest *msg, upb_arena *arena) {
struct envoy_api_v2_core_Node* sub = (struct envoy_api_v2_core_Node*)envoy_api_v2_IncrementalDiscoveryRequest_node(msg);
if (sub == NULL) {
sub = (struct envoy_api_v2_core_Node*)upb_msg_new(&envoy_api_v2_core_Node_msginit, arena);
if (!sub) return NULL;
envoy_api_v2_IncrementalDiscoveryRequest_set_node(msg, sub);
}
return sub;
}
UPB_INLINE void envoy_api_v2_IncrementalDiscoveryRequest_set_type_url(envoy_api_v2_IncrementalDiscoveryRequest *msg, upb_strview value) {
UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value;
}
UPB_INLINE upb_strview* envoy_api_v2_IncrementalDiscoveryRequest_mutable_resource_names_subscribe(envoy_api_v2_IncrementalDiscoveryRequest *msg, size_t *len) {
return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(24, 48), len);
}
UPB_INLINE upb_strview* envoy_api_v2_IncrementalDiscoveryRequest_resize_resource_names_subscribe(envoy_api_v2_IncrementalDiscoveryRequest *msg, size_t len, upb_arena *arena) {
return (upb_strview*)_upb_array_resize_accessor(msg, UPB_SIZE(24, 48), len, UPB_SIZE(8, 16), UPB_TYPE_STRING, arena);
}
UPB_INLINE bool envoy_api_v2_IncrementalDiscoveryRequest_add_resource_names_subscribe(envoy_api_v2_IncrementalDiscoveryRequest *msg, upb_strview val, upb_arena *arena) {
return _upb_array_append_accessor(
msg, UPB_SIZE(24, 48), UPB_SIZE(8, 16), UPB_TYPE_STRING, &val, arena);
}
UPB_INLINE upb_strview* envoy_api_v2_IncrementalDiscoveryRequest_mutable_resource_names_unsubscribe(envoy_api_v2_IncrementalDiscoveryRequest *msg, size_t *len) {
return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(28, 56), len);
}
UPB_INLINE upb_strview* envoy_api_v2_IncrementalDiscoveryRequest_resize_resource_names_unsubscribe(envoy_api_v2_IncrementalDiscoveryRequest *msg, size_t len, upb_arena *arena) {
return (upb_strview*)_upb_array_resize_accessor(msg, UPB_SIZE(28, 56), len, UPB_SIZE(8, 16), UPB_TYPE_STRING, arena);
}
UPB_INLINE bool envoy_api_v2_IncrementalDiscoveryRequest_add_resource_names_unsubscribe(envoy_api_v2_IncrementalDiscoveryRequest *msg, upb_strview val, upb_arena *arena) {
return _upb_array_append_accessor(
msg, UPB_SIZE(28, 56), UPB_SIZE(8, 16), UPB_TYPE_STRING, &val, arena);
}
UPB_INLINE envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry** envoy_api_v2_IncrementalDiscoveryRequest_mutable_initial_resource_versions(envoy_api_v2_IncrementalDiscoveryRequest *msg, size_t *len) {
return (envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry**)_upb_array_mutable_accessor(msg, UPB_SIZE(32, 64), len);
}
UPB_INLINE envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry** envoy_api_v2_IncrementalDiscoveryRequest_resize_initial_resource_versions(envoy_api_v2_IncrementalDiscoveryRequest *msg, size_t len, upb_arena *arena) {
return (envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry**)_upb_array_resize_accessor(msg, UPB_SIZE(32, 64), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
}
UPB_INLINE struct envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry* envoy_api_v2_IncrementalDiscoveryRequest_add_initial_resource_versions(envoy_api_v2_IncrementalDiscoveryRequest *msg, upb_arena *arena) {
struct envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry* sub = (struct envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry*)upb_msg_new(&envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry_msginit, arena);
bool ok = _upb_array_append_accessor(
msg, UPB_SIZE(32, 64), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
if (!ok) return NULL;
return sub;
}
UPB_INLINE void envoy_api_v2_IncrementalDiscoveryRequest_set_response_nonce(envoy_api_v2_IncrementalDiscoveryRequest *msg, upb_strview value) {
UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 16)) = value;
}
UPB_INLINE void envoy_api_v2_IncrementalDiscoveryRequest_set_error_detail(envoy_api_v2_IncrementalDiscoveryRequest *msg, struct google_rpc_Status* value) {
UPB_FIELD_AT(msg, struct google_rpc_Status*, UPB_SIZE(20, 40)) = value;
}
UPB_INLINE struct google_rpc_Status* envoy_api_v2_IncrementalDiscoveryRequest_mutable_error_detail(envoy_api_v2_IncrementalDiscoveryRequest *msg, upb_arena *arena) {
struct google_rpc_Status* sub = (struct google_rpc_Status*)envoy_api_v2_IncrementalDiscoveryRequest_error_detail(msg);
if (sub == NULL) {
sub = (struct google_rpc_Status*)upb_msg_new(&google_rpc_Status_msginit, arena);
if (!sub) return NULL;
envoy_api_v2_IncrementalDiscoveryRequest_set_error_detail(msg, sub);
}
return sub;
}
/* envoy.api.v2.IncrementalDiscoveryRequest.InitialResourceVersionsEntry */
UPB_INLINE envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry *envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry_new(upb_arena *arena) {
return (envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry *)upb_msg_new(&envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry_msginit, arena);
}
UPB_INLINE envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry *envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry_parsenew(upb_strview buf, upb_arena *arena) {
envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry *ret = envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry_new(arena);
return (ret && upb_decode(buf, ret, &envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry_msginit)) ? ret : NULL;
}
UPB_INLINE char *envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry_serialize(const envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry *msg, upb_arena *arena, size_t *len) {
return upb_encode(msg, &envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry_msginit, arena, len);
}
UPB_INLINE upb_strview envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry_key(const envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); }
UPB_INLINE upb_strview envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry_value(const envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 16)); }
UPB_INLINE void envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry_set_key(envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry *msg, upb_strview value) {
UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value;
}
UPB_INLINE void envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry_set_value(envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry *msg, upb_strview value) {
UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 16)) = value;
}
/* envoy.api.v2.IncrementalDiscoveryResponse */
UPB_INLINE envoy_api_v2_IncrementalDiscoveryResponse *envoy_api_v2_IncrementalDiscoveryResponse_new(upb_arena *arena) {
return (envoy_api_v2_IncrementalDiscoveryResponse *)upb_msg_new(&envoy_api_v2_IncrementalDiscoveryResponse_msginit, arena);
}
UPB_INLINE envoy_api_v2_IncrementalDiscoveryResponse *envoy_api_v2_IncrementalDiscoveryResponse_parsenew(upb_strview buf, upb_arena *arena) {
envoy_api_v2_IncrementalDiscoveryResponse *ret = envoy_api_v2_IncrementalDiscoveryResponse_new(arena);
return (ret && upb_decode(buf, ret, &envoy_api_v2_IncrementalDiscoveryResponse_msginit)) ? ret : NULL;
}
UPB_INLINE char *envoy_api_v2_IncrementalDiscoveryResponse_serialize(const envoy_api_v2_IncrementalDiscoveryResponse *msg, upb_arena *arena, size_t *len) {
return upb_encode(msg, &envoy_api_v2_IncrementalDiscoveryResponse_msginit, arena, len);
}
UPB_INLINE upb_strview envoy_api_v2_IncrementalDiscoveryResponse_system_version_info(const envoy_api_v2_IncrementalDiscoveryResponse *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); }
UPB_INLINE const envoy_api_v2_Resource* const* envoy_api_v2_IncrementalDiscoveryResponse_resources(const envoy_api_v2_IncrementalDiscoveryResponse *msg, size_t *len) { return (const envoy_api_v2_Resource* const*)_upb_array_accessor(msg, UPB_SIZE(16, 32), len); }
UPB_INLINE upb_strview envoy_api_v2_IncrementalDiscoveryResponse_nonce(const envoy_api_v2_IncrementalDiscoveryResponse *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 16)); }
UPB_INLINE upb_strview const* envoy_api_v2_IncrementalDiscoveryResponse_removed_resources(const envoy_api_v2_IncrementalDiscoveryResponse *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(20, 40), len); }
UPB_INLINE void envoy_api_v2_IncrementalDiscoveryResponse_set_system_version_info(envoy_api_v2_IncrementalDiscoveryResponse *msg, upb_strview value) {
UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value;
}
UPB_INLINE envoy_api_v2_Resource** envoy_api_v2_IncrementalDiscoveryResponse_mutable_resources(envoy_api_v2_IncrementalDiscoveryResponse *msg, size_t *len) {
return (envoy_api_v2_Resource**)_upb_array_mutable_accessor(msg, UPB_SIZE(16, 32), len);
}
UPB_INLINE envoy_api_v2_Resource** envoy_api_v2_IncrementalDiscoveryResponse_resize_resources(envoy_api_v2_IncrementalDiscoveryResponse *msg, size_t len, upb_arena *arena) {
return (envoy_api_v2_Resource**)_upb_array_resize_accessor(msg, UPB_SIZE(16, 32), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
}
UPB_INLINE struct envoy_api_v2_Resource* envoy_api_v2_IncrementalDiscoveryResponse_add_resources(envoy_api_v2_IncrementalDiscoveryResponse *msg, upb_arena *arena) {
struct envoy_api_v2_Resource* sub = (struct envoy_api_v2_Resource*)upb_msg_new(&envoy_api_v2_Resource_msginit, arena);
bool ok = _upb_array_append_accessor(
msg, UPB_SIZE(16, 32), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
if (!ok) return NULL;
return sub;
}
UPB_INLINE void envoy_api_v2_IncrementalDiscoveryResponse_set_nonce(envoy_api_v2_IncrementalDiscoveryResponse *msg, upb_strview value) {
UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 16)) = value;
}
UPB_INLINE upb_strview* envoy_api_v2_IncrementalDiscoveryResponse_mutable_removed_resources(envoy_api_v2_IncrementalDiscoveryResponse *msg, size_t *len) {
return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(20, 40), len);
}
UPB_INLINE upb_strview* envoy_api_v2_IncrementalDiscoveryResponse_resize_removed_resources(envoy_api_v2_IncrementalDiscoveryResponse *msg, size_t len, upb_arena *arena) {
return (upb_strview*)_upb_array_resize_accessor(msg, UPB_SIZE(20, 40), len, UPB_SIZE(8, 16), UPB_TYPE_STRING, arena);
}
UPB_INLINE bool envoy_api_v2_IncrementalDiscoveryResponse_add_removed_resources(envoy_api_v2_IncrementalDiscoveryResponse *msg, upb_strview val, upb_arena *arena) {
return _upb_array_append_accessor(
msg, UPB_SIZE(20, 40), UPB_SIZE(8, 16), UPB_TYPE_STRING, &val, arena);
}
/* envoy.api.v2.Resource */
UPB_INLINE envoy_api_v2_Resource *envoy_api_v2_Resource_new(upb_arena *arena) {
return (envoy_api_v2_Resource *)upb_msg_new(&envoy_api_v2_Resource_msginit, arena);
}
UPB_INLINE envoy_api_v2_Resource *envoy_api_v2_Resource_parsenew(upb_strview buf, upb_arena *arena) {
envoy_api_v2_Resource *ret = envoy_api_v2_Resource_new(arena);
return (ret && upb_decode(buf, ret, &envoy_api_v2_Resource_msginit)) ? ret : NULL;
}
UPB_INLINE char *envoy_api_v2_Resource_serialize(const envoy_api_v2_Resource *msg, upb_arena *arena, size_t *len) {
return upb_encode(msg, &envoy_api_v2_Resource_msginit, arena, len);
}
UPB_INLINE upb_strview envoy_api_v2_Resource_version(const envoy_api_v2_Resource *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); }
UPB_INLINE const struct google_protobuf_Any* envoy_api_v2_Resource_resource(const envoy_api_v2_Resource *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Any*, UPB_SIZE(8, 16)); }
UPB_INLINE void envoy_api_v2_Resource_set_version(envoy_api_v2_Resource *msg, upb_strview value) {
UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value;
}
UPB_INLINE void envoy_api_v2_Resource_set_resource(envoy_api_v2_Resource *msg, struct google_protobuf_Any* value) {
UPB_FIELD_AT(msg, struct google_protobuf_Any*, UPB_SIZE(8, 16)) = value;
}
UPB_INLINE struct google_protobuf_Any* envoy_api_v2_Resource_mutable_resource(envoy_api_v2_Resource *msg, upb_arena *arena) {
struct google_protobuf_Any* sub = (struct google_protobuf_Any*)envoy_api_v2_Resource_resource(msg);
if (sub == NULL) {
sub = (struct google_protobuf_Any*)upb_msg_new(&google_protobuf_Any_msginit, arena);
if (!sub) return NULL;
envoy_api_v2_Resource_set_resource(msg, sub);
}
return sub;
}
#ifdef __cplusplus
} /* extern "C" */
#endif
#include "upb/port_undef.inc"
#endif /* ENVOY_API_V2_DISCOVERY_PROTO_UPB_H_ */

@ -0,0 +1,39 @@
/* This file was generated by upbc (the upb compiler) from the input
* file:
*
* envoy/type/percent.proto
*
* Do not edit -- your changes will be discarded when the file is
* regenerated. */
#include <stddef.h>
#include "upb/msg.h"
#include "envoy/type/percent.upb.h"
#include "validate/validate.upb.h"
#include "gogoproto/gogo.upb.h"
#include "upb/port_def.inc"
static const upb_msglayout_field envoy_type_Percent__fields[1] = {
{1, UPB_SIZE(0, 0), 0, 0, 1, 1},
};
const upb_msglayout envoy_type_Percent_msginit = {
NULL,
&envoy_type_Percent__fields[0],
UPB_SIZE(8, 8), 1, false,
};
static const upb_msglayout_field envoy_type_FractionalPercent__fields[2] = {
{1, UPB_SIZE(8, 8), 0, 0, 13, 1},
{2, UPB_SIZE(0, 0), 0, 0, 14, 1},
};
const upb_msglayout envoy_type_FractionalPercent_msginit = {
NULL,
&envoy_type_FractionalPercent__fields[0],
UPB_SIZE(16, 16), 2, false,
};
#include "upb/port_undef.inc"

@ -0,0 +1,88 @@
/* This file was generated by upbc (the upb compiler) from the input
* file:
*
* envoy/type/percent.proto
*
* Do not edit -- your changes will be discarded when the file is
* regenerated. */
#ifndef ENVOY_TYPE_PERCENT_PROTO_UPB_H_
#define ENVOY_TYPE_PERCENT_PROTO_UPB_H_
#include "upb/generated_util.h"
#include "upb/msg.h"
#include "upb/decode.h"
#include "upb/encode.h"
#include "upb/port_def.inc"
#ifdef __cplusplus
extern "C" {
#endif
struct envoy_type_Percent;
struct envoy_type_FractionalPercent;
typedef struct envoy_type_Percent envoy_type_Percent;
typedef struct envoy_type_FractionalPercent envoy_type_FractionalPercent;
extern const upb_msglayout envoy_type_Percent_msginit;
extern const upb_msglayout envoy_type_FractionalPercent_msginit;
/* Enums */
typedef enum {
envoy_type_FractionalPercent_HUNDRED = 0,
envoy_type_FractionalPercent_TEN_THOUSAND = 1,
envoy_type_FractionalPercent_MILLION = 2
} envoy_type_FractionalPercent_DenominatorType;
/* envoy.type.Percent */
UPB_INLINE envoy_type_Percent *envoy_type_Percent_new(upb_arena *arena) {
return (envoy_type_Percent *)upb_msg_new(&envoy_type_Percent_msginit, arena);
}
UPB_INLINE envoy_type_Percent *envoy_type_Percent_parsenew(upb_strview buf, upb_arena *arena) {
envoy_type_Percent *ret = envoy_type_Percent_new(arena);
return (ret && upb_decode(buf, ret, &envoy_type_Percent_msginit)) ? ret : NULL;
}
UPB_INLINE char *envoy_type_Percent_serialize(const envoy_type_Percent *msg, upb_arena *arena, size_t *len) {
return upb_encode(msg, &envoy_type_Percent_msginit, arena, len);
}
UPB_INLINE double envoy_type_Percent_value(const envoy_type_Percent *msg) { return UPB_FIELD_AT(msg, double, UPB_SIZE(0, 0)); }
UPB_INLINE void envoy_type_Percent_set_value(envoy_type_Percent *msg, double value) {
UPB_FIELD_AT(msg, double, UPB_SIZE(0, 0)) = value;
}
/* envoy.type.FractionalPercent */
UPB_INLINE envoy_type_FractionalPercent *envoy_type_FractionalPercent_new(upb_arena *arena) {
return (envoy_type_FractionalPercent *)upb_msg_new(&envoy_type_FractionalPercent_msginit, arena);
}
UPB_INLINE envoy_type_FractionalPercent *envoy_type_FractionalPercent_parsenew(upb_strview buf, upb_arena *arena) {
envoy_type_FractionalPercent *ret = envoy_type_FractionalPercent_new(arena);
return (ret && upb_decode(buf, ret, &envoy_type_FractionalPercent_msginit)) ? ret : NULL;
}
UPB_INLINE char *envoy_type_FractionalPercent_serialize(const envoy_type_FractionalPercent *msg, upb_arena *arena, size_t *len) {
return upb_encode(msg, &envoy_type_FractionalPercent_msginit, arena, len);
}
UPB_INLINE uint32_t envoy_type_FractionalPercent_numerator(const envoy_type_FractionalPercent *msg) { return UPB_FIELD_AT(msg, uint32_t, UPB_SIZE(8, 8)); }
UPB_INLINE envoy_type_FractionalPercent_DenominatorType envoy_type_FractionalPercent_denominator(const envoy_type_FractionalPercent *msg) { return UPB_FIELD_AT(msg, envoy_type_FractionalPercent_DenominatorType, UPB_SIZE(0, 0)); }
UPB_INLINE void envoy_type_FractionalPercent_set_numerator(envoy_type_FractionalPercent *msg, uint32_t value) {
UPB_FIELD_AT(msg, uint32_t, UPB_SIZE(8, 8)) = value;
}
UPB_INLINE void envoy_type_FractionalPercent_set_denominator(envoy_type_FractionalPercent *msg, envoy_type_FractionalPercent_DenominatorType value) {
UPB_FIELD_AT(msg, envoy_type_FractionalPercent_DenominatorType, UPB_SIZE(0, 0)) = value;
}
#ifdef __cplusplus
} /* extern "C" */
#endif
#include "upb/port_undef.inc"
#endif /* ENVOY_TYPE_PERCENT_PROTO_UPB_H_ */

@ -0,0 +1,39 @@
/* This file was generated by upbc (the upb compiler) from the input
* file:
*
* envoy/type/range.proto
*
* Do not edit -- your changes will be discarded when the file is
* regenerated. */
#include <stddef.h>
#include "upb/msg.h"
#include "envoy/type/range.upb.h"
#include "gogoproto/gogo.upb.h"
#include "upb/port_def.inc"
static const upb_msglayout_field envoy_type_Int64Range__fields[2] = {
{1, UPB_SIZE(0, 0), 0, 0, 3, 1},
{2, UPB_SIZE(8, 8), 0, 0, 3, 1},
};
const upb_msglayout envoy_type_Int64Range_msginit = {
NULL,
&envoy_type_Int64Range__fields[0],
UPB_SIZE(16, 16), 2, false,
};
static const upb_msglayout_field envoy_type_DoubleRange__fields[2] = {
{1, UPB_SIZE(0, 0), 0, 0, 1, 1},
{2, UPB_SIZE(8, 8), 0, 0, 1, 1},
};
const upb_msglayout envoy_type_DoubleRange_msginit = {
NULL,
&envoy_type_DoubleRange__fields[0],
UPB_SIZE(16, 16), 2, false,
};
#include "upb/port_undef.inc"

@ -0,0 +1,86 @@
/* This file was generated by upbc (the upb compiler) from the input
* file:
*
* envoy/type/range.proto
*
* Do not edit -- your changes will be discarded when the file is
* regenerated. */
#ifndef ENVOY_TYPE_RANGE_PROTO_UPB_H_
#define ENVOY_TYPE_RANGE_PROTO_UPB_H_
#include "upb/generated_util.h"
#include "upb/msg.h"
#include "upb/decode.h"
#include "upb/encode.h"
#include "upb/port_def.inc"
#ifdef __cplusplus
extern "C" {
#endif
struct envoy_type_Int64Range;
struct envoy_type_DoubleRange;
typedef struct envoy_type_Int64Range envoy_type_Int64Range;
typedef struct envoy_type_DoubleRange envoy_type_DoubleRange;
extern const upb_msglayout envoy_type_Int64Range_msginit;
extern const upb_msglayout envoy_type_DoubleRange_msginit;
/* Enums */
/* envoy.type.Int64Range */
UPB_INLINE envoy_type_Int64Range *envoy_type_Int64Range_new(upb_arena *arena) {
return (envoy_type_Int64Range *)upb_msg_new(&envoy_type_Int64Range_msginit, arena);
}
UPB_INLINE envoy_type_Int64Range *envoy_type_Int64Range_parsenew(upb_strview buf, upb_arena *arena) {
envoy_type_Int64Range *ret = envoy_type_Int64Range_new(arena);
return (ret && upb_decode(buf, ret, &envoy_type_Int64Range_msginit)) ? ret : NULL;
}
UPB_INLINE char *envoy_type_Int64Range_serialize(const envoy_type_Int64Range *msg, upb_arena *arena, size_t *len) {
return upb_encode(msg, &envoy_type_Int64Range_msginit, arena, len);
}
UPB_INLINE int64_t envoy_type_Int64Range_start(const envoy_type_Int64Range *msg) { return UPB_FIELD_AT(msg, int64_t, UPB_SIZE(0, 0)); }
UPB_INLINE int64_t envoy_type_Int64Range_end(const envoy_type_Int64Range *msg) { return UPB_FIELD_AT(msg, int64_t, UPB_SIZE(8, 8)); }
UPB_INLINE void envoy_type_Int64Range_set_start(envoy_type_Int64Range *msg, int64_t value) {
UPB_FIELD_AT(msg, int64_t, UPB_SIZE(0, 0)) = value;
}
UPB_INLINE void envoy_type_Int64Range_set_end(envoy_type_Int64Range *msg, int64_t value) {
UPB_FIELD_AT(msg, int64_t, UPB_SIZE(8, 8)) = value;
}
/* envoy.type.DoubleRange */
UPB_INLINE envoy_type_DoubleRange *envoy_type_DoubleRange_new(upb_arena *arena) {
return (envoy_type_DoubleRange *)upb_msg_new(&envoy_type_DoubleRange_msginit, arena);
}
UPB_INLINE envoy_type_DoubleRange *envoy_type_DoubleRange_parsenew(upb_strview buf, upb_arena *arena) {
envoy_type_DoubleRange *ret = envoy_type_DoubleRange_new(arena);
return (ret && upb_decode(buf, ret, &envoy_type_DoubleRange_msginit)) ? ret : NULL;
}
UPB_INLINE char *envoy_type_DoubleRange_serialize(const envoy_type_DoubleRange *msg, upb_arena *arena, size_t *len) {
return upb_encode(msg, &envoy_type_DoubleRange_msginit, arena, len);
}
UPB_INLINE double envoy_type_DoubleRange_start(const envoy_type_DoubleRange *msg) { return UPB_FIELD_AT(msg, double, UPB_SIZE(0, 0)); }
UPB_INLINE double envoy_type_DoubleRange_end(const envoy_type_DoubleRange *msg) { return UPB_FIELD_AT(msg, double, UPB_SIZE(8, 8)); }
UPB_INLINE void envoy_type_DoubleRange_set_start(envoy_type_DoubleRange *msg, double value) {
UPB_FIELD_AT(msg, double, UPB_SIZE(0, 0)) = value;
}
UPB_INLINE void envoy_type_DoubleRange_set_end(envoy_type_DoubleRange *msg, double value) {
UPB_FIELD_AT(msg, double, UPB_SIZE(8, 8)) = value;
}
#ifdef __cplusplus
} /* extern "C" */
#endif
#include "upb/port_undef.inc"
#endif /* ENVOY_TYPE_RANGE_PROTO_UPB_H_ */

@ -0,0 +1,17 @@
/* This file was generated by upbc (the upb compiler) from the input
* file:
*
* gogoproto/gogo.proto
*
* Do not edit -- your changes will be discarded when the file is
* regenerated. */
#include <stddef.h>
#include "upb/msg.h"
#include "gogoproto/gogo.upb.h"
#include "google/protobuf/descriptor.upb.h"
#include "upb/port_def.inc"
#include "upb/port_undef.inc"

@ -0,0 +1,32 @@
/* This file was generated by upbc (the upb compiler) from the input
* file:
*
* gogoproto/gogo.proto
*
* Do not edit -- your changes will be discarded when the file is
* regenerated. */
#ifndef GOGOPROTO_GOGO_PROTO_UPB_H_
#define GOGOPROTO_GOGO_PROTO_UPB_H_
#include "upb/generated_util.h"
#include "upb/msg.h"
#include "upb/decode.h"
#include "upb/encode.h"
#include "upb/port_def.inc"
#ifdef __cplusplus
extern "C" {
#endif
/* Enums */
#ifdef __cplusplus
} /* extern "C" */
#endif
#include "upb/port_undef.inc"
#endif /* GOGOPROTO_GOGO_PROTO_UPB_H_ */

@ -0,0 +1,18 @@
/* This file was generated by upbc (the upb compiler) from the input
* file:
*
* google/api/annotations.proto
*
* Do not edit -- your changes will be discarded when the file is
* regenerated. */
#include <stddef.h>
#include "upb/msg.h"
#include "google/api/annotations.upb.h"
#include "google/api/http.upb.h"
#include "google/protobuf/descriptor.upb.h"
#include "upb/port_def.inc"
#include "upb/port_undef.inc"

@ -0,0 +1,32 @@
/* This file was generated by upbc (the upb compiler) from the input
* file:
*
* google/api/annotations.proto
*
* Do not edit -- your changes will be discarded when the file is
* regenerated. */
#ifndef GOOGLE_API_ANNOTATIONS_PROTO_UPB_H_
#define GOOGLE_API_ANNOTATIONS_PROTO_UPB_H_
#include "upb/generated_util.h"
#include "upb/msg.h"
#include "upb/decode.h"
#include "upb/encode.h"
#include "upb/port_def.inc"
#ifdef __cplusplus
extern "C" {
#endif
/* Enums */
#ifdef __cplusplus
} /* extern "C" */
#endif
#include "upb/port_undef.inc"
#endif /* GOOGLE_API_ANNOTATIONS_PROTO_UPB_H_ */

@ -0,0 +1,66 @@
/* This file was generated by upbc (the upb compiler) from the input
* file:
*
* google/api/http.proto
*
* Do not edit -- your changes will be discarded when the file is
* regenerated. */
#include <stddef.h>
#include "upb/msg.h"
#include "google/api/http.upb.h"
#include "upb/port_def.inc"
static const upb_msglayout *const google_api_Http_submsgs[1] = {
&google_api_HttpRule_msginit,
};
static const upb_msglayout_field google_api_Http__fields[2] = {
{1, UPB_SIZE(4, 8), 0, 0, 11, 3},
{2, UPB_SIZE(0, 0), 0, 0, 8, 1},
};
const upb_msglayout google_api_Http_msginit = {
&google_api_Http_submsgs[0],
&google_api_Http__fields[0],
UPB_SIZE(8, 16), 2, false,
};
static const upb_msglayout *const google_api_HttpRule_submsgs[2] = {
&google_api_CustomHttpPattern_msginit,
&google_api_HttpRule_msginit,
};
static const upb_msglayout_field google_api_HttpRule__fields[10] = {
{1, UPB_SIZE(0, 0), 0, 0, 9, 1},
{2, UPB_SIZE(28, 56), UPB_SIZE(-37, -73), 0, 9, 1},
{3, UPB_SIZE(28, 56), UPB_SIZE(-37, -73), 0, 9, 1},
{4, UPB_SIZE(28, 56), UPB_SIZE(-37, -73), 0, 9, 1},
{5, UPB_SIZE(28, 56), UPB_SIZE(-37, -73), 0, 9, 1},
{6, UPB_SIZE(28, 56), UPB_SIZE(-37, -73), 0, 9, 1},
{7, UPB_SIZE(8, 16), 0, 0, 9, 1},
{8, UPB_SIZE(28, 56), UPB_SIZE(-37, -73), 0, 11, 1},
{11, UPB_SIZE(24, 48), 0, 1, 11, 3},
{12, UPB_SIZE(16, 32), 0, 0, 9, 1},
};
const upb_msglayout google_api_HttpRule_msginit = {
&google_api_HttpRule_submsgs[0],
&google_api_HttpRule__fields[0],
UPB_SIZE(40, 80), 10, false,
};
static const upb_msglayout_field google_api_CustomHttpPattern__fields[2] = {
{1, UPB_SIZE(0, 0), 0, 0, 9, 1},
{2, UPB_SIZE(8, 16), 0, 0, 9, 1},
};
const upb_msglayout google_api_CustomHttpPattern_msginit = {
NULL,
&google_api_CustomHttpPattern__fields[0],
UPB_SIZE(16, 32), 2, false,
};
#include "upb/port_undef.inc"

@ -0,0 +1,191 @@
/* This file was generated by upbc (the upb compiler) from the input
* file:
*
* google/api/http.proto
*
* Do not edit -- your changes will be discarded when the file is
* regenerated. */
#ifndef GOOGLE_API_HTTP_PROTO_UPB_H_
#define GOOGLE_API_HTTP_PROTO_UPB_H_
#include "upb/generated_util.h"
#include "upb/msg.h"
#include "upb/decode.h"
#include "upb/encode.h"
#include "upb/port_def.inc"
#ifdef __cplusplus
extern "C" {
#endif
struct google_api_Http;
struct google_api_HttpRule;
struct google_api_CustomHttpPattern;
typedef struct google_api_Http google_api_Http;
typedef struct google_api_HttpRule google_api_HttpRule;
typedef struct google_api_CustomHttpPattern google_api_CustomHttpPattern;
extern const upb_msglayout google_api_Http_msginit;
extern const upb_msglayout google_api_HttpRule_msginit;
extern const upb_msglayout google_api_CustomHttpPattern_msginit;
/* Enums */
/* google.api.Http */
UPB_INLINE google_api_Http *google_api_Http_new(upb_arena *arena) {
return (google_api_Http *)upb_msg_new(&google_api_Http_msginit, arena);
}
UPB_INLINE google_api_Http *google_api_Http_parsenew(upb_strview buf, upb_arena *arena) {
google_api_Http *ret = google_api_Http_new(arena);
return (ret && upb_decode(buf, ret, &google_api_Http_msginit)) ? ret : NULL;
}
UPB_INLINE char *google_api_Http_serialize(const google_api_Http *msg, upb_arena *arena, size_t *len) {
return upb_encode(msg, &google_api_Http_msginit, arena, len);
}
UPB_INLINE const google_api_HttpRule* const* google_api_Http_rules(const google_api_Http *msg, size_t *len) { return (const google_api_HttpRule* const*)_upb_array_accessor(msg, UPB_SIZE(4, 8), len); }
UPB_INLINE bool google_api_Http_fully_decode_reserved_expansion(const google_api_Http *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(0, 0)); }
UPB_INLINE google_api_HttpRule** google_api_Http_mutable_rules(google_api_Http *msg, size_t *len) {
return (google_api_HttpRule**)_upb_array_mutable_accessor(msg, UPB_SIZE(4, 8), len);
}
UPB_INLINE google_api_HttpRule** google_api_Http_resize_rules(google_api_Http *msg, size_t len, upb_arena *arena) {
return (google_api_HttpRule**)_upb_array_resize_accessor(msg, UPB_SIZE(4, 8), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
}
UPB_INLINE struct google_api_HttpRule* google_api_Http_add_rules(google_api_Http *msg, upb_arena *arena) {
struct google_api_HttpRule* sub = (struct google_api_HttpRule*)upb_msg_new(&google_api_HttpRule_msginit, arena);
bool ok = _upb_array_append_accessor(
msg, UPB_SIZE(4, 8), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
if (!ok) return NULL;
return sub;
}
UPB_INLINE void google_api_Http_set_fully_decode_reserved_expansion(google_api_Http *msg, bool value) {
UPB_FIELD_AT(msg, bool, UPB_SIZE(0, 0)) = value;
}
/* google.api.HttpRule */
UPB_INLINE google_api_HttpRule *google_api_HttpRule_new(upb_arena *arena) {
return (google_api_HttpRule *)upb_msg_new(&google_api_HttpRule_msginit, arena);
}
UPB_INLINE google_api_HttpRule *google_api_HttpRule_parsenew(upb_strview buf, upb_arena *arena) {
google_api_HttpRule *ret = google_api_HttpRule_new(arena);
return (ret && upb_decode(buf, ret, &google_api_HttpRule_msginit)) ? ret : NULL;
}
UPB_INLINE char *google_api_HttpRule_serialize(const google_api_HttpRule *msg, upb_arena *arena, size_t *len) {
return upb_encode(msg, &google_api_HttpRule_msginit, arena, len);
}
typedef enum {
google_api_HttpRule_pattern_get = 2,
google_api_HttpRule_pattern_put = 3,
google_api_HttpRule_pattern_post = 4,
google_api_HttpRule_pattern_delete = 5,
google_api_HttpRule_pattern_patch = 6,
google_api_HttpRule_pattern_custom = 8,
google_api_HttpRule_pattern_NOT_SET = 0,
} google_api_HttpRule_pattern_oneofcases;
UPB_INLINE google_api_HttpRule_pattern_oneofcases google_api_HttpRule_pattern_case(const google_api_HttpRule* msg) { return UPB_FIELD_AT(msg, int, UPB_SIZE(36, 72)); }
UPB_INLINE upb_strview google_api_HttpRule_selector(const google_api_HttpRule *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); }
UPB_INLINE bool google_api_HttpRule_has_get(const google_api_HttpRule *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(36, 72), 2); }
UPB_INLINE upb_strview google_api_HttpRule_get(const google_api_HttpRule *msg) { return UPB_READ_ONEOF(msg, upb_strview, UPB_SIZE(28, 56), UPB_SIZE(36, 72), 2, upb_strview_make("", strlen(""))); }
UPB_INLINE bool google_api_HttpRule_has_put(const google_api_HttpRule *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(36, 72), 3); }
UPB_INLINE upb_strview google_api_HttpRule_put(const google_api_HttpRule *msg) { return UPB_READ_ONEOF(msg, upb_strview, UPB_SIZE(28, 56), UPB_SIZE(36, 72), 3, upb_strview_make("", strlen(""))); }
UPB_INLINE bool google_api_HttpRule_has_post(const google_api_HttpRule *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(36, 72), 4); }
UPB_INLINE upb_strview google_api_HttpRule_post(const google_api_HttpRule *msg) { return UPB_READ_ONEOF(msg, upb_strview, UPB_SIZE(28, 56), UPB_SIZE(36, 72), 4, upb_strview_make("", strlen(""))); }
UPB_INLINE bool google_api_HttpRule_has_delete(const google_api_HttpRule *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(36, 72), 5); }
UPB_INLINE upb_strview google_api_HttpRule_delete(const google_api_HttpRule *msg) { return UPB_READ_ONEOF(msg, upb_strview, UPB_SIZE(28, 56), UPB_SIZE(36, 72), 5, upb_strview_make("", strlen(""))); }
UPB_INLINE bool google_api_HttpRule_has_patch(const google_api_HttpRule *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(36, 72), 6); }
UPB_INLINE upb_strview google_api_HttpRule_patch(const google_api_HttpRule *msg) { return UPB_READ_ONEOF(msg, upb_strview, UPB_SIZE(28, 56), UPB_SIZE(36, 72), 6, upb_strview_make("", strlen(""))); }
UPB_INLINE upb_strview google_api_HttpRule_body(const google_api_HttpRule *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 16)); }
UPB_INLINE bool google_api_HttpRule_has_custom(const google_api_HttpRule *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(36, 72), 8); }
UPB_INLINE const google_api_CustomHttpPattern* google_api_HttpRule_custom(const google_api_HttpRule *msg) { return UPB_READ_ONEOF(msg, const google_api_CustomHttpPattern*, UPB_SIZE(28, 56), UPB_SIZE(36, 72), 8, NULL); }
UPB_INLINE const google_api_HttpRule* const* google_api_HttpRule_additional_bindings(const google_api_HttpRule *msg, size_t *len) { return (const google_api_HttpRule* const*)_upb_array_accessor(msg, UPB_SIZE(24, 48), len); }
UPB_INLINE upb_strview google_api_HttpRule_response_body(const google_api_HttpRule *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(16, 32)); }
UPB_INLINE void google_api_HttpRule_set_selector(google_api_HttpRule *msg, upb_strview value) {
UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value;
}
UPB_INLINE void google_api_HttpRule_set_get(google_api_HttpRule *msg, upb_strview value) {
UPB_WRITE_ONEOF(msg, upb_strview, UPB_SIZE(28, 56), value, UPB_SIZE(36, 72), 2);
}
UPB_INLINE void google_api_HttpRule_set_put(google_api_HttpRule *msg, upb_strview value) {
UPB_WRITE_ONEOF(msg, upb_strview, UPB_SIZE(28, 56), value, UPB_SIZE(36, 72), 3);
}
UPB_INLINE void google_api_HttpRule_set_post(google_api_HttpRule *msg, upb_strview value) {
UPB_WRITE_ONEOF(msg, upb_strview, UPB_SIZE(28, 56), value, UPB_SIZE(36, 72), 4);
}
UPB_INLINE void google_api_HttpRule_set_delete(google_api_HttpRule *msg, upb_strview value) {
UPB_WRITE_ONEOF(msg, upb_strview, UPB_SIZE(28, 56), value, UPB_SIZE(36, 72), 5);
}
UPB_INLINE void google_api_HttpRule_set_patch(google_api_HttpRule *msg, upb_strview value) {
UPB_WRITE_ONEOF(msg, upb_strview, UPB_SIZE(28, 56), value, UPB_SIZE(36, 72), 6);
}
UPB_INLINE void google_api_HttpRule_set_body(google_api_HttpRule *msg, upb_strview value) {
UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 16)) = value;
}
UPB_INLINE void google_api_HttpRule_set_custom(google_api_HttpRule *msg, google_api_CustomHttpPattern* value) {
UPB_WRITE_ONEOF(msg, google_api_CustomHttpPattern*, UPB_SIZE(28, 56), value, UPB_SIZE(36, 72), 8);
}
UPB_INLINE struct google_api_CustomHttpPattern* google_api_HttpRule_mutable_custom(google_api_HttpRule *msg, upb_arena *arena) {
struct google_api_CustomHttpPattern* sub = (struct google_api_CustomHttpPattern*)google_api_HttpRule_custom(msg);
if (sub == NULL) {
sub = (struct google_api_CustomHttpPattern*)upb_msg_new(&google_api_CustomHttpPattern_msginit, arena);
if (!sub) return NULL;
google_api_HttpRule_set_custom(msg, sub);
}
return sub;
}
UPB_INLINE google_api_HttpRule** google_api_HttpRule_mutable_additional_bindings(google_api_HttpRule *msg, size_t *len) {
return (google_api_HttpRule**)_upb_array_mutable_accessor(msg, UPB_SIZE(24, 48), len);
}
UPB_INLINE google_api_HttpRule** google_api_HttpRule_resize_additional_bindings(google_api_HttpRule *msg, size_t len, upb_arena *arena) {
return (google_api_HttpRule**)_upb_array_resize_accessor(msg, UPB_SIZE(24, 48), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
}
UPB_INLINE struct google_api_HttpRule* google_api_HttpRule_add_additional_bindings(google_api_HttpRule *msg, upb_arena *arena) {
struct google_api_HttpRule* sub = (struct google_api_HttpRule*)upb_msg_new(&google_api_HttpRule_msginit, arena);
bool ok = _upb_array_append_accessor(
msg, UPB_SIZE(24, 48), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
if (!ok) return NULL;
return sub;
}
UPB_INLINE void google_api_HttpRule_set_response_body(google_api_HttpRule *msg, upb_strview value) {
UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(16, 32)) = value;
}
/* google.api.CustomHttpPattern */
UPB_INLINE google_api_CustomHttpPattern *google_api_CustomHttpPattern_new(upb_arena *arena) {
return (google_api_CustomHttpPattern *)upb_msg_new(&google_api_CustomHttpPattern_msginit, arena);
}
UPB_INLINE google_api_CustomHttpPattern *google_api_CustomHttpPattern_parsenew(upb_strview buf, upb_arena *arena) {
google_api_CustomHttpPattern *ret = google_api_CustomHttpPattern_new(arena);
return (ret && upb_decode(buf, ret, &google_api_CustomHttpPattern_msginit)) ? ret : NULL;
}
UPB_INLINE char *google_api_CustomHttpPattern_serialize(const google_api_CustomHttpPattern *msg, upb_arena *arena, size_t *len) {
return upb_encode(msg, &google_api_CustomHttpPattern_msginit, arena, len);
}
UPB_INLINE upb_strview google_api_CustomHttpPattern_kind(const google_api_CustomHttpPattern *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); }
UPB_INLINE upb_strview google_api_CustomHttpPattern_path(const google_api_CustomHttpPattern *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 16)); }
UPB_INLINE void google_api_CustomHttpPattern_set_kind(google_api_CustomHttpPattern *msg, upb_strview value) {
UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value;
}
UPB_INLINE void google_api_CustomHttpPattern_set_path(google_api_CustomHttpPattern *msg, upb_strview value) {
UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 16)) = value;
}
#ifdef __cplusplus
} /* extern "C" */
#endif
#include "upb/port_undef.inc"
#endif /* GOOGLE_API_HTTP_PROTO_UPB_H_ */

@ -0,0 +1,33 @@
/* This file was generated by upbc (the upb compiler) from the input
* file:
*
* google/rpc/status.proto
*
* Do not edit -- your changes will be discarded when the file is
* regenerated. */
#include <stddef.h>
#include "upb/msg.h"
#include "google/rpc/status.upb.h"
#include "google/protobuf/any.upb.h"
#include "upb/port_def.inc"
static const upb_msglayout *const google_rpc_Status_submsgs[1] = {
&google_protobuf_Any_msginit,
};
static const upb_msglayout_field google_rpc_Status__fields[3] = {
{1, UPB_SIZE(0, 0), 0, 0, 5, 1},
{2, UPB_SIZE(4, 8), 0, 0, 9, 1},
{3, UPB_SIZE(12, 24), 0, 0, 11, 3},
};
const upb_msglayout google_rpc_Status_msginit = {
&google_rpc_Status_submsgs[0],
&google_rpc_Status__fields[0],
UPB_SIZE(16, 32), 3, false,
};
#include "upb/port_undef.inc"

@ -0,0 +1,75 @@
/* This file was generated by upbc (the upb compiler) from the input
* file:
*
* google/rpc/status.proto
*
* Do not edit -- your changes will be discarded when the file is
* regenerated. */
#ifndef GOOGLE_RPC_STATUS_PROTO_UPB_H_
#define GOOGLE_RPC_STATUS_PROTO_UPB_H_
#include "upb/generated_util.h"
#include "upb/msg.h"
#include "upb/decode.h"
#include "upb/encode.h"
#include "upb/port_def.inc"
#ifdef __cplusplus
extern "C" {
#endif
struct google_rpc_Status;
typedef struct google_rpc_Status google_rpc_Status;
extern const upb_msglayout google_rpc_Status_msginit;
struct google_protobuf_Any;
extern const upb_msglayout google_protobuf_Any_msginit;
/* Enums */
/* google.rpc.Status */
UPB_INLINE google_rpc_Status *google_rpc_Status_new(upb_arena *arena) {
return (google_rpc_Status *)upb_msg_new(&google_rpc_Status_msginit, arena);
}
UPB_INLINE google_rpc_Status *google_rpc_Status_parsenew(upb_strview buf, upb_arena *arena) {
google_rpc_Status *ret = google_rpc_Status_new(arena);
return (ret && upb_decode(buf, ret, &google_rpc_Status_msginit)) ? ret : NULL;
}
UPB_INLINE char *google_rpc_Status_serialize(const google_rpc_Status *msg, upb_arena *arena, size_t *len) {
return upb_encode(msg, &google_rpc_Status_msginit, arena, len);
}
UPB_INLINE int32_t google_rpc_Status_code(const google_rpc_Status *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(0, 0)); }
UPB_INLINE upb_strview google_rpc_Status_message(const google_rpc_Status *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)); }
UPB_INLINE const struct google_protobuf_Any* const* google_rpc_Status_details(const google_rpc_Status *msg, size_t *len) { return (const struct google_protobuf_Any* const*)_upb_array_accessor(msg, UPB_SIZE(12, 24), len); }
UPB_INLINE void google_rpc_Status_set_code(google_rpc_Status *msg, int32_t value) {
UPB_FIELD_AT(msg, int32_t, UPB_SIZE(0, 0)) = value;
}
UPB_INLINE void google_rpc_Status_set_message(google_rpc_Status *msg, upb_strview value) {
UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)) = value;
}
UPB_INLINE struct google_protobuf_Any** google_rpc_Status_mutable_details(google_rpc_Status *msg, size_t *len) {
return (struct google_protobuf_Any**)_upb_array_mutable_accessor(msg, UPB_SIZE(12, 24), len);
}
UPB_INLINE struct google_protobuf_Any** google_rpc_Status_resize_details(google_rpc_Status *msg, size_t len, upb_arena *arena) {
return (struct google_protobuf_Any**)_upb_array_resize_accessor(msg, UPB_SIZE(12, 24), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
}
UPB_INLINE struct google_protobuf_Any* google_rpc_Status_add_details(google_rpc_Status *msg, upb_arena *arena) {
struct google_protobuf_Any* sub = (struct google_protobuf_Any*)upb_msg_new(&google_protobuf_Any_msginit, arena);
bool ok = _upb_array_append_accessor(
msg, UPB_SIZE(12, 24), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
if (!ok) return NULL;
return sub;
}
#ifdef __cplusplus
} /* extern "C" */
#endif
#include "upb/port_undef.inc"
#endif /* GOOGLE_RPC_STATUS_PROTO_UPB_H_ */

@ -0,0 +1,443 @@
/* This file was generated by upbc (the upb compiler) from the input
* file:
*
* validate/validate.proto
*
* Do not edit -- your changes will be discarded when the file is
* regenerated. */
#include <stddef.h>
#include "upb/msg.h"
#include "validate/validate.upb.h"
#include "google/protobuf/descriptor.upb.h"
#include "google/protobuf/duration.upb.h"
#include "google/protobuf/timestamp.upb.h"
#include "upb/port_def.inc"
static const upb_msglayout *const validate_FieldRules_submsgs[22] = {
&validate_AnyRules_msginit,
&validate_BoolRules_msginit,
&validate_BytesRules_msginit,
&validate_DoubleRules_msginit,
&validate_DurationRules_msginit,
&validate_EnumRules_msginit,
&validate_Fixed32Rules_msginit,
&validate_Fixed64Rules_msginit,
&validate_FloatRules_msginit,
&validate_Int32Rules_msginit,
&validate_Int64Rules_msginit,
&validate_MapRules_msginit,
&validate_MessageRules_msginit,
&validate_RepeatedRules_msginit,
&validate_SFixed32Rules_msginit,
&validate_SFixed64Rules_msginit,
&validate_SInt32Rules_msginit,
&validate_SInt64Rules_msginit,
&validate_StringRules_msginit,
&validate_TimestampRules_msginit,
&validate_UInt32Rules_msginit,
&validate_UInt64Rules_msginit,
};
static const upb_msglayout_field validate_FieldRules__fields[22] = {
{1, UPB_SIZE(0, 0), UPB_SIZE(-5, -9), 8, 11, 1},
{2, UPB_SIZE(0, 0), UPB_SIZE(-5, -9), 3, 11, 1},
{3, UPB_SIZE(0, 0), UPB_SIZE(-5, -9), 9, 11, 1},
{4, UPB_SIZE(0, 0), UPB_SIZE(-5, -9), 10, 11, 1},
{5, UPB_SIZE(0, 0), UPB_SIZE(-5, -9), 20, 11, 1},
{6, UPB_SIZE(0, 0), UPB_SIZE(-5, -9), 21, 11, 1},
{7, UPB_SIZE(0, 0), UPB_SIZE(-5, -9), 16, 11, 1},
{8, UPB_SIZE(0, 0), UPB_SIZE(-5, -9), 17, 11, 1},
{9, UPB_SIZE(0, 0), UPB_SIZE(-5, -9), 6, 11, 1},
{10, UPB_SIZE(0, 0), UPB_SIZE(-5, -9), 7, 11, 1},
{11, UPB_SIZE(0, 0), UPB_SIZE(-5, -9), 14, 11, 1},
{12, UPB_SIZE(0, 0), UPB_SIZE(-5, -9), 15, 11, 1},
{13, UPB_SIZE(0, 0), UPB_SIZE(-5, -9), 1, 11, 1},
{14, UPB_SIZE(0, 0), UPB_SIZE(-5, -9), 18, 11, 1},
{15, UPB_SIZE(0, 0), UPB_SIZE(-5, -9), 2, 11, 1},
{16, UPB_SIZE(0, 0), UPB_SIZE(-5, -9), 5, 11, 1},
{17, UPB_SIZE(0, 0), UPB_SIZE(-5, -9), 12, 11, 1},
{18, UPB_SIZE(0, 0), UPB_SIZE(-5, -9), 13, 11, 1},
{19, UPB_SIZE(0, 0), UPB_SIZE(-5, -9), 11, 11, 1},
{20, UPB_SIZE(0, 0), UPB_SIZE(-5, -9), 0, 11, 1},
{21, UPB_SIZE(0, 0), UPB_SIZE(-5, -9), 4, 11, 1},
{22, UPB_SIZE(0, 0), UPB_SIZE(-5, -9), 19, 11, 1},
};
const upb_msglayout validate_FieldRules_msginit = {
&validate_FieldRules_submsgs[0],
&validate_FieldRules__fields[0],
UPB_SIZE(8, 16), 22, false,
};
static const upb_msglayout_field validate_FloatRules__fields[7] = {
{1, UPB_SIZE(4, 4), 1, 0, 2, 1},
{2, UPB_SIZE(8, 8), 2, 0, 2, 1},
{3, UPB_SIZE(12, 12), 3, 0, 2, 1},
{4, UPB_SIZE(16, 16), 4, 0, 2, 1},
{5, UPB_SIZE(20, 20), 5, 0, 2, 1},
{6, UPB_SIZE(24, 24), 0, 0, 2, 3},
{7, UPB_SIZE(28, 32), 0, 0, 2, 3},
};
const upb_msglayout validate_FloatRules_msginit = {
NULL,
&validate_FloatRules__fields[0],
UPB_SIZE(32, 40), 7, false,
};
static const upb_msglayout_field validate_DoubleRules__fields[7] = {
{1, UPB_SIZE(8, 8), 1, 0, 1, 1},
{2, UPB_SIZE(16, 16), 2, 0, 1, 1},
{3, UPB_SIZE(24, 24), 3, 0, 1, 1},
{4, UPB_SIZE(32, 32), 4, 0, 1, 1},
{5, UPB_SIZE(40, 40), 5, 0, 1, 1},
{6, UPB_SIZE(48, 48), 0, 0, 1, 3},
{7, UPB_SIZE(52, 56), 0, 0, 1, 3},
};
const upb_msglayout validate_DoubleRules_msginit = {
NULL,
&validate_DoubleRules__fields[0],
UPB_SIZE(56, 64), 7, false,
};
static const upb_msglayout_field validate_Int32Rules__fields[7] = {
{1, UPB_SIZE(4, 4), 1, 0, 5, 1},
{2, UPB_SIZE(8, 8), 2, 0, 5, 1},
{3, UPB_SIZE(12, 12), 3, 0, 5, 1},
{4, UPB_SIZE(16, 16), 4, 0, 5, 1},
{5, UPB_SIZE(20, 20), 5, 0, 5, 1},
{6, UPB_SIZE(24, 24), 0, 0, 5, 3},
{7, UPB_SIZE(28, 32), 0, 0, 5, 3},
};
const upb_msglayout validate_Int32Rules_msginit = {
NULL,
&validate_Int32Rules__fields[0],
UPB_SIZE(32, 40), 7, false,
};
static const upb_msglayout_field validate_Int64Rules__fields[7] = {
{1, UPB_SIZE(8, 8), 1, 0, 3, 1},
{2, UPB_SIZE(16, 16), 2, 0, 3, 1},
{3, UPB_SIZE(24, 24), 3, 0, 3, 1},
{4, UPB_SIZE(32, 32), 4, 0, 3, 1},
{5, UPB_SIZE(40, 40), 5, 0, 3, 1},
{6, UPB_SIZE(48, 48), 0, 0, 3, 3},
{7, UPB_SIZE(52, 56), 0, 0, 3, 3},
};
const upb_msglayout validate_Int64Rules_msginit = {
NULL,
&validate_Int64Rules__fields[0],
UPB_SIZE(56, 64), 7, false,
};
static const upb_msglayout_field validate_UInt32Rules__fields[7] = {
{1, UPB_SIZE(4, 4), 1, 0, 13, 1},
{2, UPB_SIZE(8, 8), 2, 0, 13, 1},
{3, UPB_SIZE(12, 12), 3, 0, 13, 1},
{4, UPB_SIZE(16, 16), 4, 0, 13, 1},
{5, UPB_SIZE(20, 20), 5, 0, 13, 1},
{6, UPB_SIZE(24, 24), 0, 0, 13, 3},
{7, UPB_SIZE(28, 32), 0, 0, 13, 3},
};
const upb_msglayout validate_UInt32Rules_msginit = {
NULL,
&validate_UInt32Rules__fields[0],
UPB_SIZE(32, 40), 7, false,
};
static const upb_msglayout_field validate_UInt64Rules__fields[7] = {
{1, UPB_SIZE(8, 8), 1, 0, 4, 1},
{2, UPB_SIZE(16, 16), 2, 0, 4, 1},
{3, UPB_SIZE(24, 24), 3, 0, 4, 1},
{4, UPB_SIZE(32, 32), 4, 0, 4, 1},
{5, UPB_SIZE(40, 40), 5, 0, 4, 1},
{6, UPB_SIZE(48, 48), 0, 0, 4, 3},
{7, UPB_SIZE(52, 56), 0, 0, 4, 3},
};
const upb_msglayout validate_UInt64Rules_msginit = {
NULL,
&validate_UInt64Rules__fields[0],
UPB_SIZE(56, 64), 7, false,
};
static const upb_msglayout_field validate_SInt32Rules__fields[7] = {
{1, UPB_SIZE(4, 4), 1, 0, 17, 1},
{2, UPB_SIZE(8, 8), 2, 0, 17, 1},
{3, UPB_SIZE(12, 12), 3, 0, 17, 1},
{4, UPB_SIZE(16, 16), 4, 0, 17, 1},
{5, UPB_SIZE(20, 20), 5, 0, 17, 1},
{6, UPB_SIZE(24, 24), 0, 0, 17, 3},
{7, UPB_SIZE(28, 32), 0, 0, 17, 3},
};
const upb_msglayout validate_SInt32Rules_msginit = {
NULL,
&validate_SInt32Rules__fields[0],
UPB_SIZE(32, 40), 7, false,
};
static const upb_msglayout_field validate_SInt64Rules__fields[7] = {
{1, UPB_SIZE(8, 8), 1, 0, 18, 1},
{2, UPB_SIZE(16, 16), 2, 0, 18, 1},
{3, UPB_SIZE(24, 24), 3, 0, 18, 1},
{4, UPB_SIZE(32, 32), 4, 0, 18, 1},
{5, UPB_SIZE(40, 40), 5, 0, 18, 1},
{6, UPB_SIZE(48, 48), 0, 0, 18, 3},
{7, UPB_SIZE(52, 56), 0, 0, 18, 3},
};
const upb_msglayout validate_SInt64Rules_msginit = {
NULL,
&validate_SInt64Rules__fields[0],
UPB_SIZE(56, 64), 7, false,
};
static const upb_msglayout_field validate_Fixed32Rules__fields[7] = {
{1, UPB_SIZE(4, 4), 1, 0, 7, 1},
{2, UPB_SIZE(8, 8), 2, 0, 7, 1},
{3, UPB_SIZE(12, 12), 3, 0, 7, 1},
{4, UPB_SIZE(16, 16), 4, 0, 7, 1},
{5, UPB_SIZE(20, 20), 5, 0, 7, 1},
{6, UPB_SIZE(24, 24), 0, 0, 7, 3},
{7, UPB_SIZE(28, 32), 0, 0, 7, 3},
};
const upb_msglayout validate_Fixed32Rules_msginit = {
NULL,
&validate_Fixed32Rules__fields[0],
UPB_SIZE(32, 40), 7, false,
};
static const upb_msglayout_field validate_Fixed64Rules__fields[7] = {
{1, UPB_SIZE(8, 8), 1, 0, 6, 1},
{2, UPB_SIZE(16, 16), 2, 0, 6, 1},
{3, UPB_SIZE(24, 24), 3, 0, 6, 1},
{4, UPB_SIZE(32, 32), 4, 0, 6, 1},
{5, UPB_SIZE(40, 40), 5, 0, 6, 1},
{6, UPB_SIZE(48, 48), 0, 0, 6, 3},
{7, UPB_SIZE(52, 56), 0, 0, 6, 3},
};
const upb_msglayout validate_Fixed64Rules_msginit = {
NULL,
&validate_Fixed64Rules__fields[0],
UPB_SIZE(56, 64), 7, false,
};
static const upb_msglayout_field validate_SFixed32Rules__fields[7] = {
{1, UPB_SIZE(4, 4), 1, 0, 15, 1},
{2, UPB_SIZE(8, 8), 2, 0, 15, 1},
{3, UPB_SIZE(12, 12), 3, 0, 15, 1},
{4, UPB_SIZE(16, 16), 4, 0, 15, 1},
{5, UPB_SIZE(20, 20), 5, 0, 15, 1},
{6, UPB_SIZE(24, 24), 0, 0, 15, 3},
{7, UPB_SIZE(28, 32), 0, 0, 15, 3},
};
const upb_msglayout validate_SFixed32Rules_msginit = {
NULL,
&validate_SFixed32Rules__fields[0],
UPB_SIZE(32, 40), 7, false,
};
static const upb_msglayout_field validate_SFixed64Rules__fields[7] = {
{1, UPB_SIZE(8, 8), 1, 0, 16, 1},
{2, UPB_SIZE(16, 16), 2, 0, 16, 1},
{3, UPB_SIZE(24, 24), 3, 0, 16, 1},
{4, UPB_SIZE(32, 32), 4, 0, 16, 1},
{5, UPB_SIZE(40, 40), 5, 0, 16, 1},
{6, UPB_SIZE(48, 48), 0, 0, 16, 3},
{7, UPB_SIZE(52, 56), 0, 0, 16, 3},
};
const upb_msglayout validate_SFixed64Rules_msginit = {
NULL,
&validate_SFixed64Rules__fields[0],
UPB_SIZE(56, 64), 7, false,
};
static const upb_msglayout_field validate_BoolRules__fields[1] = {
{1, UPB_SIZE(1, 1), 1, 0, 8, 1},
};
const upb_msglayout validate_BoolRules_msginit = {
NULL,
&validate_BoolRules__fields[0],
UPB_SIZE(2, 2), 1, false,
};
static const upb_msglayout_field validate_StringRules__fields[20] = {
{1, UPB_SIZE(56, 56), 7, 0, 9, 1},
{2, UPB_SIZE(8, 8), 1, 0, 4, 1},
{3, UPB_SIZE(16, 16), 2, 0, 4, 1},
{4, UPB_SIZE(24, 24), 3, 0, 4, 1},
{5, UPB_SIZE(32, 32), 4, 0, 4, 1},
{6, UPB_SIZE(64, 72), 8, 0, 9, 1},
{7, UPB_SIZE(72, 88), 9, 0, 9, 1},
{8, UPB_SIZE(80, 104), 10, 0, 9, 1},
{9, UPB_SIZE(88, 120), 11, 0, 9, 1},
{10, UPB_SIZE(96, 136), 0, 0, 9, 3},
{11, UPB_SIZE(100, 144), 0, 0, 9, 3},
{12, UPB_SIZE(104, 152), UPB_SIZE(-109, -157), 0, 8, 1},
{13, UPB_SIZE(104, 152), UPB_SIZE(-109, -157), 0, 8, 1},
{14, UPB_SIZE(104, 152), UPB_SIZE(-109, -157), 0, 8, 1},
{15, UPB_SIZE(104, 152), UPB_SIZE(-109, -157), 0, 8, 1},
{16, UPB_SIZE(104, 152), UPB_SIZE(-109, -157), 0, 8, 1},
{17, UPB_SIZE(104, 152), UPB_SIZE(-109, -157), 0, 8, 1},
{18, UPB_SIZE(104, 152), UPB_SIZE(-109, -157), 0, 8, 1},
{19, UPB_SIZE(40, 40), 5, 0, 4, 1},
{20, UPB_SIZE(48, 48), 6, 0, 4, 1},
};
const upb_msglayout validate_StringRules_msginit = {
NULL,
&validate_StringRules__fields[0],
UPB_SIZE(112, 160), 20, false,
};
static const upb_msglayout_field validate_BytesRules__fields[13] = {
{1, UPB_SIZE(32, 32), 4, 0, 12, 1},
{2, UPB_SIZE(8, 8), 1, 0, 4, 1},
{3, UPB_SIZE(16, 16), 2, 0, 4, 1},
{4, UPB_SIZE(40, 48), 5, 0, 9, 1},
{5, UPB_SIZE(48, 64), 6, 0, 12, 1},
{6, UPB_SIZE(56, 80), 7, 0, 12, 1},
{7, UPB_SIZE(64, 96), 8, 0, 12, 1},
{8, UPB_SIZE(72, 112), 0, 0, 12, 3},
{9, UPB_SIZE(76, 120), 0, 0, 12, 3},
{10, UPB_SIZE(80, 128), UPB_SIZE(-85, -133), 0, 8, 1},
{11, UPB_SIZE(80, 128), UPB_SIZE(-85, -133), 0, 8, 1},
{12, UPB_SIZE(80, 128), UPB_SIZE(-85, -133), 0, 8, 1},
{13, UPB_SIZE(24, 24), 3, 0, 4, 1},
};
const upb_msglayout validate_BytesRules_msginit = {
NULL,
&validate_BytesRules__fields[0],
UPB_SIZE(88, 144), 13, false,
};
static const upb_msglayout_field validate_EnumRules__fields[4] = {
{1, UPB_SIZE(4, 4), 1, 0, 5, 1},
{2, UPB_SIZE(8, 8), 2, 0, 8, 1},
{3, UPB_SIZE(12, 16), 0, 0, 5, 3},
{4, UPB_SIZE(16, 24), 0, 0, 5, 3},
};
const upb_msglayout validate_EnumRules_msginit = {
NULL,
&validate_EnumRules__fields[0],
UPB_SIZE(20, 32), 4, false,
};
static const upb_msglayout_field validate_MessageRules__fields[2] = {
{1, UPB_SIZE(1, 1), 1, 0, 8, 1},
{2, UPB_SIZE(2, 2), 2, 0, 8, 1},
};
const upb_msglayout validate_MessageRules_msginit = {
NULL,
&validate_MessageRules__fields[0],
UPB_SIZE(3, 3), 2, false,
};
static const upb_msglayout *const validate_RepeatedRules_submsgs[1] = {
&validate_FieldRules_msginit,
};
static const upb_msglayout_field validate_RepeatedRules__fields[4] = {
{1, UPB_SIZE(8, 8), 1, 0, 4, 1},
{2, UPB_SIZE(16, 16), 2, 0, 4, 1},
{3, UPB_SIZE(24, 24), 3, 0, 8, 1},
{4, UPB_SIZE(28, 32), 4, 0, 11, 1},
};
const upb_msglayout validate_RepeatedRules_msginit = {
&validate_RepeatedRules_submsgs[0],
&validate_RepeatedRules__fields[0],
UPB_SIZE(32, 40), 4, false,
};
static const upb_msglayout *const validate_MapRules_submsgs[2] = {
&validate_FieldRules_msginit,
};
static const upb_msglayout_field validate_MapRules__fields[5] = {
{1, UPB_SIZE(8, 8), 1, 0, 4, 1},
{2, UPB_SIZE(16, 16), 2, 0, 4, 1},
{3, UPB_SIZE(24, 24), 3, 0, 8, 1},
{4, UPB_SIZE(28, 32), 4, 0, 11, 1},
{5, UPB_SIZE(32, 40), 5, 0, 11, 1},
};
const upb_msglayout validate_MapRules_msginit = {
&validate_MapRules_submsgs[0],
&validate_MapRules__fields[0],
UPB_SIZE(40, 48), 5, false,
};
static const upb_msglayout_field validate_AnyRules__fields[3] = {
{1, UPB_SIZE(1, 1), 1, 0, 8, 1},
{2, UPB_SIZE(4, 8), 0, 0, 9, 3},
{3, UPB_SIZE(8, 16), 0, 0, 9, 3},
};
const upb_msglayout validate_AnyRules_msginit = {
NULL,
&validate_AnyRules__fields[0],
UPB_SIZE(12, 24), 3, false,
};
static const upb_msglayout *const validate_DurationRules_submsgs[7] = {
&google_protobuf_Duration_msginit,
};
static const upb_msglayout_field validate_DurationRules__fields[8] = {
{1, UPB_SIZE(1, 1), 1, 0, 8, 1},
{2, UPB_SIZE(4, 8), 2, 0, 11, 1},
{3, UPB_SIZE(8, 16), 3, 0, 11, 1},
{4, UPB_SIZE(12, 24), 4, 0, 11, 1},
{5, UPB_SIZE(16, 32), 5, 0, 11, 1},
{6, UPB_SIZE(20, 40), 6, 0, 11, 1},
{7, UPB_SIZE(24, 48), 0, 0, 11, 3},
{8, UPB_SIZE(28, 56), 0, 0, 11, 3},
};
const upb_msglayout validate_DurationRules_msginit = {
&validate_DurationRules_submsgs[0],
&validate_DurationRules__fields[0],
UPB_SIZE(32, 64), 8, false,
};
static const upb_msglayout *const validate_TimestampRules_submsgs[6] = {
&google_protobuf_Duration_msginit,
&google_protobuf_Timestamp_msginit,
};
static const upb_msglayout_field validate_TimestampRules__fields[9] = {
{1, UPB_SIZE(2, 2), 1, 0, 8, 1},
{2, UPB_SIZE(8, 8), 4, 1, 11, 1},
{3, UPB_SIZE(12, 16), 5, 1, 11, 1},
{4, UPB_SIZE(16, 24), 6, 1, 11, 1},
{5, UPB_SIZE(20, 32), 7, 1, 11, 1},
{6, UPB_SIZE(24, 40), 8, 1, 11, 1},
{7, UPB_SIZE(3, 3), 2, 0, 8, 1},
{8, UPB_SIZE(4, 4), 3, 0, 8, 1},
{9, UPB_SIZE(28, 48), 9, 0, 11, 1},
};
const upb_msglayout validate_TimestampRules_msginit = {
&validate_TimestampRules_submsgs[0],
&validate_TimestampRules__fields[0],
UPB_SIZE(32, 56), 9, false,
};
#include "upb/port_undef.inc"

File diff suppressed because it is too large Load Diff

@ -58,7 +58,7 @@ class Atomic {
bool CompareExchangeStrong(T* expected, T desired, MemoryOrder success,
MemoryOrder failure) {
return GPR_ATM_INC_CAS_THEN(storage_.compare_exchange_weak(
return GPR_ATM_INC_CAS_THEN(storage_.compare_exchange_strong(
*expected, desired, static_cast<std::memory_order>(success),
static_cast<std::memory_order>(failure)));
}

@ -59,7 +59,6 @@ class grpc_httpcli_ssl_channel_security_connector final
tsi_result InitHandshakerFactory(const char* pem_root_certs,
const tsi_ssl_root_certs_store* root_store) {
tsi_ssl_client_handshaker_options options;
memset(&options, 0, sizeof(options));
options.pem_root_certs = pem_root_certs;
options.root_store = root_store;
return tsi_create_ssl_client_handshaker_factory_with_options(

@ -38,8 +38,7 @@ bool kernel_supports_errqueue() { return errqueue_supported; }
void grpc_errqueue_init() {
/* Both-compile time and run-time linux kernel versions should be atleast 4.0.0
*/
#ifdef LINUX_VERSION_CODE
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0)
#ifdef GRPC_LINUX_ERRQUEUE
struct utsname buffer;
if (uname(&buffer) != 0) {
gpr_log(GPR_ERROR, "uname: %s", strerror(errno));
@ -55,8 +54,7 @@ void grpc_errqueue_init() {
} else {
gpr_log(GPR_DEBUG, "ERRQUEUE support not enabled");
}
#endif /* LINUX_VERSION_CODE <= KERNEL_VERSION(4, 0, 0) */
#endif /* LINUX_VERSION_CODE */
#endif /* GRPC_LINUX_ERRQUEUE */
}
} /* namespace grpc_core */

@ -319,6 +319,11 @@ grpc_ssl_channel_security_connector_create(
gpr_log(GPR_ERROR, "An ssl channel needs a config and a target name.");
return nullptr;
}
if (config->pem_root_certs == nullptr &&
grpc_core::DefaultSslRootStore::GetPemRootCerts() == nullptr) {
gpr_log(GPR_ERROR, "Could not get pem root certs.");
return nullptr;
}
grpc_core::RefCountedPtr<grpc_ssl_channel_security_connector> c =
grpc_core::MakeRefCounted<grpc_ssl_channel_security_connector>(
std::move(channel_creds), std::move(request_metadata_creds), config,

@ -161,7 +161,7 @@ void SpiffeChannelSecurityConnector::check_peer(
const grpc_tls_server_authorization_check_config* config =
creds->options().server_authorization_check_config();
/* If server authorization config is not null, use it to perform
* server authorizaiton check. */
* server authorization check. */
if (config != nullptr) {
const tsi_peer_property* p =
tsi_peer_get_property_by_name(&peer, TSI_X509_PEM_CERT_PROPERTY);
@ -254,17 +254,17 @@ SpiffeChannelSecurityConnector::InitializeHandshakerFactory(
const SpiffeCredentials* creds =
static_cast<const SpiffeCredentials*>(channel_creds());
auto key_materials_config = PopulateSpiffeCredentials(creds->options());
if (!key_materials_config.get()->pem_key_cert_pair_list().size()) {
key_materials_config.get()->Unref();
if (key_materials_config->pem_key_cert_pair_list().empty()) {
key_materials_config->Unref();
return GRPC_SECURITY_ERROR;
}
tsi_ssl_pem_key_cert_pair* pem_key_cert_pair = ConvertToTsiPemKeyCertPair(
key_materials_config.get()->pem_key_cert_pair_list());
key_materials_config->pem_key_cert_pair_list());
grpc_security_status status = grpc_ssl_tsi_client_handshaker_factory_init(
pem_key_cert_pair, key_materials_config.get()->pem_root_certs(),
pem_key_cert_pair, key_materials_config->pem_root_certs(),
ssl_session_cache, &client_handshaker_factory_);
// Free memory.
key_materials_config.get()->Unref();
key_materials_config->Unref();
grpc_tsi_ssl_pem_key_cert_pairs_destroy(pem_key_cert_pair, 1);
return status;
}
@ -401,8 +401,8 @@ SpiffeServerSecurityConnector::RefreshServerHandshakerFactory() {
auto key_materials_config = PopulateSpiffeCredentials(creds->options());
/* Credential reload does NOT take effect and we need to keep using
* the existing handshaker factory. */
if (key_materials_config.get()->pem_key_cert_pair_list().empty()) {
key_materials_config.get()->Unref();
if (key_materials_config->pem_key_cert_pair_list().empty()) {
key_materials_config->Unref();
return GRPC_SECURITY_ERROR;
}
/* Credential reload takes effect and we need to free the existing
@ -411,15 +411,15 @@ SpiffeServerSecurityConnector::RefreshServerHandshakerFactory() {
tsi_ssl_server_handshaker_factory_unref(server_handshaker_factory_);
}
tsi_ssl_pem_key_cert_pair* pem_key_cert_pairs = ConvertToTsiPemKeyCertPair(
key_materials_config.get()->pem_key_cert_pair_list());
key_materials_config->pem_key_cert_pair_list());
size_t num_key_cert_pairs =
key_materials_config.get()->pem_key_cert_pair_list().size();
key_materials_config->pem_key_cert_pair_list().size();
grpc_security_status status = grpc_ssl_tsi_server_handshaker_factory_init(
pem_key_cert_pairs, num_key_cert_pairs,
key_materials_config.get()->pem_root_certs(),
key_materials_config->pem_root_certs(),
creds->options().cert_request_type(), &server_handshaker_factory_);
// Free memory.
key_materials_config.get()->Unref();
key_materials_config->Unref();
grpc_tsi_ssl_pem_key_cert_pairs_destroy(pem_key_cert_pairs,
num_key_cert_pairs);
return status;

@ -1035,9 +1035,14 @@ static void recv_trailing_filter(void* args, grpc_metadata_batch* b,
grpc_get_status_code_from_metadata(b->idx.named.grpc_status->md);
grpc_error* error = GRPC_ERROR_NONE;
if (status_code != GRPC_STATUS_OK) {
error = grpc_error_set_int(
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Error received from peer"),
GRPC_ERROR_INT_GRPC_STATUS, static_cast<intptr_t>(status_code));
char* peer_msg = nullptr;
char* peer = grpc_call_get_peer(call);
gpr_asprintf(&peer_msg, "Error received from peer %s", peer);
error = grpc_error_set_int(GRPC_ERROR_CREATE_FROM_COPIED_STRING(peer_msg),
GRPC_ERROR_INT_GRPC_STATUS,
static_cast<intptr_t>(status_code));
gpr_free(peer);
gpr_free(peer_msg);
}
if (b->idx.named.grpc_message != nullptr) {
error = grpc_error_set_str(

@ -1636,7 +1636,6 @@ tsi_result tsi_create_ssl_client_handshaker_factory(
const char** alpn_protocols, uint16_t num_alpn_protocols,
tsi_ssl_client_handshaker_factory** factory) {
tsi_ssl_client_handshaker_options options;
memset(&options, 0, sizeof(options));
options.pem_key_cert_pair = pem_key_cert_pair;
options.pem_root_certs = pem_root_certs;
options.cipher_suites = cipher_suites;
@ -1766,7 +1765,6 @@ tsi_result tsi_create_ssl_server_handshaker_factory_ex(
const char* cipher_suites, const char** alpn_protocols,
uint16_t num_alpn_protocols, tsi_ssl_server_handshaker_factory** factory) {
tsi_ssl_server_handshaker_options options;
memset(&options, 0, sizeof(options));
options.pem_key_cert_pairs = pem_key_cert_pairs;
options.num_key_cert_pairs = num_key_cert_pairs;
options.pem_client_root_certs = pem_client_root_certs;

@ -30,6 +30,35 @@
namespace grpc {
void RegisterOpenCensusPlugin() {
RegisterChannelFilter<CensusChannelData, CensusClientCallData>(
"opencensus_client", GRPC_CLIENT_CHANNEL, INT_MAX /* priority */,
nullptr /* condition function */);
RegisterChannelFilter<CensusChannelData, CensusServerCallData>(
"opencensus_server", GRPC_SERVER_CHANNEL, INT_MAX /* priority */,
nullptr /* condition function */);
// Access measures to ensure they are initialized. Otherwise, creating a view
// before the first RPC would cause an error.
RpcClientSentBytesPerRpc();
RpcClientReceivedBytesPerRpc();
RpcClientRoundtripLatency();
RpcClientServerLatency();
RpcClientSentMessagesPerRpc();
RpcClientReceivedMessagesPerRpc();
RpcServerSentBytesPerRpc();
RpcServerReceivedBytesPerRpc();
RpcServerServerLatency();
RpcServerSentMessagesPerRpc();
RpcServerReceivedMessagesPerRpc();
}
::opencensus::trace::Span GetSpanFromServerContext(ServerContext* context) {
return reinterpret_cast<const CensusContext*>(context->census_context())
->Span();
}
// These measure definitions should be kept in sync across opencensus
// implementations--see
// https://github.com/census-instrumentation/opencensus-java/blob/master/contrib/grpc_metrics/src/main/java/io/opencensus/contrib/grpc/metrics/RpcMeasureConstants.java.
@ -97,39 +126,5 @@ ABSL_CONST_INIT const absl::string_view
ABSL_CONST_INIT const absl::string_view kRpcServerServerLatencyMeasureName =
"grpc.io/server/server_latency";
} // namespace grpc
namespace grpc_impl {
void RegisterOpenCensusPlugin() {
grpc::RegisterChannelFilter<grpc::CensusChannelData,
grpc::CensusClientCallData>(
"opencensus_client", GRPC_CLIENT_CHANNEL, INT_MAX /* priority */,
nullptr /* condition function */);
grpc::RegisterChannelFilter<grpc::CensusChannelData,
grpc::CensusServerCallData>(
"opencensus_server", GRPC_SERVER_CHANNEL, INT_MAX /* priority */,
nullptr /* condition function */);
// Access measures to ensure they are initialized. Otherwise, creating a view
// before the first RPC would cause an error.
grpc::RpcClientSentBytesPerRpc();
grpc::RpcClientReceivedBytesPerRpc();
grpc::RpcClientRoundtripLatency();
grpc::RpcClientServerLatency();
grpc::RpcClientSentMessagesPerRpc();
grpc::RpcClientReceivedMessagesPerRpc();
grpc::RpcServerSentBytesPerRpc();
grpc::RpcServerReceivedBytesPerRpc();
grpc::RpcServerServerLatency();
grpc::RpcServerSentMessagesPerRpc();
grpc::RpcServerReceivedMessagesPerRpc();
}
::opencensus::trace::Span GetSpanFromServerContext(
grpc::ServerContext* context) {
return reinterpret_cast<const grpc::CensusContext*>(context->census_context())
->Span();
}
} // namespace grpc_impl
} // namespace grpc

@ -22,14 +22,12 @@
#include <grpc/support/port_platform.h>
#include "absl/strings/string_view.h"
#include "include/grpcpp/opencensus_impl.h"
#include "include/grpcpp/opencensus.h"
#include "opencensus/stats/stats.h"
namespace grpc_impl {
namespace grpc {
class ServerContext;
}
namespace grpc {
// The tag keys set when recording RPC stats.
::opencensus::stats::TagKey ClientMethodTagKey();

@ -25,23 +25,6 @@
#include "opencensus/stats/internal/set_aggregation_window.h"
#include "opencensus/stats/stats.h"
namespace grpc_impl {
void RegisterOpenCensusViewsForExport() {
grpc::ClientSentMessagesPerRpcCumulative().RegisterForExport();
grpc::ClientSentBytesPerRpcCumulative().RegisterForExport();
grpc::ClientReceivedMessagesPerRpcCumulative().RegisterForExport();
grpc::ClientReceivedBytesPerRpcCumulative().RegisterForExport();
grpc::ClientRoundtripLatencyCumulative().RegisterForExport();
grpc::ClientServerLatencyCumulative().RegisterForExport();
grpc::ServerSentMessagesPerRpcCumulative().RegisterForExport();
grpc::ServerSentBytesPerRpcCumulative().RegisterForExport();
grpc::ServerReceivedMessagesPerRpcCumulative().RegisterForExport();
grpc::ServerReceivedBytesPerRpcCumulative().RegisterForExport();
grpc::ServerServerLatencyCumulative().RegisterForExport();
}
} // namespace grpc_impl
namespace grpc {
using ::opencensus::stats::Aggregation;
@ -88,6 +71,21 @@ ViewDescriptor HourDescriptor() {
} // namespace
void RegisterOpenCensusViewsForExport() {
ClientSentMessagesPerRpcCumulative().RegisterForExport();
ClientSentBytesPerRpcCumulative().RegisterForExport();
ClientReceivedMessagesPerRpcCumulative().RegisterForExport();
ClientReceivedBytesPerRpcCumulative().RegisterForExport();
ClientRoundtripLatencyCumulative().RegisterForExport();
ClientServerLatencyCumulative().RegisterForExport();
ServerSentMessagesPerRpcCumulative().RegisterForExport();
ServerSentBytesPerRpcCumulative().RegisterForExport();
ServerReceivedMessagesPerRpcCumulative().RegisterForExport();
ServerReceivedBytesPerRpcCumulative().RegisterForExport();
ServerServerLatencyCumulative().RegisterForExport();
}
// client cumulative
const ViewDescriptor& ClientSentBytesPerRpcCumulative() {
const static ViewDescriptor descriptor =

@ -95,6 +95,22 @@ class ServerContext::CompletionOp final : public internal::CallOpSetInterface {
tag_ = tag;
}
void SetCancelCallback(std::function<void()> callback) {
std::lock_guard<std::mutex> lock(mu_);
if (finalized_ && (cancelled_ != 0)) {
callback();
return;
}
cancel_callback_ = std::move(callback);
}
void ClearCancelCallback() {
std::lock_guard<std::mutex> g(mu_);
cancel_callback_ = nullptr;
}
void set_core_cq_tag(void* core_cq_tag) { core_cq_tag_ = core_cq_tag; }
void* core_cq_tag() override { return core_cq_tag_; }
@ -141,6 +157,7 @@ class ServerContext::CompletionOp final : public internal::CallOpSetInterface {
std::mutex mu_;
bool finalized_;
int cancelled_; // This is an int (not bool) because it is passed to core
std::function<void()> cancel_callback_;
bool done_intercepting_;
internal::InterceptorBatchMethodsImpl interceptor_methods_;
};
@ -191,11 +208,17 @@ bool ServerContext::CompletionOp::FinalizeResult(void** tag, bool* status) {
// Decide whether to call the cancel callback before releasing the lock
bool call_cancel = (cancelled_ != 0);
// If it's a unary cancel callback, call it under the lock so that it doesn't
// race with ClearCancelCallback
if (cancel_callback_) {
cancel_callback_();
}
// Release the lock since we are going to be calling a callback and
// interceptors now
lock.unlock();
if (call_cancel && (reactor_ != nullptr)) {
if (call_cancel && reactor_ != nullptr) {
reactor_->OnCancel();
}
@ -315,6 +338,14 @@ void ServerContext::TryCancel() const {
}
}
void ServerContext::SetCancelCallback(std::function<void()> callback) {
completion_op_->SetCancelCallback(std::move(callback));
}
void ServerContext::ClearCancelCallback() {
completion_op_->ClearCancelCallback();
}
bool ServerContext::IsCancelled() const {
if (completion_tag_) {
// When using callback API, this result is always valid.

@ -80,7 +80,7 @@
>$(Protobuf_PackagedToolsPath)/$(Protobuf_ToolsOs)_$(Protobuf_ToolsCpu)/protoc</Protobuf_ProtocFullPath>
</PropertyGroup>
<Error Condition=" '$(DesignTimeBuild)' != 'true' and '$(PROTOBUF_PROTOC)' == ''
<Error Condition=" '$(DisableProtobufDesignTimeBuild)' != 'true' and '$(PROTOBUF_PROTOC)' == ''
and ( '$(Protobuf_ToolsOs)' == '' or '$(Protobuf_ToolsCpu)' == '' ) "
Text="Google.Protobuf.Tools cannot determine host OS and CPU.&#10;Use environment variables PROTOBUF_TOOLS_OS={linux|macosx|windows} and PROTOBUF_TOOLS_CPU={x86|x64} to try the closest match to your system.&#10;You may also set PROTOBUF_PROTOC to specify full path to the host-provided compiler (v3.5+ is required)." />
</Target>
@ -93,7 +93,7 @@
<Target Name="Protobuf_BeforeCompile" />
<Target Name="Protobuf_AfterCompile" />
<!-- Main compile sequence. Certain steps are gated by the value $(DesignTimeBuild),
<!-- Main compile sequence. Certain steps are gated by the value $(DisableProtobufDesignTimeBuild),
so the sequence is good for either design time or build time. -->
<Target Name="Protobuf_Compile"
Condition=" '@(ProtoBuf)' != '' "
@ -159,7 +159,7 @@
<Output TaskParameter="PossibleOutputs" ItemName="Protobuf_ExpectedOutputs" />
</ProtoCompilerOutputs>
<!-- Read any dependency files from previous compiles. -->
<ProtoReadDependencies Condition=" '$(Protobuf_DepFilesPath)' != '' and '$(DesignTimeBuild)' != 'true' "
<ProtoReadDependencies Condition=" '$(Protobuf_DepFilesPath)' != '' and '$(DisableProtobufDesignTimeBuild)' != 'true' "
ProtoBuf="@(Protobuf_Compile)"
ProtoDepDir="$(Protobuf_DepFilesPath)" >
<Output TaskParameter="Dependencies" ItemName="Protobuf_Dependencies" />
@ -246,7 +246,7 @@
</Target>
<Target Name="_Protobuf_CoreCompile"
Condition=" '$(DesignTimeBuild)' != 'true' "
Condition=" '$(DisableProtobufDesignTimeBuild)' != 'true' "
DependsOnTargets="Protobuf_PrepareCompileOptions;_Protobuf_GatherStaleFiles">
<!-- Ensure output directories. -->
<MakeDir Directories="%(_Protobuf_OutOfDateProto.OutputDir)" />
@ -290,7 +290,7 @@
compile though). You can empty this collection in your Before targets to do nothing.
The target is not executed if the proto compiler is not executed. -->
<Target Name="Protobuf_ReconcileOutputs"
Condition=" '$(DesignTimeBuild)' != 'true' ">
Condition=" '$(DisableProtobufDesignTimeBuild)' != 'true' ">
<!-- Warn about unexpected/missing files outside object file directory only.
This should have happened because build was incorrectly customized. -->
<FindUnderPath Path="$(BaseIntermediateOutputPath)" Files="@(Protobuf_ExpectedNotGenerated)">

@ -14,7 +14,7 @@ Xamarin.Android
`arm64-v8a` (some newer Android devices), `x86` (for emulator)
Xamarin.iOS
- supported architectures: arm64 (iPhone 6+) and x86_64 (iPhone simulator)
- supported architectures: armv7, arm64 (iPhone 6+) and x86_64 (iPhone simulator)
# Unity

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# Helper script to crosscompile grpc_csharp_ext native extension for Android.
# Helper script to crosscompile grpc_csharp_ext native extension for iOS.
set -ex
@ -28,9 +28,8 @@ function build {
PATH_CC="$(xcrun --sdk $SDK --find clang)"
PATH_CXX="$(xcrun --sdk $SDK --find clang++)"
# TODO(jtattermusch): add -mios-version-min=6.0 and -Wl,ios_version_min=6.0
CPPFLAGS="-O2 -Wframe-larger-than=16384 -arch $ARCH -isysroot $(xcrun --sdk $SDK --show-sdk-path) -DPB_NO_PACKED_STRUCTS=1"
LDFLAGS="-arch $ARCH -isysroot $(xcrun --sdk $SDK --show-sdk-path)"
CPPFLAGS="-O2 -Wframe-larger-than=16384 -arch $ARCH -isysroot $(xcrun --sdk $SDK --show-sdk-path) -mios-version-min=6.0 -DPB_NO_PACKED_STRUCTS=1"
LDFLAGS="-arch $ARCH -isysroot $(xcrun --sdk $SDK --show-sdk-path) -Wl,ios_version_min=6.0"
# TODO(jtattermusch): revisit the build arguments
make -j4 static_csharp \
@ -51,10 +50,12 @@ function fatten {
mkdir -p libs/ios
lipo -create -output libs/ios/lib$LIB_NAME.a \
libs/ios_armv7/lib$LIB_NAME.a \
libs/ios_arm64/lib$LIB_NAME.a \
libs/ios_x86_64/lib$LIB_NAME.a
}
build iphoneos armv7
build iphoneos arm64
build iphonesimulator x86_64

@ -103,7 +103,11 @@ class ChangeMetadataInterceptor extends Grpc\Interceptor
$metadata["foo"] = array('interceptor_from_unary_request');
return $continuation($method, $argument, $deserialize, $metadata, $options);
}
public function interceptStreamUnary($method, $deserialize, array $metadata = [], array $options = [], $continuation)
public function interceptStreamUnary($method,
$deserialize,
array $metadata = [],
array $options = [],
$continuation)
{
$metadata["foo"] = array('interceptor_from_stream_request');
return $continuation($method, $deserialize, $metadata, $options);
@ -178,7 +182,11 @@ class ChangeRequestInterceptor extends Grpc\Interceptor
$argument->setData('intercepted_unary_request');
return $continuation($method, $argument, $deserialize, $metadata, $options);
}
public function interceptStreamUnary($method, $deserialize, array $metadata = [], array $options = [], $continuation)
public function interceptStreamUnary($method,
$deserialize,
array $metadata = [],
array $options = [],
$continuation)
{
return new ChangeRequestCall(
$continuation($method, $deserialize, $metadata, $options)
@ -190,6 +198,7 @@ class StopCallInterceptor extends Grpc\Interceptor
{
public function interceptUnaryUnary($method,
$argument,
$deserialize,
array $metadata = [],
array $options = [],
$continuation)
@ -197,6 +206,7 @@ class StopCallInterceptor extends Grpc\Interceptor
$metadata["foo"] = array('interceptor_from_request_response');
}
public function interceptStreamUnary($method,
$deserialize,
array $metadata = [],
array $options = [],
$continuation)

@ -282,7 +282,7 @@ class Status(six.with_metaclass(abc.ABCMeta)):
Attributes:
code: A StatusCode object to be sent to the client.
details: An ASCII-encodable string to be sent to the client upon
details: A UTF-8-encodable string to be sent to the client upon
termination of the RPC.
trailing_metadata: The trailing :term:`metadata` in the RPC.
"""
@ -1131,7 +1131,7 @@ class ServicerContext(six.with_metaclass(abc.ABCMeta, RpcContext)):
Args:
code: A StatusCode object to be sent to the client.
It must not be StatusCode.OK.
details: An ASCII-encodable string to be sent to the client upon
details: A UTF-8-encodable string to be sent to the client upon
termination of the RPC.
Raises:
@ -1179,7 +1179,7 @@ class ServicerContext(six.with_metaclass(abc.ABCMeta, RpcContext)):
no details to transmit.
Args:
details: An ASCII-encodable string to be sent to the client upon
details: A UTF-8-encodable string to be sent to the client upon
termination of the RPC.
"""
raise NotImplementedError()

@ -13,15 +13,7 @@
# limitations under the License.
cimport libc.time
from libc.stdint cimport intptr_t
# Typedef types with approximately the same semantics to provide their names to
# Cython
ctypedef unsigned char uint8_t
ctypedef int int32_t
ctypedef unsigned uint32_t
ctypedef long int64_t
from libc.stdint cimport intptr_t, uint8_t, int32_t, uint32_t, int64_t
cdef extern from "grpc/support/alloc.h":
@ -61,6 +53,10 @@ cdef extern from "grpc/grpc.h":
void *grpc_slice_start_ptr "GRPC_SLICE_START_PTR" (grpc_slice s) nogil
size_t grpc_slice_length "GRPC_SLICE_LENGTH" (grpc_slice s) nogil
const int GPR_MS_PER_SEC
const int GPR_US_PER_SEC
const int GPR_NS_PER_SEC
ctypedef enum gpr_clock_type:
GPR_CLOCK_MONOTONIC
GPR_CLOCK_REALTIME
@ -82,6 +78,8 @@ cdef extern from "grpc/grpc.h":
gpr_clock_type target_clock) nogil
gpr_timespec gpr_time_from_millis(int64_t ms, gpr_clock_type type) nogil
gpr_timespec gpr_time_from_nanos(int64_t ns, gpr_clock_type type) nogil
double gpr_timespec_to_micros(gpr_timespec t) nogil
gpr_timespec gpr_time_add(gpr_timespec a, gpr_timespec b) nogil

@ -13,7 +13,7 @@
# limitations under the License.
cdef gpr_timespec _timespec_from_time(object time)
cdef gpr_timespec _timespec_from_time(object time) except *
cdef double _time_from_timespec(gpr_timespec timespec) except *

@ -13,18 +13,17 @@
# limitations under the License.
cdef gpr_timespec _timespec_from_time(object time):
cdef gpr_timespec timespec
cdef gpr_timespec _timespec_from_time(object time) except *:
if time is None:
return gpr_inf_future(GPR_CLOCK_REALTIME)
else:
timespec.seconds = time
timespec.nanoseconds = (time - float(timespec.seconds)) * 1e9
timespec.clock_type = GPR_CLOCK_REALTIME
return timespec
return gpr_time_from_nanos(
<int64_t>(<double>time * GPR_NS_PER_SEC),
GPR_CLOCK_REALTIME,
)
cdef double _time_from_timespec(gpr_timespec timespec) except *:
cdef gpr_timespec real_timespec = gpr_convert_clock_type(
timespec, GPR_CLOCK_REALTIME)
return <double>real_timespec.seconds + <double>real_timespec.nanoseconds / 1e9
return gpr_timespec_to_micros(real_timespec) / GPR_US_PER_SEC

@ -147,7 +147,9 @@ class TestGevent(setuptools.Command):
# TODO(https://github.com/grpc/grpc/issues/17330) enable these three tests
'channelz._channelz_servicer_test.ChannelzServicerTest.test_many_subchannels',
'channelz._channelz_servicer_test.ChannelzServicerTest.test_many_subchannels_and_sockets',
'channelz._channelz_servicer_test.ChannelzServicerTest.test_streaming_rpc'
'channelz._channelz_servicer_test.ChannelzServicerTest.test_streaming_rpc',
# TODO(https://github.com/grpc/grpc/issues/15411) enable this test
'unit._cython._channel_test.ChannelTest.test_negative_deadline_connectivity'
)
description = 'run tests with gevent. Assumes grpc/gevent are installed'
user_options = []

@ -57,6 +57,14 @@ class ChannelTest(unittest.TestCase):
def test_multiple_channels_lonely_connectivity(self):
_in_parallel(_create_loop_destroy, ())
def test_negative_deadline_connectivity(self):
channel = _channel()
connectivity = channel.check_connectivity_state(True)
channel.watch_connectivity_state(connectivity, -3.14)
channel.close(cygrpc.StatusCode.ok, 'Channel close!')
# NOTE(lidiz) The negative timeout should not trigger SIGABRT.
# Bug report: https://github.com/grpc/grpc/issues/18244
if __name__ == '__main__':
unittest.main(verbosity=2)

@ -48,7 +48,7 @@ class ProxyBenchmarkClientServiceImpl < Grpc::Testing::ProxyClientService::Servi
if @use_c_ext
puts "Use protobuf c extension"
command = "php -d extension=" + File.expand_path(File.dirname(__FILE__)) +
"/../../php/tests/qps/vendor/google/protobuf/php/ext/google/protobuf/modules/protobuf.so " +
"/../../../third_party/protobuf/php/ext/google/protobuf/modules/protobuf.so " +
"-d extension=" + File.expand_path(File.dirname(__FILE__)) + "/../../php/ext/grpc/modules/grpc.so " +
File.expand_path(File.dirname(__FILE__)) + "/" + @php_client_bin + " " + @mytarget + " #{chan%@config.server_targets.length}"
else

@ -16,5 +16,8 @@
FROM mcr.microsoft.com/dotnet/core/sdk:3.0.100-preview3-stretch
# needed by get-dotnet.sh script
RUN apt-get update && apt-get install -y jq && apt-get clean
# Define the default command.
CMD ["bash"]

@ -25,6 +25,14 @@
cp -r /var/local/jenkins/service_account $HOME || true
cd /var/local/git/grpc-dotnet
# If needed, update dotnet SDK and put it on path
./build/get-dotnet.sh
if [ -f $HOME/.dotnet/dotnet ]
then
ln -s $HOME/.dotnet/dotnet /usr/local/bin/dotnet
fi
./build/get-grpc.sh
cd testassets/InteropTestsWebsite

@ -111,7 +111,7 @@ static void server_authz_check_cb(void* user_data) {
static_cast<grpc_tls_server_authorization_check_arg*>(user_data);
GPR_ASSERT(check_arg != nullptr);
// result = 1 indicates the server authorization check passes.
// Normally, the applicaiton code should resort to mapping information
// Normally, the application code should resort to mapping information
// between server identity and target name to derive the result.
// For this test, we directly return 1 for simplicity.
check_arg->success = 1;
@ -143,7 +143,7 @@ static int client_cred_reload_sync(void* config_user_data,
gpr_zalloc(sizeof(grpc_ssl_pem_key_cert_pair)));
key_cert_pair[0]->private_key = gpr_strdup(test_server1_key);
key_cert_pair[0]->cert_chain = gpr_strdup(test_server1_cert);
if (!arg->key_materials_config->pem_key_cert_pair_list().size()) {
if (arg->key_materials_config->pem_key_cert_pair_list().empty()) {
grpc_tls_key_materials_config_set_key_materials(
arg->key_materials_config, gpr_strdup(test_root_cert),
(const grpc_ssl_pem_key_cert_pair**)key_cert_pair, 1);
@ -169,7 +169,7 @@ static int server_cred_reload_sync(void* config_user_data,
GPR_ASSERT(arg->key_materials_config != nullptr);
GPR_ASSERT(arg->key_materials_config->pem_key_cert_pair_list().data() !=
nullptr);
if (!arg->key_materials_config->pem_key_cert_pair_list().size()) {
if (arg->key_materials_config->pem_key_cert_pair_list().empty()) {
grpc_tls_key_materials_config_set_key_materials(
arg->key_materials_config, gpr_strdup(test_root_cert),
(const grpc_ssl_pem_key_cert_pair**)key_cert_pair, 1);

@ -187,7 +187,7 @@ static bool compare_slice_buffer_with_buffer(grpc_slice_buffer *slices, const ch
grpc_slice_buffer_init(&read_one_slice);
while (read_slices.length < kBufferSize) {
init_event_closure(&read_done, &read);
grpc_endpoint_read(ep_, &read_one_slice, &read_done);
grpc_endpoint_read(ep_, &read_one_slice, &read_done, /*urgent=*/false);
XCTAssertEqual([self waitForEvent:&read timeout:kReadTimeout], YES);
XCTAssertEqual(reinterpret_cast<grpc_error *>(read), GRPC_ERROR_NONE);
grpc_slice_buffer_move_into(&read_one_slice, &read_slices);
@ -218,7 +218,7 @@ static bool compare_slice_buffer_with_buffer(grpc_slice_buffer *slices, const ch
grpc_slice_buffer_init(&read_slices);
init_event_closure(&read_done, &read);
grpc_endpoint_read(ep_, &read_slices, &read_done);
grpc_endpoint_read(ep_, &read_slices, &read_done, /*urgent=*/false);
grpc_slice_buffer_init(&write_slices);
slice = grpc_slice_from_static_buffer(write_buffer, kBufferSize);
@ -267,7 +267,7 @@ static bool compare_slice_buffer_with_buffer(grpc_slice_buffer *slices, const ch
init_event_closure(&read_done, &read);
grpc_slice_buffer_init(&read_slices);
grpc_endpoint_read(ep_, &read_slices, &read_done);
grpc_endpoint_read(ep_, &read_slices, &read_done, /*urgent=*/false);
grpc_slice_buffer_init(&write_slices);
slice = grpc_slice_from_static_buffer(write_buffer, kBufferSize);
@ -306,7 +306,7 @@ static bool compare_slice_buffer_with_buffer(grpc_slice_buffer *slices, const ch
init_event_closure(&read_done, &read);
grpc_slice_buffer_init(&read_slices);
grpc_endpoint_read(ep_, &read_slices, &read_done);
grpc_endpoint_read(ep_, &read_slices, &read_done, /*urgent=*/false);
struct linger so_linger;
so_linger.l_onoff = 1;

@ -8,7 +8,6 @@
/* Begin PBXBuildFile section */
5E143B892069D72200715A6E /* CFStreamClientTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5E143B882069D72200715A6E /* CFStreamClientTests.mm */; };
5E143B8C206B5F9F00715A6E /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 5E143B8A2069D72700715A6E /* Info.plist */; };
5E143B8E206C5B9A00715A6E /* CFStreamEndpointTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5E143B8D206C5B9A00715A6E /* CFStreamEndpointTests.mm */; };
604EA96D9CD477A8EA411BDF /* libPods-CFStreamTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = AFFA154D492751CEAC05D591 /* libPods-CFStreamTests.a */; };
/* End PBXBuildFile section */
@ -82,7 +81,6 @@
4EBA55D3E23FC6C84596E3D5 /* [CP] Check Pods Manifest.lock */,
5E143B752069D67300715A6E /* Sources */,
5E143B762069D67300715A6E /* Frameworks */,
5E143B772069D67300715A6E /* Resources */,
);
buildRules = (
);
@ -126,17 +124,6 @@
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
5E143B772069D67300715A6E /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
5E143B8C206B5F9F00715A6E /* Info.plist in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
4EBA55D3E23FC6C84596E3D5 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;

@ -17,6 +17,7 @@
# ./tools/run_tests/run_tests.py -l objc
set -ev
set -o pipefail
cd "$(dirname "$0")"

@ -121,7 +121,7 @@ class InterceptRecvTrailingMetadataLoadBalancingPolicy
cb_(cb),
user_data_(user_data) {}
PickResult Pick(PickState* pick, grpc_error** error) override {
PickResult Pick(PickArgs* pick, grpc_error** error) override {
PickResult result = delegate_picker_->Pick(pick, error);
if (result == PICK_COMPLETE && pick->connected_subchannel != nullptr) {
New<TrailingMetadataHandler>(pick, cb_, user_data_); // deletes itself
@ -171,7 +171,7 @@ class InterceptRecvTrailingMetadataLoadBalancingPolicy
class TrailingMetadataHandler {
public:
TrailingMetadataHandler(PickState* pick,
TrailingMetadataHandler(PickArgs* pick,
InterceptRecvTrailingMetadataCallback cb,
void* user_data)
: cb_(cb), user_data_(user_data) {

@ -245,6 +245,9 @@ grpc_cc_test(
size = "large",
deps = [
":end2end_test_lib",
# DO NOT REMOVE THE grpc++ dependence below since the internal build
# system uses it to specialize targets
"//:grpc++",
],
)
@ -634,6 +637,7 @@ grpc_cc_test(
grpc_cc_test(
name = "thread_stress_test",
timeout = "long",
srcs = ["thread_stress_test.cc"],
external_deps = [
"gtest",

@ -1117,6 +1117,82 @@ TEST_P(ClientCallbackEnd2endTest, UnimplementedRpc) {
}
}
TEST_P(ClientCallbackEnd2endTest,
ResponseStreamExtraReactionFlowReadsUntilDone) {
MAYBE_SKIP_TEST;
ResetStub();
class ReadAllIncomingDataClient
: public grpc::experimental::ClientReadReactor<EchoResponse> {
public:
ReadAllIncomingDataClient(grpc::testing::EchoTestService::Stub* stub) {
request_.set_message("Hello client ");
stub->experimental_async()->ResponseStream(&context_, &request_, this);
}
bool WaitForReadDone() {
std::unique_lock<std::mutex> l(mu_);
while (!read_done_) {
read_cv_.wait(l);
}
read_done_ = false;
return read_ok_;
}
void Await() {
std::unique_lock<std::mutex> l(mu_);
while (!done_) {
done_cv_.wait(l);
}
}
const Status& status() {
std::unique_lock<std::mutex> l(mu_);
return status_;
}
private:
void OnReadDone(bool ok) override {
std::unique_lock<std::mutex> l(mu_);
read_ok_ = ok;
read_done_ = true;
read_cv_.notify_one();
}
void OnDone(const Status& s) override {
std::unique_lock<std::mutex> l(mu_);
done_ = true;
status_ = s;
done_cv_.notify_one();
}
EchoRequest request_;
EchoResponse response_;
ClientContext context_;
bool read_ok_ = false;
bool read_done_ = false;
std::mutex mu_;
std::condition_variable read_cv_;
std::condition_variable done_cv_;
bool done_ = false;
Status status_;
} client{stub_.get()};
int reads_complete = 0;
client.AddHold();
client.StartCall();
EchoResponse response;
bool read_ok = true;
while (read_ok) {
client.StartRead(&response);
read_ok = client.WaitForReadDone();
if (read_ok) {
++reads_complete;
}
}
client.RemoveHold();
client.Await();
EXPECT_EQ(kServerDefaultResponseStreamsToSend, reads_complete);
EXPECT_EQ(client.status().error_code(), grpc::StatusCode::OK);
}
std::vector<TestScenario> CreateTestScenarios(bool test_insecure) {
std::vector<TestScenario> scenarios;
std::vector<grpc::string> credentials_types{

@ -1381,6 +1381,80 @@ TEST_P(End2endTest, ExpectErrorTest) {
}
}
TEST_P(End2endTest, DelayedRpcEarlyCanceledUsingCancelCallback) {
MAYBE_SKIP_TEST;
// This test case is only relevant with callback server.
// Additionally, using interceptors makes this test subject to
// timing-dependent failures if the interceptors take too long to run.
if (!GetParam().callback_server || GetParam().use_interceptors) {
return;
}
ResetStub();
ClientContext context;
context.AddMetadata(kServerUseCancelCallback,
grpc::to_string(MAYBE_USE_CALLBACK_EARLY_CANCEL));
EchoRequest request;
EchoResponse response;
request.set_message("Hello");
request.mutable_param()->set_skip_cancelled_check(true);
context.TryCancel();
Status s = stub_->Echo(&context, request, &response);
EXPECT_EQ(StatusCode::CANCELLED, s.error_code());
}
TEST_P(End2endTest, DelayedRpcLateCanceledUsingCancelCallback) {
MAYBE_SKIP_TEST;
// This test case is only relevant with callback server.
// Additionally, using interceptors makes this test subject to
// timing-dependent failures if the interceptors take too long to run.
if (!GetParam().callback_server || GetParam().use_interceptors) {
return;
}
ResetStub();
ClientContext context;
context.AddMetadata(kServerUseCancelCallback,
grpc::to_string(MAYBE_USE_CALLBACK_LATE_CANCEL));
EchoRequest request;
EchoResponse response;
request.set_message("Hello");
request.mutable_param()->set_skip_cancelled_check(true);
// Let server sleep for 80 ms first to give the cancellation a chance.
// This is split into 40 ms to start the cancel and 40 ms extra time for
// it to make it to the server, to make it highly probable that the server
// RPC would have already started by the time the cancellation is sent
// and the server-side gets enough time to react to it.
request.mutable_param()->set_server_sleep_us(80 * 1000);
std::thread echo_thread{[this, &context, &request, &response] {
Status s = stub_->Echo(&context, request, &response);
EXPECT_EQ(StatusCode::CANCELLED, s.error_code());
}};
std::this_thread::sleep_for(std::chrono::microseconds(40000));
context.TryCancel();
echo_thread.join();
}
TEST_P(End2endTest, DelayedRpcNonCanceledUsingCancelCallback) {
MAYBE_SKIP_TEST;
if (!GetParam().callback_server) {
return;
}
ResetStub();
EchoRequest request;
EchoResponse response;
request.set_message("Hello");
ClientContext context;
context.AddMetadata(kServerUseCancelCallback,
grpc::to_string(MAYBE_USE_CALLBACK_NO_CANCEL));
Status s = stub_->Echo(&context, request, &response);
EXPECT_TRUE(s.ok());
}
//////////////////////////////////////////////////////////////////////////
// Test with and without a proxy.
class ProxyEnd2endTest : public End2endTest {
@ -2015,7 +2089,7 @@ INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_CASE_P(
ProxyEnd2end, ProxyEnd2endTest,
::testing::ValuesIn(CreateTestScenarios(true, true, true, true, false)));
::testing::ValuesIn(CreateTestScenarios(true, true, true, true, true)));
INSTANTIATE_TEST_CASE_P(
SecureEnd2end, SecureEnd2endTest,
@ -2023,7 +2097,7 @@ INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_CASE_P(
ResourceQuotaEnd2end, ResourceQuotaEnd2endTest,
::testing::ValuesIn(CreateTestScenarios(false, true, true, true, false)));
::testing::ValuesIn(CreateTestScenarios(false, true, true, true, true)));
} // namespace
} // namespace testing

File diff suppressed because it is too large Load Diff

@ -126,13 +126,14 @@ void ServerTryCancelNonblocking(ServerContext* context) {
}
void LoopUntilCancelled(Alarm* alarm, ServerContext* context,
experimental::ServerCallbackRpcController* controller) {
experimental::ServerCallbackRpcController* controller,
int loop_delay_us) {
if (!context->IsCancelled()) {
alarm->experimental().Set(
gpr_time_add(gpr_now(GPR_CLOCK_REALTIME),
gpr_time_from_micros(1000, GPR_TIMESPAN)),
[alarm, context, controller](bool) {
LoopUntilCancelled(alarm, context, controller);
gpr_time_from_micros(loop_delay_us, GPR_TIMESPAN)),
[alarm, context, controller, loop_delay_us](bool) {
LoopUntilCancelled(alarm, context, controller, loop_delay_us);
});
} else {
controller->Finish(Status::CANCELLED);
@ -249,6 +250,25 @@ Status TestServiceImpl::CheckClientInitialMetadata(ServerContext* context,
void CallbackTestServiceImpl::Echo(
ServerContext* context, const EchoRequest* request, EchoResponse* response,
experimental::ServerCallbackRpcController* controller) {
CancelState* cancel_state = new CancelState;
int server_use_cancel_callback =
GetIntValueFromMetadata(kServerUseCancelCallback,
context->client_metadata(), DO_NOT_USE_CALLBACK);
if (server_use_cancel_callback != DO_NOT_USE_CALLBACK) {
controller->SetCancelCallback([cancel_state] {
EXPECT_FALSE(cancel_state->callback_invoked.exchange(
true, std::memory_order_relaxed));
});
if (server_use_cancel_callback == MAYBE_USE_CALLBACK_EARLY_CANCEL) {
EXPECT_TRUE(context->IsCancelled());
EXPECT_TRUE(
cancel_state->callback_invoked.load(std::memory_order_relaxed));
} else {
EXPECT_FALSE(context->IsCancelled());
EXPECT_FALSE(
cancel_state->callback_invoked.load(std::memory_order_relaxed));
}
}
// A bit of sleep to make sure that short deadline tests fail
if (request->has_param() && request->param().server_sleep_us() > 0) {
// Set an alarm for that much time
@ -256,11 +276,11 @@ void CallbackTestServiceImpl::Echo(
gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC),
gpr_time_from_micros(request->param().server_sleep_us(),
GPR_TIMESPAN)),
[this, context, request, response, controller](bool) {
EchoNonDelayed(context, request, response, controller);
[this, context, request, response, controller, cancel_state](bool) {
EchoNonDelayed(context, request, response, controller, cancel_state);
});
} else {
EchoNonDelayed(context, request, response, controller);
EchoNonDelayed(context, request, response, controller, cancel_state);
}
}
@ -279,7 +299,26 @@ void CallbackTestServiceImpl::CheckClientInitialMetadata(
void CallbackTestServiceImpl::EchoNonDelayed(
ServerContext* context, const EchoRequest* request, EchoResponse* response,
experimental::ServerCallbackRpcController* controller) {
experimental::ServerCallbackRpcController* controller,
CancelState* cancel_state) {
int server_use_cancel_callback =
GetIntValueFromMetadata(kServerUseCancelCallback,
context->client_metadata(), DO_NOT_USE_CALLBACK);
// Safe to clear cancel callback even if it wasn't set
controller->ClearCancelCallback();
if (server_use_cancel_callback == MAYBE_USE_CALLBACK_EARLY_CANCEL ||
server_use_cancel_callback == MAYBE_USE_CALLBACK_LATE_CANCEL) {
EXPECT_TRUE(context->IsCancelled());
EXPECT_TRUE(cancel_state->callback_invoked.load(std::memory_order_relaxed));
delete cancel_state;
controller->Finish(Status::CANCELLED);
return;
}
EXPECT_FALSE(cancel_state->callback_invoked.load(std::memory_order_relaxed));
delete cancel_state;
if (request->has_param() && request->param().server_die()) {
gpr_log(GPR_ERROR, "The request should not reach application handler.");
GPR_ASSERT(0);
@ -301,9 +340,11 @@ void CallbackTestServiceImpl::EchoNonDelayed(
EXPECT_FALSE(context->IsCancelled());
context->TryCancel();
gpr_log(GPR_INFO, "Server called TryCancel() to cancel the request");
// Now wait until it's really canceled
LoopUntilCancelled(&alarm_, context, controller);
if (server_use_cancel_callback == DO_NOT_USE_CALLBACK) {
// Now wait until it's really canceled
LoopUntilCancelled(&alarm_, context, controller, 1000);
}
return;
}
@ -318,20 +359,11 @@ void CallbackTestServiceImpl::EchoNonDelayed(
std::unique_lock<std::mutex> lock(mu_);
signal_client_ = true;
}
std::function<void(bool)> recurrence = [this, context, request, controller,
&recurrence](bool) {
if (!context->IsCancelled()) {
alarm_.experimental().Set(
gpr_time_add(
gpr_now(GPR_CLOCK_REALTIME),
gpr_time_from_micros(request->param().client_cancel_after_us(),
GPR_TIMESPAN)),
recurrence);
} else {
controller->Finish(Status::CANCELLED);
}
};
recurrence(true);
if (server_use_cancel_callback == DO_NOT_USE_CALLBACK) {
// Now wait until it's really canceled
LoopUntilCancelled(&alarm_, context, controller,
request->param().client_cancel_after_us());
}
return;
} else if (request->has_param() &&
request->param().server_cancel_after_us()) {

@ -33,6 +33,7 @@ namespace testing {
const int kServerDefaultResponseStreamsToSend = 3;
const char* const kServerResponseStreamsToSend = "server_responses_to_send";
const char* const kServerTryCancelRequest = "server_try_cancel";
const char* const kServerUseCancelCallback = "server_use_cancel_callback";
const char* const kDebugInfoTrailerKey = "debug-info-bin";
const char* const kServerFinishAfterNReads = "server_finish_after_n_reads";
const char* const kServerUseCoalescingApi = "server_use_coalescing_api";
@ -46,6 +47,13 @@ typedef enum {
CANCEL_AFTER_PROCESSING
} ServerTryCancelRequestPhase;
typedef enum {
DO_NOT_USE_CALLBACK = 0,
MAYBE_USE_CALLBACK_EARLY_CANCEL,
MAYBE_USE_CALLBACK_LATE_CANCEL,
MAYBE_USE_CALLBACK_NO_CANCEL,
} ServerUseCancelCallback;
class TestServiceImpl : public ::grpc::testing::EchoTestService::Service {
public:
TestServiceImpl() : signal_client_(false), host_() {}
@ -115,9 +123,13 @@ class CallbackTestServiceImpl
}
private:
struct CancelState {
std::atomic_bool callback_invoked{false};
};
void EchoNonDelayed(ServerContext* context, const EchoRequest* request,
EchoResponse* response,
experimental::ServerCallbackRpcController* controller);
experimental::ServerCallbackRpcController* controller,
CancelState* cancel_state);
Alarm alarm_;
bool signal_client_;

@ -56,13 +56,8 @@
// TODO(dgq): Other scenarios in need of testing:
// - Send a serverlist with faulty ip:port addresses (port > 2^16, etc).
// - Test reception of invalid serverlist
// - Test pinging
// - Test against a non-LB server.
// - Random LB server closing the stream unexpectedly.
// - Test using DNS-resolvable names (localhost?)
// - Test handling of creation of faulty RR instance by having the LB return a
// serverlist with non-existent backends after having initially returned a
// valid one.
//
// Findings from end to end testing to be covered here:
// - Handling of LB servers restart, including reconnection after backing-off
@ -74,8 +69,6 @@
// part of the xds shutdown process.
// 2) the retry timer is active. Again, the weak reference it holds should
// prevent a premature call to \a glb_destroy.
// - Restart of backend servers with no changes to serverlist. This exercises
// the RR handover mechanism.
using std::chrono::system_clock;
@ -149,14 +142,7 @@ class BackendServiceImpl : public BackendService {
return status;
}
// Returns true on its first invocation, false otherwise.
bool Shutdown() {
std::unique_lock<std::mutex> lock(mu_);
const bool prev = !shutdown_;
shutdown_ = true;
gpr_log(GPR_INFO, "Backend: shut down");
return prev;
}
void Shutdown() {}
std::set<grpc::string> clients() {
std::unique_lock<std::mutex> lock(clients_mu_);
@ -170,7 +156,6 @@ class BackendServiceImpl : public BackendService {
}
std::mutex mu_;
bool shutdown_ = false;
std::mutex clients_mu_;
std::set<grpc::string> clients_;
};
@ -200,6 +185,14 @@ struct ClientStats {
}
return *this;
}
void Reset() {
num_calls_started = 0;
num_calls_finished = 0;
num_calls_finished_with_client_failed_to_send = 0;
num_calls_finished_known_received = 0;
drop_token_counts.clear();
}
};
class BalancerServiceImpl : public BalancerService {
@ -209,17 +202,11 @@ class BalancerServiceImpl : public BalancerService {
explicit BalancerServiceImpl(int client_load_reporting_interval_seconds)
: client_load_reporting_interval_seconds_(
client_load_reporting_interval_seconds),
shutdown_(false) {}
client_load_reporting_interval_seconds) {}
Status BalanceLoad(ServerContext* context, Stream* stream) override {
// TODO(juanlishen): Clean up the scoping.
gpr_log(GPR_INFO, "LB[%p]: BalanceLoad", this);
{
std::unique_lock<std::mutex> lock(mu_);
if (shutdown_) goto done;
}
{
// Balancer shouldn't receive the call credentials metadata.
EXPECT_EQ(context->client_metadata().find(g_kCallCredsMdKey),
@ -247,17 +234,12 @@ class BalancerServiceImpl : public BalancerService {
responses_and_delays = responses_and_delays_;
}
for (const auto& response_and_delay : responses_and_delays) {
{
std::unique_lock<std::mutex> lock(mu_);
if (shutdown_) goto done;
}
SendResponse(stream, response_and_delay.first,
response_and_delay.second);
}
{
std::unique_lock<std::mutex> lock(mu_);
if (shutdown_) goto done;
serverlist_cond_.wait(lock, [this] { return serverlist_ready_; });
serverlist_cond_.wait(lock, [this] { return serverlist_done_; });
}
if (client_load_reporting_interval_seconds_ > 0) {
@ -299,17 +281,12 @@ class BalancerServiceImpl : public BalancerService {
responses_and_delays_.push_back(std::make_pair(response, send_after_ms));
}
// Returns true on its first invocation, false otherwise.
bool Shutdown() {
bool prev;
{
std::unique_lock<std::mutex> lock(mu_);
prev = !shutdown_;
shutdown_ = true;
}
NotifyDoneWithServerlists();
void Shutdown() {
std::unique_lock<std::mutex> lock(mu_);
NotifyDoneWithServerlistsLocked();
responses_and_delays_.clear();
client_stats_.Reset();
gpr_log(GPR_INFO, "LB[%p]: shut down", this);
return prev;
}
static LoadBalanceResponse BuildResponseForBackends(
@ -345,8 +322,14 @@ class BalancerServiceImpl : public BalancerService {
void NotifyDoneWithServerlists() {
std::lock_guard<std::mutex> lock(mu_);
serverlist_ready_ = true;
serverlist_cond_.notify_all();
NotifyDoneWithServerlistsLocked();
}
void NotifyDoneWithServerlistsLocked() {
if (!serverlist_done_) {
serverlist_done_ = true;
serverlist_cond_.notify_all();
}
}
private:
@ -368,14 +351,13 @@ class BalancerServiceImpl : public BalancerService {
std::condition_variable load_report_cond_;
bool load_report_ready_ = false;
std::condition_variable serverlist_cond_;
bool serverlist_ready_ = false;
bool serverlist_done_ = false;
ClientStats client_stats_;
bool shutdown_;
};
class XdsEnd2endTest : public ::testing::Test {
protected:
XdsEnd2endTest(int num_backends, int num_balancers,
XdsEnd2endTest(size_t num_backends, size_t num_balancers,
int client_load_reporting_interval_seconds)
: server_host_("localhost"),
num_backends_(num_backends),
@ -394,29 +376,35 @@ class XdsEnd2endTest : public ::testing::Test {
grpc_core::MakeRefCounted<grpc_core::FakeResolverResponseGenerator>();
// Start the backends.
for (size_t i = 0; i < num_backends_; ++i) {
backends_.emplace_back(new BackendServiceImpl());
backend_servers_.emplace_back(ServerThread<BackendService>(
"backend", server_host_, backends_.back().get()));
backends_.emplace_back(new ServerThread<BackendServiceImpl>("backend"));
backends_.back()->Start(server_host_);
}
// Start the load balancers.
for (size_t i = 0; i < num_balancers_; ++i) {
balancers_.emplace_back(
new BalancerServiceImpl(client_load_reporting_interval_seconds_));
balancer_servers_.emplace_back(ServerThread<BalancerService>(
"balancer", server_host_, balancers_.back().get()));
balancers_.emplace_back(new ServerThread<BalancerServiceImpl>(
"balancer", client_load_reporting_interval_seconds_));
balancers_.back()->Start(server_host_);
}
ResetStub();
}
void TearDown() override {
for (size_t i = 0; i < backends_.size(); ++i) {
if (backends_[i]->Shutdown()) backend_servers_[i].Shutdown();
}
for (size_t i = 0; i < balancers_.size(); ++i) {
if (balancers_[i]->Shutdown()) balancer_servers_[i].Shutdown();
}
ShutdownAllBackends();
for (auto& balancer : balancers_) balancer->Shutdown();
}
void StartAllBackends() {
for (auto& backend : backends_) backend->Start(server_host_);
}
void StartBackend(size_t index) { backends_[index]->Start(server_host_); }
void ShutdownAllBackends() {
for (auto& backend : backends_) backend->Shutdown();
}
void ShutdownBackend(size_t index) { backends_[index]->Shutdown(); }
void ResetStub(int fallback_timeout = 0,
const grpc::string& expected_targets = "") {
ChannelArguments args;
@ -445,20 +433,21 @@ class XdsEnd2endTest : public ::testing::Test {
}
void ResetBackendCounters() {
for (const auto& backend : backends_) backend->ResetCounters();
for (auto& backend : backends_) backend->service_.ResetCounters();
}
ClientStats WaitForLoadReports() {
ClientStats client_stats;
for (const auto& balancer : balancers_) {
client_stats += balancer->WaitForLoadReport();
for (auto& balancer : balancers_) {
client_stats += balancer->service_.WaitForLoadReport();
}
return client_stats;
}
bool SeenAllBackends() {
for (const auto& backend : backends_) {
if (backend->request_count() == 0) return false;
bool SeenAllBackends(size_t start_index = 0, size_t stop_index = 0) {
if (stop_index == 0) stop_index = backends_.size();
for (size_t i = start_index; i < stop_index; ++i) {
if (backends_[i]->service_.request_count() == 0) return false;
}
return true;
}
@ -478,13 +467,14 @@ class XdsEnd2endTest : public ::testing::Test {
++*num_total;
}
std::tuple<int, int, int> WaitForAllBackends(
int num_requests_multiple_of = 1) {
std::tuple<int, int, int> WaitForAllBackends(int num_requests_multiple_of = 1,
size_t start_index = 0,
size_t stop_index = 0) {
int num_ok = 0;
int num_failure = 0;
int num_drops = 0;
int num_total = 0;
while (!SeenAllBackends()) {
while (!SeenAllBackends(start_index, stop_index)) {
SendRpcAndCount(&num_total, &num_ok, &num_failure, &num_drops);
}
while (num_total % num_requests_multiple_of != 0) {
@ -502,7 +492,7 @@ class XdsEnd2endTest : public ::testing::Test {
void WaitForBackend(size_t backend_idx) {
do {
(void)SendRpc();
} while (backends_[backend_idx]->request_count() == 0);
} while (backends_[backend_idx]->service_.request_count() == 0);
ResetBackendCounters();
}
@ -553,8 +543,8 @@ class XdsEnd2endTest : public ::testing::Test {
grpc_core::FakeResolverResponseGenerator* lb_channel_response_generator =
nullptr) {
std::vector<int> ports;
for (size_t i = 0; i < balancer_servers_.size(); ++i) {
ports.emplace_back(balancer_servers_[i].port_);
for (size_t i = 0; i < balancers_.size(); ++i) {
ports.emplace_back(balancers_[i]->port_);
}
SetNextResolutionForLbChannel(ports, service_config_json,
lb_channel_response_generator);
@ -591,10 +581,12 @@ class XdsEnd2endTest : public ::testing::Test {
response_generator_->SetReresolutionResponse(&fake_result);
}
const std::vector<int> GetBackendPorts(const size_t start_index = 0) const {
const std::vector<int> GetBackendPorts(size_t start_index = 0,
size_t stop_index = 0) const {
if (stop_index == 0) stop_index = backends_.size();
std::vector<int> backend_ports;
for (size_t i = start_index; i < backend_servers_.size(); ++i) {
backend_ports.push_back(backend_servers_[i].port_);
for (size_t i = start_index; i < stop_index; ++i) {
backend_ports.push_back(backends_[i]->port_);
}
return backend_ports;
}
@ -602,7 +594,7 @@ class XdsEnd2endTest : public ::testing::Test {
void ScheduleResponseForBalancer(size_t i,
const LoadBalanceResponse& response,
int delay_ms) {
balancers_.at(i)->add_response(response, delay_ms);
balancers_[i]->service_.add_response(response, delay_ms);
}
Status SendRpc(EchoResponse* response = nullptr, int timeout_ms = 1000,
@ -637,23 +629,28 @@ class XdsEnd2endTest : public ::testing::Test {
template <typename T>
struct ServerThread {
explicit ServerThread(const grpc::string& type,
const grpc::string& server_host, T* service)
: type_(type), service_(service) {
template <typename... Args>
explicit ServerThread(const grpc::string& type, Args&&... args)
: port_(grpc_pick_unused_port_or_die()),
type_(type),
service_(std::forward<Args>(args)...) {}
void Start(const grpc::string& server_host) {
gpr_log(GPR_INFO, "starting %s server on port %d", type_.c_str(), port_);
GPR_ASSERT(!running_);
running_ = true;
std::mutex mu;
// We need to acquire the lock here in order to prevent the notify_one
// by ServerThread::Start from firing before the wait below is hit.
// by ServerThread::Serve from firing before the wait below is hit.
std::unique_lock<std::mutex> lock(mu);
port_ = grpc_pick_unused_port_or_die();
gpr_log(GPR_INFO, "starting %s server on port %d", type_.c_str(), port_);
std::condition_variable cond;
thread_.reset(new std::thread(
std::bind(&ServerThread::Start, this, server_host, &mu, &cond)));
std::bind(&ServerThread::Serve, this, server_host, &mu, &cond)));
cond.wait(lock);
gpr_log(GPR_INFO, "%s server startup complete", type_.c_str());
}
void Start(const grpc::string& server_host, std::mutex* mu,
void Serve(const grpc::string& server_host, std::mutex* mu,
std::condition_variable* cond) {
// We need to acquire the lock here in order to prevent the notify_one
// below from firing before its corresponding wait is executed.
@ -664,23 +661,27 @@ class XdsEnd2endTest : public ::testing::Test {
std::shared_ptr<ServerCredentials> creds(new SecureServerCredentials(
grpc_fake_transport_security_server_credentials_create()));
builder.AddListeningPort(server_address.str(), creds);
builder.RegisterService(service_);
builder.RegisterService(&service_);
server_ = builder.BuildAndStart();
cond->notify_one();
}
void Shutdown() {
if (!running_) return;
gpr_log(GPR_INFO, "%s about to shutdown", type_.c_str());
service_.Shutdown();
server_->Shutdown(grpc_timeout_milliseconds_to_deadline(0));
thread_->join();
gpr_log(GPR_INFO, "%s shutdown completed", type_.c_str());
running_ = false;
}
int port_;
const int port_;
grpc::string type_;
T service_;
std::unique_ptr<Server> server_;
T* service_;
std::unique_ptr<std::thread> thread_;
bool running_ = false;
};
const grpc::string server_host_;
@ -689,10 +690,8 @@ class XdsEnd2endTest : public ::testing::Test {
const int client_load_reporting_interval_seconds_;
std::shared_ptr<Channel> channel_;
std::unique_ptr<grpc::testing::EchoTestService::Stub> stub_;
std::vector<std::unique_ptr<BackendServiceImpl>> backends_;
std::vector<std::unique_ptr<BalancerServiceImpl>> balancers_;
std::vector<ServerThread<BackendService>> backend_servers_;
std::vector<ServerThread<BalancerService>> balancer_servers_;
std::vector<std::unique_ptr<ServerThread<BackendServiceImpl>>> backends_;
std::vector<std::unique_ptr<ServerThread<BalancerServiceImpl>>> balancers_;
grpc_core::RefCountedPtr<grpc_core::FakeResolverResponseGenerator>
response_generator_;
grpc_core::RefCountedPtr<grpc_core::FakeResolverResponseGenerator>
@ -728,14 +727,13 @@ TEST_F(SingleBalancerTest, Vanilla) {
CheckRpcSendOk(kNumRpcsPerAddress * num_backends_);
// Each backend should have gotten 100 requests.
for (size_t i = 0; i < backends_.size(); ++i) {
EXPECT_EQ(kNumRpcsPerAddress,
backend_servers_[i].service_->request_count());
EXPECT_EQ(kNumRpcsPerAddress, backends_[i]->service_.request_count());
}
balancers_[0]->NotifyDoneWithServerlists();
balancers_[0]->service_.NotifyDoneWithServerlists();
// The balancer got a single request.
EXPECT_EQ(1U, balancer_servers_[0].service_->request_count());
EXPECT_EQ(1U, balancers_[0]->service_.request_count());
// and sent a single response.
EXPECT_EQ(1U, balancer_servers_[0].service_->response_count());
EXPECT_EQ(1U, balancers_[0]->service_.response_count());
// Check LB policy name for the channel.
EXPECT_EQ("xds_experimental", channel_->GetLoadBalancingPolicyName());
@ -746,8 +744,8 @@ TEST_F(SingleBalancerTest, SameBackendListedMultipleTimes) {
SetNextResolutionForLbChannelAllBalancers();
// Same backend listed twice.
std::vector<int> ports;
ports.push_back(backend_servers_[0].port_);
ports.push_back(backend_servers_[0].port_);
ports.push_back(backends_[0]->port_);
ports.push_back(backends_[0]->port_);
const size_t kNumRpcsPerAddress = 10;
ScheduleResponseForBalancer(
0, BalancerServiceImpl::BuildResponseForBackends(ports, {}), 0);
@ -756,19 +754,18 @@ TEST_F(SingleBalancerTest, SameBackendListedMultipleTimes) {
// Send kNumRpcsPerAddress RPCs per server.
CheckRpcSendOk(kNumRpcsPerAddress * ports.size());
// Backend should have gotten 20 requests.
EXPECT_EQ(kNumRpcsPerAddress * 2,
backend_servers_[0].service_->request_count());
EXPECT_EQ(kNumRpcsPerAddress * 2, backends_[0]->service_.request_count());
// And they should have come from a single client port, because of
// subchannel sharing.
EXPECT_EQ(1UL, backends_[0]->clients().size());
balancers_[0]->NotifyDoneWithServerlists();
EXPECT_EQ(1UL, backends_[0]->service_.clients().size());
balancers_[0]->service_.NotifyDoneWithServerlists();
}
TEST_F(SingleBalancerTest, SecureNaming) {
// TODO(juanlishen): Use separate fake creds for the balancer channel.
ResetStub(0, kApplicationTargetName_ + ";lb");
SetNextResolution({}, kDefaultServiceConfig_.c_str());
SetNextResolutionForLbChannel({balancer_servers_[0].port_});
SetNextResolutionForLbChannel({balancers_[0]->port_});
const size_t kNumRpcsPerAddress = 100;
ScheduleResponseForBalancer(
0, BalancerServiceImpl::BuildResponseForBackends(GetBackendPorts(), {}),
@ -782,13 +779,12 @@ TEST_F(SingleBalancerTest, SecureNaming) {
// Each backend should have gotten 100 requests.
for (size_t i = 0; i < backends_.size(); ++i) {
EXPECT_EQ(kNumRpcsPerAddress,
backend_servers_[i].service_->request_count());
EXPECT_EQ(kNumRpcsPerAddress, backends_[i]->service_.request_count());
}
// The balancer got a single request.
EXPECT_EQ(1U, balancer_servers_[0].service_->request_count());
EXPECT_EQ(1U, balancers_[0]->service_.request_count());
// and sent a single response.
EXPECT_EQ(1U, balancer_servers_[0].service_->response_count());
EXPECT_EQ(1U, balancers_[0]->service_.response_count());
}
TEST_F(SingleBalancerTest, SecureNamingDeathTest) {
@ -806,7 +802,7 @@ TEST_F(SingleBalancerTest, SecureNamingDeathTest) {
"\"fake:///wrong_lb\" } }\n"
" ]\n"
"}");
SetNextResolutionForLbChannel({balancer_servers_[0].port_});
SetNextResolutionForLbChannel({balancers_[0]->port_});
channel_->WaitForConnected(grpc_timeout_seconds_to_deadline(1));
},
"");
@ -834,11 +830,11 @@ TEST_F(SingleBalancerTest, InitiallyEmptyServerlist) {
// populated serverlist but under the call's deadline (which is enforced by
// the call's deadline).
EXPECT_GT(ellapsed_ms.count(), kServerlistDelayMs);
balancers_[0]->NotifyDoneWithServerlists();
balancers_[0]->service_.NotifyDoneWithServerlists();
// The balancer got a single request.
EXPECT_EQ(1U, balancer_servers_[0].service_->request_count());
EXPECT_EQ(1U, balancers_[0]->service_.request_count());
// and sent two responses.
EXPECT_EQ(2U, balancer_servers_[0].service_->response_count());
EXPECT_EQ(2U, balancers_[0]->service_.response_count());
}
TEST_F(SingleBalancerTest, AllServersUnreachableFailFast) {
@ -854,11 +850,11 @@ TEST_F(SingleBalancerTest, AllServersUnreachableFailFast) {
const Status status = SendRpc();
// The error shouldn't be DEADLINE_EXCEEDED.
EXPECT_EQ(StatusCode::UNAVAILABLE, status.error_code());
balancers_[0]->NotifyDoneWithServerlists();
balancers_[0]->service_.NotifyDoneWithServerlists();
// The balancer got a single request.
EXPECT_EQ(1U, balancer_servers_[0].service_->request_count());
EXPECT_EQ(1U, balancers_[0]->service_.request_count());
// and sent a single response.
EXPECT_EQ(1U, balancer_servers_[0].service_->response_count());
EXPECT_EQ(1U, balancers_[0]->service_.response_count());
}
// The fallback tests are deferred because the fallback mode hasn't been
@ -882,27 +878,18 @@ TEST_F(SingleBalancerTest, BackendsRestart) {
channel_->GetState(true /* try_to_connect */);
// Send kNumRpcsPerAddress RPCs per server.
CheckRpcSendOk(kNumRpcsPerAddress * num_backends_);
balancers_[0]->NotifyDoneWithServerlists();
balancers_[0]->service_.NotifyDoneWithServerlists();
// The balancer got a single request.
EXPECT_EQ(1U, balancer_servers_[0].service_->request_count());
EXPECT_EQ(1U, balancers_[0]->service_.request_count());
// and sent a single response.
EXPECT_EQ(1U, balancer_servers_[0].service_->response_count());
for (size_t i = 0; i < backends_.size(); ++i) {
if (backends_[i]->Shutdown()) backend_servers_[i].Shutdown();
}
CheckRpcSendFailure();
for (size_t i = 0; i < num_backends_; ++i) {
backends_.emplace_back(new BackendServiceImpl());
backend_servers_.emplace_back(ServerThread<BackendService>(
"backend", server_host_, backends_.back().get()));
}
// The following RPC will fail due to the backend ports having changed. It
// will nonetheless exercise the xds-roundrobin handling of the RR policy
// having gone into shutdown.
// TODO(dgq): implement the "backend restart" component as well. We need extra
// machinery to either update the LB responses "on the fly" or instruct
// backends which ports to restart on.
EXPECT_EQ(1U, balancers_[0]->service_.response_count());
// Stop backends. RPCs should fail.
ShutdownAllBackends();
CheckRpcSendFailure();
// Restart all backends. RPCs should start succeeding again.
StartAllBackends();
CheckRpcSendOk(1 /* times */, 1000 /* timeout_ms */,
true /* wait_for_ready */);
}
class UpdatesTest : public XdsEnd2endTest {
@ -929,22 +916,22 @@ TEST_F(UpdatesTest, UpdateBalancersButKeepUsingOriginalBalancer) {
gpr_log(GPR_INFO, "========= DONE WITH FIRST BATCH ==========");
// All 10 requests should have gone to the first backend.
EXPECT_EQ(10U, backend_servers_[0].service_->request_count());
EXPECT_EQ(10U, backends_[0]->service_.request_count());
// Balancer 0 got a single request.
EXPECT_EQ(1U, balancer_servers_[0].service_->request_count());
EXPECT_EQ(1U, balancers_[0]->service_.request_count());
// and sent a single response.
EXPECT_EQ(1U, balancer_servers_[0].service_->response_count());
EXPECT_EQ(0U, balancer_servers_[1].service_->request_count());
EXPECT_EQ(0U, balancer_servers_[1].service_->response_count());
EXPECT_EQ(0U, balancer_servers_[2].service_->request_count());
EXPECT_EQ(0U, balancer_servers_[2].service_->response_count());
EXPECT_EQ(1U, balancers_[0]->service_.response_count());
EXPECT_EQ(0U, balancers_[1]->service_.request_count());
EXPECT_EQ(0U, balancers_[1]->service_.response_count());
EXPECT_EQ(0U, balancers_[2]->service_.request_count());
EXPECT_EQ(0U, balancers_[2]->service_.response_count());
gpr_log(GPR_INFO, "========= ABOUT TO UPDATE 1 ==========");
SetNextResolutionForLbChannel({balancer_servers_[1].port_});
SetNextResolutionForLbChannel({balancers_[1]->port_});
gpr_log(GPR_INFO, "========= UPDATE 1 DONE ==========");
EXPECT_EQ(0U, backend_servers_[1].service_->request_count());
EXPECT_EQ(0U, backends_[1]->service_.request_count());
gpr_timespec deadline = gpr_time_add(
gpr_now(GPR_CLOCK_REALTIME), gpr_time_from_millis(10000, GPR_TIMESPAN));
// Send 10 seconds worth of RPCs
@ -953,14 +940,14 @@ TEST_F(UpdatesTest, UpdateBalancersButKeepUsingOriginalBalancer) {
} while (gpr_time_cmp(gpr_now(GPR_CLOCK_REALTIME), deadline) < 0);
// The current LB call is still working, so xds continued using it to the
// first balancer, which doesn't assign the second backend.
EXPECT_EQ(0U, backend_servers_[1].service_->request_count());
EXPECT_EQ(1U, balancer_servers_[0].service_->request_count());
EXPECT_EQ(1U, balancer_servers_[0].service_->response_count());
EXPECT_EQ(0U, balancer_servers_[1].service_->request_count());
EXPECT_EQ(0U, balancer_servers_[1].service_->response_count());
EXPECT_EQ(0U, balancer_servers_[2].service_->request_count());
EXPECT_EQ(0U, balancer_servers_[2].service_->response_count());
EXPECT_EQ(0U, backends_[1]->service_.request_count());
EXPECT_EQ(1U, balancers_[0]->service_.request_count());
EXPECT_EQ(1U, balancers_[0]->service_.response_count());
EXPECT_EQ(0U, balancers_[1]->service_.request_count());
EXPECT_EQ(0U, balancers_[1]->service_.response_count());
EXPECT_EQ(0U, balancers_[2]->service_.request_count());
EXPECT_EQ(0U, balancers_[2]->service_.response_count());
}
TEST_F(UpdatesTest, UpdateBalancerName) {
@ -982,19 +969,19 @@ TEST_F(UpdatesTest, UpdateBalancerName) {
gpr_log(GPR_INFO, "========= DONE WITH FIRST BATCH ==========");
// All 10 requests should have gone to the first backend.
EXPECT_EQ(10U, backend_servers_[0].service_->request_count());
EXPECT_EQ(10U, backends_[0]->service_.request_count());
// Balancer 0 got a single request.
EXPECT_EQ(1U, balancer_servers_[0].service_->request_count());
EXPECT_EQ(1U, balancers_[0]->service_.request_count());
// and sent a single response.
EXPECT_EQ(1U, balancer_servers_[0].service_->response_count());
EXPECT_EQ(0U, balancer_servers_[1].service_->request_count());
EXPECT_EQ(0U, balancer_servers_[1].service_->response_count());
EXPECT_EQ(0U, balancer_servers_[2].service_->request_count());
EXPECT_EQ(0U, balancer_servers_[2].service_->response_count());
EXPECT_EQ(1U, balancers_[0]->service_.response_count());
EXPECT_EQ(0U, balancers_[1]->service_.request_count());
EXPECT_EQ(0U, balancers_[1]->service_.response_count());
EXPECT_EQ(0U, balancers_[2]->service_.request_count());
EXPECT_EQ(0U, balancers_[2]->service_.response_count());
std::vector<int> ports;
ports.emplace_back(balancer_servers_[1].port_);
ports.emplace_back(balancers_[1]->port_);
auto new_lb_channel_response_generator =
grpc_core::MakeRefCounted<grpc_core::FakeResolverResponseGenerator>();
SetNextResolutionForLbChannel(ports, nullptr,
@ -1013,22 +1000,22 @@ TEST_F(UpdatesTest, UpdateBalancerName) {
// Wait until update has been processed, as signaled by the second backend
// receiving a request.
EXPECT_EQ(0U, backend_servers_[1].service_->request_count());
EXPECT_EQ(0U, backends_[1]->service_.request_count());
WaitForBackend(1);
backend_servers_[1].service_->ResetCounters();
backends_[1]->service_.ResetCounters();
gpr_log(GPR_INFO, "========= BEFORE SECOND BATCH ==========");
CheckRpcSendOk(10);
gpr_log(GPR_INFO, "========= DONE WITH SECOND BATCH ==========");
// All 10 requests should have gone to the second backend.
EXPECT_EQ(10U, backend_servers_[1].service_->request_count());
EXPECT_EQ(1U, balancer_servers_[0].service_->request_count());
EXPECT_EQ(1U, balancer_servers_[0].service_->response_count());
EXPECT_EQ(1U, balancer_servers_[1].service_->request_count());
EXPECT_EQ(1U, balancer_servers_[1].service_->response_count());
EXPECT_EQ(0U, balancer_servers_[2].service_->request_count());
EXPECT_EQ(0U, balancer_servers_[2].service_->response_count());
EXPECT_EQ(10U, backends_[1]->service_.request_count());
EXPECT_EQ(1U, balancers_[0]->service_.request_count());
EXPECT_EQ(1U, balancers_[0]->service_.response_count());
EXPECT_EQ(1U, balancers_[1]->service_.request_count());
EXPECT_EQ(1U, balancers_[1]->service_.response_count());
EXPECT_EQ(0U, balancers_[2]->service_.request_count());
EXPECT_EQ(0U, balancers_[2]->service_.response_count());
}
// Send an update with the same set of LBs as the one in SetUp() in order to
@ -1054,26 +1041,26 @@ TEST_F(UpdatesTest, UpdateBalancersRepeated) {
gpr_log(GPR_INFO, "========= DONE WITH FIRST BATCH ==========");
// All 10 requests should have gone to the first backend.
EXPECT_EQ(10U, backend_servers_[0].service_->request_count());
EXPECT_EQ(10U, backends_[0]->service_.request_count());
// Balancer 0 got a single request.
EXPECT_EQ(1U, balancer_servers_[0].service_->request_count());
EXPECT_EQ(1U, balancers_[0]->service_.request_count());
// and sent a single response.
EXPECT_EQ(1U, balancer_servers_[0].service_->response_count());
EXPECT_EQ(0U, balancer_servers_[1].service_->request_count());
EXPECT_EQ(0U, balancer_servers_[1].service_->response_count());
EXPECT_EQ(0U, balancer_servers_[2].service_->request_count());
EXPECT_EQ(0U, balancer_servers_[2].service_->response_count());
EXPECT_EQ(1U, balancers_[0]->service_.response_count());
EXPECT_EQ(0U, balancers_[1]->service_.request_count());
EXPECT_EQ(0U, balancers_[1]->service_.response_count());
EXPECT_EQ(0U, balancers_[2]->service_.request_count());
EXPECT_EQ(0U, balancers_[2]->service_.response_count());
std::vector<int> ports;
ports.emplace_back(balancer_servers_[0].port_);
ports.emplace_back(balancer_servers_[1].port_);
ports.emplace_back(balancer_servers_[2].port_);
ports.emplace_back(balancers_[0]->port_);
ports.emplace_back(balancers_[1]->port_);
ports.emplace_back(balancers_[2]->port_);
gpr_log(GPR_INFO, "========= ABOUT TO UPDATE 1 ==========");
SetNextResolutionForLbChannel(ports);
gpr_log(GPR_INFO, "========= UPDATE 1 DONE ==========");
EXPECT_EQ(0U, backend_servers_[1].service_->request_count());
EXPECT_EQ(0U, backends_[1]->service_.request_count());
gpr_timespec deadline = gpr_time_add(
gpr_now(GPR_CLOCK_REALTIME), gpr_time_from_millis(10000, GPR_TIMESPAN));
// Send 10 seconds worth of RPCs
@ -1082,16 +1069,16 @@ TEST_F(UpdatesTest, UpdateBalancersRepeated) {
} while (gpr_time_cmp(gpr_now(GPR_CLOCK_REALTIME), deadline) < 0);
// xds continued using the original LB call to the first balancer, which
// doesn't assign the second backend.
EXPECT_EQ(0U, backend_servers_[1].service_->request_count());
EXPECT_EQ(0U, backends_[1]->service_.request_count());
ports.clear();
ports.emplace_back(balancer_servers_[0].port_);
ports.emplace_back(balancer_servers_[1].port_);
ports.emplace_back(balancers_[0]->port_);
ports.emplace_back(balancers_[1]->port_);
gpr_log(GPR_INFO, "========= ABOUT TO UPDATE 2 ==========");
SetNextResolutionForLbChannel(ports);
gpr_log(GPR_INFO, "========= UPDATE 2 DONE ==========");
EXPECT_EQ(0U, backend_servers_[1].service_->request_count());
EXPECT_EQ(0U, backends_[1]->service_.request_count());
deadline = gpr_time_add(gpr_now(GPR_CLOCK_REALTIME),
gpr_time_from_millis(10000, GPR_TIMESPAN));
// Send 10 seconds worth of RPCs
@ -1100,12 +1087,12 @@ TEST_F(UpdatesTest, UpdateBalancersRepeated) {
} while (gpr_time_cmp(gpr_now(GPR_CLOCK_REALTIME), deadline) < 0);
// xds continued using the original LB call to the first balancer, which
// doesn't assign the second backend.
EXPECT_EQ(0U, backend_servers_[1].service_->request_count());
EXPECT_EQ(0U, backends_[1]->service_.request_count());
}
TEST_F(UpdatesTest, UpdateBalancersDeadUpdate) {
SetNextResolution({}, kDefaultServiceConfig_.c_str());
SetNextResolutionForLbChannel({balancer_servers_[0].port_});
SetNextResolutionForLbChannel({balancers_[0]->port_});
const std::vector<int> first_backend{GetBackendPorts()[0]};
const std::vector<int> second_backend{GetBackendPorts()[1]};
@ -1119,11 +1106,11 @@ TEST_F(UpdatesTest, UpdateBalancersDeadUpdate) {
CheckRpcSendOk(10);
gpr_log(GPR_INFO, "========= DONE WITH FIRST BATCH ==========");
// All 10 requests should have gone to the first backend.
EXPECT_EQ(10U, backend_servers_[0].service_->request_count());
EXPECT_EQ(10U, backends_[0]->service_.request_count());
// Kill balancer 0
gpr_log(GPR_INFO, "********** ABOUT TO KILL BALANCER 0 *************");
if (balancers_[0]->Shutdown()) balancer_servers_[0].Shutdown();
balancers_[0]->Shutdown();
gpr_log(GPR_INFO, "********** KILLED BALANCER 0 *************");
// This is serviced by the existing child policy.
@ -1131,48 +1118,48 @@ TEST_F(UpdatesTest, UpdateBalancersDeadUpdate) {
CheckRpcSendOk(10);
gpr_log(GPR_INFO, "========= DONE WITH SECOND BATCH ==========");
// All 10 requests should again have gone to the first backend.
EXPECT_EQ(20U, backend_servers_[0].service_->request_count());
EXPECT_EQ(0U, backend_servers_[1].service_->request_count());
EXPECT_EQ(20U, backends_[0]->service_.request_count());
EXPECT_EQ(0U, backends_[1]->service_.request_count());
// Balancer 0 got a single request.
EXPECT_EQ(1U, balancer_servers_[0].service_->request_count());
EXPECT_EQ(1U, balancers_[0]->service_.request_count());
// and sent a single response.
EXPECT_EQ(1U, balancer_servers_[0].service_->response_count());
EXPECT_EQ(0U, balancer_servers_[1].service_->request_count());
EXPECT_EQ(0U, balancer_servers_[1].service_->response_count());
EXPECT_EQ(0U, balancer_servers_[2].service_->request_count());
EXPECT_EQ(0U, balancer_servers_[2].service_->response_count());
EXPECT_EQ(1U, balancers_[0]->service_.response_count());
EXPECT_EQ(0U, balancers_[1]->service_.request_count());
EXPECT_EQ(0U, balancers_[1]->service_.response_count());
EXPECT_EQ(0U, balancers_[2]->service_.request_count());
EXPECT_EQ(0U, balancers_[2]->service_.response_count());
gpr_log(GPR_INFO, "========= ABOUT TO UPDATE 1 ==========");
SetNextResolutionForLbChannel({balancer_servers_[1].port_});
SetNextResolutionForLbChannel({balancers_[1]->port_});
gpr_log(GPR_INFO, "========= UPDATE 1 DONE ==========");
// Wait until update has been processed, as signaled by the second backend
// receiving a request. In the meantime, the client continues to be serviced
// (by the first backend) without interruption.
EXPECT_EQ(0U, backend_servers_[1].service_->request_count());
EXPECT_EQ(0U, backends_[1]->service_.request_count());
WaitForBackend(1);
// This is serviced by the updated RR policy
backend_servers_[1].service_->ResetCounters();
backends_[1]->service_.ResetCounters();
gpr_log(GPR_INFO, "========= BEFORE THIRD BATCH ==========");
CheckRpcSendOk(10);
gpr_log(GPR_INFO, "========= DONE WITH THIRD BATCH ==========");
// All 10 requests should have gone to the second backend.
EXPECT_EQ(10U, backend_servers_[1].service_->request_count());
EXPECT_EQ(10U, backends_[1]->service_.request_count());
EXPECT_EQ(1U, balancer_servers_[0].service_->request_count());
EXPECT_EQ(1U, balancer_servers_[0].service_->response_count());
EXPECT_EQ(1U, balancers_[0]->service_.request_count());
EXPECT_EQ(1U, balancers_[0]->service_.response_count());
// The second balancer, published as part of the first update, may end up
// getting two requests (that is, 1 <= #req <= 2) if the LB call retry timer
// firing races with the arrival of the update containing the second
// balancer.
EXPECT_GE(balancer_servers_[1].service_->request_count(), 1U);
EXPECT_GE(balancer_servers_[1].service_->response_count(), 1U);
EXPECT_LE(balancer_servers_[1].service_->request_count(), 2U);
EXPECT_LE(balancer_servers_[1].service_->response_count(), 2U);
EXPECT_EQ(0U, balancer_servers_[2].service_->request_count());
EXPECT_EQ(0U, balancer_servers_[2].service_->response_count());
EXPECT_GE(balancers_[1]->service_.request_count(), 1U);
EXPECT_GE(balancers_[1]->service_.response_count(), 1U);
EXPECT_LE(balancers_[1]->service_.request_count(), 2U);
EXPECT_LE(balancers_[1]->service_.response_count(), 2U);
EXPECT_EQ(0U, balancers_[2]->service_.request_count());
EXPECT_EQ(0U, balancers_[2]->service_.response_count());
}
// The re-resolution tests are deferred because they rely on the fallback mode,
@ -1201,6 +1188,9 @@ class SingleBalancerWithClientLoadReportingTest : public XdsEnd2endTest {
// TODO(vpowar): Add TEST_F(SingleBalancerWithClientLoadReportingTest, Vanilla)
// TODO(roth): Add TEST_F(SingleBalancerWithClientLoadReportingTest,
// BalancerRestart)
// TODO(roth): Add TEST_F(SingleBalancerWithClientLoadReportingTest, Drop)
} // namespace

@ -58,7 +58,7 @@ class EchoServer final : public EchoTestService::Service {
class StatsPluginEnd2EndTest : public ::testing::Test {
protected:
static void SetUpTestCase() { grpc_impl::RegisterOpenCensusPlugin(); }
static void SetUpTestCase() { RegisterOpenCensusPlugin(); }
void SetUp() {
// Set up a synchronous server on a different thread to avoid the asynch

@ -92,17 +92,101 @@ DEFINE_int32(soak_iterations, 1000,
DEFINE_int32(iteration_interval, 10,
"The interval in seconds between rpcs. This is used by "
"long_connection test");
DEFINE_string(additional_metadata, "",
"Additional metadata to send in each request, as a "
"semicolon-separated list of key:value pairs.");
using grpc::testing::CreateChannelForTestCase;
using grpc::testing::GetServiceAccountJsonKey;
using grpc::testing::UpdateActions;
namespace {
// Parse the contents of FLAGS_additional_metadata into a map. Allow
// alphanumeric characters and dashes in keys, and any character but semicolons
// in values. Convert keys to lowercase. On failure, log an error and return
// false.
bool ParseAdditionalMetadataFlag(
const grpc::string& flag,
std::multimap<grpc::string, grpc::string>* additional_metadata) {
size_t start_pos = 0;
while (start_pos < flag.length()) {
size_t colon_pos = flag.find(':', start_pos);
if (colon_pos == grpc::string::npos) {
gpr_log(GPR_ERROR,
"Couldn't parse metadata flag: extra characters at end of flag");
return false;
}
size_t semicolon_pos = flag.find(';', colon_pos);
grpc::string key = flag.substr(start_pos, colon_pos - start_pos);
grpc::string value =
flag.substr(colon_pos + 1, semicolon_pos - colon_pos - 1);
constexpr char alphanum_and_hyphen[] =
"-0123456789"
"abcdefghijklmnopqrstuvwxyz"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ";
if (key.find_first_not_of(alphanum_and_hyphen) != grpc::string::npos) {
gpr_log(GPR_ERROR,
"Couldn't parse metadata flag: key contains characters other "
"than alphanumeric and hyphens: %s",
key.c_str());
return false;
}
// Convert to lowercase.
for (char& c : key) {
if (c >= 'A' && c <= 'Z') {
c += ('a' - 'A');
}
}
gpr_log(GPR_INFO, "Adding additional metadata with key %s and value %s",
key.c_str(), value.c_str());
additional_metadata->insert({key, value});
if (semicolon_pos == grpc::string::npos) {
break;
} else {
start_pos = semicolon_pos + 1;
}
}
return true;
}
} // namespace
int main(int argc, char** argv) {
grpc::testing::InitTest(&argc, &argv, true);
gpr_log(GPR_INFO, "Testing these cases: %s", FLAGS_test_case.c_str());
int ret = 0;
grpc::testing::ChannelCreationFunc channel_creation_func =
std::bind(&CreateChannelForTestCase, FLAGS_test_case);
grpc::testing::ChannelCreationFunc channel_creation_func;
grpc::string test_case = FLAGS_test_case;
if (FLAGS_additional_metadata == "") {
channel_creation_func = [test_case]() {
return CreateChannelForTestCase(test_case);
};
} else {
std::multimap<grpc::string, grpc::string> additional_metadata;
if (!ParseAdditionalMetadataFlag(FLAGS_additional_metadata,
&additional_metadata)) {
return 1;
}
channel_creation_func = [test_case, additional_metadata]() {
std::vector<std::unique_ptr<
grpc::experimental::ClientInterceptorFactoryInterface>>
factories;
factories.emplace_back(
new grpc::testing::AdditionalMetadataInterceptorFactory(
additional_metadata));
return CreateChannelForTestCase(test_case, std::move(factories));
};
}
grpc::testing::InteropClient client(channel_creation_func, true,
FLAGS_do_not_abort_on_transient_failures);

@ -79,7 +79,10 @@ void UpdateActions(
std::unordered_map<grpc::string, std::function<bool()>>* actions) {}
std::shared_ptr<Channel> CreateChannelForTestCase(
const grpc::string& test_case) {
const grpc::string& test_case,
std::vector<
std::unique_ptr<experimental::ClientInterceptorFactoryInterface>>
interceptor_creators) {
GPR_ASSERT(FLAGS_server_port);
const int host_port_buf_size = 1024;
char host_port[host_port_buf_size];
@ -107,9 +110,15 @@ std::shared_ptr<Channel> CreateChannelForTestCase(
transport_security security_type =
FLAGS_use_alts ? ALTS : (FLAGS_use_tls ? TLS : INSECURE);
return CreateTestChannel(host_port, FLAGS_server_host_override,
security_type, !FLAGS_use_test_ca, creds);
security_type, !FLAGS_use_test_ca, creds,
std::move(interceptor_creators));
} else {
return CreateTestChannel(host_port, FLAGS_custom_credentials_type, creds);
if (interceptor_creators.empty()) {
return CreateTestChannel(host_port, FLAGS_custom_credentials_type, creds);
} else {
return CreateTestChannel(host_port, FLAGS_custom_credentials_type, creds,
std::move(interceptor_creators));
}
}
}

@ -39,7 +39,10 @@ void UpdateActions(
std::unordered_map<grpc::string, std::function<bool()>>* actions);
std::shared_ptr<Channel> CreateChannelForTestCase(
const grpc::string& test_case);
const grpc::string& test_case,
std::vector<
std::unique_ptr<experimental::ClientInterceptorFactoryInterface>>
interceptor_creators = {});
class InteropClientContextInspector {
public:
@ -59,6 +62,43 @@ class InteropClientContextInspector {
const ::grpc::ClientContext& context_;
};
class AdditionalMetadataInterceptor : public experimental::Interceptor {
public:
AdditionalMetadataInterceptor(
std::multimap<grpc::string, grpc::string> additional_metadata)
: additional_metadata_(std::move(additional_metadata)) {}
void Intercept(experimental::InterceptorBatchMethods* methods) override {
if (methods->QueryInterceptionHookPoint(
experimental::InterceptionHookPoints::PRE_SEND_INITIAL_METADATA)) {
std::multimap<grpc::string, grpc::string>* metadata =
methods->GetSendInitialMetadata();
for (const auto& entry : additional_metadata_) {
metadata->insert(entry);
}
}
methods->Proceed();
}
private:
const std::multimap<grpc::string, grpc::string> additional_metadata_;
};
class AdditionalMetadataInterceptorFactory
: public experimental::ClientInterceptorFactoryInterface {
public:
AdditionalMetadataInterceptorFactory(
std::multimap<grpc::string, grpc::string> additional_metadata)
: additional_metadata_(std::move(additional_metadata)) {}
experimental::Interceptor* CreateClientInterceptor(
experimental::ClientRpcInfo* info) override {
return new AdditionalMetadataInterceptor(additional_metadata_);
}
const std::multimap<grpc::string, grpc::string> additional_metadata_;
};
} // namespace testing
} // namespace grpc

@ -29,9 +29,7 @@
#include "test/cpp/microbenchmarks/helpers.h"
absl::once_flag once;
void RegisterOnce() {
absl::call_once(once, grpc_impl::RegisterOpenCensusPlugin);
}
void RegisterOnce() { absl::call_once(once, grpc::RegisterOpenCensusPlugin); }
class EchoServer final : public grpc::testing::EchoTestService::Service {
grpc::Status Echo(grpc::ServerContext* context,
@ -101,7 +99,7 @@ static void BM_E2eLatencyCensusEnabled(benchmark::State& state) {
RegisterOnce();
// This we can safely repeat, and doing so clears accumulated data to avoid
// initialization costs varying between runs.
grpc_impl::RegisterOpenCensusViewsForExport();
grpc::RegisterOpenCensusViewsForExport();
EchoServerThread server;
std::unique_ptr<grpc::testing::EchoTestService::Stub> stub =

@ -71,10 +71,73 @@ std::shared_ptr<Channel> CreateTestChannel(
const grpc::string& override_hostname, bool use_prod_roots,
const std::shared_ptr<CallCredentials>& creds,
const ChannelArguments& args) {
return CreateTestChannel(server, cred_type, override_hostname, use_prod_roots,
creds, args,
/*interceptor_creators=*/{});
}
std::shared_ptr<Channel> CreateTestChannel(
const grpc::string& server, const grpc::string& override_hostname,
testing::transport_security security_type, bool use_prod_roots,
const std::shared_ptr<CallCredentials>& creds,
const ChannelArguments& args) {
return CreateTestChannel(server, override_hostname, security_type,
use_prod_roots, creds, args,
/*interceptor_creators=*/{});
}
std::shared_ptr<Channel> CreateTestChannel(
const grpc::string& server, const grpc::string& override_hostname,
testing::transport_security security_type, bool use_prod_roots,
const std::shared_ptr<CallCredentials>& creds) {
return CreateTestChannel(server, override_hostname, security_type,
use_prod_roots, creds, ChannelArguments());
}
std::shared_ptr<Channel> CreateTestChannel(
const grpc::string& server, const grpc::string& override_hostname,
testing::transport_security security_type, bool use_prod_roots) {
return CreateTestChannel(server, override_hostname, security_type,
use_prod_roots, std::shared_ptr<CallCredentials>());
}
// Shortcut for end2end and interop tests.
std::shared_ptr<Channel> CreateTestChannel(
const grpc::string& server, testing::transport_security security_type) {
return CreateTestChannel(server, "foo.test.google.fr", security_type, false);
}
std::shared_ptr<Channel> CreateTestChannel(
const grpc::string& server, const grpc::string& credential_type,
const std::shared_ptr<CallCredentials>& creds) {
ChannelArguments channel_args;
std::shared_ptr<ChannelCredentials> channel_creds =
testing::GetCredentialsProvider()->GetChannelCredentials(credential_type,
&channel_args);
GPR_ASSERT(channel_creds != nullptr);
if (creds.get()) {
channel_creds = CompositeChannelCredentials(channel_creds, creds);
}
return CreateCustomChannel(server, channel_creds, channel_args);
}
std::shared_ptr<Channel> CreateTestChannel(
const grpc::string& server, const grpc::string& cred_type,
const grpc::string& override_hostname, bool use_prod_roots,
const std::shared_ptr<CallCredentials>& creds, const ChannelArguments& args,
std::vector<
std::unique_ptr<experimental::ClientInterceptorFactoryInterface>>
interceptor_creators) {
ChannelArguments channel_args(args);
std::shared_ptr<ChannelCredentials> channel_creds;
if (cred_type.empty()) {
return CreateCustomChannel(server, InsecureChannelCredentials(), args);
if (interceptor_creators.empty()) {
return CreateCustomChannel(server, InsecureChannelCredentials(), args);
} else {
return experimental::CreateCustomChannelWithInterceptors(
server, InsecureChannelCredentials(), args,
std::move(interceptor_creators));
}
} else if (cred_type == testing::kTlsCredentialsType) { // cred_type == "ssl"
if (use_prod_roots) {
gpr_once_init(&g_once_init_add_prod_ssl_provider, &AddProdSslType);
@ -95,54 +158,62 @@ std::shared_ptr<Channel> CreateTestChannel(
if (creds.get()) {
channel_creds = CompositeChannelCredentials(channel_creds, creds);
}
return CreateCustomChannel(connect_to, channel_creds, channel_args);
if (interceptor_creators.empty()) {
return CreateCustomChannel(connect_to, channel_creds, channel_args);
} else {
return experimental::CreateCustomChannelWithInterceptors(
connect_to, channel_creds, channel_args,
std::move(interceptor_creators));
}
} else {
channel_creds = testing::GetCredentialsProvider()->GetChannelCredentials(
cred_type, &channel_args);
GPR_ASSERT(channel_creds != nullptr);
return CreateCustomChannel(server, channel_creds, args);
if (interceptor_creators.empty()) {
return CreateCustomChannel(server, channel_creds, args);
} else {
return experimental::CreateCustomChannelWithInterceptors(
server, channel_creds, args, std::move(interceptor_creators));
}
}
}
std::shared_ptr<Channel> CreateTestChannel(
const grpc::string& server, const grpc::string& override_hostname,
testing::transport_security security_type, bool use_prod_roots,
const std::shared_ptr<CallCredentials>& creds,
const ChannelArguments& args) {
grpc::string type =
const std::shared_ptr<CallCredentials>& creds, const ChannelArguments& args,
std::vector<
std::unique_ptr<experimental::ClientInterceptorFactoryInterface>>
interceptor_creators) {
grpc::string credential_type =
security_type == testing::ALTS
? testing::kAltsCredentialsType
: (security_type == testing::TLS ? testing::kTlsCredentialsType
: testing::kInsecureCredentialsType);
return CreateTestChannel(server, type, override_hostname, use_prod_roots,
creds, args);
return CreateTestChannel(server, credential_type, override_hostname,
use_prod_roots, creds, args,
std::move(interceptor_creators));
}
std::shared_ptr<Channel> CreateTestChannel(
const grpc::string& server, const grpc::string& override_hostname,
testing::transport_security security_type, bool use_prod_roots,
const std::shared_ptr<CallCredentials>& creds) {
return CreateTestChannel(server, override_hostname, security_type,
use_prod_roots, creds, ChannelArguments());
}
std::shared_ptr<Channel> CreateTestChannel(
const grpc::string& server, const grpc::string& override_hostname,
testing::transport_security security_type, bool use_prod_roots) {
const std::shared_ptr<CallCredentials>& creds,
std::vector<
std::unique_ptr<experimental::ClientInterceptorFactoryInterface>>
interceptor_creators) {
return CreateTestChannel(server, override_hostname, security_type,
use_prod_roots, std::shared_ptr<CallCredentials>());
}
// Shortcut for end2end and interop tests.
std::shared_ptr<Channel> CreateTestChannel(
const grpc::string& server, testing::transport_security security_type) {
return CreateTestChannel(server, "foo.test.google.fr", security_type, false);
use_prod_roots, creds, ChannelArguments(),
std::move(interceptor_creators));
}
std::shared_ptr<Channel> CreateTestChannel(
const grpc::string& server, const grpc::string& credential_type,
const std::shared_ptr<CallCredentials>& creds) {
const std::shared_ptr<CallCredentials>& creds,
std::vector<
std::unique_ptr<experimental::ClientInterceptorFactoryInterface>>
interceptor_creators) {
ChannelArguments channel_args;
std::shared_ptr<ChannelCredentials> channel_creds =
testing::GetCredentialsProvider()->GetChannelCredentials(credential_type,
@ -151,7 +222,8 @@ std::shared_ptr<Channel> CreateTestChannel(
if (creds.get()) {
channel_creds = CompositeChannelCredentials(channel_creds, creds);
}
return CreateCustomChannel(server, channel_creds, channel_args);
return experimental::CreateCustomChannelWithInterceptors(
server, channel_creds, channel_args, std::move(interceptor_creators));
}
} // namespace grpc

@ -21,6 +21,7 @@
#include <memory>
#include <grpcpp/impl/codegen/client_interceptor.h>
#include <grpcpp/security/credentials.h>
namespace grpc {
@ -60,6 +61,37 @@ std::shared_ptr<Channel> CreateTestChannel(
const grpc::string& server, const grpc::string& credential_type,
const std::shared_ptr<CallCredentials>& creds);
std::shared_ptr<Channel> CreateTestChannel(
const grpc::string& server, const grpc::string& override_hostname,
testing::transport_security security_type, bool use_prod_roots,
const std::shared_ptr<CallCredentials>& creds,
std::vector<
std::unique_ptr<experimental::ClientInterceptorFactoryInterface>>
interceptor_creators);
std::shared_ptr<Channel> CreateTestChannel(
const grpc::string& server, const grpc::string& override_hostname,
testing::transport_security security_type, bool use_prod_roots,
const std::shared_ptr<CallCredentials>& creds, const ChannelArguments& args,
std::vector<
std::unique_ptr<experimental::ClientInterceptorFactoryInterface>>
interceptor_creators);
std::shared_ptr<Channel> CreateTestChannel(
const grpc::string& server, const grpc::string& cred_type,
const grpc::string& override_hostname, bool use_prod_roots,
const std::shared_ptr<CallCredentials>& creds, const ChannelArguments& args,
std::vector<
std::unique_ptr<experimental::ClientInterceptorFactoryInterface>>
interceptor_creators);
std::shared_ptr<Channel> CreateTestChannel(
const grpc::string& server, const grpc::string& credential_type,
const std::shared_ptr<CallCredentials>& creds,
std::vector<
std::unique_ptr<experimental::ClientInterceptorFactoryInterface>>
interceptor_creators);
} // namespace grpc
#endif // GRPC_TEST_CPP_UTIL_CREATE_TEST_CHANNEL_H

@ -25,12 +25,25 @@ bazel build :protoc-gen-upb
cd ../..
proto_files=( \
"google/api/annotations.proto" \
"google/api/http.proto" \
"google/protobuf/any.proto" \
"google/protobuf/struct.proto" \
"google/protobuf/wrappers.proto" \
"google/protobuf/descriptor.proto" \
"google/protobuf/duration.proto" \
"google/protobuf/timestamp.proto" )
"google/protobuf/timestamp.proto" \
"google/rpc/status.proto" \
"gogoproto/gogo.proto" \
"validate/validate.proto" \
"envoy/type/percent.proto" \
"envoy/type/range.proto" \
"envoy/api/v2/core/address.proto" \
"envoy/api/v2/core/base.proto" \
"envoy/api/v2/core/health_check.proto" \
"envoy/api/v2/discovery.proto" \
"envoy/api/v2/eds.proto" \
"envoy/api/v2/endpoint/endpoint.proto")
for i in "${proto_files[@]}"
do

@ -104,20 +104,6 @@ _EXEMPT = frozenset((
# Designer-generated source
'examples/csharp/HelloworldXamarin/Droid/Resources/Resource.designer.cs',
'examples/csharp/HelloworldXamarin/iOS/ViewController.designer.cs',
# Upb generated source
'src/core/ext/upb-generated/google/protobuf/any.upb.h',
'src/core/ext/upb-generated/google/protobuf/any.upb.c',
'src/core/ext/upb-generated/google/protobuf/descriptor.upb.h',
'src/core/ext/upb-generated/google/protobuf/descriptor.upb.c',
'src/core/ext/upb-generated/google/protobuf/duration.upb.h',
'src/core/ext/upb-generated/google/protobuf/duration.upb.c',
'src/core/ext/upb-generated/google/protobuf/struct.upb.h',
'src/core/ext/upb-generated/google/protobuf/struct.upb.c',
'src/core/ext/upb-generated/google/protobuf/timestamp.upb.h',
'src/core/ext/upb-generated/google/protobuf/timestamp.upb.c',
'src/core/ext/upb-generated/google/protobuf/wrappers.upb.h',
'src/core/ext/upb-generated/google/protobuf/wrappers.upb.c',
))
RE_YEAR = r'Copyright (?P<first_year>[0-9]+\-)?(?P<last_year>[0-9]+) ([Tt]he )?gRPC [Aa]uthors(\.|)'
@ -168,6 +154,9 @@ except subprocess.CalledProcessError:
for filename in filename_list:
if filename in _EXEMPT:
continue
# Skip check for upb generated code.
if filename.endswith('.upb.h') or filename.endswith('.upb.c'):
continue
ext = os.path.splitext(filename)[1]
base = os.path.basename(filename)
if ext in RE_LICENSE:

@ -165,20 +165,6 @@ KNOWN_BAD = set([
'src/core/tsi/alts/handshaker/transport_security_common.pb.h',
'include/grpc++/ext/reflection.grpc.pb.h',
'include/grpc++/ext/reflection.pb.h',
# Upb generated code.
'src/core/ext/upb-generated/google/protobuf/any.upb.h',
'src/core/ext/upb-generated/google/protobuf/any.upb.c',
'src/core/ext/upb-generated/google/protobuf/descriptor.upb.h',
'src/core/ext/upb-generated/google/protobuf/descriptor.upb.c',
'src/core/ext/upb-generated/google/protobuf/duration.upb.h',
'src/core/ext/upb-generated/google/protobuf/duration.upb.c',
'src/core/ext/upb-generated/google/protobuf/struct.upb.h',
'src/core/ext/upb-generated/google/protobuf/struct.upb.c',
'src/core/ext/upb-generated/google/protobuf/timestamp.upb.h',
'src/core/ext/upb-generated/google/protobuf/timestamp.upb.c',
'src/core/ext/upb-generated/google/protobuf/wrappers.upb.h',
'src/core/ext/upb-generated/google/protobuf/wrappers.upb.c',
])
grep_filter = r"grep -E '^(include|src/core)/.*\.h$'"
@ -204,6 +190,9 @@ validator = GuardValidator()
for filename in filename_list:
if filename in KNOWN_BAD: continue
# Skip check for upb generated code.
if filename.endswith('.upb.h') or filename.endswith('.upb.c'):
continue
ok = ok and validator.check(filename, args.fix)
sys.exit(0 if ok else 1)

@ -14,5 +14,8 @@
FROM mcr.microsoft.com/dotnet/core/sdk:3.0.100-preview3-stretch
# needed by get-dotnet.sh script
RUN apt-get update && apt-get install -y jq && apt-get clean
# Define the default command.
CMD ["bash"]

@ -23,6 +23,14 @@ git clone /var/local/jenkins/grpc-dotnet /var/local/git/grpc-dotnet
cp -r /var/local/jenkins/service_account $HOME || true
cd /var/local/git/grpc-dotnet
# If needed, update dotnet SDK and put it on path
./build/get-dotnet.sh
if [ -f $HOME/.dotnet/dotnet ]
then
ln -s $HOME/.dotnet/dotnet /usr/local/bin/dotnet
fi
./build/get-grpc.sh
cd testassets/InteropTestsWebsite

@ -23,7 +23,7 @@ python tools/run_tests/run_tests.py -l php7 -c "$CONFIG" --build_only -j 8
cd src/php/tests/qps
composer install
# Install protobuf C-extension for php
cd vendor/google/protobuf/php/ext/google/protobuf
cd ../../../../third_party/protobuf/php/ext/google/protobuf
phpize
./configure
make

Loading…
Cancel
Save