Reland slice metadata conversion (#28210)

* Fix status code for resource exhaustion

* Revert "Revert "Move a bunch of slice typed metadata to new system (#28107)" (#28208)"

This reverts commit 7717587063.

* fix test
pull/28222/head
Craig Tiller 3 years ago committed by GitHub
parent 9e3b364ee1
commit 220cf641fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      BUILD
  2. 2
      CMakeLists.txt
  3. 2
      Makefile
  4. 2
      build_autogenerated.yaml
  5. 1
      config.m4
  6. 1
      config.w32
  7. 1
      gRPC-Core.podspec
  8. 1
      grpc.gemspec
  9. 2
      grpc.gyp
  10. 1
      package.xml
  11. 7
      src/core/ext/filters/client_channel/backend_metric.cc
  12. 3
      src/core/ext/filters/client_channel/backend_metric.h
  13. 14
      src/core/ext/filters/client_channel/client_channel.cc
  14. 15
      src/core/ext/filters/http/client/http_client_filter.cc
  15. 34
      src/core/ext/filters/http/server/http_server_filter.cc
  16. 86
      src/core/ext/transport/binder/transport/binder_transport.cc
  17. 7
      src/core/ext/transport/chttp2/transport/chttp2_transport.cc
  18. 50
      src/core/ext/transport/chttp2/transport/hpack_encoder.cc
  19. 22
      src/core/ext/transport/chttp2/transport/hpack_encoder.h
  20. 1
      src/core/ext/transport/chttp2/transport/hpack_parser.cc
  21. 10
      src/core/lib/security/authorization/cel_authorization_engine.cc
  22. 23
      src/core/lib/security/authorization/evaluate_args.cc
  23. 1
      src/core/lib/security/authorization/evaluate_args.h
  24. 112
      src/core/lib/slice/percent_encoding.cc
  25. 16
      src/core/lib/slice/percent_encoding.h
  26. 33
      src/core/lib/slice/slice.h
  27. 538
      src/core/lib/slice/static_slice.cc
  28. 211
      src/core/lib/slice/static_slice.h
  29. 87
      src/core/lib/surface/call.cc
  30. 206
      src/core/lib/transport/metadata_batch.h
  31. 35
      src/core/lib/transport/parsed_metadata.cc
  32. 161
      src/core/lib/transport/parsed_metadata.h
  33. 658
      src/core/lib/transport/static_metadata.cc
  34. 14
      src/core/lib/transport/static_metadata.h
  35. 25
      src/cpp/ext/filters/census/client_filter.cc
  36. 43
      src/cpp/ext/filters/census/server_filter.cc
  37. 1
      src/python/grpcio/grpc_core_dependencies.py
  38. 11
      test/core/bad_client/tests/large_metadata.cc
  39. 10
      test/core/end2end/fuzzers/hpack.dictionary
  40. 11
      test/core/security/evaluate_args_test.cc
  41. 16
      test/core/slice/percent_decode_fuzzer.cc
  42. 23
      test/core/slice/percent_encode_fuzzer.cc
  43. 76
      test/core/slice/percent_encoding_test.cc
  44. 11
      test/core/util/evaluate_args_test_util.h
  45. 20
      test/cpp/microbenchmarks/bm_chttp2_hpack.cc
  46. 5
      test/cpp/util/grpc_tool_test.cc
  47. 17
      tools/codegen/core/gen_static_metadata.py
  48. 1
      tools/doxygen/Doxyfile.c++.internal
  49. 1
      tools/doxygen/Doxyfile.core.internal

@ -1854,6 +1854,7 @@ grpc_cc_library(
"src/core/lib/transport/error_utils.cc", "src/core/lib/transport/error_utils.cc",
"src/core/lib/transport/metadata.cc", "src/core/lib/transport/metadata.cc",
"src/core/lib/transport/metadata_batch.cc", "src/core/lib/transport/metadata_batch.cc",
"src/core/lib/transport/parsed_metadata.cc",
"src/core/lib/transport/pid_controller.cc", "src/core/lib/transport/pid_controller.cc",
"src/core/lib/transport/static_metadata.cc", "src/core/lib/transport/static_metadata.cc",
"src/core/lib/transport/status_conversion.cc", "src/core/lib/transport/status_conversion.cc",

2
CMakeLists.txt generated

@ -2054,6 +2054,7 @@ add_library(grpc
src/core/lib/transport/error_utils.cc src/core/lib/transport/error_utils.cc
src/core/lib/transport/metadata.cc src/core/lib/transport/metadata.cc
src/core/lib/transport/metadata_batch.cc src/core/lib/transport/metadata_batch.cc
src/core/lib/transport/parsed_metadata.cc
src/core/lib/transport/pid_controller.cc src/core/lib/transport/pid_controller.cc
src/core/lib/transport/static_metadata.cc src/core/lib/transport/static_metadata.cc
src/core/lib/transport/status_conversion.cc src/core/lib/transport/status_conversion.cc
@ -2643,6 +2644,7 @@ add_library(grpc_unsecure
src/core/lib/transport/error_utils.cc src/core/lib/transport/error_utils.cc
src/core/lib/transport/metadata.cc src/core/lib/transport/metadata.cc
src/core/lib/transport/metadata_batch.cc src/core/lib/transport/metadata_batch.cc
src/core/lib/transport/parsed_metadata.cc
src/core/lib/transport/pid_controller.cc src/core/lib/transport/pid_controller.cc
src/core/lib/transport/static_metadata.cc src/core/lib/transport/static_metadata.cc
src/core/lib/transport/status_conversion.cc src/core/lib/transport/status_conversion.cc

2
Makefile generated

@ -1589,6 +1589,7 @@ LIBGRPC_SRC = \
src/core/lib/transport/error_utils.cc \ src/core/lib/transport/error_utils.cc \
src/core/lib/transport/metadata.cc \ src/core/lib/transport/metadata.cc \
src/core/lib/transport/metadata_batch.cc \ src/core/lib/transport/metadata_batch.cc \
src/core/lib/transport/parsed_metadata.cc \
src/core/lib/transport/pid_controller.cc \ src/core/lib/transport/pid_controller.cc \
src/core/lib/transport/static_metadata.cc \ src/core/lib/transport/static_metadata.cc \
src/core/lib/transport/status_conversion.cc \ src/core/lib/transport/status_conversion.cc \
@ -2026,6 +2027,7 @@ LIBGRPC_UNSECURE_SRC = \
src/core/lib/transport/error_utils.cc \ src/core/lib/transport/error_utils.cc \
src/core/lib/transport/metadata.cc \ src/core/lib/transport/metadata.cc \
src/core/lib/transport/metadata_batch.cc \ src/core/lib/transport/metadata_batch.cc \
src/core/lib/transport/parsed_metadata.cc \
src/core/lib/transport/pid_controller.cc \ src/core/lib/transport/pid_controller.cc \
src/core/lib/transport/static_metadata.cc \ src/core/lib/transport/static_metadata.cc \
src/core/lib/transport/status_conversion.cc \ src/core/lib/transport/status_conversion.cc \

@ -1527,6 +1527,7 @@ libs:
- src/core/lib/transport/error_utils.cc - src/core/lib/transport/error_utils.cc
- src/core/lib/transport/metadata.cc - src/core/lib/transport/metadata.cc
- src/core/lib/transport/metadata_batch.cc - src/core/lib/transport/metadata_batch.cc
- src/core/lib/transport/parsed_metadata.cc
- src/core/lib/transport/pid_controller.cc - src/core/lib/transport/pid_controller.cc
- src/core/lib/transport/static_metadata.cc - src/core/lib/transport/static_metadata.cc
- src/core/lib/transport/status_conversion.cc - src/core/lib/transport/status_conversion.cc
@ -2268,6 +2269,7 @@ libs:
- src/core/lib/transport/error_utils.cc - src/core/lib/transport/error_utils.cc
- src/core/lib/transport/metadata.cc - src/core/lib/transport/metadata.cc
- src/core/lib/transport/metadata_batch.cc - src/core/lib/transport/metadata_batch.cc
- src/core/lib/transport/parsed_metadata.cc
- src/core/lib/transport/pid_controller.cc - src/core/lib/transport/pid_controller.cc
- src/core/lib/transport/static_metadata.cc - src/core/lib/transport/static_metadata.cc
- src/core/lib/transport/status_conversion.cc - src/core/lib/transport/status_conversion.cc

1
config.m4 generated

@ -642,6 +642,7 @@ if test "$PHP_GRPC" != "no"; then
src/core/lib/transport/error_utils.cc \ src/core/lib/transport/error_utils.cc \
src/core/lib/transport/metadata.cc \ src/core/lib/transport/metadata.cc \
src/core/lib/transport/metadata_batch.cc \ src/core/lib/transport/metadata_batch.cc \
src/core/lib/transport/parsed_metadata.cc \
src/core/lib/transport/pid_controller.cc \ src/core/lib/transport/pid_controller.cc \
src/core/lib/transport/static_metadata.cc \ src/core/lib/transport/static_metadata.cc \
src/core/lib/transport/status_conversion.cc \ src/core/lib/transport/status_conversion.cc \

1
config.w32 generated

@ -608,6 +608,7 @@ if (PHP_GRPC != "no") {
"src\\core\\lib\\transport\\error_utils.cc " + "src\\core\\lib\\transport\\error_utils.cc " +
"src\\core\\lib\\transport\\metadata.cc " + "src\\core\\lib\\transport\\metadata.cc " +
"src\\core\\lib\\transport\\metadata_batch.cc " + "src\\core\\lib\\transport\\metadata_batch.cc " +
"src\\core\\lib\\transport\\parsed_metadata.cc " +
"src\\core\\lib\\transport\\pid_controller.cc " + "src\\core\\lib\\transport\\pid_controller.cc " +
"src\\core\\lib\\transport\\static_metadata.cc " + "src\\core\\lib\\transport\\static_metadata.cc " +
"src\\core\\lib\\transport\\status_conversion.cc " + "src\\core\\lib\\transport\\status_conversion.cc " +

1
gRPC-Core.podspec generated

@ -1345,6 +1345,7 @@ Pod::Spec.new do |s|
'src/core/lib/transport/metadata.h', 'src/core/lib/transport/metadata.h',
'src/core/lib/transport/metadata_batch.cc', 'src/core/lib/transport/metadata_batch.cc',
'src/core/lib/transport/metadata_batch.h', 'src/core/lib/transport/metadata_batch.h',
'src/core/lib/transport/parsed_metadata.cc',
'src/core/lib/transport/parsed_metadata.h', 'src/core/lib/transport/parsed_metadata.h',
'src/core/lib/transport/pid_controller.cc', 'src/core/lib/transport/pid_controller.cc',
'src/core/lib/transport/pid_controller.h', 'src/core/lib/transport/pid_controller.h',

1
grpc.gemspec generated

@ -1265,6 +1265,7 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/transport/metadata.h ) s.files += %w( src/core/lib/transport/metadata.h )
s.files += %w( src/core/lib/transport/metadata_batch.cc ) s.files += %w( src/core/lib/transport/metadata_batch.cc )
s.files += %w( src/core/lib/transport/metadata_batch.h ) s.files += %w( src/core/lib/transport/metadata_batch.h )
s.files += %w( src/core/lib/transport/parsed_metadata.cc )
s.files += %w( src/core/lib/transport/parsed_metadata.h ) s.files += %w( src/core/lib/transport/parsed_metadata.h )
s.files += %w( src/core/lib/transport/pid_controller.cc ) s.files += %w( src/core/lib/transport/pid_controller.cc )
s.files += %w( src/core/lib/transport/pid_controller.h ) s.files += %w( src/core/lib/transport/pid_controller.h )

2
grpc.gyp generated

@ -1030,6 +1030,7 @@
'src/core/lib/transport/error_utils.cc', 'src/core/lib/transport/error_utils.cc',
'src/core/lib/transport/metadata.cc', 'src/core/lib/transport/metadata.cc',
'src/core/lib/transport/metadata_batch.cc', 'src/core/lib/transport/metadata_batch.cc',
'src/core/lib/transport/parsed_metadata.cc',
'src/core/lib/transport/pid_controller.cc', 'src/core/lib/transport/pid_controller.cc',
'src/core/lib/transport/static_metadata.cc', 'src/core/lib/transport/static_metadata.cc',
'src/core/lib/transport/status_conversion.cc', 'src/core/lib/transport/status_conversion.cc',
@ -1439,6 +1440,7 @@
'src/core/lib/transport/error_utils.cc', 'src/core/lib/transport/error_utils.cc',
'src/core/lib/transport/metadata.cc', 'src/core/lib/transport/metadata.cc',
'src/core/lib/transport/metadata_batch.cc', 'src/core/lib/transport/metadata_batch.cc',
'src/core/lib/transport/parsed_metadata.cc',
'src/core/lib/transport/pid_controller.cc', 'src/core/lib/transport/pid_controller.cc',
'src/core/lib/transport/static_metadata.cc', 'src/core/lib/transport/static_metadata.cc',
'src/core/lib/transport/status_conversion.cc', 'src/core/lib/transport/status_conversion.cc',

1
package.xml generated

@ -1245,6 +1245,7 @@
<file baseinstalldir="/" name="src/core/lib/transport/metadata.h" role="src" /> <file baseinstalldir="/" name="src/core/lib/transport/metadata.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/transport/metadata_batch.cc" role="src" /> <file baseinstalldir="/" name="src/core/lib/transport/metadata_batch.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/transport/metadata_batch.h" role="src" /> <file baseinstalldir="/" name="src/core/lib/transport/metadata_batch.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/transport/parsed_metadata.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/transport/parsed_metadata.h" role="src" /> <file baseinstalldir="/" name="src/core/lib/transport/parsed_metadata.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/transport/pid_controller.cc" role="src" /> <file baseinstalldir="/" name="src/core/lib/transport/pid_controller.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/transport/pid_controller.h" role="src" /> <file baseinstalldir="/" name="src/core/lib/transport/pid_controller.h" role="src" />

@ -49,12 +49,11 @@ std::map<absl::string_view, double> ParseMap(
} // namespace } // namespace
const LoadBalancingPolicy::BackendMetricAccessor::BackendMetricData* const LoadBalancingPolicy::BackendMetricAccessor::BackendMetricData*
ParseBackendMetricData(const grpc_slice& serialized_load_report, Arena* arena) { ParseBackendMetricData(const Slice& serialized_load_report, Arena* arena) {
upb::Arena upb_arena; upb::Arena upb_arena;
xds_data_orca_v3_OrcaLoadReport* msg = xds_data_orca_v3_OrcaLoadReport_parse( xds_data_orca_v3_OrcaLoadReport* msg = xds_data_orca_v3_OrcaLoadReport_parse(
reinterpret_cast<const char*>( reinterpret_cast<const char*>(serialized_load_report.begin()),
GRPC_SLICE_START_PTR(serialized_load_report)), serialized_load_report.size(), upb_arena.ptr());
GRPC_SLICE_LENGTH(serialized_load_report), upb_arena.ptr());
if (msg == nullptr) return nullptr; if (msg == nullptr) return nullptr;
auto* backend_metric_data = arena->New< auto* backend_metric_data = arena->New<
LoadBalancingPolicy::BackendMetricAccessor::BackendMetricData>(); LoadBalancingPolicy::BackendMetricAccessor::BackendMetricData>();

@ -23,13 +23,14 @@
#include "src/core/ext/filters/client_channel/lb_policy.h" #include "src/core/ext/filters/client_channel/lb_policy.h"
#include "src/core/lib/gprpp/arena.h" #include "src/core/lib/gprpp/arena.h"
#include "src/core/lib/slice/slice.h"
namespace grpc_core { namespace grpc_core {
// Parses the serialized load report and allocates a BackendMetricData // Parses the serialized load report and allocates a BackendMetricData
// object on the arena. // object on the arena.
const LoadBalancingPolicy::BackendMetricAccessor::BackendMetricData* const LoadBalancingPolicy::BackendMetricAccessor::BackendMetricData*
ParseBackendMetricData(const grpc_slice& serialized_load_report, Arena* arena); ParseBackendMetricData(const Slice& serialized_load_report, Arena* arena);
} // namespace grpc_core } // namespace grpc_core

@ -2506,11 +2506,10 @@ class ClientChannel::LoadBalancedCall::BackendMetricAccessor
const BackendMetricData* GetBackendMetricData() override { const BackendMetricData* GetBackendMetricData() override {
if (lb_call_->backend_metric_data_ == nullptr) { if (lb_call_->backend_metric_data_ == nullptr) {
grpc_linked_mdelem* md = lb_call_->recv_trailing_metadata_->legacy_index() if (const auto* md = lb_call_->recv_trailing_metadata_->get_pointer(
->named.x_endpoint_load_metrics_bin; XEndpointLoadMetricsBinMetadata())) {
if (md != nullptr) {
lb_call_->backend_metric_data_ = lb_call_->backend_metric_data_ =
ParseBackendMetricData(GRPC_MDVALUE(md->md), lb_call_->arena_); ParseBackendMetricData(*md, lb_call_->arena_);
} }
} }
return lb_call_->backend_metric_data_; return lb_call_->backend_metric_data_;
@ -2877,14 +2876,15 @@ void ClientChannel::LoadBalancedCall::RecvTrailingMetadataReady(
status = absl::Status(static_cast<absl::StatusCode>(code), message); status = absl::Status(static_cast<absl::StatusCode>(code), message);
} else { } else {
// Get status from headers. // Get status from headers.
const auto& fields = self->recv_trailing_metadata_->legacy_index()->named; const auto& md = *self->recv_trailing_metadata_;
const auto& fields = md.legacy_index()->named;
GPR_ASSERT(fields.grpc_status != nullptr); GPR_ASSERT(fields.grpc_status != nullptr);
grpc_status_code code = grpc_status_code code =
grpc_get_status_code_from_metadata(fields.grpc_status->md); grpc_get_status_code_from_metadata(fields.grpc_status->md);
if (code != GRPC_STATUS_OK) { if (code != GRPC_STATUS_OK) {
absl::string_view message; absl::string_view message;
if (fields.grpc_message != nullptr) { if (const auto* grpc_message = md.get_pointer(GrpcMessageMetadata())) {
message = StringViewFromSlice(GRPC_MDVALUE(fields.grpc_message->md)); message = grpc_message->as_string_view();
} }
status = absl::Status(static_cast<absl::StatusCode>(code), message); status = absl::Status(static_cast<absl::StatusCode>(code), message);
} }

@ -138,17 +138,10 @@ static grpc_error_handle client_filter_incoming_metadata(
} }
} }
if (b->legacy_index()->named.grpc_message != nullptr) { if (grpc_core::Slice* grpc_message =
grpc_slice pct_decoded_msg = grpc_core::PermissivePercentDecodeSlice( b->get_pointer(grpc_core::GrpcMessageMetadata())) {
GRPC_MDVALUE(b->legacy_index()->named.grpc_message->md)); *grpc_message =
if (grpc_slice_is_equivalent( grpc_core::PermissivePercentDecodeSlice(std::move(*grpc_message));
pct_decoded_msg,
GRPC_MDVALUE(b->legacy_index()->named.grpc_message->md))) {
grpc_slice_unref_internal(pct_decoded_msg);
} else {
grpc_metadata_batch_set_value(b->legacy_index()->named.grpc_message,
pct_decoded_msg);
}
} }
if (b->legacy_index()->named.content_type != nullptr) { if (b->legacy_index()->named.content_type != nullptr) {

@ -104,18 +104,10 @@ struct channel_data {
} // namespace } // namespace
static grpc_error_handle hs_filter_outgoing_metadata(grpc_metadata_batch* b) { static grpc_error_handle hs_filter_outgoing_metadata(grpc_metadata_batch* b) {
if (b->legacy_index()->named.grpc_message != nullptr) { if (grpc_core::Slice* grpc_message =
grpc_slice pct_encoded_msg = grpc_core::PercentEncodeSlice( b->get_pointer(grpc_core::GrpcMessageMetadata())) {
GRPC_MDVALUE(b->legacy_index()->named.grpc_message->md), *grpc_message = grpc_core::PercentEncodeSlice(
grpc_core::PercentEncodingType::Compatible); std::move(*grpc_message), grpc_core::PercentEncodingType::Compatible);
if (grpc_slice_is_equivalent(
pct_encoded_msg,
GRPC_MDVALUE(b->legacy_index()->named.grpc_message->md))) {
grpc_slice_unref_internal(pct_encoded_msg);
} else {
grpc_metadata_batch_set_value(b->legacy_index()->named.grpc_message,
pct_encoded_msg);
}
} }
return GRPC_ERROR_NONE; return GRPC_ERROR_NONE;
} }
@ -306,19 +298,11 @@ static grpc_error_handle hs_filter_incoming_metadata(grpc_call_element* elem,
} }
} }
if (b->legacy_index()->named.host != nullptr && if (b->legacy_index()->named.authority == nullptr) {
b->legacy_index()->named.authority == nullptr) { absl::optional<grpc_core::Slice> host = b->Take(grpc_core::HostMetadata());
grpc_linked_mdelem* el = b->legacy_index()->named.host; if (host.has_value()) {
grpc_mdelem md = GRPC_MDELEM_REF(el->md); b->Append(":authority", std::move(*host));
b->Remove(el); }
hs_add_error(
error_name, &error,
grpc_metadata_batch_add_head(
b, el,
grpc_mdelem_from_slices(GRPC_MDSTR_AUTHORITY,
grpc_slice_ref_internal(GRPC_MDVALUE(md))),
GRPC_BATCH_AUTHORITY));
GRPC_MDELEM_UNREF(md);
} }
if (b->legacy_index()->named.authority == nullptr) { if (b->legacy_index()->named.authority == nullptr) {

@ -319,6 +319,52 @@ static void recv_trailing_metadata_locked(void* arg,
GRPC_BINDER_STREAM_UNREF(gbs, "recv_trailing_metadata"); GRPC_BINDER_STREAM_UNREF(gbs, "recv_trailing_metadata");
} }
namespace grpc_binder {
namespace {
class MetadataEncoder {
public:
MetadataEncoder(bool is_client, Transaction* tx, Metadata* init_md)
: is_client_(is_client), tx_(tx), init_md_(init_md) {}
void Encode(grpc_mdelem md) {
absl::string_view key = grpc_core::StringViewFromSlice(GRPC_MDKEY(md));
absl::string_view value = grpc_core::StringViewFromSlice(GRPC_MDVALUE(md));
gpr_log(GPR_INFO, "send metadata key-value %s",
absl::StrCat(key, " ", value).c_str());
if (grpc_slice_eq(GRPC_MDKEY(md), GRPC_MDSTR_PATH)) {
// TODO(b/192208403): Figure out if it is correct to simply drop '/'
// prefix and treat it as rpc method name
GPR_ASSERT(value[0] == '/');
std::string path = std::string(value).substr(1);
// Only client send method ref.
GPR_ASSERT(is_client_);
tx_->SetMethodRef(path);
} else if (grpc_slice_eq(GRPC_MDKEY(md), GRPC_MDSTR_GRPC_STATUS)) {
int status = grpc_get_status_code_from_metadata(md);
gpr_log(GPR_INFO, "send trailing metadata status = %d", status);
tx_->SetStatus(status);
} else {
init_md_->emplace_back(std::string(key), std::string(value));
}
}
template <typename Trait>
void Encode(Trait, const typename Trait::ValueType& value) {
init_md_->emplace_back(std::string(Trait::key()),
std::string(Trait::Encode(value).as_string_view()));
}
private:
const bool is_client_;
Transaction* const tx_;
Metadata* const init_md_;
};
} // namespace
} // namespace grpc_binder
static void perform_stream_op_locked(void* stream_op, static void perform_stream_op_locked(void* stream_op,
grpc_error_handle /*error*/) { grpc_error_handle /*error*/) {
grpc_transport_stream_op_batch* op = grpc_transport_stream_op_batch* op =
@ -386,25 +432,8 @@ static void perform_stream_op_locked(void* stream_op,
grpc_binder::Metadata init_md; grpc_binder::Metadata init_md;
auto batch = op->payload->send_initial_metadata.send_initial_metadata; auto batch = op->payload->send_initial_metadata.send_initial_metadata;
batch->ForEach([&](grpc_mdelem md) { grpc_binder::MetadataEncoder encoder(gbt->is_client, &tx, &init_md);
absl::string_view key = grpc_core::StringViewFromSlice(GRPC_MDKEY(md)); batch->Encode(&encoder);
absl::string_view value =
grpc_core::StringViewFromSlice(GRPC_MDVALUE(md));
gpr_log(GPR_INFO, "send initial metatday key-value %s",
absl::StrCat(key, " ", value).c_str());
if (grpc_slice_eq(GRPC_MDKEY(md), GRPC_MDSTR_PATH)) {
// TODO(b/192208403): Figure out if it is correct to simply drop '/'
// prefix and treat it as rpc method name
GPR_ASSERT(value[0] == '/');
std::string path = std::string(value).substr(1);
// Only client send method ref.
GPR_ASSERT(gbt->is_client);
tx.SetMethodRef(path);
} else {
init_md.emplace_back(std::string(key), std::string(value));
}
});
tx.SetPrefix(init_md); tx.SetPrefix(init_md);
} }
if (op->send_message) { if (op->send_message) {
@ -438,23 +467,10 @@ static void perform_stream_op_locked(void* stream_op,
auto batch = op->payload->send_trailing_metadata.send_trailing_metadata; auto batch = op->payload->send_trailing_metadata.send_trailing_metadata;
grpc_binder::Metadata trailing_metadata; grpc_binder::Metadata trailing_metadata;
batch->ForEach([&](grpc_mdelem md) { grpc_binder::MetadataEncoder encoder(gbt->is_client, &tx,
// Client will not send trailing metadata. &trailing_metadata);
GPR_ASSERT(!gbt->is_client); batch->Encode(&encoder);
if (grpc_slice_eq(GRPC_MDKEY(md), GRPC_MDSTR_GRPC_STATUS)) {
int status = grpc_get_status_code_from_metadata(md);
gpr_log(GPR_INFO, "send trailing metadata status = %d", status);
tx.SetStatus(status);
} else {
absl::string_view key = grpc_core::StringViewFromSlice(GRPC_MDKEY(md));
absl::string_view value =
grpc_core::StringViewFromSlice(GRPC_MDVALUE(md));
gpr_log(GPR_INFO, "send trailing metatday key-value %s",
absl::StrCat(key, " ", value).c_str());
trailing_metadata.emplace_back(std::string(key), std::string(value));
}
});
// TODO(mingcl): Will we ever has key-value pair here? According to // TODO(mingcl): Will we ever has key-value pair here? According to
// wireformat client suffix data is always empty. // wireformat client suffix data is always empty.
tx.SetSuffix(trailing_metadata); tx.SetSuffix(trailing_metadata);

@ -2102,10 +2102,9 @@ void grpc_chttp2_fake_status(grpc_chttp2_transport* t, grpc_chttp2_stream* s,
GRPC_MDSTR_GRPC_STATUS, GRPC_MDSTR_GRPC_STATUS,
grpc_core::UnmanagedMemorySlice(status_string))); grpc_core::UnmanagedMemorySlice(status_string)));
if (!message.empty()) { if (!message.empty()) {
grpc_slice message_slice = grpc_slice_from_cpp_string(std::move(message)); s->trailing_metadata_buffer.Set(
GRPC_LOG_IF_ERROR("add_status_message", grpc_core::GrpcMessageMetadata(),
s->trailing_metadata_buffer.ReplaceOrAppend( grpc_core::Slice::FromCopiedBuffer(message));
GRPC_MDSTR_GRPC_MESSAGE, message_slice));
} }
s->published_metadata[1] = GRPC_METADATA_SYNTHESIZED_FROM_FAKE; s->published_metadata[1] = GRPC_METADATA_SYNTHESIZED_FROM_FAKE;
grpc_chttp2_maybe_complete_recv_trailing_metadata(t, s); grpc_chttp2_maybe_complete_recv_trailing_metadata(t, s);

@ -265,6 +265,32 @@ class StringValue {
VarintWriter<1> len_val_; VarintWriter<1> len_val_;
}; };
class BinaryStringValue {
public:
explicit BinaryStringValue(const grpc_slice& value,
bool use_true_binary_metadata)
: wire_value_(GetWireValue(value, use_true_binary_metadata, true)),
len_val_(wire_value_.length) {}
size_t prefix_length() const {
return len_val_.length() +
(wire_value_.insert_null_before_wire_value ? 1 : 0);
}
void WritePrefix(uint8_t* prefix_data) {
len_val_.Write(wire_value_.huffman_prefix, prefix_data);
if (wire_value_.insert_null_before_wire_value) {
prefix_data[len_val_.length()] = 0;
}
}
const grpc_slice& data() { return wire_value_.data; }
private:
WireValue wire_value_;
VarintWriter<1> len_val_;
};
class NonBinaryStringValue { class NonBinaryStringValue {
public: public:
explicit NonBinaryStringValue(const grpc_slice& value) explicit NonBinaryStringValue(const grpc_slice& value)
@ -356,6 +382,30 @@ void HPackCompressor::Framer::EmitLitHdrWithStringKeyNotIdx(grpc_mdelem elem) {
Add(emit.data()); Add(emit.data());
} }
void HPackCompressor::Framer::EmitLitHdrWithBinaryStringKeyNotIdx(
const grpc_slice& key_slice, const grpc_slice& value_slice) {
GRPC_STATS_INC_HPACK_SEND_LITHDR_NOTIDX_V();
GRPC_STATS_INC_HPACK_SEND_UNCOMPRESSED();
StringKey key(key_slice);
key.WritePrefix(0x00, AddTiny(key.prefix_length()));
Add(grpc_slice_ref_internal(key.key()));
BinaryStringValue emit(value_slice, use_true_binary_metadata_);
emit.WritePrefix(AddTiny(emit.prefix_length()));
Add(emit.data());
}
void HPackCompressor::Framer::EmitLitHdrWithNonBinaryStringKeyNotIdx(
const grpc_slice& key_slice, const grpc_slice& value_slice) {
GRPC_STATS_INC_HPACK_SEND_LITHDR_NOTIDX_V();
GRPC_STATS_INC_HPACK_SEND_UNCOMPRESSED();
StringKey key(key_slice);
key.WritePrefix(0x00, AddTiny(key.prefix_length()));
Add(grpc_slice_ref_internal(key.key()));
NonBinaryStringValue emit(value_slice);
emit.WritePrefix(AddTiny(emit.prefix_length()));
Add(grpc_slice_ref_internal(emit.data()));
}
void HPackCompressor::Framer::AdvertiseTableSizeChange() { void HPackCompressor::Framer::AdvertiseTableSizeChange() {
VarintWriter<3> w(compressor_->table_.max_size()); VarintWriter<3> w(compressor_->table_.max_size());
w.Write(0x20, AddTiny(w.length())); w.Write(0x20, AddTiny(w.length()));

@ -120,6 +120,24 @@ class HPackCompressor {
void Encode(GrpcTimeoutMetadata, grpc_millis deadline); void Encode(GrpcTimeoutMetadata, grpc_millis deadline);
void Encode(TeMetadata, TeMetadata::ValueType value); void Encode(TeMetadata, TeMetadata::ValueType value);
void Encode(UserAgentMetadata, const Slice& slice); void Encode(UserAgentMetadata, const Slice& slice);
void Encode(GrpcMessageMetadata, const Slice& slice) {
if (slice.empty()) return;
EmitLitHdrWithNonBinaryStringKeyNotIdx(
StaticSlice::FromStaticString("grpc-message").c_slice(),
slice.c_slice());
}
template <typename Which>
void Encode(Which, const Slice& slice) {
if (absl::EndsWith(Which::key(), "-bin")) {
EmitLitHdrWithBinaryStringKeyNotIdx(
StaticSlice::FromStaticString(Which::key()).c_slice(),
slice.c_slice());
} else {
EmitLitHdrWithNonBinaryStringKeyNotIdx(
StaticSlice::FromStaticString(Which::key()).c_slice(),
slice.c_slice());
}
}
private: private:
struct FramePrefix { struct FramePrefix {
@ -144,6 +162,10 @@ class HPackCompressor {
void EmitLitHdrWithStringKeyIncIdx(grpc_mdelem elem); void EmitLitHdrWithStringKeyIncIdx(grpc_mdelem elem);
void EmitLitHdrWithNonBinaryStringKeyIncIdx(const grpc_slice& key_slice, void EmitLitHdrWithNonBinaryStringKeyIncIdx(const grpc_slice& key_slice,
const grpc_slice& value_slice); const grpc_slice& value_slice);
void EmitLitHdrWithBinaryStringKeyNotIdx(const grpc_slice& key_slice,
const grpc_slice& value_slice);
void EmitLitHdrWithNonBinaryStringKeyNotIdx(const grpc_slice& key_slice,
const grpc_slice& value_slice);
void EmitLitHdrWithStringKeyNotIdx(grpc_mdelem elem); void EmitLitHdrWithStringKeyNotIdx(grpc_mdelem elem);
void EncodeAlwaysIndexed(uint32_t* index, const grpc_slice& key, void EncodeAlwaysIndexed(uint32_t* index, const grpc_slice& key,

@ -1219,6 +1219,7 @@ class HPackParser::Parser {
" vs. %" PRIu32 " vs. %" PRIu32
"). GRPC_ARG_MAX_METADATA_SIZE can be set to increase this limit.", "). GRPC_ARG_MAX_METADATA_SIZE can be set to increase this limit.",
*frame_length_, metadata_size_limit_); *frame_length_, metadata_size_limit_);
if (metadata_buffer_ != nullptr) metadata_buffer_->Clear();
return input_->MaybeSetErrorAndReturn( return input_->MaybeSetErrorAndReturn(
[] { [] {
return grpc_error_set_int( return grpc_error_set_int(

@ -115,17 +115,17 @@ std::unique_ptr<mock_cel::Activation> CelAuthorizationEngine::CreateActivation(
mock_cel::CelValue::CreateStringView(method)); mock_cel::CelValue::CreateStringView(method));
} }
} else if (elem == kHeaders) { } else if (elem == kHeaders) {
std::multimap<absl::string_view, absl::string_view> headers =
args.GetHeaders();
std::vector<std::pair<mock_cel::CelValue, mock_cel::CelValue>> std::vector<std::pair<mock_cel::CelValue, mock_cel::CelValue>>
header_items; header_items;
for (const auto& header_key : header_keys_) { for (const auto& header_key : header_keys_) {
auto header_item = headers.find(header_key); std::string temp_value;
if (header_item != headers.end()) { absl::optional<absl::string_view> header_value =
args.GetHeaderValue(header_key, &temp_value);
if (header_value.has_value()) {
header_items.push_back( header_items.push_back(
std::pair<mock_cel::CelValue, mock_cel::CelValue>( std::pair<mock_cel::CelValue, mock_cel::CelValue>(
mock_cel::CelValue::CreateStringView(header_key), mock_cel::CelValue::CreateStringView(header_key),
mock_cel::CelValue::CreateStringView(header_item->second))); mock_cel::CelValue::CreateStringView(*header_value)));
} }
} }
headers_ = mock_cel::ContainerBackedMapImpl::Create( headers_ = mock_cel::ContainerBackedMapImpl::Create(

@ -91,11 +91,10 @@ absl::string_view EvaluateArgs::GetPath() const {
absl::string_view EvaluateArgs::GetHost() const { absl::string_view EvaluateArgs::GetHost() const {
absl::string_view host; absl::string_view host;
if (metadata_ != nullptr && if (metadata_ != nullptr) {
metadata_->legacy_index()->named.host != nullptr) { if (auto* host_md = metadata_->get_pointer(HostMetadata())) {
grpc_linked_mdelem* elem = metadata_->legacy_index()->named.host; host = host_md->as_string_view();
const grpc_slice& val = GRPC_MDVALUE(elem->md); }
host = StringViewFromSlice(val);
} }
return host; return host;
} }
@ -111,20 +110,6 @@ absl::string_view EvaluateArgs::GetMethod() const {
return method; return method;
} }
std::multimap<absl::string_view, absl::string_view> EvaluateArgs::GetHeaders()
const {
std::multimap<absl::string_view, absl::string_view> headers;
if (metadata_ == nullptr) {
return headers;
}
metadata_->ForEach([&](grpc_mdelem md) {
const grpc_slice& key = GRPC_MDKEY(md);
const grpc_slice& val = GRPC_MDVALUE(md);
headers.emplace(StringViewFromSlice(key), StringViewFromSlice(val));
});
return headers;
}
absl::optional<absl::string_view> EvaluateArgs::GetHeaderValue( absl::optional<absl::string_view> EvaluateArgs::GetHeaderValue(
absl::string_view key, std::string* concatenated_value) const { absl::string_view key, std::string* concatenated_value) const {
if (metadata_ == nullptr) { if (metadata_ == nullptr) {

@ -58,7 +58,6 @@ class EvaluateArgs {
absl::string_view GetPath() const; absl::string_view GetPath() const;
absl::string_view GetHost() const; absl::string_view GetHost() const;
absl::string_view GetMethod() const; absl::string_view GetMethod() const;
std::multimap<absl::string_view, absl::string_view> GetHeaders() const;
// Returns metadata value(s) for the specified key. // Returns metadata value(s) for the specified key.
// If the key is not present in the batch, returns absl::nullopt. // If the key is not present in the batch, returns absl::nullopt.
// If the key is present exactly once in the batch, returns a string_view of // If the key is present exactly once in the batch, returns a string_view of

@ -78,135 +78,79 @@ const BitSet<256>& LookupTableForPercentEncodingType(PercentEncodingType type) {
} }
} // namespace } // namespace
grpc_slice PercentEncodeSlice(const grpc_slice& slice, Slice PercentEncodeSlice(Slice slice, PercentEncodingType type) {
PercentEncodingType type) {
static const uint8_t hex[] = "0123456789ABCDEF"; static const uint8_t hex[] = "0123456789ABCDEF";
const BitSet<256>& lut = LookupTableForPercentEncodingType(type); const BitSet<256>& lut = LookupTableForPercentEncodingType(type);
// first pass: count the number of bytes needed to output this string // first pass: count the number of bytes needed to output this string
size_t output_length = 0; size_t output_length = 0;
const uint8_t* slice_start = GRPC_SLICE_START_PTR(slice);
const uint8_t* slice_end = GRPC_SLICE_END_PTR(slice);
const uint8_t* p;
bool any_reserved_bytes = false; bool any_reserved_bytes = false;
for (p = slice_start; p < slice_end; p++) { for (uint8_t c : slice) {
bool unres = lut.is_set(*p); bool unres = lut.is_set(c);
output_length += unres ? 1 : 3; output_length += unres ? 1 : 3;
any_reserved_bytes |= !unres; any_reserved_bytes |= !unres;
} }
// no unreserved bytes: return the string unmodified // no unreserved bytes: return the string unmodified
if (!any_reserved_bytes) { if (!any_reserved_bytes) {
return grpc_slice_ref_internal(slice); return slice;
} }
// second pass: actually encode // second pass: actually encode
grpc_slice out = GRPC_SLICE_MALLOC(output_length); auto out = MutableSlice::CreateUninitialized(output_length);
uint8_t* q = GRPC_SLICE_START_PTR(out); uint8_t* q = out.begin();
for (p = slice_start; p < slice_end; p++) { for (uint8_t c : slice) {
if (lut.is_set(*p)) { if (lut.is_set(c)) {
*q++ = *p; *q++ = c;
} else { } else {
*q++ = '%'; *q++ = '%';
*q++ = hex[*p >> 4]; *q++ = hex[c >> 4];
*q++ = hex[*p & 15]; *q++ = hex[c & 15];
} }
} }
GPR_ASSERT(q == GRPC_SLICE_END_PTR(out)); GPR_ASSERT(q == out.end());
return out; return Slice(std::move(out));
} }
static bool valid_hex(const uint8_t* p, const uint8_t* end) { static bool ValidHex(const uint8_t* p, const uint8_t* end) {
if (p >= end) return false; if (p >= end) return false;
return (*p >= '0' && *p <= '9') || (*p >= 'a' && *p <= 'f') || return (*p >= '0' && *p <= '9') || (*p >= 'a' && *p <= 'f') ||
(*p >= 'A' && *p <= 'F'); (*p >= 'A' && *p <= 'F');
} }
static uint8_t dehex(uint8_t c) { static uint8_t DeHex(uint8_t c) {
if (c >= '0' && c <= '9') return static_cast<uint8_t>(c - '0'); if (c >= '0' && c <= '9') return static_cast<uint8_t>(c - '0');
if (c >= 'A' && c <= 'F') return static_cast<uint8_t>(c - 'A' + 10); if (c >= 'A' && c <= 'F') return static_cast<uint8_t>(c - 'A' + 10);
if (c >= 'a' && c <= 'f') return static_cast<uint8_t>(c - 'a' + 10); if (c >= 'a' && c <= 'f') return static_cast<uint8_t>(c - 'a' + 10);
GPR_UNREACHABLE_CODE(return 255); GPR_UNREACHABLE_CODE(return 255);
} }
absl::optional<grpc_slice> PercentDecodeSlice(const grpc_slice& slice_in, Slice PermissivePercentDecodeSlice(Slice slice_in) {
PercentEncodingType type) {
const uint8_t* p = GRPC_SLICE_START_PTR(slice_in);
const uint8_t* in_end = GRPC_SLICE_END_PTR(slice_in);
size_t out_length = 0;
bool any_percent_encoded_stuff = false; bool any_percent_encoded_stuff = false;
const BitSet<256>& lut = LookupTableForPercentEncodingType(type); for (uint8_t c : slice_in) {
while (p != in_end) { if (c == '%') {
if (*p == '%') {
if (!valid_hex(++p, in_end)) return {};
if (!valid_hex(++p, in_end)) return {};
p++;
out_length++;
any_percent_encoded_stuff = true; any_percent_encoded_stuff = true;
} else if (lut.is_set(*p)) { break;
p++;
out_length++;
} else {
return {};
} }
} }
if (!any_percent_encoded_stuff) { if (!any_percent_encoded_stuff) return slice_in;
return grpc_slice_ref_internal(slice_in);
}
p = GRPC_SLICE_START_PTR(slice_in);
grpc_slice slice_out = GRPC_SLICE_MALLOC(out_length);
uint8_t* q = GRPC_SLICE_START_PTR(slice_out);
while (p != in_end) {
if (*p == '%') {
*q++ = static_cast<uint8_t>(dehex(p[1]) << 4) | (dehex(p[2]));
p += 3;
} else {
*q++ = *p++;
}
}
GPR_ASSERT(q == GRPC_SLICE_END_PTR(slice_out));
return slice_out;
}
grpc_slice PermissivePercentDecodeSlice(const grpc_slice& slice_in) { MutableSlice out = slice_in.TakeMutable();
const uint8_t* p = GRPC_SLICE_START_PTR(slice_in); uint8_t* q = out.begin();
const uint8_t* in_end = GRPC_SLICE_END_PTR(slice_in); const uint8_t* p = out.begin();
size_t out_length = 0; const uint8_t* end = out.end();
bool any_percent_encoded_stuff = false; while (p != end) {
while (p != in_end) {
if (*p == '%') {
if (!valid_hex(p + 1, in_end) || !valid_hex(p + 2, in_end)) {
p++;
out_length++;
} else {
p += 3;
out_length++;
any_percent_encoded_stuff = true;
}
} else {
p++;
out_length++;
}
}
if (!any_percent_encoded_stuff) {
return grpc_slice_ref_internal(slice_in);
}
p = GRPC_SLICE_START_PTR(slice_in);
grpc_slice out = GRPC_SLICE_MALLOC(out_length);
uint8_t* q = GRPC_SLICE_START_PTR(out);
while (p != in_end) {
if (*p == '%') { if (*p == '%') {
if (!valid_hex(p + 1, in_end) || !valid_hex(p + 2, in_end)) { if (!ValidHex(p + 1, end) || !ValidHex(p + 2, end)) {
*q++ = *p++; *q++ = *p++;
} else { } else {
*q++ = static_cast<uint8_t>(dehex(p[1]) << 4) | (dehex(p[2])); *q++ = static_cast<uint8_t>(DeHex(p[1]) << 4) | (DeHex(p[2]));
p += 3; p += 3;
} }
} else { } else {
*q++ = *p++; *q++ = *p++;
} }
} }
GPR_ASSERT(q == GRPC_SLICE_END_PTR(out)); return Slice(out.TakeSubSlice(0, q - out.begin()));
return out;
} }
} // namespace grpc_core } // namespace grpc_core

@ -34,32 +34,26 @@
#include <grpc/slice.h> #include <grpc/slice.h>
#include "src/core/lib/slice/slice.h"
namespace grpc_core { namespace grpc_core {
enum class PercentEncodingType { enum class PercentEncodingType {
// Flags [A-Za-z0-9-_.~] as unreserved bytes for the percent encoding routines // Flags [A-Za-z0-9-_.~] as unreserved bytes for the percent encoding routines
URL, URL,
// Flags ascii7 non-control characters excluding '%' as unreserved bytes for // Flags ascii7 non-control characters excluding '%' as unreserved bytes for
// the // the percent encoding routines
// percent encoding routines
Compatible Compatible
}; };
// Percent-encode a slice, returning the new slice (this cannot fail): // Percent-encode a slice, returning the new slice (this cannot fail):
// unreserved_bytes is a bitfield indicating which bytes are considered // unreserved_bytes is a bitfield indicating which bytes are considered
// unreserved and thus do not need percent encoding // unreserved and thus do not need percent encoding
grpc_slice PercentEncodeSlice(const grpc_slice& slice, Slice PercentEncodeSlice(Slice slice, PercentEncodingType type);
PercentEncodingType type);
// Percent-decode a slice, strictly.
// If the input is legal (contains no unreserved bytes, and legal % encodings),
// returns the decoded slice.
// If the input is not legal, returns {}.
absl::optional<grpc_slice> PercentDecodeSlice(const grpc_slice& slice_in,
PercentEncodingType type);
// Percent-decode a slice, permissively. // Percent-decode a slice, permissively.
// If a % triplet can not be decoded, pass it through verbatim. // If a % triplet can not be decoded, pass it through verbatim.
// This cannot fail. // This cannot fail.
grpc_slice PermissivePercentDecodeSlice(const grpc_slice& slice_in); Slice PermissivePercentDecodeSlice(Slice slice_in);
} // namespace grpc_core } // namespace grpc_core

@ -162,10 +162,14 @@ struct CopyConstructors {
static Out FromCopiedString(std::string s) { static Out FromCopiedString(std::string s) {
return Out(grpc_slice_from_cpp_string(std::move(s))); return Out(grpc_slice_from_cpp_string(std::move(s)));
} }
static Out FromCopiedBuffer(const char* p, size_t len) {
return Out(UnmanagedMemorySlice(p, len));
}
template <typename Buffer> template <typename Buffer>
static Out FromCopiedBuffer(const Buffer& buffer) { static Out FromCopiedBuffer(const Buffer& buffer) {
return Out(UnmanagedMemorySlice( return FromCopiedBuffer(reinterpret_cast<const char*>(buffer.data()),
reinterpret_cast<const char*>(buffer.data()), buffer.size())); buffer.size());
} }
}; };
@ -187,6 +191,10 @@ class StaticSlice : public slice_detail::BaseSlice {
return StaticSlice(grpc_slice_from_static_string(s)); return StaticSlice(grpc_slice_from_static_string(s));
} }
static StaticSlice FromStaticString(absl::string_view s) {
return StaticSlice(ExternallyManagedSlice(s.data(), s.size()));
}
StaticSlice(const StaticSlice& other) StaticSlice(const StaticSlice& other)
: slice_detail::BaseSlice(other.c_slice()) {} : slice_detail::BaseSlice(other.c_slice()) {}
StaticSlice& operator=(const StaticSlice& other) { StaticSlice& operator=(const StaticSlice& other) {
@ -221,6 +229,16 @@ class MutableSlice : public slice_detail::BaseSlice,
return *this; return *this;
} }
static MutableSlice CreateUninitialized(size_t length) {
return MutableSlice(grpc_slice_malloc(length));
}
// Return a sub slice of this one. Leaves this slice in an indeterminate but
// valid state.
MutableSlice TakeSubSlice(size_t pos, size_t n) {
return MutableSlice(grpc_slice_sub_no_ref(TakeCSlice(), pos, pos + n));
}
// Iterator access to the underlying bytes // Iterator access to the underlying bytes
uint8_t* begin() { return mutable_data(); } uint8_t* begin() { return mutable_data(); }
uint8_t* end() { return mutable_data() + size(); } uint8_t* end() { return mutable_data() + size(); }
@ -235,10 +253,7 @@ class Slice : public slice_detail::BaseSlice,
Slice() = default; Slice() = default;
~Slice() { grpc_slice_unref_internal(c_slice()); } ~Slice() { grpc_slice_unref_internal(c_slice()); }
explicit Slice(const grpc_slice& slice) : slice_detail::BaseSlice(slice) {} explicit Slice(const grpc_slice& slice) : slice_detail::BaseSlice(slice) {}
template <class SliceType> explicit Slice(slice_detail::BaseSlice&& other)
explicit Slice(absl::enable_if_t<
std::is_base_of<slice_detail::BaseSlice, SliceType>::value,
SliceType>&& other)
: slice_detail::BaseSlice(other.TakeCSlice()) {} : slice_detail::BaseSlice(other.TakeCSlice()) {}
Slice(const Slice&) = delete; Slice(const Slice&) = delete;
@ -300,6 +315,12 @@ class Slice : public slice_detail::BaseSlice,
return MutableSlice(grpc_slice_copy(c_slice())); return MutableSlice(grpc_slice_copy(c_slice()));
} }
// Return a sub slice of this one. Leaves this slice in an indeterminate but
// valid state.
Slice TakeSubSlice(size_t pos, size_t n) {
return Slice(grpc_slice_sub_no_ref(TakeCSlice(), pos, pos + n));
}
Slice Ref() const { return Slice(grpc_slice_ref_internal(c_slice())); } Slice Ref() const { return Slice(grpc_slice_ref_internal(c_slice())); }
Slice Copy() const { return Slice(grpc_slice_copy(c_slice())); } Slice Copy() const { return Slice(grpc_slice_copy(c_slice())); }

@ -32,95 +32,88 @@ namespace grpc_core {
const uint8_t g_static_metadata_bytes[] = { const uint8_t g_static_metadata_bytes[] = {
58, 112, 97, 116, 104, 58, 109, 101, 116, 104, 111, 100, 58, 115, 116, 58, 112, 97, 116, 104, 58, 109, 101, 116, 104, 111, 100, 58, 115, 116,
97, 116, 117, 115, 58, 97, 117, 116, 104, 111, 114, 105, 116, 121, 58, 97, 116, 117, 115, 58, 97, 117, 116, 104, 111, 114, 105, 116, 121, 58,
115, 99, 104, 101, 109, 101, 103, 114, 112, 99, 45, 109, 101, 115, 115, 115, 99, 104, 101, 109, 101, 103, 114, 112, 99, 45, 115, 116, 97, 116,
97, 103, 101, 103, 114, 112, 99, 45, 115, 116, 97, 116, 117, 115, 103, 117, 115, 103, 114, 112, 99, 45, 101, 110, 99, 111, 100, 105, 110, 103,
114, 112, 99, 45, 112, 97, 121, 108, 111, 97, 100, 45, 98, 105, 110, 103, 114, 112, 99, 45, 97, 99, 99, 101, 112, 116, 45, 101, 110, 99,
103, 114, 112, 99, 45, 101, 110, 99, 111, 100, 105, 110, 103, 103, 114, 111, 100, 105, 110, 103, 99, 111, 110, 116, 101, 110, 116, 45, 116, 121,
112, 99, 45, 97, 99, 99, 101, 112, 116, 45, 101, 110, 99, 111, 100, 112, 101, 99, 111, 110, 116, 101, 110, 116, 45, 101, 110, 99, 111, 100,
105, 110, 103, 103, 114, 112, 99, 45, 115, 101, 114, 118, 101, 114, 45, 105, 110, 103, 97, 99, 99, 101, 112, 116, 45, 101, 110, 99, 111, 100,
115, 116, 97, 116, 115, 45, 98, 105, 110, 103, 114, 112, 99, 45, 116, 105, 110, 103, 103, 114, 112, 99, 45, 105, 110, 116, 101, 114, 110, 97,
97, 103, 115, 45, 98, 105, 110, 103, 114, 112, 99, 45, 116, 114, 97, 108, 45, 101, 110, 99, 111, 100, 105, 110, 103, 45, 114, 101, 113, 117,
99, 101, 45, 98, 105, 110, 99, 111, 110, 116, 101, 110, 116, 45, 116, 101, 115, 116, 103, 114, 112, 99, 45, 112, 114, 101, 118, 105, 111, 117,
121, 112, 101, 99, 111, 110, 116, 101, 110, 116, 45, 101, 110, 99, 111, 115, 45, 114, 112, 99, 45, 97, 116, 116, 101, 109, 112, 116, 115, 103,
100, 105, 110, 103, 97, 99, 99, 101, 112, 116, 45, 101, 110, 99, 111, 114, 112, 99, 45, 114, 101, 116, 114, 121, 45, 112, 117, 115, 104, 98,
100, 105, 110, 103, 103, 114, 112, 99, 45, 105, 110, 116, 101, 114, 110, 97, 99, 107, 45, 109, 115, 103, 114, 112, 99, 45, 116, 105, 109, 101,
97, 108, 45, 101, 110, 99, 111, 100, 105, 110, 103, 45, 114, 101, 113, 111, 117, 116, 49, 50, 51, 52, 47, 103, 114, 112, 99, 46, 108, 98,
117, 101, 115, 116, 104, 111, 115, 116, 103, 114, 112, 99, 45, 112, 114, 46, 118, 49, 46, 76, 111, 97, 100, 66, 97, 108, 97, 110, 99, 101,
101, 118, 105, 111, 117, 115, 45, 114, 112, 99, 45, 97, 116, 116, 101, 114, 47, 66, 97, 108, 97, 110, 99, 101, 76, 111, 97, 100, 47, 101,
109, 112, 116, 115, 103, 114, 112, 99, 45, 114, 101, 116, 114, 121, 45, 110, 118, 111, 121, 46, 115, 101, 114, 118, 105, 99, 101, 46, 108, 111,
112, 117, 115, 104, 98, 97, 99, 107, 45, 109, 115, 120, 45, 101, 110, 97, 100, 95, 115, 116, 97, 116, 115, 46, 118, 50, 46, 76, 111, 97,
100, 112, 111, 105, 110, 116, 45, 108, 111, 97, 100, 45, 109, 101, 116, 100, 82, 101, 112, 111, 114, 116, 105, 110, 103, 83, 101, 114, 118, 105,
114, 105, 99, 115, 45, 98, 105, 110, 103, 114, 112, 99, 45, 116, 105, 99, 101, 47, 83, 116, 114, 101, 97, 109, 76, 111, 97, 100, 83, 116,
109, 101, 111, 117, 116, 117, 115, 101, 114, 45, 97, 103, 101, 110, 116, 97, 116, 115, 47, 101, 110, 118, 111, 121, 46, 115, 101, 114, 118, 105,
49, 50, 51, 52, 47, 103, 114, 112, 99, 46, 108, 98, 46, 118, 49, 99, 101, 46, 108, 111, 97, 100, 95, 115, 116, 97, 116, 115, 46, 118,
46, 76, 111, 97, 100, 66, 97, 108, 97, 110, 99, 101, 114, 47, 66, 51, 46, 76, 111, 97, 100, 82, 101, 112, 111, 114, 116, 105, 110, 103,
97, 108, 97, 110, 99, 101, 76, 111, 97, 100, 47, 101, 110, 118, 111, 83, 101, 114, 118, 105, 99, 101, 47, 83, 116, 114, 101, 97, 109, 76,
121, 46, 115, 101, 114, 118, 105, 99, 101, 46, 108, 111, 97, 100, 95, 111, 97, 100, 83, 116, 97, 116, 115, 47, 103, 114, 112, 99, 46, 104,
115, 116, 97, 116, 115, 46, 118, 50, 46, 76, 111, 97, 100, 82, 101, 101, 97, 108, 116, 104, 46, 118, 49, 46, 72, 101, 97, 108, 116, 104,
112, 111, 114, 116, 105, 110, 103, 83, 101, 114, 118, 105, 99, 101, 47, 47, 87, 97, 116, 99, 104, 47, 101, 110, 118, 111, 121, 46, 115, 101,
83, 116, 114, 101, 97, 109, 76, 111, 97, 100, 83, 116, 97, 116, 115, 114, 118, 105, 99, 101, 46, 100, 105, 115, 99, 111, 118, 101, 114, 121,
47, 101, 110, 118, 111, 121, 46, 115, 101, 114, 118, 105, 99, 101, 46, 46, 118, 50, 46, 65, 103, 103, 114, 101, 103, 97, 116, 101, 100, 68,
108, 111, 97, 100, 95, 115, 116, 97, 116, 115, 46, 118, 51, 46, 76, 105, 115, 99, 111, 118, 101, 114, 121, 83, 101, 114, 118, 105, 99, 101,
111, 97, 100, 82, 101, 112, 111, 114, 116, 105, 110, 103, 83, 101, 114, 47, 83, 116, 114, 101, 97, 109, 65, 103, 103, 114, 101, 103, 97, 116,
118, 105, 99, 101, 47, 83, 116, 114, 101, 97, 109, 76, 111, 97, 100, 101, 100, 82, 101, 115, 111, 117, 114, 99, 101, 115, 47, 101, 110, 118,
83, 116, 97, 116, 115, 47, 103, 114, 112, 99, 46, 104, 101, 97, 108, 111, 121, 46, 115, 101, 114, 118, 105, 99, 101, 46, 100, 105, 115, 99,
116, 104, 46, 118, 49, 46, 72, 101, 97, 108, 116, 104, 47, 87, 97, 111, 118, 101, 114, 121, 46, 118, 51, 46, 65, 103, 103, 114, 101, 103,
116, 99, 104, 47, 101, 110, 118, 111, 121, 46, 115, 101, 114, 118, 105, 97, 116, 101, 100, 68, 105, 115, 99, 111, 118, 101, 114, 121, 83, 101,
99, 101, 46, 100, 105, 115, 99, 111, 118, 101, 114, 121, 46, 118, 50, 114, 118, 105, 99, 101, 47, 83, 116, 114, 101, 97, 109, 65, 103, 103,
46, 65, 103, 103, 114, 101, 103, 97, 116, 101, 100, 68, 105, 115, 99, 114, 101, 103, 97, 116, 101, 100, 82, 101, 115, 111, 117, 114, 99, 101,
111, 118, 101, 114, 121, 83, 101, 114, 118, 105, 99, 101, 47, 83, 116, 115, 100, 101, 102, 108, 97, 116, 101, 103, 122, 105, 112, 115, 116, 114,
114, 101, 97, 109, 65, 103, 103, 114, 101, 103, 97, 116, 101, 100, 82, 101, 97, 109, 47, 103, 122, 105, 112, 116, 101, 116, 114, 97, 105, 108,
101, 115, 111, 117, 114, 99, 101, 115, 47, 101, 110, 118, 111, 121, 46, 101, 114, 115, 71, 69, 84, 80, 79, 83, 84, 47, 47, 105, 110, 100,
115, 101, 114, 118, 105, 99, 101, 46, 100, 105, 115, 99, 111, 118, 101, 101, 120, 46, 104, 116, 109, 108, 104, 116, 116, 112, 104, 116, 116, 112,
114, 121, 46, 118, 51, 46, 65, 103, 103, 114, 101, 103, 97, 116, 101, 115, 50, 48, 48, 50, 48, 52, 50, 48, 54, 51, 48, 52, 52, 48,
100, 68, 105, 115, 99, 111, 118, 101, 114, 121, 83, 101, 114, 118, 105, 48, 52, 48, 52, 53, 48, 48, 97, 99, 99, 101, 112, 116, 45, 99,
99, 101, 47, 83, 116, 114, 101, 97, 109, 65, 103, 103, 114, 101, 103, 104, 97, 114, 115, 101, 116, 103, 122, 105, 112, 44, 32, 100, 101, 102,
97, 116, 101, 100, 82, 101, 115, 111, 117, 114, 99, 101, 115, 100, 101, 108, 97, 116, 101, 97, 99, 99, 101, 112, 116, 45, 108, 97, 110, 103,
102, 108, 97, 116, 101, 103, 122, 105, 112, 115, 116, 114, 101, 97, 109, 117, 97, 103, 101, 97, 99, 99, 101, 112, 116, 45, 114, 97, 110, 103,
47, 103, 122, 105, 112, 116, 101, 116, 114, 97, 105, 108, 101, 114, 115, 101, 115, 97, 99, 99, 101, 112, 116, 97, 99, 99, 101, 115, 115, 45,
71, 69, 84, 80, 79, 83, 84, 47, 47, 105, 110, 100, 101, 120, 46, 99, 111, 110, 116, 114, 111, 108, 45, 97, 108, 108, 111, 119, 45, 111,
104, 116, 109, 108, 104, 116, 116, 112, 104, 116, 116, 112, 115, 50, 48, 114, 105, 103, 105, 110, 97, 103, 101, 97, 108, 108, 111, 119, 97, 117,
48, 50, 48, 52, 50, 48, 54, 51, 48, 52, 52, 48, 48, 52, 48, 116, 104, 111, 114, 105, 122, 97, 116, 105, 111, 110, 99, 97, 99, 104,
52, 53, 48, 48, 97, 99, 99, 101, 112, 116, 45, 99, 104, 97, 114, 101, 45, 99, 111, 110, 116, 114, 111, 108, 99, 111, 110, 116, 101, 110,
115, 101, 116, 103, 122, 105, 112, 44, 32, 100, 101, 102, 108, 97, 116, 116, 45, 100, 105, 115, 112, 111, 115, 105, 116, 105, 111, 110, 99, 111,
101, 97, 99, 99, 101, 112, 116, 45, 108, 97, 110, 103, 117, 97, 103, 110, 116, 101, 110, 116, 45, 108, 97, 110, 103, 117, 97, 103, 101, 99,
101, 97, 99, 99, 101, 112, 116, 45, 114, 97, 110, 103, 101, 115, 97, 111, 110, 116, 101, 110, 116, 45, 108, 101, 110, 103, 116, 104, 99, 111,
99, 99, 101, 112, 116, 97, 99, 99, 101, 115, 115, 45, 99, 111, 110, 110, 116, 101, 110, 116, 45, 108, 111, 99, 97, 116, 105, 111, 110, 99,
116, 114, 111, 108, 45, 97, 108, 108, 111, 119, 45, 111, 114, 105, 103, 111, 110, 116, 101, 110, 116, 45, 114, 97, 110, 103, 101, 99, 111, 111,
105, 110, 97, 103, 101, 97, 108, 108, 111, 119, 97, 117, 116, 104, 111, 107, 105, 101, 100, 97, 116, 101, 101, 116, 97, 103, 101, 120, 112, 101,
114, 105, 122, 97, 116, 105, 111, 110, 99, 97, 99, 104, 101, 45, 99, 99, 116, 101, 120, 112, 105, 114, 101, 115, 102, 114, 111, 109, 104, 111,
111, 110, 116, 114, 111, 108, 99, 111, 110, 116, 101, 110, 116, 45, 100, 115, 116, 105, 102, 45, 109, 97, 116, 99, 104, 105, 102, 45, 109, 111,
105, 115, 112, 111, 115, 105, 116, 105, 111, 110, 99, 111, 110, 116, 101, 100, 105, 102, 105, 101, 100, 45, 115, 105, 110, 99, 101, 105, 102, 45,
110, 116, 45, 108, 97, 110, 103, 117, 97, 103, 101, 99, 111, 110, 116, 110, 111, 110, 101, 45, 109, 97, 116, 99, 104, 105, 102, 45, 114, 97,
101, 110, 116, 45, 108, 101, 110, 103, 116, 104, 99, 111, 110, 116, 101, 110, 103, 101, 105, 102, 45, 117, 110, 109, 111, 100, 105, 102, 105, 101,
110, 116, 45, 108, 111, 99, 97, 116, 105, 111, 110, 99, 111, 110, 116, 100, 45, 115, 105, 110, 99, 101, 108, 97, 115, 116, 45, 109, 111, 100,
101, 110, 116, 45, 114, 97, 110, 103, 101, 99, 111, 111, 107, 105, 101, 105, 102, 105, 101, 100, 108, 105, 110, 107, 108, 111, 99, 97, 116, 105,
100, 97, 116, 101, 101, 116, 97, 103, 101, 120, 112, 101, 99, 116, 101, 111, 110, 109, 97, 120, 45, 102, 111, 114, 119, 97, 114, 100, 115, 112,
120, 112, 105, 114, 101, 115, 102, 114, 111, 109, 105, 102, 45, 109, 97, 114, 111, 120, 121, 45, 97, 117, 116, 104, 101, 110, 116, 105, 99, 97,
116, 99, 104, 105, 102, 45, 109, 111, 100, 105, 102, 105, 101, 100, 45, 116, 101, 112, 114, 111, 120, 121, 45, 97, 117, 116, 104, 111, 114, 105,
115, 105, 110, 99, 101, 105, 102, 45, 110, 111, 110, 101, 45, 109, 97, 122, 97, 116, 105, 111, 110, 114, 97, 110, 103, 101, 114, 101, 102, 101,
116, 99, 104, 105, 102, 45, 114, 97, 110, 103, 101, 105, 102, 45, 117, 114, 101, 114, 114, 101, 102, 114, 101, 115, 104, 114, 101, 116, 114, 121,
110, 109, 111, 100, 105, 102, 105, 101, 100, 45, 115, 105, 110, 99, 101, 45, 97, 102, 116, 101, 114, 115, 101, 114, 118, 101, 114, 115, 101, 116,
108, 97, 115, 116, 45, 109, 111, 100, 105, 102, 105, 101, 100, 108, 105, 45, 99, 111, 111, 107, 105, 101, 115, 116, 114, 105, 99, 116, 45, 116,
110, 107, 108, 111, 99, 97, 116, 105, 111, 110, 109, 97, 120, 45, 102, 114, 97, 110, 115, 112, 111, 114, 116, 45, 115, 101, 99, 117, 114, 105,
111, 114, 119, 97, 114, 100, 115, 112, 114, 111, 120, 121, 45, 97, 117, 116, 121, 116, 114, 97, 110, 115, 102, 101, 114, 45, 101, 110, 99, 111,
116, 104, 101, 110, 116, 105, 99, 97, 116, 101, 112, 114, 111, 120, 121, 100, 105, 110, 103, 117, 115, 101, 114, 45, 97, 103, 101, 110, 116, 118,
45, 97, 117, 116, 104, 111, 114, 105, 122, 97, 116, 105, 111, 110, 114, 97, 114, 121, 118, 105, 97, 119, 119, 119, 45, 97, 117, 116, 104, 101,
97, 110, 103, 101, 114, 101, 102, 101, 114, 101, 114, 114, 101, 102, 114, 110, 116, 105, 99, 97, 116, 101, 48, 105, 100, 101, 110, 116, 105, 116,
101, 115, 104, 114, 101, 116, 114, 121, 45, 97, 102, 116, 101, 114, 115, 121, 97, 112, 112, 108, 105, 99, 97, 116, 105, 111, 110, 47, 103, 114,
101, 114, 118, 101, 114, 115, 101, 116, 45, 99, 111, 111, 107, 105, 101, 112, 99, 103, 114, 112, 99, 80, 85, 84, 108, 98, 45, 99, 111, 115,
115, 116, 114, 105, 99, 116, 45, 116, 114, 97, 110, 115, 112, 111, 114, 116, 45, 98, 105, 110, 105, 100, 101, 110, 116, 105, 116, 121, 44, 100,
116, 45, 115, 101, 99, 117, 114, 105, 116, 121, 116, 114, 97, 110, 115, 101, 102, 108, 97, 116, 101, 105, 100, 101, 110, 116, 105, 116, 121, 44,
102, 101, 114, 45, 101, 110, 99, 111, 100, 105, 110, 103, 118, 97, 114, 103, 122, 105, 112, 100, 101, 102, 108, 97, 116, 101, 44, 103, 122, 105,
121, 118, 105, 97, 119, 119, 119, 45, 97, 117, 116, 104, 101, 110, 116, 112, 105, 100, 101, 110, 116, 105, 116, 121, 44, 100, 101, 102, 108, 97,
105, 99, 97, 116, 101, 48, 105, 100, 101, 110, 116, 105, 116, 121, 97, 116, 101, 44, 103, 122, 105, 112};
112, 112, 108, 105, 99, 97, 116, 105, 111, 110, 47, 103, 114, 112, 99,
103, 114, 112, 99, 80, 85, 84, 108, 98, 45, 99, 111, 115, 116, 45,
98, 105, 110, 105, 100, 101, 110, 116, 105, 116, 121, 44, 100, 101, 102,
108, 97, 116, 101, 105, 100, 101, 110, 116, 105, 116, 121, 44, 103, 122,
105, 112, 100, 101, 102, 108, 97, 116, 101, 44, 103, 122, 105, 112, 105,
100, 101, 110, 116, 105, 116, 121, 44, 100, 101, 102, 108, 97, 116, 101,
44, 103, 122, 105, 112};
grpc_slice_refcount StaticSliceRefcount::kStaticSubRefcount; grpc_slice_refcount StaticSliceRefcount::kStaticSubRefcount;
@ -176,10 +169,7 @@ StaticSliceRefcount g_static_metadata_slice_refcounts[GRPC_STATIC_MDSTR_COUNT] =
StaticSliceRefcount(92), StaticSliceRefcount(93), StaticSliceRefcount(92), StaticSliceRefcount(93),
StaticSliceRefcount(94), StaticSliceRefcount(95), StaticSliceRefcount(94), StaticSliceRefcount(95),
StaticSliceRefcount(96), StaticSliceRefcount(97), StaticSliceRefcount(96), StaticSliceRefcount(97),
StaticSliceRefcount(98), StaticSliceRefcount(99), StaticSliceRefcount(98),
StaticSliceRefcount(100), StaticSliceRefcount(101),
StaticSliceRefcount(102), StaticSliceRefcount(103),
StaticSliceRefcount(104),
}; };
const StaticMetadataSlice const StaticMetadataSlice
@ -195,205 +185,193 @@ const StaticMetadataSlice
g_static_metadata_bytes + 19), g_static_metadata_bytes + 19),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[4].base, 7, StaticMetadataSlice(&g_static_metadata_slice_refcounts[4].base, 7,
g_static_metadata_bytes + 29), g_static_metadata_bytes + 29),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[5].base, 12, StaticMetadataSlice(&g_static_metadata_slice_refcounts[5].base, 11,
g_static_metadata_bytes + 36), g_static_metadata_bytes + 36),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[6].base, 11, StaticMetadataSlice(&g_static_metadata_slice_refcounts[6].base, 13,
g_static_metadata_bytes + 48), g_static_metadata_bytes + 47),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[7].base, 16, StaticMetadataSlice(&g_static_metadata_slice_refcounts[7].base, 20,
g_static_metadata_bytes + 59), g_static_metadata_bytes + 60),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[8].base, 13, StaticMetadataSlice(&g_static_metadata_slice_refcounts[8].base, 12,
g_static_metadata_bytes + 75), g_static_metadata_bytes + 80),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[9].base, 20, StaticMetadataSlice(&g_static_metadata_slice_refcounts[9].base, 16,
g_static_metadata_bytes + 88), g_static_metadata_bytes + 92),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[10].base, 21, StaticMetadataSlice(&g_static_metadata_slice_refcounts[10].base, 15,
g_static_metadata_bytes + 108), g_static_metadata_bytes + 108),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[11].base, 13, StaticMetadataSlice(&g_static_metadata_slice_refcounts[11].base, 30,
g_static_metadata_bytes + 129), g_static_metadata_bytes + 123),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[12].base, 14, StaticMetadataSlice(&g_static_metadata_slice_refcounts[12].base, 26,
g_static_metadata_bytes + 142), g_static_metadata_bytes + 153),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[13].base, 12, StaticMetadataSlice(&g_static_metadata_slice_refcounts[13].base, 22,
g_static_metadata_bytes + 156), g_static_metadata_bytes + 179),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[14].base, 16, StaticMetadataSlice(&g_static_metadata_slice_refcounts[14].base, 12,
g_static_metadata_bytes + 168), g_static_metadata_bytes + 201),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[15].base, 15, StaticMetadataSlice(&g_static_metadata_slice_refcounts[15].base, 1,
g_static_metadata_bytes + 184), g_static_metadata_bytes + 213),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[16].base, 30, StaticMetadataSlice(&g_static_metadata_slice_refcounts[16].base, 1,
g_static_metadata_bytes + 199), g_static_metadata_bytes + 214),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[17].base, 4, StaticMetadataSlice(&g_static_metadata_slice_refcounts[17].base, 1,
g_static_metadata_bytes + 229), g_static_metadata_bytes + 215),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[18].base, 26, StaticMetadataSlice(&g_static_metadata_slice_refcounts[18].base, 1,
g_static_metadata_bytes + 233), g_static_metadata_bytes + 216),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[19].base, 22, StaticMetadataSlice(&g_static_metadata_slice_refcounts[19].base, 0,
g_static_metadata_bytes + 259), g_static_metadata_bytes + 217),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[20].base, 27, StaticMetadataSlice(&g_static_metadata_slice_refcounts[20].base, 36,
g_static_metadata_bytes + 281), g_static_metadata_bytes + 217),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[21].base, 12, StaticMetadataSlice(&g_static_metadata_slice_refcounts[21].base, 65,
g_static_metadata_bytes + 308), g_static_metadata_bytes + 253),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[22].base, 10, StaticMetadataSlice(&g_static_metadata_slice_refcounts[22].base, 65,
g_static_metadata_bytes + 320), g_static_metadata_bytes + 318),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[23].base, 1, StaticMetadataSlice(&g_static_metadata_slice_refcounts[23].base, 28,
g_static_metadata_bytes + 330), g_static_metadata_bytes + 383),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[24].base, 1, StaticMetadataSlice(&g_static_metadata_slice_refcounts[24].base, 80,
g_static_metadata_bytes + 331), g_static_metadata_bytes + 411),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[25].base, 1, StaticMetadataSlice(&g_static_metadata_slice_refcounts[25].base, 80,
g_static_metadata_bytes + 332), g_static_metadata_bytes + 491),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[26].base, 1, StaticMetadataSlice(&g_static_metadata_slice_refcounts[26].base, 7,
g_static_metadata_bytes + 333), g_static_metadata_bytes + 571),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[27].base, 0, StaticMetadataSlice(&g_static_metadata_slice_refcounts[27].base, 4,
g_static_metadata_bytes + 334), g_static_metadata_bytes + 578),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[28].base, 36, StaticMetadataSlice(&g_static_metadata_slice_refcounts[28].base, 11,
g_static_metadata_bytes + 334), g_static_metadata_bytes + 582),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[29].base, 65, StaticMetadataSlice(&g_static_metadata_slice_refcounts[29].base, 2,
g_static_metadata_bytes + 370), g_static_metadata_bytes + 593),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[30].base, 65, StaticMetadataSlice(&g_static_metadata_slice_refcounts[30].base, 8,
g_static_metadata_bytes + 435), g_static_metadata_bytes + 595),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[31].base, 28, StaticMetadataSlice(&g_static_metadata_slice_refcounts[31].base, 3,
g_static_metadata_bytes + 500), g_static_metadata_bytes + 603),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[32].base, 80, StaticMetadataSlice(&g_static_metadata_slice_refcounts[32].base, 4,
g_static_metadata_bytes + 528), g_static_metadata_bytes + 606),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[33].base, 80, StaticMetadataSlice(&g_static_metadata_slice_refcounts[33].base, 1,
g_static_metadata_bytes + 608), g_static_metadata_bytes + 610),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[34].base, 7, StaticMetadataSlice(&g_static_metadata_slice_refcounts[34].base, 11,
g_static_metadata_bytes + 688), g_static_metadata_bytes + 611),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[35].base, 4, StaticMetadataSlice(&g_static_metadata_slice_refcounts[35].base, 4,
g_static_metadata_bytes + 695), g_static_metadata_bytes + 622),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[36].base, 11, StaticMetadataSlice(&g_static_metadata_slice_refcounts[36].base, 5,
g_static_metadata_bytes + 699), g_static_metadata_bytes + 626),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[37].base, 2, StaticMetadataSlice(&g_static_metadata_slice_refcounts[37].base, 3,
g_static_metadata_bytes + 710), g_static_metadata_bytes + 631),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[38].base, 8, StaticMetadataSlice(&g_static_metadata_slice_refcounts[38].base, 3,
g_static_metadata_bytes + 712), g_static_metadata_bytes + 634),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[39].base, 3, StaticMetadataSlice(&g_static_metadata_slice_refcounts[39].base, 3,
g_static_metadata_bytes + 720), g_static_metadata_bytes + 637),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[40].base, 4, StaticMetadataSlice(&g_static_metadata_slice_refcounts[40].base, 3,
g_static_metadata_bytes + 723), g_static_metadata_bytes + 640),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[41].base, 1, StaticMetadataSlice(&g_static_metadata_slice_refcounts[41].base, 3,
g_static_metadata_bytes + 727), g_static_metadata_bytes + 643),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[42].base, 11, StaticMetadataSlice(&g_static_metadata_slice_refcounts[42].base, 3,
g_static_metadata_bytes + 728), g_static_metadata_bytes + 646),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[43].base, 4, StaticMetadataSlice(&g_static_metadata_slice_refcounts[43].base, 3,
g_static_metadata_bytes + 739), g_static_metadata_bytes + 649),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[44].base, 5, StaticMetadataSlice(&g_static_metadata_slice_refcounts[44].base, 14,
g_static_metadata_bytes + 652),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[45].base, 13,
g_static_metadata_bytes + 666),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[46].base, 15,
g_static_metadata_bytes + 679),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[47].base, 13,
g_static_metadata_bytes + 694),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[48].base, 6,
g_static_metadata_bytes + 707),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[49].base, 27,
g_static_metadata_bytes + 713),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[50].base, 3,
g_static_metadata_bytes + 740),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[51].base, 5,
g_static_metadata_bytes + 743), g_static_metadata_bytes + 743),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[45].base, 3, StaticMetadataSlice(&g_static_metadata_slice_refcounts[52].base, 13,
g_static_metadata_bytes + 748), g_static_metadata_bytes + 748),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[46].base, 3,
g_static_metadata_bytes + 751),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[47].base, 3,
g_static_metadata_bytes + 754),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[48].base, 3,
g_static_metadata_bytes + 757),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[49].base, 3,
g_static_metadata_bytes + 760),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[50].base, 3,
g_static_metadata_bytes + 763),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[51].base, 3,
g_static_metadata_bytes + 766),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[52].base, 14,
g_static_metadata_bytes + 769),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[53].base, 13, StaticMetadataSlice(&g_static_metadata_slice_refcounts[53].base, 13,
g_static_metadata_bytes + 783), g_static_metadata_bytes + 761),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[54].base, 15, StaticMetadataSlice(&g_static_metadata_slice_refcounts[54].base, 19,
g_static_metadata_bytes + 796), g_static_metadata_bytes + 774),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[55].base, 13, StaticMetadataSlice(&g_static_metadata_slice_refcounts[55].base, 16,
g_static_metadata_bytes + 811), g_static_metadata_bytes + 793),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[56].base, 6, StaticMetadataSlice(&g_static_metadata_slice_refcounts[56].base, 14,
g_static_metadata_bytes + 824), g_static_metadata_bytes + 809),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[57].base, 27, StaticMetadataSlice(&g_static_metadata_slice_refcounts[57].base, 16,
g_static_metadata_bytes + 830), g_static_metadata_bytes + 823),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[58].base, 3, StaticMetadataSlice(&g_static_metadata_slice_refcounts[58].base, 13,
g_static_metadata_bytes + 857), g_static_metadata_bytes + 839),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[59].base, 5, StaticMetadataSlice(&g_static_metadata_slice_refcounts[59].base, 6,
g_static_metadata_bytes + 860), g_static_metadata_bytes + 852),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[60].base, 13, StaticMetadataSlice(&g_static_metadata_slice_refcounts[60].base, 4,
g_static_metadata_bytes + 865), g_static_metadata_bytes + 858),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[61].base, 13, StaticMetadataSlice(&g_static_metadata_slice_refcounts[61].base, 4,
g_static_metadata_bytes + 878), g_static_metadata_bytes + 862),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[62].base, 19, StaticMetadataSlice(&g_static_metadata_slice_refcounts[62].base, 6,
g_static_metadata_bytes + 891), g_static_metadata_bytes + 866),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[63].base, 16, StaticMetadataSlice(&g_static_metadata_slice_refcounts[63].base, 7,
g_static_metadata_bytes + 910), g_static_metadata_bytes + 872),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[64].base, 14, StaticMetadataSlice(&g_static_metadata_slice_refcounts[64].base, 4,
g_static_metadata_bytes + 926), g_static_metadata_bytes + 879),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[65].base, 16, StaticMetadataSlice(&g_static_metadata_slice_refcounts[65].base, 4,
g_static_metadata_bytes + 940), g_static_metadata_bytes + 883),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[66].base, 13, StaticMetadataSlice(&g_static_metadata_slice_refcounts[66].base, 8,
g_static_metadata_bytes + 956), g_static_metadata_bytes + 887),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[67].base, 6, StaticMetadataSlice(&g_static_metadata_slice_refcounts[67].base, 17,
g_static_metadata_bytes + 969), g_static_metadata_bytes + 895),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[68].base, 4, StaticMetadataSlice(&g_static_metadata_slice_refcounts[68].base, 13,
g_static_metadata_bytes + 975), g_static_metadata_bytes + 912),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[69].base, 4, StaticMetadataSlice(&g_static_metadata_slice_refcounts[69].base, 8,
g_static_metadata_bytes + 979), g_static_metadata_bytes + 925),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[70].base, 6, StaticMetadataSlice(&g_static_metadata_slice_refcounts[70].base, 19,
g_static_metadata_bytes + 983), g_static_metadata_bytes + 933),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[71].base, 7, StaticMetadataSlice(&g_static_metadata_slice_refcounts[71].base, 13,
g_static_metadata_bytes + 989), g_static_metadata_bytes + 952),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[72].base, 4, StaticMetadataSlice(&g_static_metadata_slice_refcounts[72].base, 4,
g_static_metadata_bytes + 996), g_static_metadata_bytes + 965),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[73].base, 8, StaticMetadataSlice(&g_static_metadata_slice_refcounts[73].base, 8,
g_static_metadata_bytes + 1000), g_static_metadata_bytes + 969),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[74].base, 17, StaticMetadataSlice(&g_static_metadata_slice_refcounts[74].base, 12,
g_static_metadata_bytes + 1008), g_static_metadata_bytes + 977),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[75].base, 13, StaticMetadataSlice(&g_static_metadata_slice_refcounts[75].base, 18,
g_static_metadata_bytes + 1025), g_static_metadata_bytes + 989),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[76].base, 8, StaticMetadataSlice(&g_static_metadata_slice_refcounts[76].base, 19,
g_static_metadata_bytes + 1007),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[77].base, 5,
g_static_metadata_bytes + 1026),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[78].base, 7,
g_static_metadata_bytes + 1031),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[79].base, 7,
g_static_metadata_bytes + 1038), g_static_metadata_bytes + 1038),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[77].base, 19, StaticMetadataSlice(&g_static_metadata_slice_refcounts[80].base, 11,
g_static_metadata_bytes + 1046), g_static_metadata_bytes + 1045),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[78].base, 13, StaticMetadataSlice(&g_static_metadata_slice_refcounts[81].base, 6,
g_static_metadata_bytes + 1065), g_static_metadata_bytes + 1056),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[79].base, 4, StaticMetadataSlice(&g_static_metadata_slice_refcounts[82].base, 10,
g_static_metadata_bytes + 1078), g_static_metadata_bytes + 1062),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[80].base, 8, StaticMetadataSlice(&g_static_metadata_slice_refcounts[83].base, 25,
g_static_metadata_bytes + 1082), g_static_metadata_bytes + 1072),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[81].base, 12, StaticMetadataSlice(&g_static_metadata_slice_refcounts[84].base, 17,
g_static_metadata_bytes + 1090), g_static_metadata_bytes + 1097),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[82].base, 18, StaticMetadataSlice(&g_static_metadata_slice_refcounts[85].base, 10,
g_static_metadata_bytes + 1102), g_static_metadata_bytes + 1114),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[83].base, 19, StaticMetadataSlice(&g_static_metadata_slice_refcounts[86].base, 4,
g_static_metadata_bytes + 1120), g_static_metadata_bytes + 1124),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[84].base, 5, StaticMetadataSlice(&g_static_metadata_slice_refcounts[87].base, 3,
g_static_metadata_bytes + 1139), g_static_metadata_bytes + 1128),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[85].base, 7, StaticMetadataSlice(&g_static_metadata_slice_refcounts[88].base, 16,
g_static_metadata_bytes + 1144), g_static_metadata_bytes + 1131),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[86].base, 7, StaticMetadataSlice(&g_static_metadata_slice_refcounts[89].base, 1,
g_static_metadata_bytes + 1151), g_static_metadata_bytes + 1147),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[87].base, 11, StaticMetadataSlice(&g_static_metadata_slice_refcounts[90].base, 8,
g_static_metadata_bytes + 1158), g_static_metadata_bytes + 1148),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[88].base, 6, StaticMetadataSlice(&g_static_metadata_slice_refcounts[91].base, 16,
g_static_metadata_bytes + 1169), g_static_metadata_bytes + 1156),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[89].base, 10,
g_static_metadata_bytes + 1175),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[90].base, 25,
g_static_metadata_bytes + 1185),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[91].base, 17,
g_static_metadata_bytes + 1210),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[92].base, 4, StaticMetadataSlice(&g_static_metadata_slice_refcounts[92].base, 4,
g_static_metadata_bytes + 1227), g_static_metadata_bytes + 1172),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[93].base, 3, StaticMetadataSlice(&g_static_metadata_slice_refcounts[93].base, 3,
g_static_metadata_bytes + 1176),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[94].base, 11,
g_static_metadata_bytes + 1179),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[95].base, 16,
g_static_metadata_bytes + 1190),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[96].base, 13,
g_static_metadata_bytes + 1206),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[97].base, 12,
g_static_metadata_bytes + 1219),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[98].base, 21,
g_static_metadata_bytes + 1231), g_static_metadata_bytes + 1231),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[94].base, 16,
g_static_metadata_bytes + 1234),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[95].base, 1,
g_static_metadata_bytes + 1250),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[96].base, 8,
g_static_metadata_bytes + 1251),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[97].base, 16,
g_static_metadata_bytes + 1259),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[98].base, 4,
g_static_metadata_bytes + 1275),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[99].base, 3,
g_static_metadata_bytes + 1279),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[100].base, 11,
g_static_metadata_bytes + 1282),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[101].base, 16,
g_static_metadata_bytes + 1293),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[102].base, 13,
g_static_metadata_bytes + 1309),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[103].base, 12,
g_static_metadata_bytes + 1322),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[104].base, 21,
g_static_metadata_bytes + 1334),
}; };
} // namespace grpc_core } // namespace grpc_core

@ -38,7 +38,7 @@
static_assert( static_assert(
std::is_trivially_destructible<grpc_core::StaticMetadataSlice>::value, std::is_trivially_destructible<grpc_core::StaticMetadataSlice>::value,
"StaticMetadataSlice must be trivially destructible."); "StaticMetadataSlice must be trivially destructible.");
#define GRPC_STATIC_MDSTR_COUNT 105 #define GRPC_STATIC_MDSTR_COUNT 99
/* ":path" */ /* ":path" */
#define GRPC_MDSTR_PATH (::grpc_core::g_static_metadata_slice_table[0]) #define GRPC_MDSTR_PATH (::grpc_core::g_static_metadata_slice_table[0])
/* ":method" */ /* ":method" */
@ -49,253 +49,236 @@ static_assert(
#define GRPC_MDSTR_AUTHORITY (::grpc_core::g_static_metadata_slice_table[3]) #define GRPC_MDSTR_AUTHORITY (::grpc_core::g_static_metadata_slice_table[3])
/* ":scheme" */ /* ":scheme" */
#define GRPC_MDSTR_SCHEME (::grpc_core::g_static_metadata_slice_table[4]) #define GRPC_MDSTR_SCHEME (::grpc_core::g_static_metadata_slice_table[4])
/* "grpc-message" */
#define GRPC_MDSTR_GRPC_MESSAGE (::grpc_core::g_static_metadata_slice_table[5])
/* "grpc-status" */ /* "grpc-status" */
#define GRPC_MDSTR_GRPC_STATUS (::grpc_core::g_static_metadata_slice_table[6]) #define GRPC_MDSTR_GRPC_STATUS (::grpc_core::g_static_metadata_slice_table[5])
/* "grpc-payload-bin" */
#define GRPC_MDSTR_GRPC_PAYLOAD_BIN \
(::grpc_core::g_static_metadata_slice_table[7])
/* "grpc-encoding" */ /* "grpc-encoding" */
#define GRPC_MDSTR_GRPC_ENCODING (::grpc_core::g_static_metadata_slice_table[8]) #define GRPC_MDSTR_GRPC_ENCODING (::grpc_core::g_static_metadata_slice_table[6])
/* "grpc-accept-encoding" */ /* "grpc-accept-encoding" */
#define GRPC_MDSTR_GRPC_ACCEPT_ENCODING \ #define GRPC_MDSTR_GRPC_ACCEPT_ENCODING \
(::grpc_core::g_static_metadata_slice_table[9]) (::grpc_core::g_static_metadata_slice_table[7])
/* "grpc-server-stats-bin" */
#define GRPC_MDSTR_GRPC_SERVER_STATS_BIN \
(::grpc_core::g_static_metadata_slice_table[10])
/* "grpc-tags-bin" */
#define GRPC_MDSTR_GRPC_TAGS_BIN \
(::grpc_core::g_static_metadata_slice_table[11])
/* "grpc-trace-bin" */
#define GRPC_MDSTR_GRPC_TRACE_BIN \
(::grpc_core::g_static_metadata_slice_table[12])
/* "content-type" */ /* "content-type" */
#define GRPC_MDSTR_CONTENT_TYPE (::grpc_core::g_static_metadata_slice_table[13]) #define GRPC_MDSTR_CONTENT_TYPE (::grpc_core::g_static_metadata_slice_table[8])
/* "content-encoding" */ /* "content-encoding" */
#define GRPC_MDSTR_CONTENT_ENCODING \ #define GRPC_MDSTR_CONTENT_ENCODING \
(::grpc_core::g_static_metadata_slice_table[14]) (::grpc_core::g_static_metadata_slice_table[9])
/* "accept-encoding" */ /* "accept-encoding" */
#define GRPC_MDSTR_ACCEPT_ENCODING \ #define GRPC_MDSTR_ACCEPT_ENCODING \
(::grpc_core::g_static_metadata_slice_table[15]) (::grpc_core::g_static_metadata_slice_table[10])
/* "grpc-internal-encoding-request" */ /* "grpc-internal-encoding-request" */
#define GRPC_MDSTR_GRPC_INTERNAL_ENCODING_REQUEST \ #define GRPC_MDSTR_GRPC_INTERNAL_ENCODING_REQUEST \
(::grpc_core::g_static_metadata_slice_table[16]) (::grpc_core::g_static_metadata_slice_table[11])
/* "host" */
#define GRPC_MDSTR_HOST (::grpc_core::g_static_metadata_slice_table[17])
/* "grpc-previous-rpc-attempts" */ /* "grpc-previous-rpc-attempts" */
#define GRPC_MDSTR_GRPC_PREVIOUS_RPC_ATTEMPTS \ #define GRPC_MDSTR_GRPC_PREVIOUS_RPC_ATTEMPTS \
(::grpc_core::g_static_metadata_slice_table[18]) (::grpc_core::g_static_metadata_slice_table[12])
/* "grpc-retry-pushback-ms" */ /* "grpc-retry-pushback-ms" */
#define GRPC_MDSTR_GRPC_RETRY_PUSHBACK_MS \ #define GRPC_MDSTR_GRPC_RETRY_PUSHBACK_MS \
(::grpc_core::g_static_metadata_slice_table[19]) (::grpc_core::g_static_metadata_slice_table[13])
/* "x-endpoint-load-metrics-bin" */
#define GRPC_MDSTR_X_ENDPOINT_LOAD_METRICS_BIN \
(::grpc_core::g_static_metadata_slice_table[20])
/* "grpc-timeout" */ /* "grpc-timeout" */
#define GRPC_MDSTR_GRPC_TIMEOUT (::grpc_core::g_static_metadata_slice_table[21]) #define GRPC_MDSTR_GRPC_TIMEOUT (::grpc_core::g_static_metadata_slice_table[14])
/* "user-agent" */
#define GRPC_MDSTR_USER_AGENT (::grpc_core::g_static_metadata_slice_table[22])
/* "1" */ /* "1" */
#define GRPC_MDSTR_1 (::grpc_core::g_static_metadata_slice_table[23]) #define GRPC_MDSTR_1 (::grpc_core::g_static_metadata_slice_table[15])
/* "2" */ /* "2" */
#define GRPC_MDSTR_2 (::grpc_core::g_static_metadata_slice_table[24]) #define GRPC_MDSTR_2 (::grpc_core::g_static_metadata_slice_table[16])
/* "3" */ /* "3" */
#define GRPC_MDSTR_3 (::grpc_core::g_static_metadata_slice_table[25]) #define GRPC_MDSTR_3 (::grpc_core::g_static_metadata_slice_table[17])
/* "4" */ /* "4" */
#define GRPC_MDSTR_4 (::grpc_core::g_static_metadata_slice_table[26]) #define GRPC_MDSTR_4 (::grpc_core::g_static_metadata_slice_table[18])
/* "" */ /* "" */
#define GRPC_MDSTR_EMPTY (::grpc_core::g_static_metadata_slice_table[27]) #define GRPC_MDSTR_EMPTY (::grpc_core::g_static_metadata_slice_table[19])
/* "/grpc.lb.v1.LoadBalancer/BalanceLoad" */ /* "/grpc.lb.v1.LoadBalancer/BalanceLoad" */
#define GRPC_MDSTR_SLASH_GRPC_DOT_LB_DOT_V1_DOT_LOADBALANCER_SLASH_BALANCELOAD \ #define GRPC_MDSTR_SLASH_GRPC_DOT_LB_DOT_V1_DOT_LOADBALANCER_SLASH_BALANCELOAD \
(::grpc_core::g_static_metadata_slice_table[28]) (::grpc_core::g_static_metadata_slice_table[20])
/* "/envoy.service.load_stats.v2.LoadReportingService/StreamLoadStats" */ /* "/envoy.service.load_stats.v2.LoadReportingService/StreamLoadStats" */
#define GRPC_MDSTR_SLASH_ENVOY_DOT_SERVICE_DOT_LOAD_STATS_DOT_V2_DOT_LOADREPORTINGSERVICE_SLASH_STREAMLOADSTATS \ #define GRPC_MDSTR_SLASH_ENVOY_DOT_SERVICE_DOT_LOAD_STATS_DOT_V2_DOT_LOADREPORTINGSERVICE_SLASH_STREAMLOADSTATS \
(::grpc_core::g_static_metadata_slice_table[29]) (::grpc_core::g_static_metadata_slice_table[21])
/* "/envoy.service.load_stats.v3.LoadReportingService/StreamLoadStats" */ /* "/envoy.service.load_stats.v3.LoadReportingService/StreamLoadStats" */
#define GRPC_MDSTR_SLASH_ENVOY_DOT_SERVICE_DOT_LOAD_STATS_DOT_V3_DOT_LOADREPORTINGSERVICE_SLASH_STREAMLOADSTATS \ #define GRPC_MDSTR_SLASH_ENVOY_DOT_SERVICE_DOT_LOAD_STATS_DOT_V3_DOT_LOADREPORTINGSERVICE_SLASH_STREAMLOADSTATS \
(::grpc_core::g_static_metadata_slice_table[30]) (::grpc_core::g_static_metadata_slice_table[22])
/* "/grpc.health.v1.Health/Watch" */ /* "/grpc.health.v1.Health/Watch" */
#define GRPC_MDSTR_SLASH_GRPC_DOT_HEALTH_DOT_V1_DOT_HEALTH_SLASH_WATCH \ #define GRPC_MDSTR_SLASH_GRPC_DOT_HEALTH_DOT_V1_DOT_HEALTH_SLASH_WATCH \
(::grpc_core::g_static_metadata_slice_table[31]) (::grpc_core::g_static_metadata_slice_table[23])
/* "/envoy.service.discovery.v2.AggregatedDiscoveryService/StreamAggregatedResources" /* "/envoy.service.discovery.v2.AggregatedDiscoveryService/StreamAggregatedResources"
*/ */
#define GRPC_MDSTR_SLASH_ENVOY_DOT_SERVICE_DOT_DISCOVERY_DOT_V2_DOT_AGGREGATEDDISCOVERYSERVICE_SLASH_STREAMAGGREGATEDRESOURCES \ #define GRPC_MDSTR_SLASH_ENVOY_DOT_SERVICE_DOT_DISCOVERY_DOT_V2_DOT_AGGREGATEDDISCOVERYSERVICE_SLASH_STREAMAGGREGATEDRESOURCES \
(::grpc_core::g_static_metadata_slice_table[32]) (::grpc_core::g_static_metadata_slice_table[24])
/* "/envoy.service.discovery.v3.AggregatedDiscoveryService/StreamAggregatedResources" /* "/envoy.service.discovery.v3.AggregatedDiscoveryService/StreamAggregatedResources"
*/ */
#define GRPC_MDSTR_SLASH_ENVOY_DOT_SERVICE_DOT_DISCOVERY_DOT_V3_DOT_AGGREGATEDDISCOVERYSERVICE_SLASH_STREAMAGGREGATEDRESOURCES \ #define GRPC_MDSTR_SLASH_ENVOY_DOT_SERVICE_DOT_DISCOVERY_DOT_V3_DOT_AGGREGATEDDISCOVERYSERVICE_SLASH_STREAMAGGREGATEDRESOURCES \
(::grpc_core::g_static_metadata_slice_table[33]) (::grpc_core::g_static_metadata_slice_table[25])
/* "deflate" */ /* "deflate" */
#define GRPC_MDSTR_DEFLATE (::grpc_core::g_static_metadata_slice_table[34]) #define GRPC_MDSTR_DEFLATE (::grpc_core::g_static_metadata_slice_table[26])
/* "gzip" */ /* "gzip" */
#define GRPC_MDSTR_GZIP (::grpc_core::g_static_metadata_slice_table[35]) #define GRPC_MDSTR_GZIP (::grpc_core::g_static_metadata_slice_table[27])
/* "stream/gzip" */ /* "stream/gzip" */
#define GRPC_MDSTR_STREAM_SLASH_GZIP \ #define GRPC_MDSTR_STREAM_SLASH_GZIP \
(::grpc_core::g_static_metadata_slice_table[36]) (::grpc_core::g_static_metadata_slice_table[28])
/* "te" */ /* "te" */
#define GRPC_MDSTR_TE (::grpc_core::g_static_metadata_slice_table[37]) #define GRPC_MDSTR_TE (::grpc_core::g_static_metadata_slice_table[29])
/* "trailers" */ /* "trailers" */
#define GRPC_MDSTR_TRAILERS (::grpc_core::g_static_metadata_slice_table[38]) #define GRPC_MDSTR_TRAILERS (::grpc_core::g_static_metadata_slice_table[30])
/* "GET" */ /* "GET" */
#define GRPC_MDSTR_GET (::grpc_core::g_static_metadata_slice_table[39]) #define GRPC_MDSTR_GET (::grpc_core::g_static_metadata_slice_table[31])
/* "POST" */ /* "POST" */
#define GRPC_MDSTR_POST (::grpc_core::g_static_metadata_slice_table[40]) #define GRPC_MDSTR_POST (::grpc_core::g_static_metadata_slice_table[32])
/* "/" */ /* "/" */
#define GRPC_MDSTR_SLASH (::grpc_core::g_static_metadata_slice_table[41]) #define GRPC_MDSTR_SLASH (::grpc_core::g_static_metadata_slice_table[33])
/* "/index.html" */ /* "/index.html" */
#define GRPC_MDSTR_SLASH_INDEX_DOT_HTML \ #define GRPC_MDSTR_SLASH_INDEX_DOT_HTML \
(::grpc_core::g_static_metadata_slice_table[42]) (::grpc_core::g_static_metadata_slice_table[34])
/* "http" */ /* "http" */
#define GRPC_MDSTR_HTTP (::grpc_core::g_static_metadata_slice_table[43]) #define GRPC_MDSTR_HTTP (::grpc_core::g_static_metadata_slice_table[35])
/* "https" */ /* "https" */
#define GRPC_MDSTR_HTTPS (::grpc_core::g_static_metadata_slice_table[44]) #define GRPC_MDSTR_HTTPS (::grpc_core::g_static_metadata_slice_table[36])
/* "200" */ /* "200" */
#define GRPC_MDSTR_200 (::grpc_core::g_static_metadata_slice_table[45]) #define GRPC_MDSTR_200 (::grpc_core::g_static_metadata_slice_table[37])
/* "204" */ /* "204" */
#define GRPC_MDSTR_204 (::grpc_core::g_static_metadata_slice_table[46]) #define GRPC_MDSTR_204 (::grpc_core::g_static_metadata_slice_table[38])
/* "206" */ /* "206" */
#define GRPC_MDSTR_206 (::grpc_core::g_static_metadata_slice_table[47]) #define GRPC_MDSTR_206 (::grpc_core::g_static_metadata_slice_table[39])
/* "304" */ /* "304" */
#define GRPC_MDSTR_304 (::grpc_core::g_static_metadata_slice_table[48]) #define GRPC_MDSTR_304 (::grpc_core::g_static_metadata_slice_table[40])
/* "400" */ /* "400" */
#define GRPC_MDSTR_400 (::grpc_core::g_static_metadata_slice_table[49]) #define GRPC_MDSTR_400 (::grpc_core::g_static_metadata_slice_table[41])
/* "404" */ /* "404" */
#define GRPC_MDSTR_404 (::grpc_core::g_static_metadata_slice_table[50]) #define GRPC_MDSTR_404 (::grpc_core::g_static_metadata_slice_table[42])
/* "500" */ /* "500" */
#define GRPC_MDSTR_500 (::grpc_core::g_static_metadata_slice_table[51]) #define GRPC_MDSTR_500 (::grpc_core::g_static_metadata_slice_table[43])
/* "accept-charset" */ /* "accept-charset" */
#define GRPC_MDSTR_ACCEPT_CHARSET \ #define GRPC_MDSTR_ACCEPT_CHARSET \
(::grpc_core::g_static_metadata_slice_table[52]) (::grpc_core::g_static_metadata_slice_table[44])
/* "gzip, deflate" */ /* "gzip, deflate" */
#define GRPC_MDSTR_GZIP_COMMA_DEFLATE \ #define GRPC_MDSTR_GZIP_COMMA_DEFLATE \
(::grpc_core::g_static_metadata_slice_table[53]) (::grpc_core::g_static_metadata_slice_table[45])
/* "accept-language" */ /* "accept-language" */
#define GRPC_MDSTR_ACCEPT_LANGUAGE \ #define GRPC_MDSTR_ACCEPT_LANGUAGE \
(::grpc_core::g_static_metadata_slice_table[54]) (::grpc_core::g_static_metadata_slice_table[46])
/* "accept-ranges" */ /* "accept-ranges" */
#define GRPC_MDSTR_ACCEPT_RANGES \ #define GRPC_MDSTR_ACCEPT_RANGES \
(::grpc_core::g_static_metadata_slice_table[55]) (::grpc_core::g_static_metadata_slice_table[47])
/* "accept" */ /* "accept" */
#define GRPC_MDSTR_ACCEPT (::grpc_core::g_static_metadata_slice_table[56]) #define GRPC_MDSTR_ACCEPT (::grpc_core::g_static_metadata_slice_table[48])
/* "access-control-allow-origin" */ /* "access-control-allow-origin" */
#define GRPC_MDSTR_ACCESS_CONTROL_ALLOW_ORIGIN \ #define GRPC_MDSTR_ACCESS_CONTROL_ALLOW_ORIGIN \
(::grpc_core::g_static_metadata_slice_table[57]) (::grpc_core::g_static_metadata_slice_table[49])
/* "age" */ /* "age" */
#define GRPC_MDSTR_AGE (::grpc_core::g_static_metadata_slice_table[58]) #define GRPC_MDSTR_AGE (::grpc_core::g_static_metadata_slice_table[50])
/* "allow" */ /* "allow" */
#define GRPC_MDSTR_ALLOW (::grpc_core::g_static_metadata_slice_table[59]) #define GRPC_MDSTR_ALLOW (::grpc_core::g_static_metadata_slice_table[51])
/* "authorization" */ /* "authorization" */
#define GRPC_MDSTR_AUTHORIZATION \ #define GRPC_MDSTR_AUTHORIZATION \
(::grpc_core::g_static_metadata_slice_table[60]) (::grpc_core::g_static_metadata_slice_table[52])
/* "cache-control" */ /* "cache-control" */
#define GRPC_MDSTR_CACHE_CONTROL \ #define GRPC_MDSTR_CACHE_CONTROL \
(::grpc_core::g_static_metadata_slice_table[61]) (::grpc_core::g_static_metadata_slice_table[53])
/* "content-disposition" */ /* "content-disposition" */
#define GRPC_MDSTR_CONTENT_DISPOSITION \ #define GRPC_MDSTR_CONTENT_DISPOSITION \
(::grpc_core::g_static_metadata_slice_table[62]) (::grpc_core::g_static_metadata_slice_table[54])
/* "content-language" */ /* "content-language" */
#define GRPC_MDSTR_CONTENT_LANGUAGE \ #define GRPC_MDSTR_CONTENT_LANGUAGE \
(::grpc_core::g_static_metadata_slice_table[63]) (::grpc_core::g_static_metadata_slice_table[55])
/* "content-length" */ /* "content-length" */
#define GRPC_MDSTR_CONTENT_LENGTH \ #define GRPC_MDSTR_CONTENT_LENGTH \
(::grpc_core::g_static_metadata_slice_table[64]) (::grpc_core::g_static_metadata_slice_table[56])
/* "content-location" */ /* "content-location" */
#define GRPC_MDSTR_CONTENT_LOCATION \ #define GRPC_MDSTR_CONTENT_LOCATION \
(::grpc_core::g_static_metadata_slice_table[65]) (::grpc_core::g_static_metadata_slice_table[57])
/* "content-range" */ /* "content-range" */
#define GRPC_MDSTR_CONTENT_RANGE \ #define GRPC_MDSTR_CONTENT_RANGE \
(::grpc_core::g_static_metadata_slice_table[66]) (::grpc_core::g_static_metadata_slice_table[58])
/* "cookie" */ /* "cookie" */
#define GRPC_MDSTR_COOKIE (::grpc_core::g_static_metadata_slice_table[67]) #define GRPC_MDSTR_COOKIE (::grpc_core::g_static_metadata_slice_table[59])
/* "date" */ /* "date" */
#define GRPC_MDSTR_DATE (::grpc_core::g_static_metadata_slice_table[68]) #define GRPC_MDSTR_DATE (::grpc_core::g_static_metadata_slice_table[60])
/* "etag" */ /* "etag" */
#define GRPC_MDSTR_ETAG (::grpc_core::g_static_metadata_slice_table[69]) #define GRPC_MDSTR_ETAG (::grpc_core::g_static_metadata_slice_table[61])
/* "expect" */ /* "expect" */
#define GRPC_MDSTR_EXPECT (::grpc_core::g_static_metadata_slice_table[70]) #define GRPC_MDSTR_EXPECT (::grpc_core::g_static_metadata_slice_table[62])
/* "expires" */ /* "expires" */
#define GRPC_MDSTR_EXPIRES (::grpc_core::g_static_metadata_slice_table[71]) #define GRPC_MDSTR_EXPIRES (::grpc_core::g_static_metadata_slice_table[63])
/* "from" */ /* "from" */
#define GRPC_MDSTR_FROM (::grpc_core::g_static_metadata_slice_table[72]) #define GRPC_MDSTR_FROM (::grpc_core::g_static_metadata_slice_table[64])
/* "host" */
#define GRPC_MDSTR_HOST (::grpc_core::g_static_metadata_slice_table[65])
/* "if-match" */ /* "if-match" */
#define GRPC_MDSTR_IF_MATCH (::grpc_core::g_static_metadata_slice_table[73]) #define GRPC_MDSTR_IF_MATCH (::grpc_core::g_static_metadata_slice_table[66])
/* "if-modified-since" */ /* "if-modified-since" */
#define GRPC_MDSTR_IF_MODIFIED_SINCE \ #define GRPC_MDSTR_IF_MODIFIED_SINCE \
(::grpc_core::g_static_metadata_slice_table[74]) (::grpc_core::g_static_metadata_slice_table[67])
/* "if-none-match" */ /* "if-none-match" */
#define GRPC_MDSTR_IF_NONE_MATCH \ #define GRPC_MDSTR_IF_NONE_MATCH \
(::grpc_core::g_static_metadata_slice_table[75]) (::grpc_core::g_static_metadata_slice_table[68])
/* "if-range" */ /* "if-range" */
#define GRPC_MDSTR_IF_RANGE (::grpc_core::g_static_metadata_slice_table[76]) #define GRPC_MDSTR_IF_RANGE (::grpc_core::g_static_metadata_slice_table[69])
/* "if-unmodified-since" */ /* "if-unmodified-since" */
#define GRPC_MDSTR_IF_UNMODIFIED_SINCE \ #define GRPC_MDSTR_IF_UNMODIFIED_SINCE \
(::grpc_core::g_static_metadata_slice_table[77]) (::grpc_core::g_static_metadata_slice_table[70])
/* "last-modified" */ /* "last-modified" */
#define GRPC_MDSTR_LAST_MODIFIED \ #define GRPC_MDSTR_LAST_MODIFIED \
(::grpc_core::g_static_metadata_slice_table[78]) (::grpc_core::g_static_metadata_slice_table[71])
/* "link" */ /* "link" */
#define GRPC_MDSTR_LINK (::grpc_core::g_static_metadata_slice_table[79]) #define GRPC_MDSTR_LINK (::grpc_core::g_static_metadata_slice_table[72])
/* "location" */ /* "location" */
#define GRPC_MDSTR_LOCATION (::grpc_core::g_static_metadata_slice_table[80]) #define GRPC_MDSTR_LOCATION (::grpc_core::g_static_metadata_slice_table[73])
/* "max-forwards" */ /* "max-forwards" */
#define GRPC_MDSTR_MAX_FORWARDS (::grpc_core::g_static_metadata_slice_table[81]) #define GRPC_MDSTR_MAX_FORWARDS (::grpc_core::g_static_metadata_slice_table[74])
/* "proxy-authenticate" */ /* "proxy-authenticate" */
#define GRPC_MDSTR_PROXY_AUTHENTICATE \ #define GRPC_MDSTR_PROXY_AUTHENTICATE \
(::grpc_core::g_static_metadata_slice_table[82]) (::grpc_core::g_static_metadata_slice_table[75])
/* "proxy-authorization" */ /* "proxy-authorization" */
#define GRPC_MDSTR_PROXY_AUTHORIZATION \ #define GRPC_MDSTR_PROXY_AUTHORIZATION \
(::grpc_core::g_static_metadata_slice_table[83]) (::grpc_core::g_static_metadata_slice_table[76])
/* "range" */ /* "range" */
#define GRPC_MDSTR_RANGE (::grpc_core::g_static_metadata_slice_table[84]) #define GRPC_MDSTR_RANGE (::grpc_core::g_static_metadata_slice_table[77])
/* "referer" */ /* "referer" */
#define GRPC_MDSTR_REFERER (::grpc_core::g_static_metadata_slice_table[85]) #define GRPC_MDSTR_REFERER (::grpc_core::g_static_metadata_slice_table[78])
/* "refresh" */ /* "refresh" */
#define GRPC_MDSTR_REFRESH (::grpc_core::g_static_metadata_slice_table[86]) #define GRPC_MDSTR_REFRESH (::grpc_core::g_static_metadata_slice_table[79])
/* "retry-after" */ /* "retry-after" */
#define GRPC_MDSTR_RETRY_AFTER (::grpc_core::g_static_metadata_slice_table[87]) #define GRPC_MDSTR_RETRY_AFTER (::grpc_core::g_static_metadata_slice_table[80])
/* "server" */ /* "server" */
#define GRPC_MDSTR_SERVER (::grpc_core::g_static_metadata_slice_table[88]) #define GRPC_MDSTR_SERVER (::grpc_core::g_static_metadata_slice_table[81])
/* "set-cookie" */ /* "set-cookie" */
#define GRPC_MDSTR_SET_COOKIE (::grpc_core::g_static_metadata_slice_table[89]) #define GRPC_MDSTR_SET_COOKIE (::grpc_core::g_static_metadata_slice_table[82])
/* "strict-transport-security" */ /* "strict-transport-security" */
#define GRPC_MDSTR_STRICT_TRANSPORT_SECURITY \ #define GRPC_MDSTR_STRICT_TRANSPORT_SECURITY \
(::grpc_core::g_static_metadata_slice_table[90]) (::grpc_core::g_static_metadata_slice_table[83])
/* "transfer-encoding" */ /* "transfer-encoding" */
#define GRPC_MDSTR_TRANSFER_ENCODING \ #define GRPC_MDSTR_TRANSFER_ENCODING \
(::grpc_core::g_static_metadata_slice_table[91]) (::grpc_core::g_static_metadata_slice_table[84])
/* "user-agent" */
#define GRPC_MDSTR_USER_AGENT (::grpc_core::g_static_metadata_slice_table[85])
/* "vary" */ /* "vary" */
#define GRPC_MDSTR_VARY (::grpc_core::g_static_metadata_slice_table[92]) #define GRPC_MDSTR_VARY (::grpc_core::g_static_metadata_slice_table[86])
/* "via" */ /* "via" */
#define GRPC_MDSTR_VIA (::grpc_core::g_static_metadata_slice_table[93]) #define GRPC_MDSTR_VIA (::grpc_core::g_static_metadata_slice_table[87])
/* "www-authenticate" */ /* "www-authenticate" */
#define GRPC_MDSTR_WWW_AUTHENTICATE \ #define GRPC_MDSTR_WWW_AUTHENTICATE \
(::grpc_core::g_static_metadata_slice_table[94]) (::grpc_core::g_static_metadata_slice_table[88])
/* "0" */ /* "0" */
#define GRPC_MDSTR_0 (::grpc_core::g_static_metadata_slice_table[95]) #define GRPC_MDSTR_0 (::grpc_core::g_static_metadata_slice_table[89])
/* "identity" */ /* "identity" */
#define GRPC_MDSTR_IDENTITY (::grpc_core::g_static_metadata_slice_table[96]) #define GRPC_MDSTR_IDENTITY (::grpc_core::g_static_metadata_slice_table[90])
/* "application/grpc" */ /* "application/grpc" */
#define GRPC_MDSTR_APPLICATION_SLASH_GRPC \ #define GRPC_MDSTR_APPLICATION_SLASH_GRPC \
(::grpc_core::g_static_metadata_slice_table[97]) (::grpc_core::g_static_metadata_slice_table[91])
/* "grpc" */ /* "grpc" */
#define GRPC_MDSTR_GRPC (::grpc_core::g_static_metadata_slice_table[98]) #define GRPC_MDSTR_GRPC (::grpc_core::g_static_metadata_slice_table[92])
/* "PUT" */ /* "PUT" */
#define GRPC_MDSTR_PUT (::grpc_core::g_static_metadata_slice_table[99]) #define GRPC_MDSTR_PUT (::grpc_core::g_static_metadata_slice_table[93])
/* "lb-cost-bin" */ /* "lb-cost-bin" */
#define GRPC_MDSTR_LB_COST_BIN (::grpc_core::g_static_metadata_slice_table[100]) #define GRPC_MDSTR_LB_COST_BIN (::grpc_core::g_static_metadata_slice_table[94])
/* "identity,deflate" */ /* "identity,deflate" */
#define GRPC_MDSTR_IDENTITY_COMMA_DEFLATE \ #define GRPC_MDSTR_IDENTITY_COMMA_DEFLATE \
(::grpc_core::g_static_metadata_slice_table[101]) (::grpc_core::g_static_metadata_slice_table[95])
/* "identity,gzip" */ /* "identity,gzip" */
#define GRPC_MDSTR_IDENTITY_COMMA_GZIP \ #define GRPC_MDSTR_IDENTITY_COMMA_GZIP \
(::grpc_core::g_static_metadata_slice_table[102]) (::grpc_core::g_static_metadata_slice_table[96])
/* "deflate,gzip" */ /* "deflate,gzip" */
#define GRPC_MDSTR_DEFLATE_COMMA_GZIP \ #define GRPC_MDSTR_DEFLATE_COMMA_GZIP \
(::grpc_core::g_static_metadata_slice_table[103]) (::grpc_core::g_static_metadata_slice_table[97])
/* "identity,deflate,gzip" */ /* "identity,deflate,gzip" */
#define GRPC_MDSTR_IDENTITY_COMMA_DEFLATE_COMMA_GZIP \ #define GRPC_MDSTR_IDENTITY_COMMA_DEFLATE_COMMA_GZIP \
(::grpc_core::g_static_metadata_slice_table[104]) (::grpc_core::g_static_metadata_slice_table[98])
namespace grpc_core { namespace grpc_core {
extern StaticSliceRefcount extern StaticSliceRefcount

@ -899,7 +899,6 @@ static grpc_metadata* get_md_elem(grpc_metadata* metadata,
static int prepare_application_metadata(grpc_call* call, int count, static int prepare_application_metadata(grpc_call* call, int count,
grpc_metadata* metadata, grpc_metadata* metadata,
int is_trailing, int is_trailing,
int prepend_extra_metadata,
grpc_metadata* additional_metadata, grpc_metadata* additional_metadata,
int additional_metadata_count) { int additional_metadata_count) {
int total_count = count + additional_metadata_count; int total_count = count + additional_metadata_count;
@ -932,16 +931,6 @@ static int prepare_application_metadata(grpc_call* call, int count,
} }
return 0; return 0;
} }
if (prepend_extra_metadata) {
if (call->send_extra_metadata_count == 0) {
prepend_extra_metadata = 0;
} else {
for (i = 0; i < call->send_extra_metadata_count; i++) {
GRPC_LOG_IF_ERROR("prepare_application_metadata",
batch->LinkTail(&call->send_extra_metadata[i]));
}
}
}
for (i = 0; i < total_count; i++) { for (i = 0; i < total_count; i++) {
grpc_metadata* md = get_md_elem(metadata, additional_metadata, i, count); grpc_metadata* md = get_md_elem(metadata, additional_metadata, i, count);
grpc_linked_mdelem* l = linked_from_md(md); grpc_linked_mdelem* l = linked_from_md(md);
@ -951,7 +940,6 @@ static int prepare_application_metadata(grpc_call* call, int count,
} }
GRPC_LOG_IF_ERROR("prepare_application_metadata", error); GRPC_LOG_IF_ERROR("prepare_application_metadata", error);
} }
call->send_extra_metadata_count = 0;
return 1; return 1;
} }
@ -1089,12 +1077,10 @@ static void recv_trailing_filter(void* args, grpc_metadata_batch* b,
static_cast<intptr_t>(status_code)); static_cast<intptr_t>(status_code));
gpr_free(peer); gpr_free(peer);
} }
if (b->legacy_index()->named.grpc_message != nullptr) { auto grpc_message = b->Take(grpc_core::GrpcMessageMetadata());
error = grpc_error_set_str( if (grpc_message.has_value()) {
error, GRPC_ERROR_STR_GRPC_MESSAGE, error = grpc_error_set_str(error, GRPC_ERROR_STR_GRPC_MESSAGE,
grpc_core::StringViewFromSlice( grpc_message->as_string_view());
GRPC_MDVALUE(b->legacy_index()->named.grpc_message->md)));
b->Remove(GRPC_BATCH_GRPC_MESSAGE);
} else if (error != GRPC_ERROR_NONE) { } else if (error != GRPC_ERROR_NONE) {
error = grpc_error_set_str(error, GRPC_ERROR_STR_GRPC_MESSAGE, ""); error = grpc_error_set_str(error, GRPC_ERROR_STR_GRPC_MESSAGE, "");
} }
@ -1675,10 +1661,20 @@ static grpc_call_error call_start_batch(grpc_call* call, const grpc_op* ops,
} }
stream_op->send_initial_metadata = true; stream_op->send_initial_metadata = true;
call->sent_initial_metadata = true; call->sent_initial_metadata = true;
if (call->is_client) {
// TODO(ctiller): this will turn into explicit Set() calls once we
// migrate :path, :authority.
for (int i = 0; i < call->send_extra_metadata_count; i++) {
GRPC_LOG_IF_ERROR("prepare_client_metadata",
call->send_initial_metadata.LinkTail(
&call->send_extra_metadata[i]));
}
call->send_extra_metadata_count = 0;
}
if (!prepare_application_metadata( if (!prepare_application_metadata(
call, static_cast<int>(op->data.send_initial_metadata.count), call, static_cast<int>(op->data.send_initial_metadata.count),
op->data.send_initial_metadata.metadata, 0, call->is_client, op->data.send_initial_metadata.metadata, 0, &compression_md,
&compression_md, static_cast<int>(additional_metadata_count))) { static_cast<int>(additional_metadata_count))) {
error = GRPC_CALL_ERROR_INVALID_METADATA; error = GRPC_CALL_ERROR_INVALID_METADATA;
goto done_with_error; goto done_with_error;
} }
@ -1770,10 +1766,17 @@ static grpc_call_error call_start_batch(grpc_call* call, const grpc_op* ops,
} }
stream_op->send_trailing_metadata = true; stream_op->send_trailing_metadata = true;
call->sent_final_op = true; call->sent_final_op = true;
GPR_ASSERT(call->send_extra_metadata_count == 0);
call->send_extra_metadata_count = 1; if (!prepare_application_metadata(
call->send_extra_metadata[0].md = grpc_get_reffed_status_elem( call,
op->data.send_status_from_server.status); static_cast<int>(
op->data.send_status_from_server.trailing_metadata_count),
op->data.send_status_from_server.trailing_metadata, 1, nullptr,
0)) {
error = GRPC_CALL_ERROR_INVALID_METADATA;
goto done_with_error;
}
grpc_error_handle status_error = grpc_error_handle status_error =
op->data.send_status_from_server.status == GRPC_STATUS_OK op->data.send_status_from_server.status == GRPC_STATUS_OK
? GRPC_ERROR_NONE ? GRPC_ERROR_NONE
@ -1784,36 +1787,26 @@ static grpc_call_error call_start_batch(grpc_call* call, const grpc_op* ops,
static_cast<intptr_t>( static_cast<intptr_t>(
op->data.send_status_from_server.status)); op->data.send_status_from_server.status));
if (op->data.send_status_from_server.status_details != nullptr) { if (op->data.send_status_from_server.status_details != nullptr) {
call->send_extra_metadata[1].md = grpc_mdelem_from_slices( call->send_trailing_metadata.Set(
GRPC_MDSTR_GRPC_MESSAGE, grpc_core::GrpcMessageMetadata(),
grpc_slice_copy( grpc_core::Slice(grpc_slice_copy(
*op->data.send_status_from_server.status_details)); *op->data.send_status_from_server.status_details)));
call->send_extra_metadata_count++;
if (status_error != GRPC_ERROR_NONE) { if (status_error != GRPC_ERROR_NONE) {
char* msg = grpc_slice_to_c_string( status_error = grpc_error_set_str(
GRPC_MDVALUE(call->send_extra_metadata[1].md)); status_error, GRPC_ERROR_STR_GRPC_MESSAGE,
status_error = grpc_error_set_str(status_error, grpc_core::StringViewFromSlice(
GRPC_ERROR_STR_GRPC_MESSAGE, msg); *op->data.send_status_from_server.status_details));
gpr_free(msg);
} }
} }
call->status_error.set(status_error); call->status_error.set(status_error);
GRPC_ERROR_UNREF(status_error); GRPC_ERROR_UNREF(status_error);
if (!prepare_application_metadata( GRPC_LOG_IF_ERROR(
call, "set call status",
static_cast<int>( call->send_trailing_metadata.Append(grpc_get_reffed_status_elem(
op->data.send_status_from_server.trailing_metadata_count), op->data.send_status_from_server.status)));
op->data.send_status_from_server.trailing_metadata, 1, 1,
nullptr, 0)) {
for (int n = 0; n < call->send_extra_metadata_count; n++) {
GRPC_MDELEM_UNREF(call->send_extra_metadata[n].md);
}
call->send_extra_metadata_count = 0;
error = GRPC_CALL_ERROR_INVALID_METADATA;
goto done_with_error;
}
stream_op_payload->send_trailing_metadata.send_trailing_metadata = stream_op_payload->send_trailing_metadata.send_trailing_metadata =
&call->send_trailing_metadata; &call->send_trailing_metadata;
stream_op_payload->send_trailing_metadata.sent = stream_op_payload->send_trailing_metadata.sent =

@ -138,11 +138,9 @@ struct TeMetadata {
} }
}; };
// user-agent metadata trait. struct SimpleSliceBasedMetadata {
struct UserAgentMetadata {
using ValueType = Slice; using ValueType = Slice;
using MementoType = Slice; using MementoType = Slice;
static absl::string_view key() { return "user-agent"; }
static MementoType ParseMemento(Slice value) { return value.TakeOwned(); } static MementoType ParseMemento(Slice value) { return value.TakeOwned(); }
static ValueType MementoToValue(MementoType value) { return value; } static ValueType MementoToValue(MementoType value) { return value; }
static Slice Encode(const ValueType& x) { return x.Ref(); } static Slice Encode(const ValueType& x) { return x.Ref(); }
@ -151,68 +149,139 @@ struct UserAgentMetadata {
} }
}; };
// user-agent metadata trait.
struct UserAgentMetadata : public SimpleSliceBasedMetadata {
static absl::string_view key() { return "user-agent"; }
};
// grpc-message metadata trait.
struct GrpcMessageMetadata : public SimpleSliceBasedMetadata {
static absl::string_view key() { return "grpc-message"; }
};
// host metadata trait.
struct HostMetadata : public SimpleSliceBasedMetadata {
static absl::string_view key() { return "host"; }
};
// x-endpoint-load-metrics-bin metadata trait.
struct XEndpointLoadMetricsBinMetadata : public SimpleSliceBasedMetadata {
static absl::string_view key() { return "x-endpoint-load-metrics-bin"; }
};
// grpc-server-stats-bin metadata trait.
struct GrpcServerStatsBinMetadata : public SimpleSliceBasedMetadata {
static absl::string_view key() { return "grpc-server-stats-bin"; }
};
// grpc-trace-bin metadata trait.
struct GrpcTraceBinMetadata : public SimpleSliceBasedMetadata {
static absl::string_view key() { return "grpc-trace-bin"; }
};
// grpc-tags-bin metadata trait.
struct GrpcTagsBinMetadata : public SimpleSliceBasedMetadata {
static absl::string_view key() { return "grpc-tags-bin"; }
};
namespace metadata_detail { namespace metadata_detail {
// Inner implementation of MetadataMap<Container>::Parse() // Helper type - maps a string name to a trait.
// Recursive in terms of metadata trait, tries each known type in order by doing template <typename... Traits>
// a string comparison on key, and if that key is found parses it. If not found, struct NameLookup;
// calls not_found to generate the result value.
template <typename Container, typename... Traits> template <typename Trait, typename... Traits>
struct ParseHelper; struct NameLookup<Trait, Traits...> {
// Call op->Found(Trait()) if op->name == Trait::key() for some Trait in
template <typename Container, typename Trait, typename... Traits> // Traits. If not found, call op->NotFount().
struct ParseHelper<Container, Trait, Traits...> { template <typename Op>
template <typename NotFound> static auto Lookup(absl::string_view key, Op* op)
static ParsedMetadata<Container> Parse(absl::string_view key, Slice value, -> decltype(op->Found(Trait())) {
uint32_t transport_size,
NotFound not_found) {
if (key == Trait::key()) { if (key == Trait::key()) {
return ParsedMetadata<Container>( return op->Found(Trait());
Trait(), Trait::ParseMemento(value.TakeOwned()), transport_size);
} }
return ParseHelper<Container, Traits...>::Parse(key, std::move(value), return NameLookup<Traits...>::Lookup(key, op);
transport_size, not_found);
} }
}; };
template <typename Container> template <>
struct ParseHelper<Container> { struct NameLookup<> {
template <typename NotFound> template <typename Op>
static ParsedMetadata<Container> Parse(absl::string_view, Slice value, static auto Lookup(absl::string_view key, Op* op)
uint32_t, NotFound not_found) { -> decltype(op->NotFound(key)) {
return not_found(std::move(value)); return op->NotFound(key);
} }
}; };
// Inner implementation of MetadataMap<Container>::Append() // Helper to take a slice to a memento to a value.
// Recursive in terms of metadata trait, tries each known type in order by doing // By splitting this part out we can scale code size as the number of (memento,
// a string comparison on key, and if that key is found sets it. If not found, // value) types, rather than as the number of traits.
// calls not_found to append generically. template <typename ParseMementoFn, typename MementoToValueFn>
template <typename Container, typename... Traits> struct ParseValue {
struct AppendHelper; template <ParseMementoFn parse_memento, MementoToValueFn memento_to_value>
static GPR_ATTRIBUTE_NOINLINE auto Parse(Slice* value)
template <typename Container, typename Trait, typename... Traits> -> decltype(memento_to_value(parse_memento(std::move(*value)))) {
struct AppendHelper<Container, Trait, Traits...> { return memento_to_value(parse_memento(std::move(*value)));
template <typename NotFound>
static void Append(Container* container, absl::string_view key, Slice value,
NotFound not_found) {
if (key == Trait::key()) {
container->Set(Trait(), Trait::MementoToValue(
Trait::ParseMemento(value.TakeOwned())));
return;
} }
AppendHelper<Container, Traits...>::Append(container, key, std::move(value), };
not_found);
// This is an "Op" type for NameLookup.
// Used for MetadataMap::Parse, its Found/NotFound methods turn a slice into a
// ParsedMetadata object.
template <typename Container>
class ParseHelper {
public:
ParseHelper(Slice value, size_t transport_size)
: value_(std::move(value)), transport_size_(transport_size) {}
template <typename Trait>
ParsedMetadata<Container> Found(Trait trait) {
return ParsedMetadata<Container>(
trait, Trait::ParseMemento(std::move(value_)), transport_size_);
}
GPR_ATTRIBUTE_NOINLINE ParsedMetadata<Container> NotFound(
absl::string_view key) {
return ParsedMetadata<Container>(
grpc_mdelem_from_slices(grpc_slice_intern(grpc_slice_from_static_buffer(
key.data(), key.size())),
value_.TakeCSlice()));
} }
private:
Slice value_;
const size_t transport_size_;
}; };
// This is an "Op" type for NameLookup.
// Used for MetadataMap::Parse, its Found/NotFound methods turn a slice into a
// value and add it to a container.
template <typename Container> template <typename Container>
struct AppendHelper<Container> { class AppendHelper {
template <typename NotFound> public:
static void Append(Container*, absl::string_view, Slice value, AppendHelper(Container* container, Slice value)
NotFound not_found) { : container_(container), value_(std::move(value)) {}
not_found(std::move(value));
template <typename Trait>
GPR_ATTRIBUTE_NOINLINE void Found(Trait trait) {
container_->Set(
trait, ParseValue<decltype(Trait::ParseMemento),
decltype(Trait::MementoToValue)>::
template Parse<Trait::ParseMemento, Trait::MementoToValue>(
&value_));
} }
void NotFound(absl::string_view key) {
GPR_ASSERT(GRPC_ERROR_NONE ==
container_->Append(grpc_mdelem_from_slices(
grpc_slice_intern(
grpc_slice_from_static_buffer(key.data(), key.length())),
value_.TakeCSlice())));
}
private:
Container* const container_;
Slice value_;
}; };
} // namespace metadata_detail } // namespace metadata_detail
@ -239,7 +308,7 @@ struct AppendHelper<Container> {
// // The type that's stored in compression/decompression tables // // The type that's stored in compression/decompression tables
// using MementoType = ...; // using MementoType = ...;
// // The string key for this metadata type (for transports that require it) // // The string key for this metadata type (for transports that require it)
// static constexpr absl::string_view key() { return "grpc-xyz"; } // static absl::string_view key() { return "grpc-xyz"; }
// // Parse a memento from a slice // // Parse a memento from a slice
// // Takes ownership of value // // Takes ownership of value
// static MementoType ParseMemento(Slice value) { ... } // static MementoType ParseMemento(Slice value) { ... }
@ -352,10 +421,13 @@ class MetadataMap {
// m.Remove(T()); // m.Remove(T());
template <typename Which> template <typename Which>
absl::optional<typename Which::ValueType> Take(Which which) { absl::optional<typename Which::ValueType> Take(Which which) {
auto value = get(which); if (auto* p = get_pointer(which)) {
absl::optional<typename Which::ValueType> value(std::move(*p));
Remove(which); Remove(which);
return value; return value;
} }
return {};
}
// Parse metadata from a key/value pair, and return an object representing // Parse metadata from a key/value pair, and return an object representing
// that result. // that result.
@ -363,16 +435,9 @@ class MetadataMap {
// Once we don't care about interning anymore, make that change! // Once we don't care about interning anymore, make that change!
static ParsedMetadata<MetadataMap> Parse(absl::string_view key, Slice value, static ParsedMetadata<MetadataMap> Parse(absl::string_view key, Slice value,
uint32_t transport_size) { uint32_t transport_size) {
bool parsed = true; metadata_detail::ParseHelper<MetadataMap> helper(value.TakeOwned(),
auto out = metadata_detail::ParseHelper<MetadataMap, Traits...>::Parse( transport_size);
key, std::move(value), transport_size, [&](Slice value) { return metadata_detail::NameLookup<Traits...>::Lookup(key, &helper);
parsed = false;
return ParsedMetadata<MetadataMap>(grpc_mdelem_from_slices(
grpc_slice_intern(
grpc_slice_from_static_buffer(key.data(), key.size())),
value.TakeCSlice()));
});
return out;
} }
// Set a value from a parsed metadata object. // Set a value from a parsed metadata object.
@ -383,14 +448,8 @@ class MetadataMap {
// Append a key/value pair - takes ownership of value // Append a key/value pair - takes ownership of value
void Append(absl::string_view key, Slice value) { void Append(absl::string_view key, Slice value) {
metadata_detail::AppendHelper<MetadataMap, Traits...>::Append( metadata_detail::AppendHelper<MetadataMap> helper(this, value.TakeOwned());
this, key, std::move(value), [this, key](Slice value) { metadata_detail::NameLookup<Traits...>::Lookup(key, &helper);
GPR_ASSERT(GRPC_ERROR_NONE ==
Append(grpc_mdelem_from_slices(
grpc_slice_intern(grpc_slice_from_static_buffer(
key.data(), key.length())),
value.TakeCSlice())));
});
} }
// //
@ -908,9 +967,12 @@ bool MetadataMap<Traits...>::ReplaceIfExists(grpc_slice key, grpc_slice value) {
} // namespace grpc_core } // namespace grpc_core
using grpc_metadata_batch = using grpc_metadata_batch = grpc_core::MetadataMap<
grpc_core::MetadataMap<grpc_core::GrpcTimeoutMetadata, grpc_core::GrpcTimeoutMetadata, grpc_core::TeMetadata,
grpc_core::TeMetadata, grpc_core::UserAgentMetadata>; grpc_core::UserAgentMetadata, grpc_core::GrpcMessageMetadata,
grpc_core::HostMetadata, grpc_core::XEndpointLoadMetricsBinMetadata,
grpc_core::GrpcServerStatsBinMetadata, grpc_core::GrpcTraceBinMetadata,
grpc_core::GrpcTagsBinMetadata>;
inline void grpc_metadata_batch_clear(grpc_metadata_batch* batch) { inline void grpc_metadata_batch_clear(grpc_metadata_batch* batch) {
batch->Clear(); batch->Clear();

@ -0,0 +1,35 @@
// Copyright 2021 gRPC authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include <grpc/support/port_platform.h>
#include "src/core/lib/transport/parsed_metadata.h"
namespace grpc_core {
namespace metadata_detail {
std::string MakeDebugString(absl::string_view key, absl::string_view value) {
return absl::StrCat(key, ": ", value);
}
Slice SliceFromBuffer(const Buffer& buffer) {
return Slice(grpc_slice_ref_internal(buffer.slice));
}
void DestroySliceValue(const Buffer& value) {
grpc_slice_unref_internal(value.slice);
}
} // namespace metadata_detail
} // namespace grpc_core

@ -41,6 +41,51 @@ struct HasSimpleMemento {
sizeof(typename Which::MementoType) <= sizeof(uint64_t); sizeof(typename Which::MementoType) <= sizeof(uint64_t);
}; };
// Storage type for a single metadata entry.
union Buffer {
uint64_t trivial;
void* pointer;
grpc_slice slice;
grpc_mdelem mdelem;
};
// Given a key and a value, concatenate together to make a debug string.
// Split out to avoid template bloat.
std::string MakeDebugString(absl::string_view key, absl::string_view value);
// Wrapper around MakeDebugString.
// For the value part, use two functions - one to extract a typed field from
// Buffer, and a second (sourced from the trait) to generate a displayable debug
// string from the field value. We try to maximize indirection/code sharing here
// as this is not critical path code and we'd like to avoid some code bloat -
// better to scale by number of types than then number of metadata traits!
template <typename Field, typename CompatibleWithField, typename Display>
GPR_ATTRIBUTE_NOINLINE std::string MakeDebugStringPipeline(
absl::string_view key, const Buffer& value,
Field (*field_from_buffer)(const Buffer&),
Display (*display_from_field)(CompatibleWithField)) {
return MakeDebugString(
key, absl::StrCat(display_from_field(field_from_buffer(value))));
}
// Extract a trivial field value from a Buffer - for MakeDebugStringPipeline.
template <typename Field>
Field FieldFromTrivial(const Buffer& value) {
return static_cast<Field>(value.trivial);
}
// Extract a pointer field value from a Buffer - for MakeDebugStringPipeline.
template <typename Field>
Field FieldFromPointer(const Buffer& value) {
return *static_cast<const Field*>(value.pointer);
}
// Extract a Slice from a Buffer.
Slice SliceFromBuffer(const Buffer& buffer);
// Unref the grpc_slice part of a Buffer (assumes it is in fact a grpc_slice).
void DestroySliceValue(const Buffer& value);
} // namespace metadata_detail } // namespace metadata_detail
// A parsed metadata value. // A parsed metadata value.
@ -77,6 +122,7 @@ class ParsedMetadata {
transport_size_(transport_size) { transport_size_(transport_size) {
value_.pointer = new typename Which::MementoType(std::move(value)); value_.pointer = new typename Which::MementoType(std::move(value));
} }
// Construct metadata from a Slice typed value.
template <typename Which> template <typename Which>
ParsedMetadata(Which, Slice value, uint32_t transport_size) ParsedMetadata(Which, Slice value, uint32_t transport_size)
: vtable_(ParsedMetadata::template SliceTraitVTable<Which>()), : vtable_(ParsedMetadata::template SliceTraitVTable<Which>()),
@ -123,7 +169,13 @@ class ParsedMetadata {
uint32_t transport_size() const { return transport_size_; } uint32_t transport_size() const { return transport_size_; }
// Create a new parsed metadata with the same key but a different value. // Create a new parsed metadata with the same key but a different value.
ParsedMetadata WithNewValue(Slice value) const { ParsedMetadata WithNewValue(Slice value) const {
return vtable_->with_new_value(value_, &value); ParsedMetadata result;
result.vtable_ = vtable_;
result.value_ = value_;
result.transport_size_ =
TransportSize(vtable_->key_length(value_), value.length());
vtable_->with_new_value(&value, &result);
return result;
} }
std::string DebugString() const { return vtable_->debug_string(value_); } std::string DebugString() const { return vtable_->debug_string(value_); }
@ -134,24 +186,19 @@ class ParsedMetadata {
} }
private: private:
union Buffer { using Buffer = metadata_detail::Buffer;
uint64_t trivial;
void* pointer;
grpc_slice slice;
grpc_mdelem mdelem;
};
struct VTable { struct VTable {
const bool is_binary_header; const bool is_binary_header;
void (*const destroy)(const Buffer& value); void (*const destroy)(const Buffer& value);
grpc_error_handle (*const set)(const Buffer& value, grpc_error_handle (*const set)(const Buffer& value,
MetadataContainer* container); MetadataContainer* container);
// TODO(ctiller): ideally we'd pass new_value by value here, but there was // result is a bitwise copy of the originating ParsedMetadata.
// an apparent miscompile with gcc-4.9 and WithNewValue - passing a pointer void (*const with_new_value)(Slice* new_value, ParsedMetadata* result);
// here fixed it. std::string (*const debug_string)(const Buffer& value);
ParsedMetadata (*const with_new_value)(const Buffer& value, // TODO(ctiller): when we delete mdelem, make this a simple integer constant
Slice* new_value); // on the vtable
std::string (*debug_string)(const Buffer& value); size_t (*const key_length)(const Buffer& value);
}; };
static const VTable* EmptyVTable(); static const VTable* EmptyVTable();
@ -164,11 +211,18 @@ class ParsedMetadata {
template <bool kIsBinaryHeader> template <bool kIsBinaryHeader>
static const VTable* MdelemVtable(); static const VTable* MdelemVtable();
template <Slice (*ParseMemento)(Slice)>
GPR_ATTRIBUTE_NOINLINE void WithNewValueSetSlice(Slice* slice) {
value_.slice = ParseMemento(std::move(*slice)).TakeCSlice();
}
const VTable* vtable_; const VTable* vtable_;
Buffer value_; Buffer value_;
uint32_t transport_size_; uint32_t transport_size_;
}; };
namespace metadata_detail {} // namespace metadata_detail
template <typename MetadataContainer> template <typename MetadataContainer>
const typename ParsedMetadata<MetadataContainer>::VTable* const typename ParsedMetadata<MetadataContainer>::VTable*
ParsedMetadata<MetadataContainer>::EmptyVTable() { ParsedMetadata<MetadataContainer>::EmptyVTable() {
@ -179,9 +233,12 @@ ParsedMetadata<MetadataContainer>::EmptyVTable() {
// set // set
[](const Buffer&, MetadataContainer*) { return GRPC_ERROR_NONE; }, [](const Buffer&, MetadataContainer*) { return GRPC_ERROR_NONE; },
// with_new_value // with_new_value
[](const Buffer&, Slice*) { return ParsedMetadata(); }, [](Slice*, ParsedMetadata*) {},
// debug_string // debug_string
[](const Buffer&) -> std::string { return "empty"; }}; [](const Buffer&) -> std::string { return "empty"; },
// key_length
[](const Buffer&) -> size_t { return 0; },
};
return &vtable; return &vtable;
} }
@ -201,18 +258,19 @@ ParsedMetadata<MetadataContainer>::TrivialTraitVTable() {
return GRPC_ERROR_NONE; return GRPC_ERROR_NONE;
}, },
// with_new_value // with_new_value
[](const Buffer&, Slice* value) { [](Slice* value, ParsedMetadata* result) {
const auto length = value->length(); result->value_.trivial = Which::ParseMemento(std::move(*value));
return ParsedMetadata(Which(), Which::ParseMemento(std::move(*value)),
TransportSize(Which::key().length(), length));
}, },
// debug_string // debug_string
[](const Buffer& value) { [](const Buffer& value) {
return absl::StrCat( return metadata_detail::MakeDebugStringPipeline(
Which::key(), ": ", Which::key(), value,
Which::DisplayValue( metadata_detail::FieldFromTrivial<typename Which::MementoType>,
static_cast<typename Which::MementoType>(value.trivial))); Which::DisplayValue);
}}; },
// key_length
[](const Buffer&) { return Which::key().size(); },
};
return &vtable; return &vtable;
} }
@ -233,16 +291,20 @@ ParsedMetadata<MetadataContainer>::NonTrivialTraitVTable() {
return GRPC_ERROR_NONE; return GRPC_ERROR_NONE;
}, },
// with_new_value // with_new_value
[](const Buffer&, Slice* value) { [](Slice* value, ParsedMetadata* result) {
const auto length = value->length(); result->value_.pointer = new
return ParsedMetadata(Which(), Which::ParseMemento(std::move(*value)), typename Which::MementoType(Which::ParseMemento(std::move(*value)));
TransportSize(Which::key().length(), length));
}, },
// debug_string // debug_string
[](const Buffer& value) { [](const Buffer& value) {
auto* p = static_cast<typename Which::MementoType*>(value.pointer); return metadata_detail::MakeDebugStringPipeline(
return absl::StrCat(Which::key(), ": ", Which::DisplayValue(*p)); Which::key(), value,
}}; metadata_detail::FieldFromPointer<typename Which::MementoType>,
Which::DisplayValue);
},
// key_length
[](const Buffer&) { return Which::key().size(); },
};
return &vtable; return &vtable;
} }
@ -253,24 +315,26 @@ ParsedMetadata<MetadataContainer>::SliceTraitVTable() {
static const VTable vtable = { static const VTable vtable = {
absl::EndsWith(Which::key(), "-bin"), absl::EndsWith(Which::key(), "-bin"),
// destroy // destroy
[](const Buffer& value) { grpc_slice_unref_internal(value.slice); }, metadata_detail::DestroySliceValue,
// set // set
[](const Buffer& value, MetadataContainer* map) { [](const Buffer& value, MetadataContainer* map) {
map->Set(Which(), Slice(grpc_slice_ref_internal(value.slice))); map->Set(Which(), Which::MementoToValue(
metadata_detail::SliceFromBuffer(value)));
return GRPC_ERROR_NONE; return GRPC_ERROR_NONE;
}, },
// with_new_value // with_new_value
[](const Buffer&, Slice* value) { [](Slice* value, ParsedMetadata* result) {
const auto length = value->length(); result->WithNewValueSetSlice<Which::ParseMemento>(value);
return ParsedMetadata(Which(), Which::ParseMemento(std::move(*value)),
TransportSize(Which::key().length(), length));
}, },
// debug_string // debug_string
[](const Buffer& value) { [](const Buffer& value) {
return absl::StrCat( return metadata_detail::MakeDebugStringPipeline(
Which::key(), ": ", Which::key(), value, metadata_detail::SliceFromBuffer,
Which::DisplayValue(Slice(grpc_slice_ref_internal(value.slice)))); Which::DisplayValue);
}}; },
// key_length
[](const Buffer&) { return Which::key().size(); },
};
return &vtable; return &vtable;
} }
@ -294,16 +358,21 @@ ParsedMetadata<MetadataContainer>::MdelemVtable() {
return err; return err;
}, },
// with_new_value // with_new_value
[](const Buffer& value, Slice* value_slice) { [](Slice* value_slice, ParsedMetadata* result) {
return ParsedMetadata(grpc_mdelem_from_slices( result->value_.mdelem = grpc_mdelem_from_slices(
static_cast<const ManagedMemorySlice&>( static_cast<const ManagedMemorySlice&>(
grpc_slice_ref_internal(GRPC_MDKEY(value.mdelem))), grpc_slice_ref_internal(GRPC_MDKEY(result->value_.mdelem))),
value_slice->TakeCSlice())); value_slice->TakeCSlice());
}, },
// debug_string // debug_string
[](const Buffer& value) { [](const Buffer& value) {
return absl::StrCat(StringViewFromSlice(GRPC_MDKEY(value.mdelem)), ": ", return metadata_detail::MakeDebugString(
StringViewFromSlice(GRPC_MDKEY(value.mdelem)),
StringViewFromSlice(GRPC_MDVALUE(value.mdelem))); StringViewFromSlice(GRPC_MDVALUE(value.mdelem)));
},
// key_length
[](const Buffer& value) {
return GRPC_SLICE_LENGTH(GRPC_MDKEY(value.mdelem));
}}; }};
return &vtable; return &vtable;
} }

@ -35,506 +35,506 @@ StaticMetadata g_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT] = {
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[3].base, 10, StaticMetadataSlice(&g_static_metadata_slice_refcounts[3].base, 10,
g_static_metadata_bytes + 19), g_static_metadata_bytes + 19),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[27].base, 0, StaticMetadataSlice(&g_static_metadata_slice_refcounts[19].base, 0,
g_static_metadata_bytes + 334), g_static_metadata_bytes + 217),
0), 0),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[1].base, 7, StaticMetadataSlice(&g_static_metadata_slice_refcounts[1].base, 7,
g_static_metadata_bytes + 5), g_static_metadata_bytes + 5),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[39].base, 3, StaticMetadataSlice(&g_static_metadata_slice_refcounts[31].base, 3,
g_static_metadata_bytes + 720), g_static_metadata_bytes + 603),
1), 1),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[1].base, 7, StaticMetadataSlice(&g_static_metadata_slice_refcounts[1].base, 7,
g_static_metadata_bytes + 5), g_static_metadata_bytes + 5),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[40].base, 4, StaticMetadataSlice(&g_static_metadata_slice_refcounts[32].base, 4,
g_static_metadata_bytes + 723), g_static_metadata_bytes + 606),
2), 2),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[0].base, 5, StaticMetadataSlice(&g_static_metadata_slice_refcounts[0].base, 5,
g_static_metadata_bytes + 0), g_static_metadata_bytes + 0),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[41].base, 1, StaticMetadataSlice(&g_static_metadata_slice_refcounts[33].base, 1,
g_static_metadata_bytes + 727), g_static_metadata_bytes + 610),
3), 3),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[0].base, 5, StaticMetadataSlice(&g_static_metadata_slice_refcounts[0].base, 5,
g_static_metadata_bytes + 0), g_static_metadata_bytes + 0),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[42].base, 11, StaticMetadataSlice(&g_static_metadata_slice_refcounts[34].base, 11,
g_static_metadata_bytes + 728), g_static_metadata_bytes + 611),
4), 4),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[4].base, 7, StaticMetadataSlice(&g_static_metadata_slice_refcounts[4].base, 7,
g_static_metadata_bytes + 29), g_static_metadata_bytes + 29),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[43].base, 4, StaticMetadataSlice(&g_static_metadata_slice_refcounts[35].base, 4,
g_static_metadata_bytes + 739), g_static_metadata_bytes + 622),
5), 5),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[4].base, 7, StaticMetadataSlice(&g_static_metadata_slice_refcounts[4].base, 7,
g_static_metadata_bytes + 29), g_static_metadata_bytes + 29),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[44].base, 5, StaticMetadataSlice(&g_static_metadata_slice_refcounts[36].base, 5,
g_static_metadata_bytes + 743), g_static_metadata_bytes + 626),
6), 6),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[2].base, 7, StaticMetadataSlice(&g_static_metadata_slice_refcounts[2].base, 7,
g_static_metadata_bytes + 12), g_static_metadata_bytes + 12),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[45].base, 3, StaticMetadataSlice(&g_static_metadata_slice_refcounts[37].base, 3,
g_static_metadata_bytes + 748), g_static_metadata_bytes + 631),
7), 7),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[2].base, 7, StaticMetadataSlice(&g_static_metadata_slice_refcounts[2].base, 7,
g_static_metadata_bytes + 12), g_static_metadata_bytes + 12),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[46].base, 3, StaticMetadataSlice(&g_static_metadata_slice_refcounts[38].base, 3,
g_static_metadata_bytes + 751), g_static_metadata_bytes + 634),
8), 8),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[2].base, 7, StaticMetadataSlice(&g_static_metadata_slice_refcounts[2].base, 7,
g_static_metadata_bytes + 12), g_static_metadata_bytes + 12),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[47].base, 3, StaticMetadataSlice(&g_static_metadata_slice_refcounts[39].base, 3,
g_static_metadata_bytes + 754), g_static_metadata_bytes + 637),
9), 9),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[2].base, 7, StaticMetadataSlice(&g_static_metadata_slice_refcounts[2].base, 7,
g_static_metadata_bytes + 12), g_static_metadata_bytes + 12),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[48].base, 3, StaticMetadataSlice(&g_static_metadata_slice_refcounts[40].base, 3,
g_static_metadata_bytes + 757), g_static_metadata_bytes + 640),
10), 10),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[2].base, 7, StaticMetadataSlice(&g_static_metadata_slice_refcounts[2].base, 7,
g_static_metadata_bytes + 12), g_static_metadata_bytes + 12),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[49].base, 3, StaticMetadataSlice(&g_static_metadata_slice_refcounts[41].base, 3,
g_static_metadata_bytes + 760), g_static_metadata_bytes + 643),
11), 11),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[2].base, 7, StaticMetadataSlice(&g_static_metadata_slice_refcounts[2].base, 7,
g_static_metadata_bytes + 12), g_static_metadata_bytes + 12),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[50].base, 3, StaticMetadataSlice(&g_static_metadata_slice_refcounts[42].base, 3,
g_static_metadata_bytes + 763), g_static_metadata_bytes + 646),
12), 12),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[2].base, 7, StaticMetadataSlice(&g_static_metadata_slice_refcounts[2].base, 7,
g_static_metadata_bytes + 12), g_static_metadata_bytes + 12),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[51].base, 3, StaticMetadataSlice(&g_static_metadata_slice_refcounts[43].base, 3,
g_static_metadata_bytes + 766), g_static_metadata_bytes + 649),
13), 13),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[52].base, 14, StaticMetadataSlice(&g_static_metadata_slice_refcounts[44].base, 14,
g_static_metadata_bytes + 769), g_static_metadata_bytes + 652),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[27].base, 0, StaticMetadataSlice(&g_static_metadata_slice_refcounts[19].base, 0,
g_static_metadata_bytes + 334), g_static_metadata_bytes + 217),
14), 14),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[15].base, 15, StaticMetadataSlice(&g_static_metadata_slice_refcounts[10].base, 15,
g_static_metadata_bytes + 184), g_static_metadata_bytes + 108),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[53].base, 13, StaticMetadataSlice(&g_static_metadata_slice_refcounts[45].base, 13,
g_static_metadata_bytes + 783), g_static_metadata_bytes + 666),
15), 15),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[54].base, 15, StaticMetadataSlice(&g_static_metadata_slice_refcounts[46].base, 15,
g_static_metadata_bytes + 796), g_static_metadata_bytes + 679),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[27].base, 0, StaticMetadataSlice(&g_static_metadata_slice_refcounts[19].base, 0,
g_static_metadata_bytes + 334), g_static_metadata_bytes + 217),
16), 16),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[55].base, 13, StaticMetadataSlice(&g_static_metadata_slice_refcounts[47].base, 13,
g_static_metadata_bytes + 811), g_static_metadata_bytes + 694),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[27].base, 0, StaticMetadataSlice(&g_static_metadata_slice_refcounts[19].base, 0,
g_static_metadata_bytes + 334), g_static_metadata_bytes + 217),
17), 17),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[56].base, 6, StaticMetadataSlice(&g_static_metadata_slice_refcounts[48].base, 6,
g_static_metadata_bytes + 824), g_static_metadata_bytes + 707),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[27].base, 0, StaticMetadataSlice(&g_static_metadata_slice_refcounts[19].base, 0,
g_static_metadata_bytes + 334), g_static_metadata_bytes + 217),
18), 18),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[57].base, 27, StaticMetadataSlice(&g_static_metadata_slice_refcounts[49].base, 27,
g_static_metadata_bytes + 830), g_static_metadata_bytes + 713),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[27].base, 0, StaticMetadataSlice(&g_static_metadata_slice_refcounts[19].base, 0,
g_static_metadata_bytes + 334), g_static_metadata_bytes + 217),
19), 19),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[58].base, 3, StaticMetadataSlice(&g_static_metadata_slice_refcounts[50].base, 3,
g_static_metadata_bytes + 857), g_static_metadata_bytes + 740),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[27].base, 0, StaticMetadataSlice(&g_static_metadata_slice_refcounts[19].base, 0,
g_static_metadata_bytes + 334), g_static_metadata_bytes + 217),
20), 20),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[59].base, 5, StaticMetadataSlice(&g_static_metadata_slice_refcounts[51].base, 5,
g_static_metadata_bytes + 860), g_static_metadata_bytes + 743),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[27].base, 0, StaticMetadataSlice(&g_static_metadata_slice_refcounts[19].base, 0,
g_static_metadata_bytes + 334), g_static_metadata_bytes + 217),
21), 21),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[60].base, 13, StaticMetadataSlice(&g_static_metadata_slice_refcounts[52].base, 13,
g_static_metadata_bytes + 865), g_static_metadata_bytes + 748),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[27].base, 0, StaticMetadataSlice(&g_static_metadata_slice_refcounts[19].base, 0,
g_static_metadata_bytes + 334), g_static_metadata_bytes + 217),
22), 22),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[61].base, 13, StaticMetadataSlice(&g_static_metadata_slice_refcounts[53].base, 13,
g_static_metadata_bytes + 878), g_static_metadata_bytes + 761),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[27].base, 0, StaticMetadataSlice(&g_static_metadata_slice_refcounts[19].base, 0,
g_static_metadata_bytes + 334), g_static_metadata_bytes + 217),
23), 23),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[62].base, 19, StaticMetadataSlice(&g_static_metadata_slice_refcounts[54].base, 19,
g_static_metadata_bytes + 891), g_static_metadata_bytes + 774),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[27].base, 0, StaticMetadataSlice(&g_static_metadata_slice_refcounts[19].base, 0,
g_static_metadata_bytes + 334), g_static_metadata_bytes + 217),
24), 24),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[14].base, 16, StaticMetadataSlice(&g_static_metadata_slice_refcounts[9].base, 16,
g_static_metadata_bytes + 168), g_static_metadata_bytes + 92),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[27].base, 0, StaticMetadataSlice(&g_static_metadata_slice_refcounts[19].base, 0,
g_static_metadata_bytes + 334), g_static_metadata_bytes + 217),
25), 25),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[63].base, 16, StaticMetadataSlice(&g_static_metadata_slice_refcounts[55].base, 16,
g_static_metadata_bytes + 910), g_static_metadata_bytes + 793),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[27].base, 0, StaticMetadataSlice(&g_static_metadata_slice_refcounts[19].base, 0,
g_static_metadata_bytes + 334), g_static_metadata_bytes + 217),
26), 26),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[64].base, 14, StaticMetadataSlice(&g_static_metadata_slice_refcounts[56].base, 14,
g_static_metadata_bytes + 926), g_static_metadata_bytes + 809),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[27].base, 0, StaticMetadataSlice(&g_static_metadata_slice_refcounts[19].base, 0,
g_static_metadata_bytes + 334), g_static_metadata_bytes + 217),
27), 27),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[65].base, 16, StaticMetadataSlice(&g_static_metadata_slice_refcounts[57].base, 16,
g_static_metadata_bytes + 940), g_static_metadata_bytes + 823),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[27].base, 0, StaticMetadataSlice(&g_static_metadata_slice_refcounts[19].base, 0,
g_static_metadata_bytes + 334), g_static_metadata_bytes + 217),
28), 28),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[66].base, 13, StaticMetadataSlice(&g_static_metadata_slice_refcounts[58].base, 13,
g_static_metadata_bytes + 956), g_static_metadata_bytes + 839),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[27].base, 0, StaticMetadataSlice(&g_static_metadata_slice_refcounts[19].base, 0,
g_static_metadata_bytes + 334), g_static_metadata_bytes + 217),
29), 29),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[13].base, 12, StaticMetadataSlice(&g_static_metadata_slice_refcounts[8].base, 12,
g_static_metadata_bytes + 156), g_static_metadata_bytes + 80),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[27].base, 0, StaticMetadataSlice(&g_static_metadata_slice_refcounts[19].base, 0,
g_static_metadata_bytes + 334), g_static_metadata_bytes + 217),
30), 30),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[67].base, 6, StaticMetadataSlice(&g_static_metadata_slice_refcounts[59].base, 6,
g_static_metadata_bytes + 969), g_static_metadata_bytes + 852),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[27].base, 0, StaticMetadataSlice(&g_static_metadata_slice_refcounts[19].base, 0,
g_static_metadata_bytes + 334), g_static_metadata_bytes + 217),
31), 31),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[68].base, 4, StaticMetadataSlice(&g_static_metadata_slice_refcounts[60].base, 4,
g_static_metadata_bytes + 975), g_static_metadata_bytes + 858),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[27].base, 0, StaticMetadataSlice(&g_static_metadata_slice_refcounts[19].base, 0,
g_static_metadata_bytes + 334), g_static_metadata_bytes + 217),
32), 32),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[69].base, 4, StaticMetadataSlice(&g_static_metadata_slice_refcounts[61].base, 4,
g_static_metadata_bytes + 979), g_static_metadata_bytes + 862),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[27].base, 0, StaticMetadataSlice(&g_static_metadata_slice_refcounts[19].base, 0,
g_static_metadata_bytes + 334), g_static_metadata_bytes + 217),
33), 33),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[70].base, 6, StaticMetadataSlice(&g_static_metadata_slice_refcounts[62].base, 6,
g_static_metadata_bytes + 983), g_static_metadata_bytes + 866),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[27].base, 0, StaticMetadataSlice(&g_static_metadata_slice_refcounts[19].base, 0,
g_static_metadata_bytes + 334), g_static_metadata_bytes + 217),
34), 34),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[71].base, 7, StaticMetadataSlice(&g_static_metadata_slice_refcounts[63].base, 7,
g_static_metadata_bytes + 989), g_static_metadata_bytes + 872),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[27].base, 0, StaticMetadataSlice(&g_static_metadata_slice_refcounts[19].base, 0,
g_static_metadata_bytes + 334), g_static_metadata_bytes + 217),
35), 35),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[72].base, 4, StaticMetadataSlice(&g_static_metadata_slice_refcounts[64].base, 4,
g_static_metadata_bytes + 996), g_static_metadata_bytes + 879),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[27].base, 0, StaticMetadataSlice(&g_static_metadata_slice_refcounts[19].base, 0,
g_static_metadata_bytes + 334), g_static_metadata_bytes + 217),
36), 36),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[17].base, 4, StaticMetadataSlice(&g_static_metadata_slice_refcounts[65].base, 4,
g_static_metadata_bytes + 229), g_static_metadata_bytes + 883),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[27].base, 0, StaticMetadataSlice(&g_static_metadata_slice_refcounts[19].base, 0,
g_static_metadata_bytes + 334), g_static_metadata_bytes + 217),
37), 37),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[73].base, 8, StaticMetadataSlice(&g_static_metadata_slice_refcounts[66].base, 8,
g_static_metadata_bytes + 1000), g_static_metadata_bytes + 887),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[27].base, 0, StaticMetadataSlice(&g_static_metadata_slice_refcounts[19].base, 0,
g_static_metadata_bytes + 334), g_static_metadata_bytes + 217),
38), 38),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[74].base, 17, StaticMetadataSlice(&g_static_metadata_slice_refcounts[67].base, 17,
g_static_metadata_bytes + 1008), g_static_metadata_bytes + 895),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[27].base, 0, StaticMetadataSlice(&g_static_metadata_slice_refcounts[19].base, 0,
g_static_metadata_bytes + 334), g_static_metadata_bytes + 217),
39), 39),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[75].base, 13, StaticMetadataSlice(&g_static_metadata_slice_refcounts[68].base, 13,
g_static_metadata_bytes + 1025), g_static_metadata_bytes + 912),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[27].base, 0, StaticMetadataSlice(&g_static_metadata_slice_refcounts[19].base, 0,
g_static_metadata_bytes + 334), g_static_metadata_bytes + 217),
40), 40),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[76].base, 8, StaticMetadataSlice(&g_static_metadata_slice_refcounts[69].base, 8,
g_static_metadata_bytes + 1038), g_static_metadata_bytes + 925),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[27].base, 0, StaticMetadataSlice(&g_static_metadata_slice_refcounts[19].base, 0,
g_static_metadata_bytes + 334), g_static_metadata_bytes + 217),
41), 41),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[77].base, 19, StaticMetadataSlice(&g_static_metadata_slice_refcounts[70].base, 19,
g_static_metadata_bytes + 1046), g_static_metadata_bytes + 933),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[27].base, 0, StaticMetadataSlice(&g_static_metadata_slice_refcounts[19].base, 0,
g_static_metadata_bytes + 334), g_static_metadata_bytes + 217),
42), 42),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[78].base, 13, StaticMetadataSlice(&g_static_metadata_slice_refcounts[71].base, 13,
g_static_metadata_bytes + 1065), g_static_metadata_bytes + 952),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[27].base, 0, StaticMetadataSlice(&g_static_metadata_slice_refcounts[19].base, 0,
g_static_metadata_bytes + 334), g_static_metadata_bytes + 217),
43), 43),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[79].base, 4, StaticMetadataSlice(&g_static_metadata_slice_refcounts[72].base, 4,
g_static_metadata_bytes + 1078), g_static_metadata_bytes + 965),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[27].base, 0, StaticMetadataSlice(&g_static_metadata_slice_refcounts[19].base, 0,
g_static_metadata_bytes + 334), g_static_metadata_bytes + 217),
44), 44),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[80].base, 8, StaticMetadataSlice(&g_static_metadata_slice_refcounts[73].base, 8,
g_static_metadata_bytes + 1082), g_static_metadata_bytes + 969),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[27].base, 0, StaticMetadataSlice(&g_static_metadata_slice_refcounts[19].base, 0,
g_static_metadata_bytes + 334), g_static_metadata_bytes + 217),
45), 45),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[81].base, 12, StaticMetadataSlice(&g_static_metadata_slice_refcounts[74].base, 12,
g_static_metadata_bytes + 1090), g_static_metadata_bytes + 977),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[27].base, 0, StaticMetadataSlice(&g_static_metadata_slice_refcounts[19].base, 0,
g_static_metadata_bytes + 334), g_static_metadata_bytes + 217),
46), 46),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[82].base, 18, StaticMetadataSlice(&g_static_metadata_slice_refcounts[75].base, 18,
g_static_metadata_bytes + 1102), g_static_metadata_bytes + 989),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[27].base, 0, StaticMetadataSlice(&g_static_metadata_slice_refcounts[19].base, 0,
g_static_metadata_bytes + 334), g_static_metadata_bytes + 217),
47), 47),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[83].base, 19, StaticMetadataSlice(&g_static_metadata_slice_refcounts[76].base, 19,
g_static_metadata_bytes + 1120), g_static_metadata_bytes + 1007),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[27].base, 0, StaticMetadataSlice(&g_static_metadata_slice_refcounts[19].base, 0,
g_static_metadata_bytes + 334), g_static_metadata_bytes + 217),
48), 48),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[84].base, 5, StaticMetadataSlice(&g_static_metadata_slice_refcounts[77].base, 5,
g_static_metadata_bytes + 1139), g_static_metadata_bytes + 1026),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[27].base, 0, StaticMetadataSlice(&g_static_metadata_slice_refcounts[19].base, 0,
g_static_metadata_bytes + 334), g_static_metadata_bytes + 217),
49), 49),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[85].base, 7, StaticMetadataSlice(&g_static_metadata_slice_refcounts[78].base, 7,
g_static_metadata_bytes + 1144), g_static_metadata_bytes + 1031),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[27].base, 0, StaticMetadataSlice(&g_static_metadata_slice_refcounts[19].base, 0,
g_static_metadata_bytes + 334), g_static_metadata_bytes + 217),
50), 50),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[86].base, 7, StaticMetadataSlice(&g_static_metadata_slice_refcounts[79].base, 7,
g_static_metadata_bytes + 1151), g_static_metadata_bytes + 1038),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[27].base, 0, StaticMetadataSlice(&g_static_metadata_slice_refcounts[19].base, 0,
g_static_metadata_bytes + 334), g_static_metadata_bytes + 217),
51), 51),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[87].base, 11, StaticMetadataSlice(&g_static_metadata_slice_refcounts[80].base, 11,
g_static_metadata_bytes + 1158), g_static_metadata_bytes + 1045),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[27].base, 0, StaticMetadataSlice(&g_static_metadata_slice_refcounts[19].base, 0,
g_static_metadata_bytes + 334), g_static_metadata_bytes + 217),
52), 52),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[88].base, 6, StaticMetadataSlice(&g_static_metadata_slice_refcounts[81].base, 6,
g_static_metadata_bytes + 1169), g_static_metadata_bytes + 1056),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[27].base, 0, StaticMetadataSlice(&g_static_metadata_slice_refcounts[19].base, 0,
g_static_metadata_bytes + 334), g_static_metadata_bytes + 217),
53), 53),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[89].base, 10, StaticMetadataSlice(&g_static_metadata_slice_refcounts[82].base, 10,
g_static_metadata_bytes + 1175), g_static_metadata_bytes + 1062),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[27].base, 0, StaticMetadataSlice(&g_static_metadata_slice_refcounts[19].base, 0,
g_static_metadata_bytes + 334), g_static_metadata_bytes + 217),
54), 54),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[90].base, 25, StaticMetadataSlice(&g_static_metadata_slice_refcounts[83].base, 25,
g_static_metadata_bytes + 1185), g_static_metadata_bytes + 1072),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[27].base, 0, StaticMetadataSlice(&g_static_metadata_slice_refcounts[19].base, 0,
g_static_metadata_bytes + 334), g_static_metadata_bytes + 217),
55), 55),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[91].base, 17, StaticMetadataSlice(&g_static_metadata_slice_refcounts[84].base, 17,
g_static_metadata_bytes + 1210), g_static_metadata_bytes + 1097),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[27].base, 0, StaticMetadataSlice(&g_static_metadata_slice_refcounts[19].base, 0,
g_static_metadata_bytes + 334), g_static_metadata_bytes + 217),
56), 56),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[22].base, 10, StaticMetadataSlice(&g_static_metadata_slice_refcounts[85].base, 10,
g_static_metadata_bytes + 320), g_static_metadata_bytes + 1114),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[27].base, 0, StaticMetadataSlice(&g_static_metadata_slice_refcounts[19].base, 0,
g_static_metadata_bytes + 334), g_static_metadata_bytes + 217),
57), 57),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[92].base, 4, StaticMetadataSlice(&g_static_metadata_slice_refcounts[86].base, 4,
g_static_metadata_bytes + 1227), g_static_metadata_bytes + 1124),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[27].base, 0, StaticMetadataSlice(&g_static_metadata_slice_refcounts[19].base, 0,
g_static_metadata_bytes + 334), g_static_metadata_bytes + 217),
58), 58),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[93].base, 3, StaticMetadataSlice(&g_static_metadata_slice_refcounts[87].base, 3,
g_static_metadata_bytes + 1231), g_static_metadata_bytes + 1128),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[27].base, 0, StaticMetadataSlice(&g_static_metadata_slice_refcounts[19].base, 0,
g_static_metadata_bytes + 334), g_static_metadata_bytes + 217),
59), 59),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[94].base, 16, StaticMetadataSlice(&g_static_metadata_slice_refcounts[88].base, 16,
g_static_metadata_bytes + 1234), g_static_metadata_bytes + 1131),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[27].base, 0, StaticMetadataSlice(&g_static_metadata_slice_refcounts[19].base, 0,
g_static_metadata_bytes + 334), g_static_metadata_bytes + 217),
60), 60),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[6].base, 11, StaticMetadataSlice(&g_static_metadata_slice_refcounts[5].base, 11,
g_static_metadata_bytes + 48), g_static_metadata_bytes + 36),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[95].base, 1, StaticMetadataSlice(&g_static_metadata_slice_refcounts[89].base, 1,
g_static_metadata_bytes + 1250), g_static_metadata_bytes + 1147),
61), 61),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[6].base, 11, StaticMetadataSlice(&g_static_metadata_slice_refcounts[5].base, 11,
g_static_metadata_bytes + 48), g_static_metadata_bytes + 36),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[23].base, 1, StaticMetadataSlice(&g_static_metadata_slice_refcounts[15].base, 1,
g_static_metadata_bytes + 330), g_static_metadata_bytes + 213),
62), 62),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[6].base, 11, StaticMetadataSlice(&g_static_metadata_slice_refcounts[5].base, 11,
g_static_metadata_bytes + 48), g_static_metadata_bytes + 36),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[24].base, 1, StaticMetadataSlice(&g_static_metadata_slice_refcounts[16].base, 1,
g_static_metadata_bytes + 331), g_static_metadata_bytes + 214),
63), 63),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[8].base, 13, StaticMetadataSlice(&g_static_metadata_slice_refcounts[6].base, 13,
g_static_metadata_bytes + 75), g_static_metadata_bytes + 47),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[96].base, 8, StaticMetadataSlice(&g_static_metadata_slice_refcounts[90].base, 8,
g_static_metadata_bytes + 1251), g_static_metadata_bytes + 1148),
64), 64),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[8].base, 13, StaticMetadataSlice(&g_static_metadata_slice_refcounts[6].base, 13,
g_static_metadata_bytes + 75), g_static_metadata_bytes + 47),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[35].base, 4, StaticMetadataSlice(&g_static_metadata_slice_refcounts[27].base, 4,
g_static_metadata_bytes + 695), g_static_metadata_bytes + 578),
65), 65),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[8].base, 13, StaticMetadataSlice(&g_static_metadata_slice_refcounts[6].base, 13,
g_static_metadata_bytes + 75), g_static_metadata_bytes + 47),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[34].base, 7, StaticMetadataSlice(&g_static_metadata_slice_refcounts[26].base, 7,
g_static_metadata_bytes + 688), g_static_metadata_bytes + 571),
66), 66),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[13].base, 12, StaticMetadataSlice(&g_static_metadata_slice_refcounts[8].base, 12,
g_static_metadata_bytes + 156), g_static_metadata_bytes + 80),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[97].base, 16, StaticMetadataSlice(&g_static_metadata_slice_refcounts[91].base, 16,
g_static_metadata_bytes + 1259), g_static_metadata_bytes + 1156),
67), 67),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[4].base, 7, StaticMetadataSlice(&g_static_metadata_slice_refcounts[4].base, 7,
g_static_metadata_bytes + 29), g_static_metadata_bytes + 29),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[98].base, 4, StaticMetadataSlice(&g_static_metadata_slice_refcounts[92].base, 4,
g_static_metadata_bytes + 1275), g_static_metadata_bytes + 1172),
68), 68),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[1].base, 7, StaticMetadataSlice(&g_static_metadata_slice_refcounts[1].base, 7,
g_static_metadata_bytes + 5), g_static_metadata_bytes + 5),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[99].base, 3, StaticMetadataSlice(&g_static_metadata_slice_refcounts[93].base, 3,
g_static_metadata_bytes + 1279), g_static_metadata_bytes + 1176),
69), 69),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[15].base, 15, StaticMetadataSlice(&g_static_metadata_slice_refcounts[10].base, 15,
g_static_metadata_bytes + 184), g_static_metadata_bytes + 108),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[27].base, 0, StaticMetadataSlice(&g_static_metadata_slice_refcounts[19].base, 0,
g_static_metadata_bytes + 334), g_static_metadata_bytes + 217),
70), 70),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[14].base, 16, StaticMetadataSlice(&g_static_metadata_slice_refcounts[9].base, 16,
g_static_metadata_bytes + 168), g_static_metadata_bytes + 92),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[96].base, 8, StaticMetadataSlice(&g_static_metadata_slice_refcounts[90].base, 8,
g_static_metadata_bytes + 1251), g_static_metadata_bytes + 1148),
71), 71),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[14].base, 16, StaticMetadataSlice(&g_static_metadata_slice_refcounts[9].base, 16,
g_static_metadata_bytes + 168), g_static_metadata_bytes + 92),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[35].base, 4, StaticMetadataSlice(&g_static_metadata_slice_refcounts[27].base, 4,
g_static_metadata_bytes + 695), g_static_metadata_bytes + 578),
72), 72),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[100].base, 11, StaticMetadataSlice(&g_static_metadata_slice_refcounts[94].base, 11,
g_static_metadata_bytes + 1282), g_static_metadata_bytes + 1179),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[27].base, 0, StaticMetadataSlice(&g_static_metadata_slice_refcounts[19].base, 0,
g_static_metadata_bytes + 334), g_static_metadata_bytes + 217),
73), 73),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[9].base, 20, StaticMetadataSlice(&g_static_metadata_slice_refcounts[7].base, 20,
g_static_metadata_bytes + 88), g_static_metadata_bytes + 60),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[96].base, 8, StaticMetadataSlice(&g_static_metadata_slice_refcounts[90].base, 8,
g_static_metadata_bytes + 1251), g_static_metadata_bytes + 1148),
74), 74),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[9].base, 20, StaticMetadataSlice(&g_static_metadata_slice_refcounts[7].base, 20,
g_static_metadata_bytes + 88), g_static_metadata_bytes + 60),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[34].base, 7, StaticMetadataSlice(&g_static_metadata_slice_refcounts[26].base, 7,
g_static_metadata_bytes + 688), g_static_metadata_bytes + 571),
75), 75),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[9].base, 20, StaticMetadataSlice(&g_static_metadata_slice_refcounts[7].base, 20,
g_static_metadata_bytes + 88), g_static_metadata_bytes + 60),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[101].base, 16, StaticMetadataSlice(&g_static_metadata_slice_refcounts[95].base, 16,
g_static_metadata_bytes + 1293), g_static_metadata_bytes + 1190),
76), 76),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[9].base, 20, StaticMetadataSlice(&g_static_metadata_slice_refcounts[7].base, 20,
g_static_metadata_bytes + 88), g_static_metadata_bytes + 60),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[35].base, 4, StaticMetadataSlice(&g_static_metadata_slice_refcounts[27].base, 4,
g_static_metadata_bytes + 695), g_static_metadata_bytes + 578),
77), 77),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[9].base, 20, StaticMetadataSlice(&g_static_metadata_slice_refcounts[7].base, 20,
g_static_metadata_bytes + 88), g_static_metadata_bytes + 60),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[102].base, 13, StaticMetadataSlice(&g_static_metadata_slice_refcounts[96].base, 13,
g_static_metadata_bytes + 1309), g_static_metadata_bytes + 1206),
78), 78),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[9].base, 20, StaticMetadataSlice(&g_static_metadata_slice_refcounts[7].base, 20,
g_static_metadata_bytes + 88), g_static_metadata_bytes + 60),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[103].base, 12, StaticMetadataSlice(&g_static_metadata_slice_refcounts[97].base, 12,
g_static_metadata_bytes + 1322), g_static_metadata_bytes + 1219),
79), 79),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[9].base, 20, StaticMetadataSlice(&g_static_metadata_slice_refcounts[7].base, 20,
g_static_metadata_bytes + 88), g_static_metadata_bytes + 60),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[104].base, 21, StaticMetadataSlice(&g_static_metadata_slice_refcounts[98].base, 21,
g_static_metadata_bytes + 1334), g_static_metadata_bytes + 1231),
80), 80),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[15].base, 15, StaticMetadataSlice(&g_static_metadata_slice_refcounts[10].base, 15,
g_static_metadata_bytes + 184), g_static_metadata_bytes + 108),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[96].base, 8, StaticMetadataSlice(&g_static_metadata_slice_refcounts[90].base, 8,
g_static_metadata_bytes + 1251), g_static_metadata_bytes + 1148),
81), 81),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[15].base, 15, StaticMetadataSlice(&g_static_metadata_slice_refcounts[10].base, 15,
g_static_metadata_bytes + 184), g_static_metadata_bytes + 108),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[35].base, 4, StaticMetadataSlice(&g_static_metadata_slice_refcounts[27].base, 4,
g_static_metadata_bytes + 695), g_static_metadata_bytes + 578),
82), 82),
StaticMetadata( StaticMetadata(
StaticMetadataSlice(&g_static_metadata_slice_refcounts[15].base, 15, StaticMetadataSlice(&g_static_metadata_slice_refcounts[10].base, 15,
g_static_metadata_bytes + 184), g_static_metadata_bytes + 108),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[102].base, 13, StaticMetadataSlice(&g_static_metadata_slice_refcounts[96].base, 13,
g_static_metadata_bytes + 1309), g_static_metadata_bytes + 1206),
83), 83),
}; };
@ -978,17 +978,17 @@ uintptr_t grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 4, 4, 6, 6, 8, 8, 2, 4, 4}; 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 4, 4, 6, 6, 8, 8, 2, 4, 4};
static const int8_t elems_r[] = { static const int8_t elems_r[] = {
15, 10, -8, 0, 2, -77, -42, 0, 9, -4, 0, 0, 0, 11, 0, 18, 11, -8, 0, -1, -46, 11, 0, 13, 10, 7, 0, 0, 0,
-7, 0, 5, 0, 0, 0, 0, -4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, -63, 0, -47, -68, -48, -71, -72, 0, 0, 0, -51, 0, -54, -55, -56, -57, -58, -59, -60, -61, -62, -63,
30, 29, 28, 27, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 0, 33, 32, 31, 30, 29, 29, 28, 27, 26, 25, 24, 23, 22,
17, 16, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8,
3, 2, 1, 1, 2, 1, 0, 0, 0, 0, 0, -10, 0}; 7, 6, 5, 4, 4, 3, 0, 0, 0, 0, 0, -8, 0};
static uint32_t elems_phash(uint32_t i) { static uint32_t elems_phash(uint32_t i) {
i -= 41; i -= 33;
uint32_t x = i % 103; uint32_t x = i % 97;
uint32_t y = i / 103; uint32_t y = i / 97;
uint32_t h = x; uint32_t h = x;
if (y < GPR_ARRAY_SIZE(elems_r)) { if (y < GPR_ARRAY_SIZE(elems_r)) {
uint32_t delta = static_cast<uint32_t>(elems_r[y]); uint32_t delta = static_cast<uint32_t>(elems_r[y]);
@ -998,25 +998,25 @@ static uint32_t elems_phash(uint32_t i) {
} }
static const uint16_t elem_keys[] = { static const uint16_t elem_keys[] = {
255, 256, 257, 258, 259, 260, 261, 979, 980, 1602, 144, 145, 235, 236, 237, 238, 239, 240, 241, 719, 720, 431, 432, 130,
463, 464, 1497, 41, 42, 1610, 874, 875, 653, 654, 1505, 1392, 131, 1009, 910, 811, 620, 621, 33, 34, 584, 1017, 918, 4375,
725, 1812, 2337, 5487, 5802, 6012, 6117, 6222, 6327, 6432, 6537, 1628, 4573, 4672, 4771, 4870, 4969, 5068, 5167, 5266, 5365, 5464, 5563, 5662,
6642, 6747, 6852, 6957, 7062, 7167, 7272, 7377, 7482, 7587, 7692, 5697, 5761, 5860, 5959, 1035, 6058, 6157, 6256, 6355, 6454, 6553, 6652, 6751,
7797, 7902, 5907, 8007, 8112, 8217, 8322, 8427, 8532, 8637, 8742, 8847, 6850, 6949, 7048, 7147, 7246, 7345, 7444, 7543, 7642, 7741, 7840, 7939,
8952, 9057, 9162, 9267, 9372, 9477, 9582, 518, 9687, 1041, 204, 9792, 8038, 8137, 8236, 8335, 8434, 8533, 488, 8632, 8731, 9325, 0, 783,
9897, 10527, 1046, 1047, 1048, 1049, 1671, 0, 936, 0, 0, 1566, 0, 192, 0, 0, 788, 789, 790, 791, 684, 316, 0, 0,
1677, 0, 0, 342, 0, 0, 0, 0, 0, 1462}; 1080, 981, 0, 883, 510, 511, 1086};
static const uint8_t elem_idxs[] = { static const uint8_t elem_idxs[] = {
7, 8, 9, 10, 11, 12, 13, 75, 77, 70, 1, 2, 5, 6, 25, 3, 7, 8, 9, 10, 11, 12, 13, 75, 77, 5, 6, 1, 2, 70, 25, 30,
4, 82, 66, 65, 62, 63, 72, 30, 61, 37, 57, 14, 17, 19, 20, 21, 66, 65, 3, 4, 61, 82, 72, 14, 16, 17, 18, 19, 20, 21, 22, 23,
22, 23, 24, 15, 26, 27, 28, 29, 31, 32, 33, 34, 35, 36, 38, 16, 24, 26, 27, 28, 29, 31, 32, 15, 33, 34, 35, 36, 37, 38, 39, 40,
39, 40, 18, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
54, 55, 56, 68, 58, 74, 69, 59, 60, 73, 76, 78, 79, 80, 81, 255, 57, 58, 68, 59, 60, 73, 255, 74, 255, 69, 255, 255, 76, 78, 79, 80,
64, 255, 255, 71, 83, 255, 255, 0, 255, 255, 255, 255, 255, 67}; 64, 0, 255, 255, 81, 71, 255, 67, 62, 63, 83};
grpc_mdelem grpc_static_mdelem_for_static_strings(intptr_t a, intptr_t b) { grpc_mdelem grpc_static_mdelem_for_static_strings(intptr_t a, intptr_t b) {
if (a == -1 || b == -1) return GRPC_MDNULL; if (a == -1 || b == -1) return GRPC_MDNULL;
uint32_t k = static_cast<uint32_t>(a * 105 + b); uint32_t k = static_cast<uint32_t>(a * 99 + b);
uint32_t h = elems_phash(k); uint32_t h = elems_phash(k);
return h < GPR_ARRAY_SIZE(elem_keys) && elem_keys[h] == k && return h < GPR_ARRAY_SIZE(elem_keys) && elem_keys[h] == k &&
elem_idxs[h] != 255 elem_idxs[h] != 255

@ -264,22 +264,15 @@ typedef enum {
GRPC_BATCH_STATUS, GRPC_BATCH_STATUS,
GRPC_BATCH_AUTHORITY, GRPC_BATCH_AUTHORITY,
GRPC_BATCH_SCHEME, GRPC_BATCH_SCHEME,
GRPC_BATCH_GRPC_MESSAGE,
GRPC_BATCH_GRPC_STATUS, GRPC_BATCH_GRPC_STATUS,
GRPC_BATCH_GRPC_PAYLOAD_BIN,
GRPC_BATCH_GRPC_ENCODING, GRPC_BATCH_GRPC_ENCODING,
GRPC_BATCH_GRPC_ACCEPT_ENCODING, GRPC_BATCH_GRPC_ACCEPT_ENCODING,
GRPC_BATCH_GRPC_SERVER_STATS_BIN,
GRPC_BATCH_GRPC_TAGS_BIN,
GRPC_BATCH_GRPC_TRACE_BIN,
GRPC_BATCH_CONTENT_TYPE, GRPC_BATCH_CONTENT_TYPE,
GRPC_BATCH_CONTENT_ENCODING, GRPC_BATCH_CONTENT_ENCODING,
GRPC_BATCH_ACCEPT_ENCODING, GRPC_BATCH_ACCEPT_ENCODING,
GRPC_BATCH_GRPC_INTERNAL_ENCODING_REQUEST, GRPC_BATCH_GRPC_INTERNAL_ENCODING_REQUEST,
GRPC_BATCH_HOST,
GRPC_BATCH_GRPC_PREVIOUS_RPC_ATTEMPTS, GRPC_BATCH_GRPC_PREVIOUS_RPC_ATTEMPTS,
GRPC_BATCH_GRPC_RETRY_PUSHBACK_MS, GRPC_BATCH_GRPC_RETRY_PUSHBACK_MS,
GRPC_BATCH_X_ENDPOINT_LOAD_METRICS_BIN,
GRPC_BATCH_CALLOUTS_COUNT GRPC_BATCH_CALLOUTS_COUNT
} grpc_metadata_batch_callouts_index; } grpc_metadata_batch_callouts_index;
@ -291,22 +284,15 @@ typedef union {
struct grpc_linked_mdelem* status; struct grpc_linked_mdelem* status;
struct grpc_linked_mdelem* authority; struct grpc_linked_mdelem* authority;
struct grpc_linked_mdelem* scheme; struct grpc_linked_mdelem* scheme;
struct grpc_linked_mdelem* grpc_message;
struct grpc_linked_mdelem* grpc_status; struct grpc_linked_mdelem* grpc_status;
struct grpc_linked_mdelem* grpc_payload_bin;
struct grpc_linked_mdelem* grpc_encoding; struct grpc_linked_mdelem* grpc_encoding;
struct grpc_linked_mdelem* grpc_accept_encoding; struct grpc_linked_mdelem* grpc_accept_encoding;
struct grpc_linked_mdelem* grpc_server_stats_bin;
struct grpc_linked_mdelem* grpc_tags_bin;
struct grpc_linked_mdelem* grpc_trace_bin;
struct grpc_linked_mdelem* content_type; struct grpc_linked_mdelem* content_type;
struct grpc_linked_mdelem* content_encoding; struct grpc_linked_mdelem* content_encoding;
struct grpc_linked_mdelem* accept_encoding; struct grpc_linked_mdelem* accept_encoding;
struct grpc_linked_mdelem* grpc_internal_encoding_request; struct grpc_linked_mdelem* grpc_internal_encoding_request;
struct grpc_linked_mdelem* host;
struct grpc_linked_mdelem* grpc_previous_rpc_attempts; struct grpc_linked_mdelem* grpc_previous_rpc_attempts;
struct grpc_linked_mdelem* grpc_retry_pushback_ms; struct grpc_linked_mdelem* grpc_retry_pushback_ms;
struct grpc_linked_mdelem* x_endpoint_load_metrics_bin;
} named; } named;
} grpc_metadata_batch_callouts; } grpc_metadata_batch_callouts;

@ -100,19 +100,16 @@ void OpenCensusCallTracer::OpenCensusCallAttemptTracer::
size_t tracing_len = TraceContextSerialize(context_.Context(), tracing_buf, size_t tracing_len = TraceContextSerialize(context_.Context(), tracing_buf,
kMaxTraceContextLen); kMaxTraceContextLen);
if (tracing_len > 0) { if (tracing_len > 0) {
GRPC_LOG_IF_ERROR( send_initial_metadata->Set(grpc_core::GrpcTraceBinMetadata(),
"census grpc_filter", grpc_core::Slice(grpc_core::UnmanagedMemorySlice(
send_initial_metadata->Append(grpc_mdelem_from_slices( tracing_buf, tracing_len)));
GRPC_MDSTR_GRPC_TRACE_BIN,
grpc_core::UnmanagedMemorySlice(tracing_buf, tracing_len))));
} }
grpc_slice tags = grpc_empty_slice(); grpc_slice tags = grpc_empty_slice();
// TODO(unknown): Add in tagging serialization. // TODO(unknown): Add in tagging serialization.
size_t encoded_tags_len = StatsContextSerialize(kMaxTagsLen, &tags); size_t encoded_tags_len = StatsContextSerialize(kMaxTagsLen, &tags);
if (encoded_tags_len > 0) { if (encoded_tags_len > 0) {
GRPC_LOG_IF_ERROR("census grpc_filter", send_initial_metadata->Set(grpc_core::GrpcTagsBinMetadata(),
send_initial_metadata->Append(grpc_mdelem_from_slices( grpc_core::Slice(tags));
GRPC_MDSTR_GRPC_TAGS_BIN, tags)));
} }
} }
@ -129,14 +126,12 @@ void OpenCensusCallTracer::OpenCensusCallAttemptTracer::RecordReceivedMessage(
namespace { namespace {
void FilterTrailingMetadata(grpc_metadata_batch* b, uint64_t* elapsed_time) { void FilterTrailingMetadata(grpc_metadata_batch* b, uint64_t* elapsed_time) {
if (b->legacy_index()->named.grpc_server_stats_bin != nullptr) { absl::optional<grpc_core::Slice> grpc_server_stats_bin =
b->Take(grpc_core::GrpcServerStatsBinMetadata());
if (grpc_server_stats_bin.has_value()) {
ServerStatsDeserialize( ServerStatsDeserialize(
reinterpret_cast<const char*>(GRPC_SLICE_START_PTR( reinterpret_cast<const char*>(grpc_server_stats_bin->data()),
GRPC_MDVALUE(b->legacy_index()->named.grpc_server_stats_bin->md))), grpc_server_stats_bin->size(), elapsed_time);
GRPC_SLICE_LENGTH(
GRPC_MDVALUE(b->legacy_index()->named.grpc_server_stats_bin->md)),
elapsed_time);
b->Remove(b->legacy_index()->named.grpc_server_stats_bin);
} }
} }

@ -39,8 +39,8 @@ namespace {
// server metadata elements // server metadata elements
struct ServerMetadataElements { struct ServerMetadataElements {
grpc_slice path; grpc_slice path;
grpc_slice tracing_slice; grpc_core::Slice tracing_slice;
grpc_slice census_proto; grpc_core::Slice census_proto;
}; };
void FilterInitialMetadata(grpc_metadata_batch* b, void FilterInitialMetadata(grpc_metadata_batch* b,
@ -49,15 +49,13 @@ void FilterInitialMetadata(grpc_metadata_batch* b,
sml->path = grpc_slice_ref_internal( sml->path = grpc_slice_ref_internal(
GRPC_MDVALUE(b->legacy_index()->named.path->md)); GRPC_MDVALUE(b->legacy_index()->named.path->md));
} }
if (b->legacy_index()->named.grpc_trace_bin != nullptr) { auto grpc_trace_bin = b->Take(grpc_core::GrpcTraceBinMetadata());
sml->tracing_slice = grpc_slice_ref_internal( if (grpc_trace_bin.has_value()) {
GRPC_MDVALUE(b->legacy_index()->named.grpc_trace_bin->md)); sml->tracing_slice = std::move(*grpc_trace_bin);
b->Remove(GRPC_BATCH_GRPC_TRACE_BIN);
} }
if (b->legacy_index()->named.grpc_tags_bin != nullptr) { auto grpc_tags_bin = b->Take(grpc_core::GrpcTagsBinMetadata());
sml->census_proto = grpc_slice_ref_internal( if (grpc_tags_bin.has_value()) {
GRPC_MDVALUE(b->legacy_index()->named.grpc_tags_bin->md)); sml->census_proto = std::move(*grpc_tags_bin);
b->Remove(GRPC_BATCH_GRPC_TAGS_BIN);
} }
} }
@ -91,24 +89,12 @@ void CensusServerCallData::OnDoneRecvInitialMetadataCb(
GPR_ASSERT(initial_metadata != nullptr); GPR_ASSERT(initial_metadata != nullptr);
ServerMetadataElements sml; ServerMetadataElements sml;
sml.path = grpc_empty_slice(); sml.path = grpc_empty_slice();
sml.tracing_slice = grpc_empty_slice();
sml.census_proto = grpc_empty_slice();
FilterInitialMetadata(initial_metadata, &sml); FilterInitialMetadata(initial_metadata, &sml);
calld->path_ = grpc_slice_ref_internal(sml.path); calld->path_ = grpc_slice_ref_internal(sml.path);
calld->method_ = GetMethod(&calld->path_); calld->method_ = GetMethod(&calld->path_);
calld->qualified_method_ = absl::StrCat("Recv.", calld->method_); calld->qualified_method_ = absl::StrCat("Recv.", calld->method_);
const char* tracing_str = GenerateServerContext(sml.tracing_slice.as_string_view(),
GRPC_SLICE_IS_EMPTY(sml.tracing_slice)
? ""
: reinterpret_cast<const char*>(
GRPC_SLICE_START_PTR(sml.tracing_slice));
size_t tracing_str_len = GRPC_SLICE_IS_EMPTY(sml.tracing_slice)
? 0
: GRPC_SLICE_LENGTH(sml.tracing_slice);
GenerateServerContext(absl::string_view(tracing_str, tracing_str_len),
calld->qualified_method_, &calld->context_); calld->qualified_method_, &calld->context_);
grpc_slice_unref_internal(sml.tracing_slice);
grpc_slice_unref_internal(sml.census_proto);
grpc_slice_unref_internal(sml.path); grpc_slice_unref_internal(sml.path);
grpc_census_call_set_context( grpc_census_call_set_context(
calld->gc_, reinterpret_cast<census_context*>(&calld->context_)); calld->gc_, reinterpret_cast<census_context*>(&calld->context_));
@ -142,14 +128,9 @@ void CensusServerCallData::StartTransportStreamOpBatch(
size_t len = ServerStatsSerialize(absl::ToInt64Nanoseconds(elapsed_time_), size_t len = ServerStatsSerialize(absl::ToInt64Nanoseconds(elapsed_time_),
stats_buf_, kMaxServerStatsLen); stats_buf_, kMaxServerStatsLen);
if (len > 0) { if (len > 0) {
GRPC_LOG_IF_ERROR( op->send_trailing_metadata()->batch()->Set(
"census grpc_filter", grpc_core::GrpcServerStatsBinMetadata(),
grpc_metadata_batch_add_tail( grpc_core::Slice(grpc_core::UnmanagedMemorySlice(stats_buf_, len)));
op->send_trailing_metadata()->batch(), &census_bin_,
grpc_mdelem_from_slices(
GRPC_MDSTR_GRPC_SERVER_STATS_BIN,
grpc_core::UnmanagedMemorySlice(stats_buf_, len)),
GRPC_BATCH_GRPC_SERVER_STATS_BIN));
} }
} }
// Call next op. // Call next op.

@ -617,6 +617,7 @@ CORE_SOURCE_FILES = [
'src/core/lib/transport/error_utils.cc', 'src/core/lib/transport/error_utils.cc',
'src/core/lib/transport/metadata.cc', 'src/core/lib/transport/metadata.cc',
'src/core/lib/transport/metadata_batch.cc', 'src/core/lib/transport/metadata_batch.cc',
'src/core/lib/transport/parsed_metadata.cc',
'src/core/lib/transport/pid_controller.cc', 'src/core/lib/transport/pid_controller.cc',
'src/core/lib/transport/static_metadata.cc', 'src/core/lib/transport/static_metadata.cc',
'src/core/lib/transport/status_conversion.cc', 'src/core/lib/transport/status_conversion.cc',

@ -69,6 +69,15 @@
((sizeof(PFX_TOO_MUCH_METADATA_FROM_CLIENT_REQUEST) - 1) + \ ((sizeof(PFX_TOO_MUCH_METADATA_FROM_CLIENT_REQUEST) - 1) + \
(NUM_HEADERS * PFX_TOO_MUCH_METADATA_FROM_CLIENT_HEADER_SIZE) + 1) (NUM_HEADERS * PFX_TOO_MUCH_METADATA_FROM_CLIENT_HEADER_SIZE) + 1)
static void verifier_fails(grpc_server* server, grpc_completion_queue* cq,
void* /*registered_method*/) {
while (grpc_core::Server::FromC(server)->HasOpenConnections()) {
GPR_ASSERT(grpc_completion_queue_next(
cq, grpc_timeout_milliseconds_to_deadline(20), nullptr)
.type == GRPC_QUEUE_TIMEOUT);
}
}
int main(int argc, char** argv) { int main(int argc, char** argv) {
int i; int i;
grpc_init(); grpc_init();
@ -92,7 +101,7 @@ int main(int argc, char** argv) {
args[1].client_payload = client_payload; args[1].client_payload = client_payload;
args[1].client_payload_length = sizeof(client_payload) - 1; args[1].client_payload_length = sizeof(client_payload) - 1;
grpc_run_bad_client_test(server_verifier_request_call, args, 2, 0); grpc_run_bad_client_test(verifier_fails, args, 2, 0);
grpc_shutdown(); grpc_shutdown();
return 0; return 0;

@ -4,24 +4,16 @@
"\x07:status" "\x07:status"
"\x0A:authority" "\x0A:authority"
"\x07:scheme" "\x07:scheme"
"\x0Cgrpc-message"
"\x0Bgrpc-status" "\x0Bgrpc-status"
"\x10grpc-payload-bin"
"\x0Dgrpc-encoding" "\x0Dgrpc-encoding"
"\x14grpc-accept-encoding" "\x14grpc-accept-encoding"
"\x15grpc-server-stats-bin"
"\x0Dgrpc-tags-bin"
"\x0Egrpc-trace-bin"
"\x0Ccontent-type" "\x0Ccontent-type"
"\x10content-encoding" "\x10content-encoding"
"\x0Faccept-encoding" "\x0Faccept-encoding"
"\x1Egrpc-internal-encoding-request" "\x1Egrpc-internal-encoding-request"
"\x04host"
"\x1Agrpc-previous-rpc-attempts" "\x1Agrpc-previous-rpc-attempts"
"\x16grpc-retry-pushback-ms" "\x16grpc-retry-pushback-ms"
"\x1Bx-endpoint-load-metrics-bin"
"\x0Cgrpc-timeout" "\x0Cgrpc-timeout"
"\x0Auser-agent"
"\x011" "\x011"
"\x012" "\x012"
"\x013" "\x013"
@ -72,6 +64,7 @@
"\x06expect" "\x06expect"
"\x07expires" "\x07expires"
"\x04from" "\x04from"
"\x04host"
"\x08if-match" "\x08if-match"
"\x11if-modified-since" "\x11if-modified-since"
"\x0Dif-none-match" "\x0Dif-none-match"
@ -91,6 +84,7 @@
"\x0Aset-cookie" "\x0Aset-cookie"
"\x19strict-transport-security" "\x19strict-transport-security"
"\x11transfer-encoding" "\x11transfer-encoding"
"\x0Auser-agent"
"\x04vary" "\x04vary"
"\x03via" "\x03via"
"\x10www-authenticate" "\x10www-authenticate"

@ -35,7 +35,6 @@ TEST_F(EvaluateArgsTest, EmptyMetadata) {
EXPECT_EQ(args.GetPath(), nullptr); EXPECT_EQ(args.GetPath(), nullptr);
EXPECT_EQ(args.GetMethod(), nullptr); EXPECT_EQ(args.GetMethod(), nullptr);
EXPECT_EQ(args.GetHost(), nullptr); EXPECT_EQ(args.GetHost(), nullptr);
EXPECT_THAT(args.GetHeaders(), ::testing::ElementsAre());
EXPECT_EQ(args.GetHeaderValue("some_key", nullptr), absl::nullopt); EXPECT_EQ(args.GetHeaderValue("some_key", nullptr), absl::nullopt);
} }
@ -57,16 +56,6 @@ TEST_F(EvaluateArgsTest, GetMethodSuccess) {
EXPECT_EQ(args.GetMethod(), "GET"); EXPECT_EQ(args.GetMethod(), "GET");
} }
TEST_F(EvaluateArgsTest, GetHeadersSuccess) {
util_.AddPairToMetadata("host", "host123");
util_.AddPairToMetadata(":path", "/expected/path");
EvaluateArgs args = util_.MakeEvaluateArgs();
EXPECT_THAT(args.GetHeaders(),
::testing::UnorderedElementsAre(
::testing::Pair("host", "host123"),
::testing::Pair(":path", "/expected/path")));
}
TEST_F(EvaluateArgsTest, GetHeaderValueSuccess) { TEST_F(EvaluateArgsTest, GetHeaderValueSuccess) {
util_.AddPairToMetadata("key123", "value123"); util_.AddPairToMetadata("key123", "value123");
EvaluateArgs args = util_.MakeEvaluateArgs(); EvaluateArgs args = util_.MakeEvaluateArgs();

@ -31,20 +31,8 @@ bool leak_check = true;
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
grpc_init(); grpc_init();
grpc_slice input = grpc_slice_from_copied_buffer((const char*)data, size); grpc_core::PermissivePercentDecodeSlice(
absl::optional<grpc_slice> output; grpc_core::Slice::FromCopiedBuffer((const char*)data, size));
output =
grpc_core::PercentDecodeSlice(input, grpc_core::PercentEncodingType::URL);
if (output.has_value()) {
grpc_slice_unref(*output);
}
output = grpc_core::PercentDecodeSlice(
input, grpc_core::PercentEncodingType::Compatible);
if (output.has_value()) {
grpc_slice_unref(*output);
}
grpc_slice_unref(grpc_core::PermissivePercentDecodeSlice(input));
grpc_slice_unref(input);
grpc_shutdown(); grpc_shutdown();
return 0; return 0;
} }

@ -32,22 +32,13 @@ bool leak_check = true;
static void test(const uint8_t* data, size_t size, static void test(const uint8_t* data, size_t size,
grpc_core::PercentEncodingType type) { grpc_core::PercentEncodingType type) {
grpc_init(); grpc_init();
grpc_slice input = auto input = grpc_core::Slice::FromCopiedBuffer(
grpc_slice_from_copied_buffer(reinterpret_cast<const char*>(data), size); reinterpret_cast<const char*>(data), size);
grpc_slice output = grpc_core::PercentEncodeSlice(input, type); auto output = grpc_core::PercentEncodeSlice(input.Ref(), type);
absl::optional<grpc_slice> decoded_output = auto permissive_decoded_output =
grpc_core::PercentDecodeSlice(output, type); grpc_core::PermissivePercentDecodeSlice(std::move(output));
// encoder must always produce decodable output // decoded output must always match the input
GPR_ASSERT(decoded_output.has_value()); GPR_ASSERT(input == permissive_decoded_output);
grpc_slice permissive_decoded_output =
grpc_core::PermissivePercentDecodeSlice(output);
// and decoded output must always match the input
GPR_ASSERT(grpc_slice_eq(input, *decoded_output));
GPR_ASSERT(grpc_slice_eq(input, permissive_decoded_output));
grpc_slice_unref(input);
grpc_slice_unref(output);
grpc_slice_unref(*decoded_output);
grpc_slice_unref(permissive_decoded_output);
grpc_shutdown(); grpc_shutdown();
} }

@ -29,10 +29,10 @@
#define TEST_VECTOR(raw, encoded, dict) \ #define TEST_VECTOR(raw, encoded, dict) \
test_vector(raw, sizeof(raw) - 1, encoded, sizeof(encoded) - 1, dict) test_vector(raw, sizeof(raw) - 1, encoded, sizeof(encoded) - 1, dict)
#define TEST_NONCONFORMANT_VECTOR(encoded, permissive_unencoded, dict) \ #define TEST_NONCONFORMANT_VECTOR(encoded, permissive_unencoded) \
test_nonconformant_vector(encoded, sizeof(encoded) - 1, \ test_nonconformant_vector(encoded, sizeof(encoded) - 1, \
permissive_unencoded, \ permissive_unencoded, \
sizeof(permissive_unencoded) - 1, dict) sizeof(permissive_unencoded) - 1)
static void test_vector(const char* raw, size_t raw_length, const char* encoded, static void test_vector(const char* raw, size_t raw_length, const char* encoded,
size_t encoded_length, size_t encoded_length,
@ -44,46 +44,32 @@ static void test_vector(const char* raw, size_t raw_length, const char* encoded,
gpr_free(raw_msg); gpr_free(raw_msg);
gpr_free(encoded_msg); gpr_free(encoded_msg);
grpc_slice raw_slice = grpc_slice_from_copied_buffer(raw, raw_length); auto raw_slice = grpc_core::Slice::FromCopiedBuffer(raw, raw_length);
grpc_slice encoded_slice = auto encoded_slice =
grpc_slice_from_copied_buffer(encoded, encoded_length); grpc_core::Slice::FromCopiedBuffer(encoded, encoded_length);
grpc_slice raw2encoded_slice = grpc_core::PercentEncodeSlice(raw_slice, type); auto raw2encoded_slice = grpc_core::PercentEncodeSlice(raw_slice.Ref(), type);
absl::optional<grpc_slice> encoded2raw_slice = auto encoded2raw_permissive_slice =
grpc_core::PercentDecodeSlice(encoded_slice, type); grpc_core::PermissivePercentDecodeSlice(encoded_slice.Ref());
GPR_ASSERT(encoded2raw_slice.has_value());
grpc_slice encoded2raw_permissive_slice =
grpc_core::PermissivePercentDecodeSlice(encoded_slice);
char* raw2encoded_msg = char* raw2encoded_msg = grpc_dump_slice(raw2encoded_slice.c_slice(),
grpc_dump_slice(raw2encoded_slice, GPR_DUMP_HEX | GPR_DUMP_ASCII); GPR_DUMP_HEX | GPR_DUMP_ASCII);
char* encoded2raw_msg =
grpc_dump_slice(*encoded2raw_slice, GPR_DUMP_HEX | GPR_DUMP_ASCII);
char* encoded2raw_permissive_msg = grpc_dump_slice( char* encoded2raw_permissive_msg = grpc_dump_slice(
encoded2raw_permissive_slice, GPR_DUMP_HEX | GPR_DUMP_ASCII); encoded2raw_permissive_slice.c_slice(), GPR_DUMP_HEX | GPR_DUMP_ASCII);
gpr_log(GPR_DEBUG, gpr_log(GPR_DEBUG,
"Result:\nraw2encoded = %s\nencoded2raw = %s\nencoded2raw_permissive " "Result:\nraw2encoded = %s\nencoded2raw_permissive "
"= %s", "= %s",
raw2encoded_msg, encoded2raw_msg, encoded2raw_permissive_msg); raw2encoded_msg, encoded2raw_permissive_msg);
gpr_free(raw2encoded_msg); gpr_free(raw2encoded_msg);
gpr_free(encoded2raw_msg);
gpr_free(encoded2raw_permissive_msg); gpr_free(encoded2raw_permissive_msg);
GPR_ASSERT(grpc_slice_eq(raw_slice, *encoded2raw_slice)); GPR_ASSERT(raw_slice == encoded2raw_permissive_slice);
GPR_ASSERT(grpc_slice_eq(raw_slice, encoded2raw_permissive_slice)); GPR_ASSERT(encoded_slice == raw2encoded_slice);
GPR_ASSERT(grpc_slice_eq(encoded_slice, raw2encoded_slice));
grpc_slice_unref(*encoded2raw_slice);
grpc_slice_unref(encoded2raw_permissive_slice);
grpc_slice_unref(raw2encoded_slice);
grpc_slice_unref(raw_slice);
grpc_slice_unref(encoded_slice);
} }
static void test_nonconformant_vector(const char* encoded, static void test_nonconformant_vector(const char* encoded,
size_t encoded_length, size_t encoded_length,
const char* permissive_unencoded, const char* permissive_unencoded,
size_t permissive_unencoded_length, size_t permissive_unencoded_length) {
grpc_core::PercentEncodingType type) {
char* permissive_unencoded_msg = char* permissive_unencoded_msg =
gpr_dump(permissive_unencoded, permissive_unencoded_length, gpr_dump(permissive_unencoded, permissive_unencoded_length,
GPR_DUMP_HEX | GPR_DUMP_ASCII); GPR_DUMP_HEX | GPR_DUMP_ASCII);
@ -94,28 +80,20 @@ static void test_nonconformant_vector(const char* encoded,
gpr_free(permissive_unencoded_msg); gpr_free(permissive_unencoded_msg);
gpr_free(encoded_msg); gpr_free(encoded_msg);
grpc_slice permissive_unencoded_slice = grpc_slice_from_copied_buffer( auto permissive_unencoded_slice = grpc_core::Slice::FromCopiedBuffer(
permissive_unencoded, permissive_unencoded_length); permissive_unencoded, permissive_unencoded_length);
grpc_slice encoded_slice = auto encoded_slice =
grpc_slice_from_copied_buffer(encoded, encoded_length); grpc_core::Slice::FromCopiedBuffer(encoded, encoded_length);
absl::optional<grpc_slice> encoded2raw_slice = auto encoded2raw_permissive_slice =
grpc_core::PercentDecodeSlice(encoded_slice, type); grpc_core::PermissivePercentDecodeSlice(std::move(encoded_slice));
GPR_ASSERT(!encoded2raw_slice.has_value());
grpc_slice encoded2raw_permissive_slice =
grpc_core::PermissivePercentDecodeSlice(encoded_slice);
char* encoded2raw_permissive_msg = grpc_dump_slice( char* encoded2raw_permissive_msg = grpc_dump_slice(
encoded2raw_permissive_slice, GPR_DUMP_HEX | GPR_DUMP_ASCII); encoded2raw_permissive_slice.c_slice(), GPR_DUMP_HEX | GPR_DUMP_ASCII);
gpr_log(GPR_DEBUG, "Result:\nencoded2raw_permissive = %s", gpr_log(GPR_DEBUG, "Result:\nencoded2raw_permissive = %s",
encoded2raw_permissive_msg); encoded2raw_permissive_msg);
gpr_free(encoded2raw_permissive_msg); gpr_free(encoded2raw_permissive_msg);
GPR_ASSERT( GPR_ASSERT(permissive_unencoded_slice == encoded2raw_permissive_slice);
grpc_slice_eq(permissive_unencoded_slice, encoded2raw_permissive_slice));
grpc_slice_unref(permissive_unencoded_slice);
grpc_slice_unref(encoded2raw_permissive_slice);
grpc_slice_unref(encoded_slice);
} }
int main(int argc, char** argv) { int main(int argc, char** argv) {
@ -135,10 +113,10 @@ int main(int argc, char** argv) {
TEST_VECTOR("\xff", "%FF", grpc_core::PercentEncodingType::URL); TEST_VECTOR("\xff", "%FF", grpc_core::PercentEncodingType::URL);
TEST_VECTOR("\xee", "%EE", grpc_core::PercentEncodingType::URL); TEST_VECTOR("\xee", "%EE", grpc_core::PercentEncodingType::URL);
TEST_VECTOR("%2", "%252", grpc_core::PercentEncodingType::URL); TEST_VECTOR("%2", "%252", grpc_core::PercentEncodingType::URL);
TEST_NONCONFORMANT_VECTOR("%", "%", grpc_core::PercentEncodingType::URL); TEST_NONCONFORMANT_VECTOR("%", "%");
TEST_NONCONFORMANT_VECTOR("%A", "%A", grpc_core::PercentEncodingType::URL); TEST_NONCONFORMANT_VECTOR("%A", "%A");
TEST_NONCONFORMANT_VECTOR("%AG", "%AG", grpc_core::PercentEncodingType::URL); TEST_NONCONFORMANT_VECTOR("%AG", "%AG");
TEST_NONCONFORMANT_VECTOR("\0", "\0", grpc_core::PercentEncodingType::URL); TEST_NONCONFORMANT_VECTOR("\0", "\0");
grpc_shutdown(); grpc_shutdown();
return 0; return 0;
} }

@ -33,14 +33,8 @@ class EvaluateArgsTestUtil {
~EvaluateArgsTestUtil() { delete channel_args_; } ~EvaluateArgsTestUtil() { delete channel_args_; }
void AddPairToMetadata(const char* key, const char* value) { void AddPairToMetadata(const char* key, const char* value) {
metadata_storage_.emplace_back(); metadata_.Append(
auto& storage = metadata_storage_.back(); key, Slice(grpc_slice_intern(grpc_slice_from_static_string(value))));
ASSERT_EQ(grpc_metadata_batch_add_tail(
&metadata_, &storage,
grpc_mdelem_from_slices(
grpc_slice_intern(grpc_slice_from_static_string(key)),
grpc_slice_intern(grpc_slice_from_static_string(value)))),
GRPC_ERROR_NONE);
} }
void SetLocalEndpoint(absl::string_view local_uri) { void SetLocalEndpoint(absl::string_view local_uri) {
@ -63,7 +57,6 @@ class EvaluateArgsTestUtil {
private: private:
ScopedArenaPtr arena_ = MakeScopedArena(1024); ScopedArenaPtr arena_ = MakeScopedArena(1024);
std::list<grpc_linked_mdelem> metadata_storage_;
grpc_metadata_batch metadata_{arena_.get()}; grpc_metadata_batch metadata_{arena_.get()};
MockAuthorizationEndpoint endpoint_{/*local_uri=*/"", /*peer_uri=*/""}; MockAuthorizationEndpoint endpoint_{/*local_uri=*/"", /*peer_uri=*/""};
grpc_auth_context auth_context_{nullptr}; grpc_auth_context auth_context_{nullptr};

@ -303,24 +303,20 @@ class MoreRepresentativeClientInitialMetadata {
GRPC_MDSTR_AUTHORITY, GRPC_MDSTR_AUTHORITY,
grpc_slice_intern(grpc_slice_from_static_string( grpc_slice_intern(grpc_slice_from_static_string(
"foo.test.google.fr:1234")))))); "foo.test.google.fr:1234"))))));
GPR_ASSERT(GRPC_LOG_IF_ERROR( b->Set(grpc_core::GrpcTraceBinMetadata(),
"addmd", grpc_core::Slice(grpc_core::StaticSlice::FromStaticString(
b->Append(grpc_mdelem_from_slices( "\x00\x01\x02\x03\x04\x05\x06\x07\x08"
GRPC_MDSTR_GRPC_TRACE_BIN,
grpc_slice_from_static_string("\x00\x01\x02\x03\x04\x05\x06\x07\x08"
"\x09\x0a\x0b\x0c\x0d\x0e\x0f" "\x09\x0a\x0b\x0c\x0d\x0e\x0f"
"\x10\x11\x12\x13\x14\x15\x16\x17\x18" "\x10\x11\x12\x13\x14\x15\x16\x17\x18"
"\x19\x1a\x1b\x1c\x1d\x1e\x1f" "\x19\x1a\x1b\x1c\x1d\x1e\x1f"
"\x20\x21\x22\x23\x24\x25\x26\x27\x28" "\x20\x21\x22\x23\x24\x25\x26\x27\x28"
"\x29\x2a\x2b\x2c\x2d\x2e\x2f" "\x29\x2a\x2b\x2c\x2d\x2e\x2f"
"\x30"))))); "\x30")));
GPR_ASSERT(GRPC_LOG_IF_ERROR( b->Set(grpc_core::GrpcTagsBinMetadata(),
"addmd", grpc_core::Slice(grpc_core::StaticSlice::FromStaticString(
b->Append(grpc_mdelem_from_slices( "\x00\x01\x02\x03\x04\x05\x06\x07\x08"
GRPC_MDSTR_GRPC_TAGS_BIN,
grpc_slice_from_static_string("\x00\x01\x02\x03\x04\x05\x06\x07\x08"
"\x09\x0a\x0b\x0c\x0d\x0e\x0f" "\x09\x0a\x0b\x0c\x0d\x0e\x0f"
"\x10\x11\x12\x13"))))); "\x10\x11\x12\x13")));
GPR_ASSERT(GRPC_LOG_IF_ERROR( GPR_ASSERT(GRPC_LOG_IF_ERROR(
"addmd", "addmd",
b->Append( b->Append(

@ -937,10 +937,11 @@ TEST_F(GrpcToolTest, CallCommandWithTimeoutDeadlineUpperBound) {
std::bind(PrintStream, &output_stream, std::bind(PrintStream, &output_stream,
std::placeholders::_1))); std::placeholders::_1)));
std::string output = output_stream.str();
// Expected output: "message: "true"" // Expected output: "message: "true""
// deadline not greater than timeout + current time // deadline not greater than timeout + current time
EXPECT_TRUE(nullptr != EXPECT_TRUE(nullptr != strstr(output.c_str(), "message: \"true\"")) << output;
strstr(output_stream.str().c_str(), "message: \"true\""));
ShutdownServer(); ShutdownServer();
} }

@ -35,28 +35,20 @@ import perfection
CONFIG = [ CONFIG = [
# metadata strings # metadata strings
'host',
'grpc-timeout',
'grpc-internal-encoding-request', 'grpc-internal-encoding-request',
'grpc-payload-bin',
':path', ':path',
'grpc-encoding', 'grpc-encoding',
'grpc-accept-encoding', 'grpc-accept-encoding',
'user-agent',
':authority', ':authority',
'grpc-message',
'grpc-status', 'grpc-status',
'grpc-server-stats-bin',
'grpc-tags-bin',
'grpc-trace-bin',
'grpc-previous-rpc-attempts', 'grpc-previous-rpc-attempts',
'grpc-retry-pushback-ms', 'grpc-retry-pushback-ms',
'grpc-timeout',
'1', '1',
'2', '2',
'3', '3',
'4', '4',
'', '',
'x-endpoint-load-metrics-bin',
# well known method names # well known method names
'/grpc.lb.v1.LoadBalancer/BalanceLoad', '/grpc.lb.v1.LoadBalancer/BalanceLoad',
'/envoy.service.load_stats.v2.LoadReportingService/StreamLoadStats', '/envoy.service.load_stats.v2.LoadReportingService/StreamLoadStats',
@ -158,22 +150,15 @@ METADATA_BATCH_CALLOUTS = [
':status', ':status',
':authority', ':authority',
':scheme', ':scheme',
'grpc-message',
'grpc-status', 'grpc-status',
'grpc-payload-bin',
'grpc-encoding', 'grpc-encoding',
'grpc-accept-encoding', 'grpc-accept-encoding',
'grpc-server-stats-bin',
'grpc-tags-bin',
'grpc-trace-bin',
'content-type', 'content-type',
'content-encoding', 'content-encoding',
'accept-encoding', 'accept-encoding',
'grpc-internal-encoding-request', 'grpc-internal-encoding-request',
'host',
'grpc-previous-rpc-attempts', 'grpc-previous-rpc-attempts',
'grpc-retry-pushback-ms', 'grpc-retry-pushback-ms',
'x-endpoint-load-metrics-bin',
] ]
COMPRESSION_ALGORITHMS = [ COMPRESSION_ALGORITHMS = [

@ -2240,6 +2240,7 @@ src/core/lib/transport/metadata.cc \
src/core/lib/transport/metadata.h \ src/core/lib/transport/metadata.h \
src/core/lib/transport/metadata_batch.cc \ src/core/lib/transport/metadata_batch.cc \
src/core/lib/transport/metadata_batch.h \ src/core/lib/transport/metadata_batch.h \
src/core/lib/transport/parsed_metadata.cc \
src/core/lib/transport/parsed_metadata.h \ src/core/lib/transport/parsed_metadata.h \
src/core/lib/transport/pid_controller.cc \ src/core/lib/transport/pid_controller.cc \
src/core/lib/transport/pid_controller.h \ src/core/lib/transport/pid_controller.h \

@ -2041,6 +2041,7 @@ src/core/lib/transport/metadata.cc \
src/core/lib/transport/metadata.h \ src/core/lib/transport/metadata.h \
src/core/lib/transport/metadata_batch.cc \ src/core/lib/transport/metadata_batch.cc \
src/core/lib/transport/metadata_batch.h \ src/core/lib/transport/metadata_batch.h \
src/core/lib/transport/parsed_metadata.cc \
src/core/lib/transport/parsed_metadata.h \ src/core/lib/transport/parsed_metadata.h \
src/core/lib/transport/pid_controller.cc \ src/core/lib/transport/pid_controller.cc \
src/core/lib/transport/pid_controller.h \ src/core/lib/transport/pid_controller.h \

Loading…
Cancel
Save