Progress towards mdstr elimination

reviewable/pr8842/r1
Craig Tiller 8 years ago
parent e52bbb1d01
commit 5ef31ab9c9
  1. 16
      BUILD
  2. 6
      CMakeLists.txt
  3. 8
      Makefile
  4. 2
      binding.gyp
  5. 4
      build.yaml
  6. 2
      config.m4
  7. 6
      gRPC-Core.podspec
  8. 5
      grpc.def
  9. 4
      grpc.gemspec
  10. 8
      include/grpc/compression.h
  11. 5
      include/grpc/slice.h
  12. 4
      package.xml
  13. 24
      src/core/ext/client_channel/client_channel.c
  14. 2
      src/core/ext/client_channel/subchannel.c
  15. 2
      src/core/ext/client_channel/subchannel.h
  16. 2
      src/core/ext/lb_policy/grpclb/grpclb.c
  17. 10
      src/core/ext/transport/chttp2/transport/bin_decoder.c
  18. 2
      src/core/ext/transport/chttp2/transport/hpack_encoder.h
  19. 4
      src/core/ext/transport/chttp2/transport/hpack_parser.c
  20. 2
      src/core/ext/transport/chttp2/transport/parsing.c
  21. 2
      src/core/lib/channel/channel_stack.c
  22. 4
      src/core/lib/channel/channel_stack.h
  23. 15
      src/core/lib/channel/compress_filter.c
  24. 54
      src/core/lib/channel/http_client_filter.c
  25. 45
      src/core/lib/channel/http_server_filter.c
  26. 6
      src/core/lib/channel/message_size_filter.c
  27. 4
      src/core/lib/compression/algorithm_metadata.h
  28. 35
      src/core/lib/compression/compression.c
  29. 2
      src/core/lib/iomgr/load_file.c
  30. 2
      src/core/lib/security/credentials/google_default/google_default_credentials.c
  31. 4
      src/core/lib/security/transport/client_auth_filter.c
  32. 2
      src/core/lib/security/transport/security_connector.c
  33. 4
      src/core/lib/security/transport/server_auth_filter.c
  34. 2
      src/core/lib/security/util/b64.c
  35. 2
      src/core/lib/slice/slice.c
  36. 98
      src/core/lib/slice/slice_hash_table.c
  37. 52
      src/core/lib/slice/slice_hash_table.h
  38. 6
      src/core/lib/surface/call.c
  39. 14
      src/core/lib/surface/server.c
  40. 26
      src/core/lib/transport/metadata.c
  41. 82
      src/core/lib/transport/method_config.c
  42. 74
      src/core/lib/transport/method_config.h
  43. 186
      src/core/lib/transport/static_metadata.h
  44. 2
      src/cpp/util/slice_cc.cc
  45. 2
      src/python/grpcio/grpc_core_dependencies.py
  46. 10
      src/ruby/ext/grpc/rb_grpc_imports.generated.c
  47. 17
      src/ruby/ext/grpc/rb_grpc_imports.generated.h
  48. 2
      tools/codegen/core/gen_static_metadata.py
  49. 4
      tools/doxygen/Doxyfile.core.internal
  50. 6
      tools/run_tests/sources_and_headers.json
  51. 6
      vsprojects/vcxproj/grpc/grpc.vcxproj
  52. 12
      vsprojects/vcxproj/grpc/grpc.vcxproj.filters
  53. 6
      vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj
  54. 12
      vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj.filters
  55. 6
      vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj
  56. 12
      vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters

16
BUILD

@ -231,6 +231,7 @@ cc_library(
"src/core/lib/json/json_reader.h",
"src/core/lib/json/json_writer.h",
"src/core/lib/slice/percent_encoding.h",
"src/core/lib/slice/slice_hash_table.h",
"src/core/lib/slice/slice_string_helpers.h",
"src/core/lib/surface/api_trace.h",
"src/core/lib/surface/call.h",
@ -245,7 +246,6 @@ cc_library(
"src/core/lib/surface/server.h",
"src/core/lib/transport/byte_stream.h",
"src/core/lib/transport/connectivity_state.h",
"src/core/lib/transport/mdstr_hash_table.h",
"src/core/lib/transport/metadata.h",
"src/core/lib/transport/metadata_batch.h",
"src/core/lib/transport/method_config.h",
@ -413,6 +413,7 @@ cc_library(
"src/core/lib/slice/percent_encoding.c",
"src/core/lib/slice/slice.c",
"src/core/lib/slice/slice_buffer.c",
"src/core/lib/slice/slice_hash_table.c",
"src/core/lib/slice/slice_intern.c",
"src/core/lib/slice/slice_string_helpers.c",
"src/core/lib/surface/alarm.c",
@ -435,7 +436,6 @@ cc_library(
"src/core/lib/surface/version.c",
"src/core/lib/transport/byte_stream.c",
"src/core/lib/transport/connectivity_state.c",
"src/core/lib/transport/mdstr_hash_table.c",
"src/core/lib/transport/metadata.c",
"src/core/lib/transport/metadata_batch.c",
"src/core/lib/transport/method_config.c",
@ -667,6 +667,7 @@ cc_library(
"src/core/lib/json/json_reader.h",
"src/core/lib/json/json_writer.h",
"src/core/lib/slice/percent_encoding.h",
"src/core/lib/slice/slice_hash_table.h",
"src/core/lib/slice/slice_string_helpers.h",
"src/core/lib/surface/api_trace.h",
"src/core/lib/surface/call.h",
@ -681,7 +682,6 @@ cc_library(
"src/core/lib/surface/server.h",
"src/core/lib/transport/byte_stream.h",
"src/core/lib/transport/connectivity_state.h",
"src/core/lib/transport/mdstr_hash_table.h",
"src/core/lib/transport/metadata.h",
"src/core/lib/transport/metadata_batch.h",
"src/core/lib/transport/method_config.h",
@ -834,6 +834,7 @@ cc_library(
"src/core/lib/slice/percent_encoding.c",
"src/core/lib/slice/slice.c",
"src/core/lib/slice/slice_buffer.c",
"src/core/lib/slice/slice_hash_table.c",
"src/core/lib/slice/slice_intern.c",
"src/core/lib/slice/slice_string_helpers.c",
"src/core/lib/surface/alarm.c",
@ -856,7 +857,6 @@ cc_library(
"src/core/lib/surface/version.c",
"src/core/lib/transport/byte_stream.c",
"src/core/lib/transport/connectivity_state.c",
"src/core/lib/transport/mdstr_hash_table.c",
"src/core/lib/transport/metadata.c",
"src/core/lib/transport/metadata_batch.c",
"src/core/lib/transport/method_config.c",
@ -1058,6 +1058,7 @@ cc_library(
"src/core/lib/json/json_reader.h",
"src/core/lib/json/json_writer.h",
"src/core/lib/slice/percent_encoding.h",
"src/core/lib/slice/slice_hash_table.h",
"src/core/lib/slice/slice_string_helpers.h",
"src/core/lib/surface/api_trace.h",
"src/core/lib/surface/call.h",
@ -1072,7 +1073,6 @@ cc_library(
"src/core/lib/surface/server.h",
"src/core/lib/transport/byte_stream.h",
"src/core/lib/transport/connectivity_state.h",
"src/core/lib/transport/mdstr_hash_table.h",
"src/core/lib/transport/metadata.h",
"src/core/lib/transport/metadata_batch.h",
"src/core/lib/transport/method_config.h",
@ -1217,6 +1217,7 @@ cc_library(
"src/core/lib/slice/percent_encoding.c",
"src/core/lib/slice/slice.c",
"src/core/lib/slice/slice_buffer.c",
"src/core/lib/slice/slice_hash_table.c",
"src/core/lib/slice/slice_intern.c",
"src/core/lib/slice/slice_string_helpers.c",
"src/core/lib/surface/alarm.c",
@ -1239,7 +1240,6 @@ cc_library(
"src/core/lib/surface/version.c",
"src/core/lib/transport/byte_stream.c",
"src/core/lib/transport/connectivity_state.c",
"src/core/lib/transport/mdstr_hash_table.c",
"src/core/lib/transport/metadata.c",
"src/core/lib/transport/metadata_batch.c",
"src/core/lib/transport/method_config.c",
@ -2084,6 +2084,7 @@ objc_library(
"src/core/lib/slice/percent_encoding.c",
"src/core/lib/slice/slice.c",
"src/core/lib/slice/slice_buffer.c",
"src/core/lib/slice/slice_hash_table.c",
"src/core/lib/slice/slice_intern.c",
"src/core/lib/slice/slice_string_helpers.c",
"src/core/lib/surface/alarm.c",
@ -2106,7 +2107,6 @@ objc_library(
"src/core/lib/surface/version.c",
"src/core/lib/transport/byte_stream.c",
"src/core/lib/transport/connectivity_state.c",
"src/core/lib/transport/mdstr_hash_table.c",
"src/core/lib/transport/metadata.c",
"src/core/lib/transport/metadata_batch.c",
"src/core/lib/transport/method_config.c",
@ -2317,6 +2317,7 @@ objc_library(
"src/core/lib/json/json_reader.h",
"src/core/lib/json/json_writer.h",
"src/core/lib/slice/percent_encoding.h",
"src/core/lib/slice/slice_hash_table.h",
"src/core/lib/slice/slice_string_helpers.h",
"src/core/lib/surface/api_trace.h",
"src/core/lib/surface/call.h",
@ -2331,7 +2332,6 @@ objc_library(
"src/core/lib/surface/server.h",
"src/core/lib/transport/byte_stream.h",
"src/core/lib/transport/connectivity_state.h",
"src/core/lib/transport/mdstr_hash_table.h",
"src/core/lib/transport/metadata.h",
"src/core/lib/transport/metadata_batch.h",
"src/core/lib/transport/method_config.h",

@ -368,6 +368,7 @@ add_library(grpc
src/core/lib/slice/percent_encoding.c
src/core/lib/slice/slice.c
src/core/lib/slice/slice_buffer.c
src/core/lib/slice/slice_hash_table.c
src/core/lib/slice/slice_intern.c
src/core/lib/slice/slice_string_helpers.c
src/core/lib/surface/alarm.c
@ -390,7 +391,6 @@ add_library(grpc
src/core/lib/surface/version.c
src/core/lib/transport/byte_stream.c
src/core/lib/transport/connectivity_state.c
src/core/lib/transport/mdstr_hash_table.c
src/core/lib/transport/metadata.c
src/core/lib/transport/metadata_batch.c
src/core/lib/transport/method_config.c
@ -649,6 +649,7 @@ add_library(grpc_cronet
src/core/lib/slice/percent_encoding.c
src/core/lib/slice/slice.c
src/core/lib/slice/slice_buffer.c
src/core/lib/slice/slice_hash_table.c
src/core/lib/slice/slice_intern.c
src/core/lib/slice/slice_string_helpers.c
src/core/lib/surface/alarm.c
@ -671,7 +672,6 @@ add_library(grpc_cronet
src/core/lib/surface/version.c
src/core/lib/transport/byte_stream.c
src/core/lib/transport/connectivity_state.c
src/core/lib/transport/mdstr_hash_table.c
src/core/lib/transport/metadata.c
src/core/lib/transport/metadata_batch.c
src/core/lib/transport/method_config.c
@ -902,6 +902,7 @@ add_library(grpc_unsecure
src/core/lib/slice/percent_encoding.c
src/core/lib/slice/slice.c
src/core/lib/slice/slice_buffer.c
src/core/lib/slice/slice_hash_table.c
src/core/lib/slice/slice_intern.c
src/core/lib/slice/slice_string_helpers.c
src/core/lib/surface/alarm.c
@ -924,7 +925,6 @@ add_library(grpc_unsecure
src/core/lib/surface/version.c
src/core/lib/transport/byte_stream.c
src/core/lib/transport/connectivity_state.c
src/core/lib/transport/mdstr_hash_table.c
src/core/lib/transport/metadata.c
src/core/lib/transport/metadata_batch.c
src/core/lib/transport/method_config.c

@ -2699,6 +2699,7 @@ LIBGRPC_SRC = \
src/core/lib/slice/percent_encoding.c \
src/core/lib/slice/slice.c \
src/core/lib/slice/slice_buffer.c \
src/core/lib/slice/slice_hash_table.c \
src/core/lib/slice/slice_intern.c \
src/core/lib/slice/slice_string_helpers.c \
src/core/lib/surface/alarm.c \
@ -2721,7 +2722,6 @@ LIBGRPC_SRC = \
src/core/lib/surface/version.c \
src/core/lib/transport/byte_stream.c \
src/core/lib/transport/connectivity_state.c \
src/core/lib/transport/mdstr_hash_table.c \
src/core/lib/transport/metadata.c \
src/core/lib/transport/metadata_batch.c \
src/core/lib/transport/method_config.c \
@ -2998,6 +2998,7 @@ LIBGRPC_CRONET_SRC = \
src/core/lib/slice/percent_encoding.c \
src/core/lib/slice/slice.c \
src/core/lib/slice/slice_buffer.c \
src/core/lib/slice/slice_hash_table.c \
src/core/lib/slice/slice_intern.c \
src/core/lib/slice/slice_string_helpers.c \
src/core/lib/surface/alarm.c \
@ -3020,7 +3021,6 @@ LIBGRPC_CRONET_SRC = \
src/core/lib/surface/version.c \
src/core/lib/transport/byte_stream.c \
src/core/lib/transport/connectivity_state.c \
src/core/lib/transport/mdstr_hash_table.c \
src/core/lib/transport/metadata.c \
src/core/lib/transport/metadata_batch.c \
src/core/lib/transport/method_config.c \
@ -3288,6 +3288,7 @@ LIBGRPC_TEST_UTIL_SRC = \
src/core/lib/slice/percent_encoding.c \
src/core/lib/slice/slice.c \
src/core/lib/slice/slice_buffer.c \
src/core/lib/slice/slice_hash_table.c \
src/core/lib/slice/slice_intern.c \
src/core/lib/slice/slice_string_helpers.c \
src/core/lib/surface/alarm.c \
@ -3310,7 +3311,6 @@ LIBGRPC_TEST_UTIL_SRC = \
src/core/lib/surface/version.c \
src/core/lib/transport/byte_stream.c \
src/core/lib/transport/connectivity_state.c \
src/core/lib/transport/mdstr_hash_table.c \
src/core/lib/transport/metadata.c \
src/core/lib/transport/metadata_batch.c \
src/core/lib/transport/method_config.c \
@ -3507,6 +3507,7 @@ LIBGRPC_UNSECURE_SRC = \
src/core/lib/slice/percent_encoding.c \
src/core/lib/slice/slice.c \
src/core/lib/slice/slice_buffer.c \
src/core/lib/slice/slice_hash_table.c \
src/core/lib/slice/slice_intern.c \
src/core/lib/slice/slice_string_helpers.c \
src/core/lib/surface/alarm.c \
@ -3529,7 +3530,6 @@ LIBGRPC_UNSECURE_SRC = \
src/core/lib/surface/version.c \
src/core/lib/transport/byte_stream.c \
src/core/lib/transport/connectivity_state.c \
src/core/lib/transport/mdstr_hash_table.c \
src/core/lib/transport/metadata.c \
src/core/lib/transport/metadata_batch.c \
src/core/lib/transport/method_config.c \

@ -647,6 +647,7 @@
'src/core/lib/slice/percent_encoding.c',
'src/core/lib/slice/slice.c',
'src/core/lib/slice/slice_buffer.c',
'src/core/lib/slice/slice_hash_table.c',
'src/core/lib/slice/slice_intern.c',
'src/core/lib/slice/slice_string_helpers.c',
'src/core/lib/surface/alarm.c',
@ -669,7 +670,6 @@
'src/core/lib/surface/version.c',
'src/core/lib/transport/byte_stream.c',
'src/core/lib/transport/connectivity_state.c',
'src/core/lib/transport/mdstr_hash_table.c',
'src/core/lib/transport/metadata.c',
'src/core/lib/transport/metadata_batch.c',
'src/core/lib/transport/method_config.c',

@ -238,6 +238,7 @@ filegroups:
- src/core/lib/json/json_reader.h
- src/core/lib/json/json_writer.h
- src/core/lib/slice/percent_encoding.h
- src/core/lib/slice/slice_hash_table.h
- src/core/lib/slice/slice_string_helpers.h
- src/core/lib/surface/api_trace.h
- src/core/lib/surface/call.h
@ -252,7 +253,6 @@ filegroups:
- src/core/lib/surface/server.h
- src/core/lib/transport/byte_stream.h
- src/core/lib/transport/connectivity_state.h
- src/core/lib/transport/mdstr_hash_table.h
- src/core/lib/transport/metadata.h
- src/core/lib/transport/metadata_batch.h
- src/core/lib/transport/method_config.h
@ -344,6 +344,7 @@ filegroups:
- src/core/lib/slice/percent_encoding.c
- src/core/lib/slice/slice.c
- src/core/lib/slice/slice_buffer.c
- src/core/lib/slice/slice_hash_table.c
- src/core/lib/slice/slice_intern.c
- src/core/lib/slice/slice_string_helpers.c
- src/core/lib/surface/alarm.c
@ -366,7 +367,6 @@ filegroups:
- src/core/lib/surface/version.c
- src/core/lib/transport/byte_stream.c
- src/core/lib/transport/connectivity_state.c
- src/core/lib/transport/mdstr_hash_table.c
- src/core/lib/transport/metadata.c
- src/core/lib/transport/metadata_batch.c
- src/core/lib/transport/method_config.c

@ -163,6 +163,7 @@ if test "$PHP_GRPC" != "no"; then
src/core/lib/slice/percent_encoding.c \
src/core/lib/slice/slice.c \
src/core/lib/slice/slice_buffer.c \
src/core/lib/slice/slice_hash_table.c \
src/core/lib/slice/slice_intern.c \
src/core/lib/slice/slice_string_helpers.c \
src/core/lib/surface/alarm.c \
@ -185,7 +186,6 @@ if test "$PHP_GRPC" != "no"; then
src/core/lib/surface/version.c \
src/core/lib/transport/byte_stream.c \
src/core/lib/transport/connectivity_state.c \
src/core/lib/transport/mdstr_hash_table.c \
src/core/lib/transport/metadata.c \
src/core/lib/transport/metadata_batch.c \
src/core/lib/transport/method_config.c \

@ -321,6 +321,7 @@ Pod::Spec.new do |s|
'src/core/lib/json/json_reader.h',
'src/core/lib/json/json_writer.h',
'src/core/lib/slice/percent_encoding.h',
'src/core/lib/slice/slice_hash_table.h',
'src/core/lib/slice/slice_string_helpers.h',
'src/core/lib/surface/api_trace.h',
'src/core/lib/surface/call.h',
@ -335,7 +336,6 @@ Pod::Spec.new do |s|
'src/core/lib/surface/server.h',
'src/core/lib/transport/byte_stream.h',
'src/core/lib/transport/connectivity_state.h',
'src/core/lib/transport/mdstr_hash_table.h',
'src/core/lib/transport/metadata.h',
'src/core/lib/transport/metadata_batch.h',
'src/core/lib/transport/method_config.h',
@ -507,6 +507,7 @@ Pod::Spec.new do |s|
'src/core/lib/slice/percent_encoding.c',
'src/core/lib/slice/slice.c',
'src/core/lib/slice/slice_buffer.c',
'src/core/lib/slice/slice_hash_table.c',
'src/core/lib/slice/slice_intern.c',
'src/core/lib/slice/slice_string_helpers.c',
'src/core/lib/surface/alarm.c',
@ -529,7 +530,6 @@ Pod::Spec.new do |s|
'src/core/lib/surface/version.c',
'src/core/lib/transport/byte_stream.c',
'src/core/lib/transport/connectivity_state.c',
'src/core/lib/transport/mdstr_hash_table.c',
'src/core/lib/transport/metadata.c',
'src/core/lib/transport/metadata_batch.c',
'src/core/lib/transport/method_config.c',
@ -725,6 +725,7 @@ Pod::Spec.new do |s|
'src/core/lib/json/json_reader.h',
'src/core/lib/json/json_writer.h',
'src/core/lib/slice/percent_encoding.h',
'src/core/lib/slice/slice_hash_table.h',
'src/core/lib/slice/slice_string_helpers.h',
'src/core/lib/surface/api_trace.h',
'src/core/lib/surface/call.h',
@ -739,7 +740,6 @@ Pod::Spec.new do |s|
'src/core/lib/surface/server.h',
'src/core/lib/transport/byte_stream.h',
'src/core/lib/transport/connectivity_state.h',
'src/core/lib/transport/mdstr_hash_table.h',
'src/core/lib/transport/metadata.h',
'src/core/lib/transport/metadata_batch.h',
'src/core/lib/transport/method_config.h',

@ -149,9 +149,12 @@ EXPORTS
grpc_slice_sub_no_ref
grpc_slice_split_tail
grpc_slice_split_head
gpr_empty_slice
grpc_empty_slice
grpc_slice_cmp
grpc_slice_str_cmp
grpc_slice_buf_cmp
grpc_slice_buf_start_eq
grpc_slice_hash
grpc_slice_buffer_init
grpc_slice_buffer_destroy
grpc_slice_buffer_add

@ -241,6 +241,7 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/json/json_reader.h )
s.files += %w( src/core/lib/json/json_writer.h )
s.files += %w( src/core/lib/slice/percent_encoding.h )
s.files += %w( src/core/lib/slice/slice_hash_table.h )
s.files += %w( src/core/lib/slice/slice_string_helpers.h )
s.files += %w( src/core/lib/surface/api_trace.h )
s.files += %w( src/core/lib/surface/call.h )
@ -255,7 +256,6 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/surface/server.h )
s.files += %w( src/core/lib/transport/byte_stream.h )
s.files += %w( src/core/lib/transport/connectivity_state.h )
s.files += %w( src/core/lib/transport/mdstr_hash_table.h )
s.files += %w( src/core/lib/transport/metadata.h )
s.files += %w( src/core/lib/transport/metadata_batch.h )
s.files += %w( src/core/lib/transport/method_config.h )
@ -427,6 +427,7 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/slice/percent_encoding.c )
s.files += %w( src/core/lib/slice/slice.c )
s.files += %w( src/core/lib/slice/slice_buffer.c )
s.files += %w( src/core/lib/slice/slice_hash_table.c )
s.files += %w( src/core/lib/slice/slice_intern.c )
s.files += %w( src/core/lib/slice/slice_string_helpers.c )
s.files += %w( src/core/lib/surface/alarm.c )
@ -449,7 +450,6 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/surface/version.c )
s.files += %w( src/core/lib/transport/byte_stream.c )
s.files += %w( src/core/lib/transport/connectivity_state.c )
s.files += %w( src/core/lib/transport/mdstr_hash_table.c )
s.files += %w( src/core/lib/transport/metadata.c )
s.files += %w( src/core/lib/transport/metadata_batch.c )
s.files += %w( src/core/lib/transport/method_config.c )

@ -34,11 +34,12 @@
#ifndef GRPC_COMPRESSION_H
#define GRPC_COMPRESSION_H
#include <stdlib.h>
#include <grpc/impl/codegen/port_platform.h>
#include <stdlib.h>
#include <grpc/impl/codegen/compression_types.h>
#include <grpc/slice.h>
#ifdef __cplusplus
extern "C" {
@ -48,8 +49,7 @@ extern "C" {
* grpc_compression_algorithm instance, updating \a algorithm. Returns 1 upon
* success, 0 otherwise. */
GRPCAPI int grpc_compression_algorithm_parse(
const char *name, size_t name_length,
grpc_compression_algorithm *algorithm);
grpc_slice value, grpc_compression_algorithm *algorithm);
/** Updates \a name with the encoding name corresponding to a valid \a
* algorithm. Note that \a name is statically allocated and must *not* be freed.

@ -119,13 +119,16 @@ GPRAPI grpc_slice grpc_slice_split_tail(grpc_slice *s, size_t split);
Requires s intialized, split <= s.length */
GPRAPI grpc_slice grpc_slice_split_head(grpc_slice *s, size_t split);
GPRAPI grpc_slice gpr_empty_slice(void);
GPRAPI grpc_slice grpc_empty_slice(void);
/* Returns <0 if a < b, ==0 if a == b, >0 if a > b
The order is arbitrary, and is not guaranteed to be stable across different
versions of the API. */
GPRAPI int grpc_slice_cmp(grpc_slice a, grpc_slice b);
GPRAPI int grpc_slice_str_cmp(grpc_slice a, const char *b);
GPRAPI int grpc_slice_buf_cmp(grpc_slice a, const void *b, size_t blen);
GPRAPI int grpc_slice_buf_start_eq(grpc_slice a, const void *b, size_t blen);
GPRAPI uint32_t grpc_slice_hash(grpc_slice s);

@ -248,6 +248,7 @@
<file baseinstalldir="/" name="src/core/lib/json/json_reader.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/json/json_writer.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/slice/percent_encoding.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/slice/slice_hash_table.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/slice/slice_string_helpers.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/surface/api_trace.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/surface/call.h" role="src" />
@ -262,7 +263,6 @@
<file baseinstalldir="/" name="src/core/lib/surface/server.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/transport/byte_stream.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/transport/connectivity_state.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/transport/mdstr_hash_table.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/transport/metadata.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/transport/metadata_batch.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/transport/method_config.h" role="src" />
@ -434,6 +434,7 @@
<file baseinstalldir="/" name="src/core/lib/slice/percent_encoding.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/slice/slice.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/slice/slice_buffer.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/slice/slice_hash_table.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/slice/slice_intern.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/slice/slice_string_helpers.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/surface/alarm.c" role="src" />
@ -456,7 +457,6 @@
<file baseinstalldir="/" name="src/core/lib/surface/version.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/transport/byte_stream.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/transport/connectivity_state.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/transport/mdstr_hash_table.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/transport/metadata.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/transport/metadata_batch.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/transport/method_config.c" role="src" />

@ -96,7 +96,7 @@ static void method_parameters_del(grpc_exec_ctx *exec_ctx, void *p) {
gpr_free(p);
}
static const grpc_mdstr_hash_table_vtable method_parameters_vtable = {
static const grpc_slice_hash_table_vtable method_parameters_vtable = {
method_parameters_del, method_parameters_copy, method_parameters_cmp};
static void *method_config_convert_value(
@ -131,7 +131,7 @@ typedef struct client_channel_channel_data {
char *lb_policy_name;
grpc_lb_policy *lb_policy;
/** maps method names to method_parameters structs */
grpc_mdstr_hash_table *method_params_table;
grpc_slice_hash_table *method_params_table;
/** incoming resolver result - set by resolver.next() */
grpc_channel_args *resolver_result;
/** a list of closures that are all waiting for config to come in */
@ -232,7 +232,7 @@ static void on_resolver_result_changed(grpc_exec_ctx *exec_ctx, void *arg,
char *lb_policy_name = NULL;
grpc_lb_policy *lb_policy = NULL;
grpc_lb_policy *old_lb_policy;
grpc_mdstr_hash_table *method_params_table = NULL;
grpc_slice_hash_table *method_params_table = NULL;
grpc_connectivity_state state = GRPC_CHANNEL_TRANSIENT_FAILURE;
bool exit_idle = false;
grpc_error *state_error = GRPC_ERROR_CREATE("No load balancing policy");
@ -316,7 +316,7 @@ static void on_resolver_result_changed(grpc_exec_ctx *exec_ctx, void *arg,
old_lb_policy = chand->lb_policy;
chand->lb_policy = lb_policy;
if (chand->method_params_table != NULL) {
grpc_mdstr_hash_table_unref(exec_ctx, chand->method_params_table);
grpc_slice_hash_table_unref(exec_ctx, chand->method_params_table);
}
chand->method_params_table = method_params_table;
if (lb_policy != NULL) {
@ -494,7 +494,7 @@ static void cc_destroy_channel_elem(grpc_exec_ctx *exec_ctx,
}
gpr_free(chand->lb_policy_name);
if (chand->method_params_table != NULL) {
grpc_mdstr_hash_table_unref(exec_ctx, chand->method_params_table);
grpc_slice_hash_table_unref(exec_ctx, chand->method_params_table);
}
grpc_connectivity_state_destroy(exec_ctx, &chand->state_tracker);
grpc_pollset_set_destroy(chand->interested_parties);
@ -529,7 +529,7 @@ typedef struct client_channel_call_data {
// to avoid this without breaking the grpc_deadline_state abstraction.
grpc_deadline_state deadline_state;
grpc_mdstr *path; // Request path.
grpc_slice path; // Request path.
gpr_timespec call_start_time;
gpr_timespec deadline;
wait_for_ready_value wait_for_ready_from_service_config;
@ -926,10 +926,10 @@ static void read_service_config(grpc_exec_ctx *exec_ctx, void *arg,
if (error == GRPC_ERROR_NONE) {
// Get the method config table from channel data.
gpr_mu_lock(&chand->mu);
grpc_mdstr_hash_table *method_params_table = NULL;
grpc_slice_hash_table *method_params_table = NULL;
if (chand->method_params_table != NULL) {
method_params_table =
grpc_mdstr_hash_table_ref(chand->method_params_table);
grpc_slice_hash_table_ref(chand->method_params_table);
}
gpr_mu_unlock(&chand->mu);
// If the method config table was present, use it.
@ -958,7 +958,7 @@ static void read_service_config(grpc_exec_ctx *exec_ctx, void *arg,
gpr_mu_unlock(&calld->mu);
}
}
grpc_mdstr_hash_table_unref(exec_ctx, method_params_table);
grpc_slice_hash_table_unref(exec_ctx, method_params_table);
}
}
GRPC_CALL_STACK_UNREF(exec_ctx, calld->owning_call, "read_service_config");
@ -996,8 +996,8 @@ static grpc_error *cc_init_call_elem(grpc_exec_ctx *exec_ctx,
if (chand->lb_policy != NULL) {
// We already have a resolver result, so check for service config.
if (chand->method_params_table != NULL) {
grpc_mdstr_hash_table *method_params_table =
grpc_mdstr_hash_table_ref(chand->method_params_table);
grpc_slice_hash_table *method_params_table =
grpc_slice_hash_table_ref(chand->method_params_table);
gpr_mu_unlock(&chand->mu);
method_parameters *method_params = grpc_method_config_table_get(
exec_ctx, method_params_table, args->path);
@ -1013,7 +1013,7 @@ static grpc_error *cc_init_call_elem(grpc_exec_ctx *exec_ctx,
method_params->wait_for_ready;
}
}
grpc_mdstr_hash_table_unref(exec_ctx, method_params_table);
grpc_slice_hash_table_unref(exec_ctx, method_params_table);
} else {
gpr_mu_unlock(&chand->mu);
}

@ -703,7 +703,7 @@ grpc_connected_subchannel *grpc_subchannel_get_connected_subchannel(
grpc_error *grpc_connected_subchannel_create_call(
grpc_exec_ctx *exec_ctx, grpc_connected_subchannel *con,
grpc_polling_entity *pollent, grpc_mdstr *path, gpr_timespec deadline,
grpc_polling_entity *pollent, grpc_slice path, gpr_timespec deadline,
grpc_subchannel_call **call) {
grpc_channel_stack *chanstk = CHANNEL_STACK_FROM_CONNECTION(con);
*call = gpr_malloc(sizeof(grpc_subchannel_call) + chanstk->call_stack_size);

@ -111,7 +111,7 @@ void grpc_subchannel_call_unref(grpc_exec_ctx *exec_ctx,
/** construct a subchannel call */
grpc_error *grpc_connected_subchannel_create_call(
grpc_exec_ctx *exec_ctx, grpc_connected_subchannel *connected_subchannel,
grpc_polling_entity *pollent, grpc_mdstr *path, gpr_timespec deadline,
grpc_polling_entity *pollent, grpc_slice path, gpr_timespec deadline,
grpc_subchannel_call **subchannel_call);
/** process a transport level op */

@ -447,7 +447,7 @@ static grpc_lb_addresses *process_serverlist(
GPR_ARRAY_SIZE(server->load_balance_token);
const size_t lb_token_length =
strnlen(server->load_balance_token, lb_token_max_length);
grpc_mdstr *lb_token_mdstr = grpc_mdstr_from_buffer(
grpc_slice lb_token_mdstr = grpc_mdstr_from_buffer(
(uint8_t *)server->load_balance_token, lb_token_length);
user_data = grpc_mdelem_from_metadata_strings(
exec_ctx, GRPC_MDSTR_LB_TOKEN, lb_token_mdstr);

@ -157,7 +157,7 @@ grpc_slice grpc_chttp2_base64_decode(grpc_exec_ctx *exec_ctx,
"grpc_chttp2_base64_decode has a length of %d, which is not a "
"multiple of 4.\n",
(int)input_length);
return gpr_empty_slice();
return grpc_empty_slice();
}
if (input_length > 0) {
@ -182,7 +182,7 @@ grpc_slice grpc_chttp2_base64_decode(grpc_exec_ctx *exec_ctx,
gpr_log(GPR_ERROR, "Base64 decoding failed, input string:\n%s\n", s);
gpr_free(s);
grpc_slice_unref_internal(exec_ctx, output);
return gpr_empty_slice();
return grpc_empty_slice();
}
GPR_ASSERT(ctx.output_cur == GRPC_SLICE_END_PTR(output));
GPR_ASSERT(ctx.input_cur == GRPC_SLICE_END_PTR(input));
@ -204,7 +204,7 @@ grpc_slice grpc_chttp2_base64_decode_with_length(grpc_exec_ctx *exec_ctx,
"has a tail of 1 byte.\n",
(int)input_length);
grpc_slice_unref_internal(exec_ctx, output);
return gpr_empty_slice();
return grpc_empty_slice();
}
if (output_length > input_length / 4 * 3 + tail_xtra[input_length % 4]) {
@ -214,7 +214,7 @@ grpc_slice grpc_chttp2_base64_decode_with_length(grpc_exec_ctx *exec_ctx,
(int)output_length,
(int)(input_length / 4 * 3 + tail_xtra[input_length % 4]));
grpc_slice_unref_internal(exec_ctx, output);
return gpr_empty_slice();
return grpc_empty_slice();
}
ctx.input_cur = GRPC_SLICE_START_PTR(input);
@ -228,7 +228,7 @@ grpc_slice grpc_chttp2_base64_decode_with_length(grpc_exec_ctx *exec_ctx,
gpr_log(GPR_ERROR, "Base64 decoding failed, input string:\n%s\n", s);
gpr_free(s);
grpc_slice_unref_internal(exec_ctx, output);
return gpr_empty_slice();
return grpc_empty_slice();
}
GPR_ASSERT(ctx.output_cur == GRPC_SLICE_END_PTR(output));
GPR_ASSERT(ctx.input_cur <= GRPC_SLICE_END_PTR(input));

@ -74,7 +74,7 @@ typedef struct {
/* entry tables for keys & elems: these tables track values that have been
seen and *may* be in the decompressor table */
grpc_mdstr *entries_keys[GRPC_CHTTP2_HPACKC_NUM_VALUES];
grpc_slice entries_keys[GRPC_CHTTP2_HPACKC_NUM_VALUES];
grpc_mdelem *entries_elems[GRPC_CHTTP2_HPACKC_NUM_VALUES];
uint32_t indices_keys[GRPC_CHTTP2_HPACKC_NUM_VALUES];
uint32_t indices_elems[GRPC_CHTTP2_HPACKC_NUM_VALUES];

@ -681,9 +681,9 @@ static grpc_error *on_hdr(grpc_exec_ctx *exec_ctx, grpc_chttp2_hpack_parser *p,
return GRPC_ERROR_NONE;
}
static grpc_mdstr *take_string(grpc_chttp2_hpack_parser *p,
static grpc_slice take_string(grpc_chttp2_hpack_parser *p,
grpc_chttp2_hpack_parser_string *str) {
grpc_mdstr *s = grpc_mdstr_from_buffer((uint8_t *)str->str, str->length);
grpc_slice s = grpc_mdstr_from_buffer((uint8_t *)str->str, str->length);
str->length = 0;
return s;
}

@ -200,7 +200,7 @@ grpc_error *grpc_chttp2_perform_read(grpc_exec_ctx *exec_ctx,
return err;
}
if (t->incoming_frame_size == 0) {
err = parse_frame_slice(exec_ctx, t, gpr_empty_slice(), 1);
err = parse_frame_slice(exec_ctx, t, grpc_empty_slice(), 1);
if (err != GRPC_ERROR_NONE) {
return err;
}

@ -162,7 +162,7 @@ grpc_error *grpc_call_stack_init(
grpc_exec_ctx *exec_ctx, grpc_channel_stack *channel_stack,
int initial_refs, grpc_iomgr_cb_func destroy, void *destroy_arg,
grpc_call_context_element *context, const void *transport_server_data,
grpc_mdstr *path, gpr_timespec deadline, grpc_call_stack *call_stack) {
grpc_slice path, gpr_timespec deadline, grpc_call_stack *call_stack) {
grpc_channel_element *channel_elems = CHANNEL_ELEMS_FROM_STACK(channel_stack);
grpc_call_element_args args;
size_t count = channel_stack->count;

@ -74,7 +74,7 @@ typedef struct {
grpc_call_stack *call_stack;
const void *server_transport_data;
grpc_call_context_element *context;
grpc_mdstr *path;
grpc_slice path;
gpr_timespec start_time;
gpr_timespec deadline;
} grpc_call_element_args;
@ -231,7 +231,7 @@ grpc_error *grpc_call_stack_init(
grpc_exec_ctx *exec_ctx, grpc_channel_stack *channel_stack,
int initial_refs, grpc_iomgr_cb_func destroy, void *destroy_arg,
grpc_call_context_element *context, const void *transport_server_data,
grpc_mdstr *path, gpr_timespec deadline, grpc_call_stack *call_stack);
grpc_slice path, gpr_timespec deadline, grpc_call_stack *call_stack);
/* Set a pollset or a pollset_set for a call stack: must occur before the first
* op is started */
void grpc_call_stack_set_pollset_or_pollset_set(grpc_exec_ctx *exec_ctx,

@ -45,6 +45,7 @@
#include "src/core/lib/compression/message_compress.h"
#include "src/core/lib/profiling/timers.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/slice/slice_string_helpers.h"
#include "src/core/lib/support/string.h"
#include "src/core/lib/transport/static_metadata.h"
@ -88,21 +89,23 @@ static grpc_mdelem *compression_md_filter(void *user_data, grpc_mdelem *md) {
call_data *calld = elem->call_data;
channel_data *channeld = elem->channel_data;
if (md->key == GRPC_MDSTR_GRPC_INTERNAL_ENCODING_REQUEST) {
const char *md_c_str = grpc_mdstr_as_c_string(md->value);
if (!grpc_compression_algorithm_parse(md_c_str, strlen(md_c_str),
if (grpc_slice_cmp(md->key, GRPC_MDSTR_GRPC_INTERNAL_ENCODING_REQUEST) == 0) {
if (!grpc_compression_algorithm_parse(md->value,
&calld->compression_algorithm)) {
char *val = grpc_dump_slice(md->value, GPR_DUMP_ASCII);
gpr_log(GPR_ERROR,
"Invalid compression algorithm: '%s' (unknown). Ignoring.",
md_c_str);
"Invalid compression algorithm: '%s' (unknown). Ignoring.", val);
gpr_free(val);
calld->compression_algorithm = GRPC_COMPRESS_NONE;
}
if (!GPR_BITGET(channeld->enabled_algorithms_bitset,
calld->compression_algorithm)) {
char *val = grpc_dump_slice(md->value, GPR_DUMP_ASCII);
gpr_log(GPR_ERROR,
"Invalid compression algorithm: '%s' (previously disabled). "
"Ignoring.",
md_c_str);
val);
gpr_free(val);
calld->compression_algorithm = GRPC_COMPRESS_NONE;
}
calld->has_compression_algorithm = 1;

@ -37,6 +37,7 @@
#include <string.h>
#include "src/core/lib/profiling/timers.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/slice/slice_string_helpers.h"
#include "src/core/lib/support/string.h"
#include "src/core/lib/transport/static_metadata.h"
#include "src/core/lib/transport/transport_impl.h"
@ -98,23 +99,24 @@ static grpc_mdelem *client_recv_filter(void *user_data, grpc_mdelem *md) {
client_recv_filter_args *a = user_data;
if (md == GRPC_MDELEM_STATUS_200) {
return NULL;
} else if (md->key == GRPC_MDSTR_STATUS) {
} else if (grpc_slice_cmp(md->key, GRPC_MDSTR_STATUS) == 0) {
char *message_string;
gpr_asprintf(&message_string, "Received http2 header with status: %s",
grpc_mdstr_as_c_string(md->value));
char *val = grpc_dump_slice(md->value, GPR_DUMP_ASCII);
gpr_asprintf(&message_string, "Received http2 header with status: %s", val);
grpc_slice message = grpc_slice_from_copied_string(message_string);
gpr_free(message_string);
gpr_free(val);
grpc_call_element_send_close_with_message(a->exec_ctx, a->elem,
GRPC_STATUS_CANCELLED, &message);
return NULL;
} else if (md == GRPC_MDELEM_CONTENT_TYPE_APPLICATION_SLASH_GRPC) {
return NULL;
} else if (md->key == GRPC_MDSTR_CONTENT_TYPE) {
const char *value_str = grpc_mdstr_as_c_string(md->value);
if (strncmp(value_str, EXPECTED_CONTENT_TYPE,
EXPECTED_CONTENT_TYPE_LENGTH) == 0 &&
(value_str[EXPECTED_CONTENT_TYPE_LENGTH] == '+' ||
value_str[EXPECTED_CONTENT_TYPE_LENGTH] == ';')) {
} else if (grpc_slice_cmp(md->key, GRPC_MDSTR_CONTENT_TYPE) == 0) {
if (grpc_slice_buf_start_eq(md->value, EXPECTED_CONTENT_TYPE,
EXPECTED_CONTENT_TYPE_LENGTH) &&
(GRPC_SLICE_START_PTR(md->value)[EXPECTED_CONTENT_TYPE_LENGTH] == '+' ||
GRPC_SLICE_START_PTR(md->value)[EXPECTED_CONTENT_TYPE_LENGTH] ==
';')) {
/* Although the C implementation doesn't (currently) generate them,
any custom +-suffix is explicitly valid. */
/* TODO(klempner): We should consider preallocating common values such
@ -123,7 +125,9 @@ static grpc_mdelem *client_recv_filter(void *user_data, grpc_mdelem *md) {
} else {
/* TODO(klempner): We're currently allowing this, but we shouldn't
see it without a proxy so log for now. */
gpr_log(GPR_INFO, "Unexpected content-type '%s'", value_str);
char *val = grpc_dump_slice(md->value, GPR_DUMP_ASCII);
gpr_log(GPR_INFO, "Unexpected content-type '%s'", val);
gpr_free(val);
}
return NULL;
}
@ -162,11 +166,11 @@ static void send_done(grpc_exec_ctx *exec_ctx, void *elemp, grpc_error *error) {
static grpc_mdelem *client_strip_filter(void *user_data, grpc_mdelem *md) {
/* eat the things we'd like to set ourselves */
if (md->key == GRPC_MDSTR_METHOD) return NULL;
if (md->key == GRPC_MDSTR_SCHEME) return NULL;
if (md->key == GRPC_MDSTR_TE) return NULL;
if (md->key == GRPC_MDSTR_CONTENT_TYPE) return NULL;
if (md->key == GRPC_MDSTR_USER_AGENT) return NULL;
if (grpc_slice_cmp(md->key, GRPC_MDSTR_METHOD) == 0) return NULL;
if (grpc_slice_cmp(md->key, GRPC_MDSTR_SCHEME) == 0) return NULL;
if (grpc_slice_cmp(md->key, GRPC_MDSTR_TE) == 0) return NULL;
if (grpc_slice_cmp(md->key, GRPC_MDSTR_CONTENT_TYPE) == 0) return NULL;
if (grpc_slice_cmp(md->key, GRPC_MDSTR_USER_AGENT) == 0) return NULL;
return md;
}
@ -244,10 +248,10 @@ static void hc_mutate_op(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
if (calld->send_message_blocked == false) {
/* when all the send_message data is available, then create a MDELEM and
append to headers */
grpc_mdelem *payload_bin = grpc_mdelem_from_metadata_strings(
grpc_mdelem *payload_bin = grpc_mdelem_from_slices(
exec_ctx, GRPC_MDSTR_GRPC_PAYLOAD_BIN,
grpc_mdstr_from_buffer(calld->payload_bytes,
op->send_message->length));
grpc_slice_from_copied_buffer((const char *)calld->payload_bytes,
op->send_message->length));
grpc_metadata_batch_add_tail(op->send_initial_metadata,
&calld->payload_bin, payload_bin);
calld->on_complete = op->on_complete;
@ -338,8 +342,8 @@ static grpc_mdelem *scheme_from_args(const grpc_channel_args *args) {
if (args->args[i].type == GRPC_ARG_STRING &&
strcmp(args->args[i].key, GRPC_ARG_HTTP2_SCHEME) == 0) {
for (j = 0; j < GPR_ARRAY_SIZE(valid_schemes); j++) {
if (0 == strcmp(grpc_mdstr_as_c_string(valid_schemes[j]->value),
args->args[i].value.string)) {
if (0 == grpc_slice_str_cmp(valid_schemes[j]->value,
args->args[i].value.string)) {
return valid_schemes[j];
}
}
@ -365,13 +369,13 @@ static size_t max_payload_size_from_args(const grpc_channel_args *args) {
return kMaxPayloadSizeForGet;
}
static grpc_mdstr *user_agent_from_args(const grpc_channel_args *args,
const char *transport_name) {
static grpc_slice user_agent_from_args(const grpc_channel_args *args,
const char *transport_name) {
gpr_strvec v;
size_t i;
int is_first = 1;
char *tmp;
grpc_mdstr *result;
grpc_slice result;
gpr_strvec_init(&v);
@ -409,7 +413,7 @@ static grpc_mdstr *user_agent_from_args(const grpc_channel_args *args,
tmp = gpr_strvec_flatten(&v, NULL);
gpr_strvec_destroy(&v);
result = grpc_mdstr_from_string(tmp);
result = grpc_slice_intern(grpc_slice_from_static_string(tmp));
gpr_free(tmp);
return result;
@ -425,7 +429,7 @@ static void init_channel_elem(grpc_exec_ctx *exec_ctx,
chand->static_scheme = scheme_from_args(args->channel_args);
chand->max_payload_size_for_get =
max_payload_size_from_args(args->channel_args);
chand->user_agent = grpc_mdelem_from_metadata_strings(
chand->user_agent = grpc_mdelem_from_slices(
exec_ctx, GRPC_MDSTR_USER_AGENT,
user_agent_from_args(args->channel_args,
args->optional_transport->vtable->name));

@ -38,6 +38,7 @@
#include <string.h>
#include "src/core/lib/profiling/timers.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/slice/slice_string_helpers.h"
#include "src/core/lib/transport/static_metadata.h"
#define EXPECTED_CONTENT_TYPE "application/grpc"
@ -108,7 +109,7 @@ static grpc_mdelem *server_filter(void *user_data, grpc_mdelem *md) {
} else if (md == GRPC_MDELEM_METHOD_GET) {
calld->seen_method = 1;
*calld->recv_cacheable_request = true;
} else if (md->key == GRPC_MDSTR_SCHEME) {
} else if (grpc_slice_cmp(md->key, GRPC_MDSTR_SCHEME)) {
calld->seen_scheme = 1;
} else if (md == GRPC_MDELEM_TE_TRAILERS) {
calld->seen_te_trailers = 1;
@ -116,12 +117,12 @@ static grpc_mdelem *server_filter(void *user_data, grpc_mdelem *md) {
/* TODO(klempner): Track that we've seen all the headers we should
require */
return NULL;
} else if (md->key == GRPC_MDSTR_CONTENT_TYPE) {
const char *value_str = grpc_mdstr_as_c_string(md->value);
if (strncmp(value_str, EXPECTED_CONTENT_TYPE,
EXPECTED_CONTENT_TYPE_LENGTH) == 0 &&
(value_str[EXPECTED_CONTENT_TYPE_LENGTH] == '+' ||
value_str[EXPECTED_CONTENT_TYPE_LENGTH] == ';')) {
} else if (grpc_slice_cmp(md->key, GRPC_MDSTR_CONTENT_TYPE)) {
if (grpc_slice_buf_start_eq(md->value, EXPECTED_CONTENT_TYPE,
EXPECTED_CONTENT_TYPE_LENGTH) &&
(GRPC_SLICE_START_PTR(md->value)[EXPECTED_CONTENT_TYPE_LENGTH] == '+' ||
GRPC_SLICE_START_PTR(md->value)[EXPECTED_CONTENT_TYPE_LENGTH] ==
';')) {
/* Although the C implementation doesn't (currently) generate them,
any custom +-suffix is explicitly valid. */
/* TODO(klempner): We should consider preallocating common values such
@ -130,41 +131,47 @@ static grpc_mdelem *server_filter(void *user_data, grpc_mdelem *md) {
} else {
/* TODO(klempner): We're currently allowing this, but we shouldn't
see it without a proxy so log for now. */
gpr_log(GPR_INFO, "Unexpected content-type '%s'", value_str);
char *val = grpc_dump_slice(md->value, GPR_DUMP_ASCII);
gpr_log(GPR_INFO, "Unexpected content-type '%s'", val);
gpr_free(val);
}
return NULL;
} else if (md->key == GRPC_MDSTR_TE || md->key == GRPC_MDSTR_METHOD ||
md->key == GRPC_MDSTR_SCHEME) {
gpr_log(GPR_ERROR, "Invalid %s: header: '%s'",
grpc_mdstr_as_c_string(md->key), grpc_mdstr_as_c_string(md->value));
} else if (grpc_slice_cmp(md->key, GRPC_MDSTR_TE) == 0 ||
grpc_slice_cmp(md->key, GRPC_MDSTR_METHOD) == 0 ||
grpc_slice_cmp(md->key, GRPC_MDSTR_SCHEME) == 0) {
char *key = grpc_dump_slice(md->key, GPR_DUMP_ASCII);
char *value = grpc_dump_slice(md->value, GPR_DUMP_ASCII);
gpr_log(GPR_ERROR, "Invalid %s: header: '%s'", key, value);
/* swallow it and error everything out. */
/* TODO(klempner): We ought to generate more descriptive error messages
on the wire here. */
grpc_call_element_send_cancel(a->exec_ctx, elem);
gpr_free(key);
gpr_free(value);
return NULL;
} else if (md->key == GRPC_MDSTR_PATH) {
} else if (grpc_slice_cmp(md->key, GRPC_MDSTR_PATH) == 0) {
if (calld->seen_path) {
gpr_log(GPR_ERROR, "Received :path twice");
return NULL;
}
calld->seen_path = 1;
return md;
} else if (md->key == GRPC_MDSTR_AUTHORITY) {
} else if (grpc_slice_cmp(md->key, GRPC_MDSTR_AUTHORITY) == 0) {
calld->seen_authority = 1;
return md;
} else if (md->key == GRPC_MDSTR_HOST) {
} else if (grpc_slice_cmp(md->key, GRPC_MDSTR_HOST) == 0) {
/* translate host to :authority since :authority may be
omitted */
grpc_mdelem *authority = grpc_mdelem_from_metadata_strings(
a->exec_ctx, GRPC_MDSTR_AUTHORITY, GRPC_MDSTR_REF(md->value));
grpc_mdelem *authority = grpc_mdelem_from_slices(
a->exec_ctx, GRPC_MDSTR_AUTHORITY, grpc_slice_ref(md->value));
calld->seen_authority = 1;
return authority;
} else if (md->key == GRPC_MDSTR_GRPC_PAYLOAD_BIN) {
} else if (grpc_slice_cmp(md->key, GRPC_MDSTR_GRPC_PAYLOAD_BIN) == 0) {
/* Retrieve the payload from the value of the 'grpc-internal-payload-bin'
header field */
calld->seen_payload_bin = 1;
grpc_slice_buffer_add(&calld->read_slice_buffer,
grpc_slice_ref_internal(md->value->slice));
grpc_slice_ref_internal(md->value));
grpc_slice_buffer_stream_init(&calld->read_stream,
&calld->read_slice_buffer, 0);
return NULL;

@ -68,7 +68,7 @@ static int message_size_limits_cmp(void* value1, void* value2) {
static void free_mem(grpc_exec_ctx* exec_ctx, void* p) { gpr_free(p); }
static const grpc_mdstr_hash_table_vtable message_size_limits_vtable = {
static const grpc_slice_hash_table_vtable message_size_limits_vtable = {
free_mem, message_size_limits_copy, message_size_limits_cmp};
static void* method_config_convert_value(
@ -102,7 +102,7 @@ typedef struct channel_data {
int max_send_size;
int max_recv_size;
// Maps path names to message_size_limits structs.
grpc_mdstr_hash_table* method_limit_table;
grpc_slice_hash_table* method_limit_table;
} channel_data;
// Callback invoked when we receive a message. Here we check the max
@ -236,7 +236,7 @@ static void init_channel_elem(grpc_exec_ctx* exec_ctx,
static void destroy_channel_elem(grpc_exec_ctx* exec_ctx,
grpc_channel_element* elem) {
channel_data* chand = elem->channel_data;
grpc_mdstr_hash_table_unref(exec_ctx, chand->method_limit_table);
grpc_slice_hash_table_unref(exec_ctx, chand->method_limit_table);
}
const grpc_channel_filter grpc_message_size_filter = {

@ -38,7 +38,7 @@
#include "src/core/lib/transport/metadata.h"
/** Return compression algorithm based metadata value */
grpc_mdstr *grpc_compression_algorithm_mdstr(
grpc_slice grpc_compression_algorithm_mdstr(
grpc_compression_algorithm algorithm);
/** Return compression algorithm based metadata element (grpc-encoding: xxx) */
@ -48,6 +48,6 @@ grpc_mdelem *grpc_compression_encoding_mdelem(
/** Find compression algorithm based on passed in mdstr - returns
* GRPC_COMPRESS_ALGORITHM_COUNT on failure */
grpc_compression_algorithm grpc_compression_algorithm_from_mdstr(
grpc_mdstr *str);
grpc_slice str);
#endif /* GRPC_CORE_LIB_COMPRESSION_ALGORITHM_METADATA_H */

@ -41,30 +41,24 @@
#include "src/core/lib/surface/api_trace.h"
#include "src/core/lib/transport/static_metadata.h"
int grpc_compression_algorithm_parse(const char *name, size_t name_length,
int grpc_compression_algorithm_parse(grpc_slice name,
grpc_compression_algorithm *algorithm) {
/* we use strncmp not only because it's safer (even though in this case it
* doesn't matter, given that we are comparing against string literals, but
* because this way we needn't have "name" nil-terminated (useful for slice
* data, for example) */
GRPC_API_TRACE(
"grpc_compression_algorithm_parse("
"name=%*.*s, name_length=%lu, algorithm=%p)",
5, ((int)name_length, (int)name_length, name, (unsigned long)name_length,
algorithm));
if (name_length == 0) {
return 0;
}
if (strncmp(name, "identity", name_length) == 0) {
if (grpc_slice_cmp(name, GRPC_MDSTR_IDENTITY) == 0) {
*algorithm = GRPC_COMPRESS_NONE;
} else if (strncmp(name, "gzip", name_length) == 0) {
return 1;
} else if (grpc_slice_cmp(name, GRPC_MDSTR_GZIP) == 0) {
*algorithm = GRPC_COMPRESS_GZIP;
} else if (strncmp(name, "deflate", name_length) == 0) {
return 1;
} else if (grpc_slice_cmp(name, GRPC_MDSTR_DEFLATE) == 0) {
*algorithm = GRPC_COMPRESS_DEFLATE;
return 1;
} else {
return 0;
}
return 1;
}
int grpc_compression_algorithm_name(grpc_compression_algorithm algorithm,
@ -88,14 +82,15 @@ int grpc_compression_algorithm_name(grpc_compression_algorithm algorithm,
}
grpc_compression_algorithm grpc_compression_algorithm_from_mdstr(
grpc_mdstr *str) {
if (str == GRPC_MDSTR_IDENTITY) return GRPC_COMPRESS_NONE;
if (str == GRPC_MDSTR_DEFLATE) return GRPC_COMPRESS_DEFLATE;
if (str == GRPC_MDSTR_GZIP) return GRPC_COMPRESS_GZIP;
grpc_slice str) {
if (grpc_slice_cmp(str, GRPC_MDSTR_IDENTITY) == 0) return GRPC_COMPRESS_NONE;
if (grpc_slice_cmp(str, GRPC_MDSTR_DEFLATE) == 0)
return GRPC_COMPRESS_DEFLATE;
if (grpc_slice_cmp(str, GRPC_MDSTR_GZIP) == 0) return GRPC_COMPRESS_GZIP;
return GRPC_COMPRESS_ALGORITHMS_COUNT;
}
grpc_mdstr *grpc_compression_algorithm_mdstr(
grpc_slice grpc_compression_algorithm_mdstr(
grpc_compression_algorithm algorithm) {
switch (algorithm) {
case GRPC_COMPRESS_NONE:
@ -105,9 +100,9 @@ grpc_mdstr *grpc_compression_algorithm_mdstr(
case GRPC_COMPRESS_GZIP:
return GRPC_MDSTR_GZIP;
case GRPC_COMPRESS_ALGORITHMS_COUNT:
return NULL;
return grpc_empty_slice();
}
return NULL;
return grpc_empty_slice();
}
grpc_mdelem *grpc_compression_encoding_mdelem(

@ -47,7 +47,7 @@ grpc_error *grpc_load_file(const char *filename, int add_null_terminator,
grpc_slice *output) {
unsigned char *contents = NULL;
size_t contents_size = 0;
grpc_slice result = gpr_empty_slice();
grpc_slice result = grpc_empty_slice();
FILE *file;
size_t bytes_read = 0;
grpc_error *error = GRPC_ERROR_NONE;

@ -174,7 +174,7 @@ static grpc_error *create_default_creds_from_path(
grpc_auth_json_key key;
grpc_auth_refresh_token token;
grpc_call_credentials *result = NULL;
grpc_slice creds_data = gpr_empty_slice();
grpc_slice creds_data = grpc_empty_slice();
grpc_error *error = GRPC_ERROR_NONE;
if (creds_path == NULL) {
error = GRPC_ERROR_CREATE("creds_path unset");

@ -54,8 +54,8 @@
/* We can have a per-call credentials. */
typedef struct {
grpc_call_credentials *creds;
grpc_mdstr *host;
grpc_mdstr *method;
grpc_slice host;
grpc_slice method;
/* pollset{_set} bound to this call; if we need to make external
network requests, they should be done under a pollset added to this
pollset_set so that work can progress when this call wants work to progress

@ -649,7 +649,7 @@ static grpc_security_connector_vtable ssl_server_vtable = {
ssl_server_destroy, ssl_server_check_peer};
static grpc_slice compute_default_pem_root_certs_once(void) {
grpc_slice result = gpr_empty_slice();
grpc_slice result = grpc_empty_slice();
/* First try to load the roots from the environment. */
char *default_root_certs_path =

@ -68,8 +68,8 @@ static grpc_metadata_array metadata_batch_to_md_array(
for (l = batch->list.head; l != NULL; l = l->next) {
grpc_metadata *usr_md = NULL;
grpc_mdelem *md = l->md;
grpc_mdstr *key = md->key;
grpc_mdstr *value = md->value;
grpc_slice key = md->key;
grpc_slice value = md->value;
if (result.count == result.capacity) {
result.capacity = GPR_MAX(result.capacity + 8, result.capacity * 2);
result.metadata =

@ -232,5 +232,5 @@ grpc_slice grpc_base64_decode_with_len(grpc_exec_ctx *exec_ctx, const char *b64,
fail:
grpc_slice_unref_internal(exec_ctx, result);
return gpr_empty_slice();
return grpc_empty_slice();
}

@ -41,7 +41,7 @@
#include "src/core/lib/iomgr/exec_ctx.h"
grpc_slice gpr_empty_slice(void) {
grpc_slice grpc_empty_slice(void) {
grpc_slice out;
out.refcount = 0;
out.data.inlined.length = 0;

@ -29,7 +29,7 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
#include "src/core/lib/transport/mdstr_hash_table.h"
#include "src/core/lib/slice/slice_hash_table.h"
#include <stdbool.h>
#include <string.h>
@ -37,72 +37,88 @@
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/transport/metadata.h"
struct grpc_mdstr_hash_table {
static grpc_slice_refcount terminal_slice_refcount = {0};
static const grpc_slice terminal_slice = {&terminal_slice_refcount,
.data.refcounted = {0, 0}};
struct grpc_slice_hash_table {
gpr_refcount refs;
size_t num_entries;
size_t size;
grpc_mdstr_hash_table_entry* entries;
grpc_slice_hash_table_entry* entries;
};
static bool is_terminal(grpc_slice slice) {
return slice.refcount == &terminal_slice_refcount;
}
// Helper function for insert and get operations that performs quadratic
// probing (https://en.wikipedia.org/wiki/Quadratic_probing).
static size_t grpc_mdstr_hash_table_find_index(
const grpc_mdstr_hash_table* table, const grpc_mdstr* key,
bool find_empty) {
static size_t grpc_slice_hash_table_find_index(
const grpc_slice_hash_table* table, const grpc_slice key, bool find_empty) {
size_t hash = grpc_slice_hash(key);
for (size_t i = 0; i < table->size; ++i) {
const size_t idx = (key->hash + i * i) % table->size;
if (table->entries[idx].key == NULL) return find_empty ? idx : table->size;
if (table->entries[idx].key == key) return idx;
const size_t idx = (hash + i * i) % table->size;
if (is_terminal(table->entries[idx].key)) {
return find_empty ? idx : table->size;
}
if (grpc_slice_cmp(table->entries[idx].key, key) == 0) {
return idx;
}
}
return table->size; // Not found.
}
static void grpc_mdstr_hash_table_add(
grpc_mdstr_hash_table* table, grpc_mdstr* key, void* value,
const grpc_mdstr_hash_table_vtable* vtable) {
static void grpc_slice_hash_table_add(
grpc_slice_hash_table* table, grpc_slice key, void* value,
const grpc_slice_hash_table_vtable* vtable) {
GPR_ASSERT(value != NULL);
const size_t idx =
grpc_mdstr_hash_table_find_index(table, key, true /* find_empty */);
grpc_slice_hash_table_find_index(table, key, true /* find_empty */);
GPR_ASSERT(idx != table->size); // Table should never be full.
grpc_mdstr_hash_table_entry* entry = &table->entries[idx];
entry->key = GRPC_MDSTR_REF(key);
grpc_slice_hash_table_entry* entry = &table->entries[idx];
entry->key = grpc_slice_ref(key);
entry->value = vtable->copy_value(value);
entry->vtable = vtable;
}
grpc_mdstr_hash_table* grpc_mdstr_hash_table_create(
size_t num_entries, grpc_mdstr_hash_table_entry* entries) {
grpc_mdstr_hash_table* table = gpr_malloc(sizeof(*table));
grpc_slice_hash_table* grpc_slice_hash_table_create(
size_t num_entries, grpc_slice_hash_table_entry* entries) {
grpc_slice_hash_table* table = gpr_malloc(sizeof(*table));
memset(table, 0, sizeof(*table));
gpr_ref_init(&table->refs, 1);
table->num_entries = num_entries;
// Quadratic probing gets best performance when the table is no more
// than half full.
table->size = num_entries * 2;
const size_t entry_size = sizeof(grpc_mdstr_hash_table_entry) * table->size;
const size_t entry_size = sizeof(grpc_slice_hash_table_entry) * table->size;
table->entries = gpr_malloc(entry_size);
memset(table->entries, 0, entry_size);
for (size_t i = 0; i < num_entries; ++i) {
grpc_mdstr_hash_table_entry* entry = &entries[i];
grpc_mdstr_hash_table_add(table, entry->key, entry->value, entry->vtable);
table->entries[i].key = terminal_slice;
}
for (size_t i = 0; i < num_entries; ++i) {
grpc_slice_hash_table_entry* entry = &entries[i];
grpc_slice_hash_table_add(table, entry->key, entry->value, entry->vtable);
}
return table;
}
grpc_mdstr_hash_table* grpc_mdstr_hash_table_ref(grpc_mdstr_hash_table* table) {
grpc_slice_hash_table* grpc_slice_hash_table_ref(grpc_slice_hash_table* table) {
if (table != NULL) gpr_ref(&table->refs);
return table;
}
int grpc_mdstr_hash_table_unref(grpc_exec_ctx* exec_ctx,
grpc_mdstr_hash_table* table) {
int grpc_slice_hash_table_unref(grpc_exec_ctx* exec_ctx,
grpc_slice_hash_table* table) {
if (table != NULL && gpr_unref(&table->refs)) {
for (size_t i = 0; i < table->size; ++i) {
grpc_mdstr_hash_table_entry* entry = &table->entries[i];
if (entry->key != NULL) {
GRPC_MDSTR_UNREF(exec_ctx, entry->key);
grpc_slice_hash_table_entry* entry = &table->entries[i];
if (!is_terminal(entry->key)) {
grpc_slice_unref_internal(exec_ctx, entry->key);
entry->vtable->destroy_value(exec_ctx, entry->value);
}
}
@ -113,29 +129,29 @@ int grpc_mdstr_hash_table_unref(grpc_exec_ctx* exec_ctx,
return 0;
}
size_t grpc_mdstr_hash_table_num_entries(const grpc_mdstr_hash_table* table) {
size_t grpc_slice_hash_table_num_entries(const grpc_slice_hash_table* table) {
return table->num_entries;
}
void* grpc_mdstr_hash_table_get(const grpc_mdstr_hash_table* table,
const grpc_mdstr* key) {
void* grpc_slice_hash_table_get(const grpc_slice_hash_table* table,
const grpc_slice key) {
const size_t idx =
grpc_mdstr_hash_table_find_index(table, key, false /* find_empty */);
grpc_slice_hash_table_find_index(table, key, false /* find_empty */);
if (idx == table->size) return NULL; // Not found.
return table->entries[idx].value;
}
int grpc_mdstr_hash_table_cmp(const grpc_mdstr_hash_table* table1,
const grpc_mdstr_hash_table* table2) {
int grpc_slice_hash_table_cmp(const grpc_slice_hash_table* table1,
const grpc_slice_hash_table* table2) {
// Compare by num_entries.
if (table1->num_entries < table2->num_entries) return -1;
if (table1->num_entries > table2->num_entries) return 1;
for (size_t i = 0; i < table1->num_entries; ++i) {
grpc_mdstr_hash_table_entry* e1 = &table1->entries[i];
grpc_mdstr_hash_table_entry* e2 = &table2->entries[i];
grpc_slice_hash_table_entry* e1 = &table1->entries[i];
grpc_slice_hash_table_entry* e2 = &table2->entries[i];
// Compare keys by hash value.
if (e1->key->hash < e2->key->hash) return -1;
if (e1->key->hash > e2->key->hash) return 1;
int cmp = grpc_slice_cmp(e1->key, e2->key);
if (cmp != 0) return cmp;
// Compare by vtable (pointer equality).
if (e1->vtable < e2->vtable) return -1;
if (e1->vtable > e2->vtable) return 1;
@ -146,12 +162,12 @@ int grpc_mdstr_hash_table_cmp(const grpc_mdstr_hash_table* table1,
return 0;
}
void grpc_mdstr_hash_table_iterate(
const grpc_mdstr_hash_table* table,
void (*func)(const grpc_mdstr_hash_table_entry* entry, void* user_data),
void grpc_slice_hash_table_iterate(
const grpc_slice_hash_table* table,
void (*func)(const grpc_slice_hash_table_entry* entry, void* user_data),
void* user_data) {
for (size_t i = 0; i < table->size; ++i) {
if (table->entries[i].key != NULL) {
if (!is_terminal(table->entries[i].key)) {
func(&table->entries[i], user_data);
}
}

@ -40,54 +40,54 @@
* (https://en.wikipedia.org/wiki/Open_addressing) with quadratic
* probing (https://en.wikipedia.org/wiki/Quadratic_probing).
*
* The keys are \a grpc_mdstr objects. The values are arbitrary pointers
* The keys are \a grpc_slice objects. The values are arbitrary pointers
* with a common vtable.
*
* Hash tables are intentionally immutable, to avoid the need for locking.
*/
typedef struct grpc_mdstr_hash_table grpc_mdstr_hash_table;
typedef struct grpc_slice_hash_table grpc_slice_hash_table;
typedef struct grpc_mdstr_hash_table_vtable {
void (*destroy_value)(grpc_exec_ctx* exec_ctx, void* value);
void* (*copy_value)(void* value);
int (*compare_value)(void* value1, void* value2);
} grpc_mdstr_hash_table_vtable;
typedef struct grpc_slice_hash_table_vtable {
void (*destroy_value)(grpc_exec_ctx *exec_ctx, void *value);
void *(*copy_value)(void *value);
int (*compare_value)(void *value1, void *value2);
} grpc_slice_hash_table_vtable;
typedef struct grpc_mdstr_hash_table_entry {
grpc_mdstr* key;
void* value; /* Must not be NULL. */
const grpc_mdstr_hash_table_vtable* vtable;
} grpc_mdstr_hash_table_entry;
typedef struct grpc_slice_hash_table_entry {
grpc_slice key;
void *value; /* Must not be NULL. */
const grpc_slice_hash_table_vtable *vtable;
} grpc_slice_hash_table_entry;
/** Creates a new hash table of containing \a entries, which is an array
of length \a num_entries.
Creates its own copy of all keys and values from \a entries. */
grpc_mdstr_hash_table* grpc_mdstr_hash_table_create(
size_t num_entries, grpc_mdstr_hash_table_entry* entries);
grpc_slice_hash_table *grpc_slice_hash_table_create(
size_t num_entries, grpc_slice_hash_table_entry *entries);
grpc_mdstr_hash_table* grpc_mdstr_hash_table_ref(grpc_mdstr_hash_table* table);
grpc_slice_hash_table *grpc_slice_hash_table_ref(grpc_slice_hash_table *table);
/** Returns 1 when \a table is destroyed. */
int grpc_mdstr_hash_table_unref(grpc_exec_ctx* exec_ctx,
grpc_mdstr_hash_table* table);
int grpc_slice_hash_table_unref(grpc_exec_ctx *exec_ctx,
grpc_slice_hash_table *table);
/** Returns the number of entries in \a table. */
size_t grpc_mdstr_hash_table_num_entries(const grpc_mdstr_hash_table* table);
size_t grpc_slice_hash_table_num_entries(const grpc_slice_hash_table *table);
/** Returns the value from \a table associated with \a key.
Returns NULL if \a key is not found. */
void* grpc_mdstr_hash_table_get(const grpc_mdstr_hash_table* table,
const grpc_mdstr* key);
void *grpc_slice_hash_table_get(const grpc_slice_hash_table *table,
const grpc_slice key);
/** Compares two hash tables.
The sort order is stable but undefined. */
int grpc_mdstr_hash_table_cmp(const grpc_mdstr_hash_table* table1,
const grpc_mdstr_hash_table* table2);
int grpc_slice_hash_table_cmp(const grpc_slice_hash_table *table1,
const grpc_slice_hash_table *table2);
/** Iterates over the entries in \a table, calling \a func for each entry. */
void grpc_mdstr_hash_table_iterate(
const grpc_mdstr_hash_table* table,
void (*func)(const grpc_mdstr_hash_table_entry* entry, void* user_data),
void* user_data);
void grpc_slice_hash_table_iterate(
const grpc_slice_hash_table *table,
void (*func)(const grpc_slice_hash_table_entry *entry, void *user_data),
void *user_data);
#endif /* GRPC_CORE_LIB_TRANSPORT_MDSTR_HASH_TABLE_H */

@ -94,7 +94,7 @@ typedef enum {
typedef struct {
uint8_t is_set;
grpc_status_code code;
grpc_mdstr *details;
grpc_slice details;
} received_status;
typedef struct batch_control {
@ -244,7 +244,7 @@ grpc_error *grpc_call_create(grpc_exec_ctx *exec_ctx,
/* Always support no compression */
GPR_BITSET(&call->encodings_accepted_by_peer, GRPC_COMPRESS_NONE);
call->is_client = args->server_transport_data == NULL;
grpc_mdstr *path = NULL;
grpc_slice path = NULL;
if (call->is_client) {
GPR_ASSERT(args->add_initial_metadata_count <
MAX_SEND_EXTRA_METADATA_COUNT);
@ -443,7 +443,7 @@ static void set_status_code(grpc_call *call, status_source source,
}
static void set_status_details(grpc_exec_ctx *exec_ctx, grpc_call *call,
status_source source, grpc_mdstr *status) {
status_source source, grpc_slice status) {
if (call->status[source].details != NULL) {
GRPC_MDSTR_UNREF(exec_ctx, status);
} else {

@ -98,8 +98,8 @@ typedef struct requested_call {
typedef struct channel_registered_method {
registered_method *server_registered_method;
uint32_t flags;
grpc_mdstr *method;
grpc_mdstr *host;
grpc_slice method;
grpc_slice host;
} channel_registered_method;
struct channel_data {
@ -144,8 +144,8 @@ struct call_data {
/** the current state of a call - see call_state */
call_state state;
grpc_mdstr *path;
grpc_mdstr *host;
grpc_slice path;
grpc_slice host;
gpr_timespec deadline;
grpc_completion_queue *cq_new;
@ -459,7 +459,7 @@ static void destroy_channel(grpc_exec_ctx *exec_ctx, channel_data *chand,
op);
}
static void cpstr(char **dest, size_t *capacity, grpc_mdstr *value) {
static void cpstr(char **dest, size_t *capacity, grpc_slice value) {
grpc_slice slice = value->slice;
size_t len = GRPC_SLICE_LENGTH(slice);
@ -1136,8 +1136,8 @@ void grpc_server_setup_transport(grpc_exec_ctx *exec_ctx, grpc_server *s,
channel_registered_method *crm;
grpc_channel *channel;
channel_data *chand;
grpc_mdstr *host;
grpc_mdstr *method;
grpc_slice host;
grpc_slice method;
uint32_t hash;
size_t slots;
uint32_t probes;

@ -137,7 +137,7 @@ void grpc_mdctx_global_init(void) {
memset(g_static_mdtab, 0, sizeof(g_static_mdtab));
memset(g_static_strtab, 0, sizeof(g_static_strtab));
for (i = 0; i < GRPC_STATIC_MDSTR_COUNT; i++) {
grpc_mdstr *elem = &grpc_static_mdstr_table[i];
grpc_slice elem = &grpc_static_mdstr_table[i];
const char *str = grpc_static_metadata_strings[i];
uint32_t hash = gpr_murmur_hash3(str, strlen(str), g_hash_seed);
*(grpc_slice *)&elem->slice = grpc_slice_from_static_string(str);
@ -155,13 +155,13 @@ void grpc_mdctx_global_init(void) {
}
for (i = 0; i < GRPC_STATIC_MDELEM_COUNT; i++) {
grpc_mdelem *elem = &grpc_static_mdelem_table[i];
grpc_mdstr *key =
grpc_slice key =
&grpc_static_mdstr_table[grpc_static_metadata_elem_indices[2 * i + 0]];
grpc_mdstr *value =
grpc_slice value =
&grpc_static_mdstr_table[grpc_static_metadata_elem_indices[2 * i + 1]];
uint32_t hash = GRPC_MDSTR_KV_HASH(key->hash, value->hash);
*(grpc_mdstr **)&elem->key = key;
*(grpc_mdstr **)&elem->value = value;
*(grpc_slice *)&elem->key = key;
*(grpc_slice *)&elem->value = value;
for (j = 0;; j++) {
size_t idx = (hash + j) % GPR_ARRAY_SIZE(g_static_mdtab);
if (g_static_mdtab[idx] == NULL) {
@ -216,8 +216,8 @@ static void ref_md_locked(mdtab_shard *shard,
"ELM REF:%p:%zu->%zu: '%s' = '%s'", (void *)md,
gpr_atm_no_barrier_load(&md->refcnt),
gpr_atm_no_barrier_load(&md->refcnt) + 1,
grpc_mdstr_as_c_string((grpc_mdstr *)md->key),
grpc_mdstr_as_c_string((grpc_mdstr *)md->value));
grpc_mdstr_as_c_string((grpc_slice)md->key),
grpc_mdstr_as_c_string((grpc_slice)md->value));
#endif
if (0 == gpr_atm_no_barrier_fetch_add(&md->refcnt, 1)) {
gpr_atm_no_barrier_fetch_add(&shard->free_estimate, -1);
@ -351,8 +351,8 @@ grpc_mdelem *grpc_mdelem_from_slices(grpc_exec_ctx *exec_ctx, grpc_slice key,
#ifdef GRPC_METADATA_REFCOUNT_DEBUG
gpr_log(GPR_DEBUG, "ELM NEW:%p:%zu: '%s' = '%s'", (void *)md,
gpr_atm_no_barrier_load(&md->refcnt),
grpc_mdstr_as_c_string((grpc_mdstr *)md->key),
grpc_mdstr_as_c_string((grpc_mdstr *)md->value));
grpc_mdstr_as_c_string((grpc_slice)md->key),
grpc_mdstr_as_c_string((grpc_slice)md->value));
#endif
shard->count++;
@ -391,8 +391,8 @@ grpc_mdelem *grpc_mdelem_ref(grpc_mdelem *gmd DEBUG_ARGS) {
"ELM REF:%p:%zu->%zu: '%s' = '%s'", (void *)md,
gpr_atm_no_barrier_load(&md->refcnt),
gpr_atm_no_barrier_load(&md->refcnt) + 1,
grpc_mdstr_as_c_string((grpc_mdstr *)md->key),
grpc_mdstr_as_c_string((grpc_mdstr *)md->value));
grpc_mdstr_as_c_string((grpc_slice)md->key),
grpc_mdstr_as_c_string((grpc_slice)md->value));
#endif
/* we can assume the ref count is >= 1 as the application is calling
this function - meaning that no adjustment to mdtab_free is necessary,
@ -412,8 +412,8 @@ void grpc_mdelem_unref(grpc_exec_ctx *exec_ctx, grpc_mdelem *gmd DEBUG_ARGS) {
"ELM UNREF:%p:%zu->%zu: '%s' = '%s'", (void *)md,
gpr_atm_no_barrier_load(&md->refcnt),
gpr_atm_no_barrier_load(&md->refcnt) - 1,
grpc_mdstr_as_c_string((grpc_mdstr *)md->key),
grpc_mdstr_as_c_string((grpc_mdstr *)md->value));
grpc_mdstr_as_c_string((grpc_slice)md->key),
grpc_mdstr_as_c_string((grpc_slice)md->value));
#endif
uint32_t hash =
GRPC_MDSTR_KV_HASH(grpc_slice_hash(md->key), grpc_slice_hash(md->value));

@ -39,7 +39,7 @@
#include <grpc/support/string_util.h>
#include <grpc/support/time.h>
#include "src/core/lib/transport/mdstr_hash_table.h"
#include "src/core/lib/slice/slice_hash_table.h"
#include "src/core/lib/transport/metadata.h"
//
@ -65,7 +65,7 @@ static int bool_cmp(void* v1, void* v2) {
static void free_mem(grpc_exec_ctx* exec_ctx, void* p) { gpr_free(p); }
static grpc_mdstr_hash_table_vtable bool_vtable = {free_mem, bool_copy,
static grpc_slice_hash_table_vtable bool_vtable = {free_mem, bool_copy,
bool_cmp};
// timespec vtable
@ -81,7 +81,7 @@ static int timespec_cmp(void* v1, void* v2) {
return gpr_time_cmp(*(gpr_timespec*)v1, *(gpr_timespec*)v2);
}
static grpc_mdstr_hash_table_vtable timespec_vtable = {free_mem, timespec_copy,
static grpc_slice_hash_table_vtable timespec_vtable = {free_mem, timespec_copy,
timespec_cmp};
// int32 vtable
@ -101,7 +101,7 @@ static int int32_cmp(void* v1, void* v2) {
return 0;
}
static grpc_mdstr_hash_table_vtable int32_vtable = {free_mem, int32_copy,
static grpc_slice_hash_table_vtable int32_vtable = {free_mem, int32_copy,
int32_cmp};
// Hash table keys.
@ -113,11 +113,11 @@ static grpc_mdstr_hash_table_vtable int32_vtable = {free_mem, int32_copy,
"grpc.max_response_message_bytes" // int32
struct grpc_method_config {
grpc_mdstr_hash_table* table;
grpc_mdstr* wait_for_ready_key;
grpc_mdstr* timeout_key;
grpc_mdstr* max_request_message_bytes_key;
grpc_mdstr* max_response_message_bytes_key;
grpc_slice_hash_table* table;
grpc_slice wait_for_ready_key;
grpc_slice timeout_key;
grpc_slice max_request_message_bytes_key;
grpc_slice max_response_message_bytes_key;
};
grpc_method_config* grpc_method_config_create(
@ -133,7 +133,7 @@ grpc_method_config* grpc_method_config_create(
grpc_mdstr_from_string(GRPC_METHOD_CONFIG_MAX_REQUEST_MESSAGE_BYTES);
method_config->max_response_message_bytes_key =
grpc_mdstr_from_string(GRPC_METHOD_CONFIG_MAX_RESPONSE_MESSAGE_BYTES);
grpc_mdstr_hash_table_entry entries[4];
grpc_slice_hash_table_entry entries[4];
size_t num_entries = 0;
if (wait_for_ready != NULL) {
entries[num_entries].key = method_config->wait_for_ready_key;
@ -159,18 +159,18 @@ grpc_method_config* grpc_method_config_create(
entries[num_entries].vtable = &int32_vtable;
++num_entries;
}
method_config->table = grpc_mdstr_hash_table_create(num_entries, entries);
method_config->table = grpc_slice_hash_table_create(num_entries, entries);
return method_config;
}
grpc_method_config* grpc_method_config_ref(grpc_method_config* method_config) {
grpc_mdstr_hash_table_ref(method_config->table);
grpc_slice_hash_table_ref(method_config->table);
return method_config;
}
void grpc_method_config_unref(grpc_exec_ctx* exec_ctx,
grpc_method_config* method_config) {
if (grpc_mdstr_hash_table_unref(exec_ctx, method_config->table)) {
if (grpc_slice_hash_table_unref(exec_ctx, method_config->table)) {
GRPC_MDSTR_UNREF(exec_ctx, method_config->wait_for_ready_key);
GRPC_MDSTR_UNREF(exec_ctx, method_config->timeout_key);
GRPC_MDSTR_UNREF(exec_ctx, method_config->max_request_message_bytes_key);
@ -181,31 +181,31 @@ void grpc_method_config_unref(grpc_exec_ctx* exec_ctx,
int grpc_method_config_cmp(const grpc_method_config* method_config1,
const grpc_method_config* method_config2) {
return grpc_mdstr_hash_table_cmp(method_config1->table,
return grpc_slice_hash_table_cmp(method_config1->table,
method_config2->table);
}
const bool* grpc_method_config_get_wait_for_ready(
const grpc_method_config* method_config) {
return grpc_mdstr_hash_table_get(method_config->table,
return grpc_slice_hash_table_get(method_config->table,
method_config->wait_for_ready_key);
}
const gpr_timespec* grpc_method_config_get_timeout(
const grpc_method_config* method_config) {
return grpc_mdstr_hash_table_get(method_config->table,
return grpc_slice_hash_table_get(method_config->table,
method_config->timeout_key);
}
const int32_t* grpc_method_config_get_max_request_message_bytes(
const grpc_method_config* method_config) {
return grpc_mdstr_hash_table_get(
return grpc_slice_hash_table_get(
method_config->table, method_config->max_request_message_bytes_key);
}
const int32_t* grpc_method_config_get_max_response_message_bytes(
const grpc_method_config* method_config) {
return grpc_mdstr_hash_table_get(
return grpc_slice_hash_table_get(
method_config->table, method_config->max_response_message_bytes_key);
}
@ -225,43 +225,43 @@ static int method_config_cmp(void* valuep1, void* valuep2) {
return grpc_method_config_cmp(valuep1, valuep2);
}
static const grpc_mdstr_hash_table_vtable method_config_table_vtable = {
static const grpc_slice_hash_table_vtable method_config_table_vtable = {
method_config_unref, method_config_ref, method_config_cmp};
grpc_method_config_table* grpc_method_config_table_create(
size_t num_entries, grpc_method_config_table_entry* entries) {
grpc_mdstr_hash_table_entry* hash_table_entries =
gpr_malloc(sizeof(grpc_mdstr_hash_table_entry) * num_entries);
grpc_slice_hash_table_entry* hash_table_entries =
gpr_malloc(sizeof(grpc_slice_hash_table_entry) * num_entries);
for (size_t i = 0; i < num_entries; ++i) {
hash_table_entries[i].key = entries[i].method_name;
hash_table_entries[i].value = entries[i].method_config;
hash_table_entries[i].vtable = &method_config_table_vtable;
}
grpc_method_config_table* method_config_table =
grpc_mdstr_hash_table_create(num_entries, hash_table_entries);
grpc_slice_hash_table_create(num_entries, hash_table_entries);
gpr_free(hash_table_entries);
return method_config_table;
}
grpc_method_config_table* grpc_method_config_table_ref(
grpc_method_config_table* table) {
return grpc_mdstr_hash_table_ref(table);
return grpc_slice_hash_table_ref(table);
}
void grpc_method_config_table_unref(grpc_exec_ctx* exec_ctx,
grpc_method_config_table* table) {
grpc_mdstr_hash_table_unref(exec_ctx, table);
grpc_slice_hash_table_unref(exec_ctx, table);
}
int grpc_method_config_table_cmp(const grpc_method_config_table* table1,
const grpc_method_config_table* table2) {
return grpc_mdstr_hash_table_cmp(table1, table2);
return grpc_slice_hash_table_cmp(table1, table2);
}
void* grpc_method_config_table_get(grpc_exec_ctx* exec_ctx,
const grpc_mdstr_hash_table* table,
const grpc_mdstr* path) {
void* value = grpc_mdstr_hash_table_get(table, path);
const grpc_slice_hash_table* table,
const grpc_slice path) {
void* value = grpc_slice_hash_table_get(table, path);
// If we didn't find a match for the path, try looking for a wildcard
// entry (i.e., change "/service/method" to "/service/*").
if (value == NULL) {
@ -272,9 +272,9 @@ void* grpc_method_config_table_get(grpc_exec_ctx* exec_ctx,
memcpy(buf, path_str, len);
buf[len] = '*';
buf[len + 1] = '\0';
grpc_mdstr* wildcard_path = grpc_mdstr_from_string(buf);
grpc_slice wildcard_path = grpc_mdstr_from_string(buf);
gpr_free(buf);
value = grpc_mdstr_hash_table_get(table, wildcard_path);
value = grpc_slice_hash_table_get(table, wildcard_path);
GRPC_MDSTR_UNREF(exec_ctx, wildcard_path);
}
return value;
@ -305,14 +305,14 @@ grpc_arg grpc_method_config_table_create_channel_arg(
// State used by convert_entry() below.
typedef struct conversion_state {
void* (*convert_value)(const grpc_method_config* method_config);
const grpc_mdstr_hash_table_vtable* vtable;
const grpc_slice_hash_table_vtable* vtable;
size_t num_entries;
grpc_mdstr_hash_table_entry* entries;
grpc_slice_hash_table_entry* entries;
} conversion_state;
// A function to be passed to grpc_mdstr_hash_table_iterate() to create
// A function to be passed to grpc_slice_hash_table_iterate() to create
// a copy of the entries.
static void convert_entry(const grpc_mdstr_hash_table_entry* entry,
static void convert_entry(const grpc_slice_hash_table_entry* entry,
void* user_data) {
conversion_state* state = user_data;
state->entries[state->num_entries].key = GRPC_MDSTR_REF(entry->key);
@ -321,21 +321,21 @@ static void convert_entry(const grpc_mdstr_hash_table_entry* entry,
++state->num_entries;
}
grpc_mdstr_hash_table* grpc_method_config_table_convert(
grpc_slice_hash_table* grpc_method_config_table_convert(
grpc_exec_ctx* exec_ctx, const grpc_method_config_table* table,
void* (*convert_value)(const grpc_method_config* method_config),
const grpc_mdstr_hash_table_vtable* vtable) {
const grpc_slice_hash_table_vtable* vtable) {
// Create an array of the entries in the table with converted values.
conversion_state state;
state.convert_value = convert_value;
state.vtable = vtable;
state.num_entries = 0;
state.entries = gpr_malloc(sizeof(grpc_mdstr_hash_table_entry) *
grpc_mdstr_hash_table_num_entries(table));
grpc_mdstr_hash_table_iterate(table, convert_entry, &state);
state.entries = gpr_malloc(sizeof(grpc_slice_hash_table_entry) *
grpc_slice_hash_table_num_entries(table));
grpc_slice_hash_table_iterate(table, convert_entry, &state);
// Create a new table based on the array we just constructed.
grpc_mdstr_hash_table* new_table =
grpc_mdstr_hash_table_create(state.num_entries, state.entries);
grpc_slice_hash_table* new_table =
grpc_slice_hash_table_create(state.num_entries, state.entries);
// Clean up the array.
for (size_t i = 0; i < state.num_entries; ++i) {
GRPC_MDSTR_UNREF(exec_ctx, state.entries[i].key);

@ -37,7 +37,7 @@
#include <grpc/impl/codegen/gpr_types.h>
#include <grpc/impl/codegen/grpc_types.h>
#include "src/core/lib/transport/mdstr_hash_table.h"
#include "src/core/lib/slice/slice_hash_table.h"
#include "src/core/lib/transport/metadata.h"
/// Per-method configuration.
@ -55,70 +55,70 @@ typedef struct grpc_method_config grpc_method_config;
/// \a max_request_message_bytes and \a max_response_message_bytes
/// indicate the maximum sizes of the request (checked when sending) and
/// response (checked when receiving) messages.
grpc_method_config* grpc_method_config_create(
bool* wait_for_ready, gpr_timespec* timeout,
int32_t* max_request_message_bytes, int32_t* max_response_message_bytes);
grpc_method_config *grpc_method_config_create(
bool *wait_for_ready, gpr_timespec *timeout,
int32_t *max_request_message_bytes, int32_t *max_response_message_bytes);
grpc_method_config* grpc_method_config_ref(grpc_method_config* method_config);
void grpc_method_config_unref(grpc_exec_ctx* exec_ctx,
grpc_method_config* method_config);
grpc_method_config *grpc_method_config_ref(grpc_method_config *method_config);
void grpc_method_config_unref(grpc_exec_ctx *exec_ctx,
grpc_method_config *method_config);
/// Compares two grpc_method_configs.
/// The sort order is stable but undefined.
int grpc_method_config_cmp(const grpc_method_config* method_config1,
const grpc_method_config* method_config2);
int grpc_method_config_cmp(const grpc_method_config *method_config1,
const grpc_method_config *method_config2);
/// These methods return NULL if the requested field is unset.
/// The caller does NOT take ownership of the result.
const bool* grpc_method_config_get_wait_for_ready(
const grpc_method_config* method_config);
const gpr_timespec* grpc_method_config_get_timeout(
const grpc_method_config* method_config);
const int32_t* grpc_method_config_get_max_request_message_bytes(
const grpc_method_config* method_config);
const int32_t* grpc_method_config_get_max_response_message_bytes(
const grpc_method_config* method_config);
const bool *grpc_method_config_get_wait_for_ready(
const grpc_method_config *method_config);
const gpr_timespec *grpc_method_config_get_timeout(
const grpc_method_config *method_config);
const int32_t *grpc_method_config_get_max_request_message_bytes(
const grpc_method_config *method_config);
const int32_t *grpc_method_config_get_max_response_message_bytes(
const grpc_method_config *method_config);
/// A table of method configs.
typedef grpc_mdstr_hash_table grpc_method_config_table;
typedef grpc_slice_hash_table grpc_method_config_table;
typedef struct grpc_method_config_table_entry {
/// The name is of one of the following forms:
/// service/method -- specifies exact service and method name
/// service/* -- matches all methods for the specified service
grpc_mdstr* method_name;
grpc_method_config* method_config;
grpc_slice method_name;
grpc_method_config *method_config;
} grpc_method_config_table_entry;
/// Takes new references to all keys and values in \a entries.
grpc_method_config_table* grpc_method_config_table_create(
size_t num_entries, grpc_method_config_table_entry* entries);
grpc_method_config_table *grpc_method_config_table_create(
size_t num_entries, grpc_method_config_table_entry *entries);
grpc_method_config_table* grpc_method_config_table_ref(
grpc_method_config_table* table);
void grpc_method_config_table_unref(grpc_exec_ctx* exec_ctx,
grpc_method_config_table* table);
grpc_method_config_table *grpc_method_config_table_ref(
grpc_method_config_table *table);
void grpc_method_config_table_unref(grpc_exec_ctx *exec_ctx,
grpc_method_config_table *table);
/// Compares two grpc_method_config_tables.
/// The sort order is stable but undefined.
int grpc_method_config_table_cmp(const grpc_method_config_table* table1,
const grpc_method_config_table* table2);
int grpc_method_config_table_cmp(const grpc_method_config_table *table1,
const grpc_method_config_table *table2);
/// Gets the method config for the specified \a path, which should be of
/// the form "/service/method".
/// Returns NULL if the method has no config.
/// Caller does NOT own a reference to the result.
///
/// Note: This returns a void* instead of a grpc_method_config* so that
/// Note: This returns a void *instead of a grpc_method_config *so that
/// it can also be used for tables constructed via
/// grpc_method_config_table_convert().
void* grpc_method_config_table_get(grpc_exec_ctx* exec_ctx,
const grpc_mdstr_hash_table* table,
const grpc_mdstr* path);
void *grpc_method_config_table_get(grpc_exec_ctx *exec_ctx,
const grpc_slice_hash_table *table,
const grpc_slice path);
/// Returns a channel arg containing \a table.
grpc_arg grpc_method_config_table_create_channel_arg(
grpc_method_config_table* table);
grpc_method_config_table *table);
/// Generates a new table from \a table whose values are converted to a
/// new form via the \a convert_value function. The new table will use
@ -131,9 +131,9 @@ grpc_arg grpc_method_config_table_create_channel_arg(
/// will return a new instance of the struct containing the values from
/// the grpc_method_config, and \a vtable provides the methods for
/// operating on the struct type.
grpc_mdstr_hash_table* grpc_method_config_table_convert(
grpc_exec_ctx* exec_ctx, const grpc_method_config_table* table,
void* (*convert_value)(const grpc_method_config* method_config),
const grpc_mdstr_hash_table_vtable* vtable);
grpc_slice_hash_table *grpc_method_config_table_convert(
grpc_exec_ctx *exec_ctx, const grpc_method_config_table *table,
void *(*convert_value)(const grpc_method_config *method_config),
const grpc_slice_hash_table_vtable *vtable);
#endif /* GRPC_CORE_LIB_TRANSPORT_METHOD_CONFIG_H */

@ -47,192 +47,192 @@
#define GRPC_STATIC_MDSTR_COUNT 93
extern const grpc_slice grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT];
/* "0" */
#define GRPC_MDSTR_0 (&grpc_static_slice_table[0])
#define GRPC_MDSTR_0 (grpc_static_slice_table[0])
/* "1" */
#define GRPC_MDSTR_1 (&grpc_static_slice_table[1])
#define GRPC_MDSTR_1 (grpc_static_slice_table[1])
/* "2" */
#define GRPC_MDSTR_2 (&grpc_static_slice_table[2])
#define GRPC_MDSTR_2 (grpc_static_slice_table[2])
/* "200" */
#define GRPC_MDSTR_200 (&grpc_static_slice_table[3])
#define GRPC_MDSTR_200 (grpc_static_slice_table[3])
/* "204" */
#define GRPC_MDSTR_204 (&grpc_static_slice_table[4])
#define GRPC_MDSTR_204 (grpc_static_slice_table[4])
/* "206" */
#define GRPC_MDSTR_206 (&grpc_static_slice_table[5])
#define GRPC_MDSTR_206 (grpc_static_slice_table[5])
/* "304" */
#define GRPC_MDSTR_304 (&grpc_static_slice_table[6])
#define GRPC_MDSTR_304 (grpc_static_slice_table[6])
/* "400" */
#define GRPC_MDSTR_400 (&grpc_static_slice_table[7])
#define GRPC_MDSTR_400 (grpc_static_slice_table[7])
/* "404" */
#define GRPC_MDSTR_404 (&grpc_static_slice_table[8])
#define GRPC_MDSTR_404 (grpc_static_slice_table[8])
/* "500" */
#define GRPC_MDSTR_500 (&grpc_static_slice_table[9])
#define GRPC_MDSTR_500 (grpc_static_slice_table[9])
/* "accept" */
#define GRPC_MDSTR_ACCEPT (&grpc_static_slice_table[10])
#define GRPC_MDSTR_ACCEPT (grpc_static_slice_table[10])
/* "accept-charset" */
#define GRPC_MDSTR_ACCEPT_CHARSET (&grpc_static_slice_table[11])
#define GRPC_MDSTR_ACCEPT_CHARSET (grpc_static_slice_table[11])
/* "accept-encoding" */
#define GRPC_MDSTR_ACCEPT_ENCODING (&grpc_static_slice_table[12])
#define GRPC_MDSTR_ACCEPT_ENCODING (grpc_static_slice_table[12])
/* "accept-language" */
#define GRPC_MDSTR_ACCEPT_LANGUAGE (&grpc_static_slice_table[13])
#define GRPC_MDSTR_ACCEPT_LANGUAGE (grpc_static_slice_table[13])
/* "accept-ranges" */
#define GRPC_MDSTR_ACCEPT_RANGES (&grpc_static_slice_table[14])
#define GRPC_MDSTR_ACCEPT_RANGES (grpc_static_slice_table[14])
/* "access-control-allow-origin" */
#define GRPC_MDSTR_ACCESS_CONTROL_ALLOW_ORIGIN (&grpc_static_slice_table[15])
#define GRPC_MDSTR_ACCESS_CONTROL_ALLOW_ORIGIN (grpc_static_slice_table[15])
/* "age" */
#define GRPC_MDSTR_AGE (&grpc_static_slice_table[16])
#define GRPC_MDSTR_AGE (grpc_static_slice_table[16])
/* "allow" */
#define GRPC_MDSTR_ALLOW (&grpc_static_slice_table[17])
#define GRPC_MDSTR_ALLOW (grpc_static_slice_table[17])
/* "application/grpc" */
#define GRPC_MDSTR_APPLICATION_SLASH_GRPC (&grpc_static_slice_table[18])
#define GRPC_MDSTR_APPLICATION_SLASH_GRPC (grpc_static_slice_table[18])
/* ":authority" */
#define GRPC_MDSTR_AUTHORITY (&grpc_static_slice_table[19])
#define GRPC_MDSTR_AUTHORITY (grpc_static_slice_table[19])
/* "authorization" */
#define GRPC_MDSTR_AUTHORIZATION (&grpc_static_slice_table[20])
#define GRPC_MDSTR_AUTHORIZATION (grpc_static_slice_table[20])
/* "cache-control" */
#define GRPC_MDSTR_CACHE_CONTROL (&grpc_static_slice_table[21])
#define GRPC_MDSTR_CACHE_CONTROL (grpc_static_slice_table[21])
/* "content-disposition" */
#define GRPC_MDSTR_CONTENT_DISPOSITION (&grpc_static_slice_table[22])
#define GRPC_MDSTR_CONTENT_DISPOSITION (grpc_static_slice_table[22])
/* "content-encoding" */
#define GRPC_MDSTR_CONTENT_ENCODING (&grpc_static_slice_table[23])
#define GRPC_MDSTR_CONTENT_ENCODING (grpc_static_slice_table[23])
/* "content-language" */
#define GRPC_MDSTR_CONTENT_LANGUAGE (&grpc_static_slice_table[24])
#define GRPC_MDSTR_CONTENT_LANGUAGE (grpc_static_slice_table[24])
/* "content-length" */
#define GRPC_MDSTR_CONTENT_LENGTH (&grpc_static_slice_table[25])
#define GRPC_MDSTR_CONTENT_LENGTH (grpc_static_slice_table[25])
/* "content-location" */
#define GRPC_MDSTR_CONTENT_LOCATION (&grpc_static_slice_table[26])
#define GRPC_MDSTR_CONTENT_LOCATION (grpc_static_slice_table[26])
/* "content-range" */
#define GRPC_MDSTR_CONTENT_RANGE (&grpc_static_slice_table[27])
#define GRPC_MDSTR_CONTENT_RANGE (grpc_static_slice_table[27])
/* "content-type" */
#define GRPC_MDSTR_CONTENT_TYPE (&grpc_static_slice_table[28])
#define GRPC_MDSTR_CONTENT_TYPE (grpc_static_slice_table[28])
/* "cookie" */
#define GRPC_MDSTR_COOKIE (&grpc_static_slice_table[29])
#define GRPC_MDSTR_COOKIE (grpc_static_slice_table[29])
/* "date" */
#define GRPC_MDSTR_DATE (&grpc_static_slice_table[30])
#define GRPC_MDSTR_DATE (grpc_static_slice_table[30])
/* "deflate" */
#define GRPC_MDSTR_DEFLATE (&grpc_static_slice_table[31])
#define GRPC_MDSTR_DEFLATE (grpc_static_slice_table[31])
/* "deflate,gzip" */
#define GRPC_MDSTR_DEFLATE_COMMA_GZIP (&grpc_static_slice_table[32])
#define GRPC_MDSTR_DEFLATE_COMMA_GZIP (grpc_static_slice_table[32])
/* "" */
#define GRPC_MDSTR_EMPTY (&grpc_static_slice_table[33])
#define GRPC_MDSTR_EMPTY (grpc_static_slice_table[33])
/* "etag" */
#define GRPC_MDSTR_ETAG (&grpc_static_slice_table[34])
#define GRPC_MDSTR_ETAG (grpc_static_slice_table[34])
/* "expect" */
#define GRPC_MDSTR_EXPECT (&grpc_static_slice_table[35])
#define GRPC_MDSTR_EXPECT (grpc_static_slice_table[35])
/* "expires" */
#define GRPC_MDSTR_EXPIRES (&grpc_static_slice_table[36])
#define GRPC_MDSTR_EXPIRES (grpc_static_slice_table[36])
/* "from" */
#define GRPC_MDSTR_FROM (&grpc_static_slice_table[37])
#define GRPC_MDSTR_FROM (grpc_static_slice_table[37])
/* "GET" */
#define GRPC_MDSTR_GET (&grpc_static_slice_table[38])
#define GRPC_MDSTR_GET (grpc_static_slice_table[38])
/* "grpc" */
#define GRPC_MDSTR_GRPC (&grpc_static_slice_table[39])
#define GRPC_MDSTR_GRPC (grpc_static_slice_table[39])
/* "grpc-accept-encoding" */
#define GRPC_MDSTR_GRPC_ACCEPT_ENCODING (&grpc_static_slice_table[40])
#define GRPC_MDSTR_GRPC_ACCEPT_ENCODING (grpc_static_slice_table[40])
/* "grpc-encoding" */
#define GRPC_MDSTR_GRPC_ENCODING (&grpc_static_slice_table[41])
#define GRPC_MDSTR_GRPC_ENCODING (grpc_static_slice_table[41])
/* "grpc-internal-encoding-request" */
#define GRPC_MDSTR_GRPC_INTERNAL_ENCODING_REQUEST (&grpc_static_slice_table[42])
#define GRPC_MDSTR_GRPC_INTERNAL_ENCODING_REQUEST (grpc_static_slice_table[42])
/* "grpc-message" */
#define GRPC_MDSTR_GRPC_MESSAGE (&grpc_static_slice_table[43])
#define GRPC_MDSTR_GRPC_MESSAGE (grpc_static_slice_table[43])
/* "grpc-payload-bin" */
#define GRPC_MDSTR_GRPC_PAYLOAD_BIN (&grpc_static_slice_table[44])
#define GRPC_MDSTR_GRPC_PAYLOAD_BIN (grpc_static_slice_table[44])
/* "grpc-stats-bin" */
#define GRPC_MDSTR_GRPC_STATS_BIN (&grpc_static_slice_table[45])
#define GRPC_MDSTR_GRPC_STATS_BIN (grpc_static_slice_table[45])
/* "grpc-status" */
#define GRPC_MDSTR_GRPC_STATUS (&grpc_static_slice_table[46])
#define GRPC_MDSTR_GRPC_STATUS (grpc_static_slice_table[46])
/* "grpc-timeout" */
#define GRPC_MDSTR_GRPC_TIMEOUT (&grpc_static_slice_table[47])
#define GRPC_MDSTR_GRPC_TIMEOUT (grpc_static_slice_table[47])
/* "grpc-tracing-bin" */
#define GRPC_MDSTR_GRPC_TRACING_BIN (&grpc_static_slice_table[48])
#define GRPC_MDSTR_GRPC_TRACING_BIN (grpc_static_slice_table[48])
/* "gzip" */
#define GRPC_MDSTR_GZIP (&grpc_static_slice_table[49])
#define GRPC_MDSTR_GZIP (grpc_static_slice_table[49])
/* "gzip, deflate" */
#define GRPC_MDSTR_GZIP_COMMA_DEFLATE (&grpc_static_slice_table[50])
#define GRPC_MDSTR_GZIP_COMMA_DEFLATE (grpc_static_slice_table[50])
/* "host" */
#define GRPC_MDSTR_HOST (&grpc_static_slice_table[51])
#define GRPC_MDSTR_HOST (grpc_static_slice_table[51])
/* "http" */
#define GRPC_MDSTR_HTTP (&grpc_static_slice_table[52])
#define GRPC_MDSTR_HTTP (grpc_static_slice_table[52])
/* "https" */
#define GRPC_MDSTR_HTTPS (&grpc_static_slice_table[53])
#define GRPC_MDSTR_HTTPS (grpc_static_slice_table[53])
/* "identity" */
#define GRPC_MDSTR_IDENTITY (&grpc_static_slice_table[54])
#define GRPC_MDSTR_IDENTITY (grpc_static_slice_table[54])
/* "identity,deflate" */
#define GRPC_MDSTR_IDENTITY_COMMA_DEFLATE (&grpc_static_slice_table[55])
#define GRPC_MDSTR_IDENTITY_COMMA_DEFLATE (grpc_static_slice_table[55])
/* "identity,deflate,gzip" */
#define GRPC_MDSTR_IDENTITY_COMMA_DEFLATE_COMMA_GZIP \
(&grpc_static_slice_table[56])
(grpc_static_slice_table[56])
/* "identity,gzip" */
#define GRPC_MDSTR_IDENTITY_COMMA_GZIP (&grpc_static_slice_table[57])
#define GRPC_MDSTR_IDENTITY_COMMA_GZIP (grpc_static_slice_table[57])
/* "if-match" */
#define GRPC_MDSTR_IF_MATCH (&grpc_static_slice_table[58])
#define GRPC_MDSTR_IF_MATCH (grpc_static_slice_table[58])
/* "if-modified-since" */
#define GRPC_MDSTR_IF_MODIFIED_SINCE (&grpc_static_slice_table[59])
#define GRPC_MDSTR_IF_MODIFIED_SINCE (grpc_static_slice_table[59])
/* "if-none-match" */
#define GRPC_MDSTR_IF_NONE_MATCH (&grpc_static_slice_table[60])
#define GRPC_MDSTR_IF_NONE_MATCH (grpc_static_slice_table[60])
/* "if-range" */
#define GRPC_MDSTR_IF_RANGE (&grpc_static_slice_table[61])
#define GRPC_MDSTR_IF_RANGE (grpc_static_slice_table[61])
/* "if-unmodified-since" */
#define GRPC_MDSTR_IF_UNMODIFIED_SINCE (&grpc_static_slice_table[62])
#define GRPC_MDSTR_IF_UNMODIFIED_SINCE (grpc_static_slice_table[62])
/* "last-modified" */
#define GRPC_MDSTR_LAST_MODIFIED (&grpc_static_slice_table[63])
#define GRPC_MDSTR_LAST_MODIFIED (grpc_static_slice_table[63])
/* "lb-cost-bin" */
#define GRPC_MDSTR_LB_COST_BIN (&grpc_static_slice_table[64])
#define GRPC_MDSTR_LB_COST_BIN (grpc_static_slice_table[64])
/* "lb-token" */
#define GRPC_MDSTR_LB_TOKEN (&grpc_static_slice_table[65])
#define GRPC_MDSTR_LB_TOKEN (grpc_static_slice_table[65])
/* "link" */
#define GRPC_MDSTR_LINK (&grpc_static_slice_table[66])
#define GRPC_MDSTR_LINK (grpc_static_slice_table[66])
/* "location" */
#define GRPC_MDSTR_LOCATION (&grpc_static_slice_table[67])
#define GRPC_MDSTR_LOCATION (grpc_static_slice_table[67])
/* "max-forwards" */
#define GRPC_MDSTR_MAX_FORWARDS (&grpc_static_slice_table[68])
#define GRPC_MDSTR_MAX_FORWARDS (grpc_static_slice_table[68])
/* ":method" */
#define GRPC_MDSTR_METHOD (&grpc_static_slice_table[69])
#define GRPC_MDSTR_METHOD (grpc_static_slice_table[69])
/* ":path" */
#define GRPC_MDSTR_PATH (&grpc_static_slice_table[70])
#define GRPC_MDSTR_PATH (grpc_static_slice_table[70])
/* "POST" */
#define GRPC_MDSTR_POST (&grpc_static_slice_table[71])
#define GRPC_MDSTR_POST (grpc_static_slice_table[71])
/* "proxy-authenticate" */
#define GRPC_MDSTR_PROXY_AUTHENTICATE (&grpc_static_slice_table[72])
#define GRPC_MDSTR_PROXY_AUTHENTICATE (grpc_static_slice_table[72])
/* "proxy-authorization" */
#define GRPC_MDSTR_PROXY_AUTHORIZATION (&grpc_static_slice_table[73])
#define GRPC_MDSTR_PROXY_AUTHORIZATION (grpc_static_slice_table[73])
/* "PUT" */
#define GRPC_MDSTR_PUT (&grpc_static_slice_table[74])
#define GRPC_MDSTR_PUT (grpc_static_slice_table[74])
/* "range" */
#define GRPC_MDSTR_RANGE (&grpc_static_slice_table[75])
#define GRPC_MDSTR_RANGE (grpc_static_slice_table[75])
/* "referer" */
#define GRPC_MDSTR_REFERER (&grpc_static_slice_table[76])
#define GRPC_MDSTR_REFERER (grpc_static_slice_table[76])
/* "refresh" */
#define GRPC_MDSTR_REFRESH (&grpc_static_slice_table[77])
#define GRPC_MDSTR_REFRESH (grpc_static_slice_table[77])
/* "retry-after" */
#define GRPC_MDSTR_RETRY_AFTER (&grpc_static_slice_table[78])
#define GRPC_MDSTR_RETRY_AFTER (grpc_static_slice_table[78])
/* ":scheme" */
#define GRPC_MDSTR_SCHEME (&grpc_static_slice_table[79])
#define GRPC_MDSTR_SCHEME (grpc_static_slice_table[79])
/* "server" */
#define GRPC_MDSTR_SERVER (&grpc_static_slice_table[80])
#define GRPC_MDSTR_SERVER (grpc_static_slice_table[80])
/* "set-cookie" */
#define GRPC_MDSTR_SET_COOKIE (&grpc_static_slice_table[81])
#define GRPC_MDSTR_SET_COOKIE (grpc_static_slice_table[81])
/* "/" */
#define GRPC_MDSTR_SLASH (&grpc_static_slice_table[82])
#define GRPC_MDSTR_SLASH (grpc_static_slice_table[82])
/* "/index.html" */
#define GRPC_MDSTR_SLASH_INDEX_DOT_HTML (&grpc_static_slice_table[83])
#define GRPC_MDSTR_SLASH_INDEX_DOT_HTML (grpc_static_slice_table[83])
/* ":status" */
#define GRPC_MDSTR_STATUS (&grpc_static_slice_table[84])
#define GRPC_MDSTR_STATUS (grpc_static_slice_table[84])
/* "strict-transport-security" */
#define GRPC_MDSTR_STRICT_TRANSPORT_SECURITY (&grpc_static_slice_table[85])
#define GRPC_MDSTR_STRICT_TRANSPORT_SECURITY (grpc_static_slice_table[85])
/* "te" */
#define GRPC_MDSTR_TE (&grpc_static_slice_table[86])
#define GRPC_MDSTR_TE (grpc_static_slice_table[86])
/* "trailers" */
#define GRPC_MDSTR_TRAILERS (&grpc_static_slice_table[87])
#define GRPC_MDSTR_TRAILERS (grpc_static_slice_table[87])
/* "transfer-encoding" */
#define GRPC_MDSTR_TRANSFER_ENCODING (&grpc_static_slice_table[88])
#define GRPC_MDSTR_TRANSFER_ENCODING (grpc_static_slice_table[88])
/* "user-agent" */
#define GRPC_MDSTR_USER_AGENT (&grpc_static_slice_table[89])
#define GRPC_MDSTR_USER_AGENT (grpc_static_slice_table[89])
/* "vary" */
#define GRPC_MDSTR_VARY (&grpc_static_slice_table[90])
#define GRPC_MDSTR_VARY (grpc_static_slice_table[90])
/* "via" */
#define GRPC_MDSTR_VIA (&grpc_static_slice_table[91])
#define GRPC_MDSTR_VIA (grpc_static_slice_table[91])
/* "www-authenticate" */
#define GRPC_MDSTR_WWW_AUTHENTICATE (&grpc_static_slice_table[92])
#define GRPC_MDSTR_WWW_AUTHENTICATE (grpc_static_slice_table[92])
bool grpc_is_static_metadata_string(grpc_slice slice);

@ -35,7 +35,7 @@
namespace grpc {
Slice::Slice() : slice_(gpr_empty_slice()) {}
Slice::Slice() : slice_(grpc_empty_slice()) {}
Slice::~Slice() { grpc_slice_unref(slice_); }

@ -157,6 +157,7 @@ CORE_SOURCE_FILES = [
'src/core/lib/slice/percent_encoding.c',
'src/core/lib/slice/slice.c',
'src/core/lib/slice/slice_buffer.c',
'src/core/lib/slice/slice_hash_table.c',
'src/core/lib/slice/slice_intern.c',
'src/core/lib/slice/slice_string_helpers.c',
'src/core/lib/surface/alarm.c',
@ -179,7 +180,6 @@ CORE_SOURCE_FILES = [
'src/core/lib/surface/version.c',
'src/core/lib/transport/byte_stream.c',
'src/core/lib/transport/connectivity_state.c',
'src/core/lib/transport/mdstr_hash_table.c',
'src/core/lib/transport/metadata.c',
'src/core/lib/transport/metadata_batch.c',
'src/core/lib/transport/method_config.c',

@ -187,9 +187,12 @@ grpc_slice_sub_type grpc_slice_sub_import;
grpc_slice_sub_no_ref_type grpc_slice_sub_no_ref_import;
grpc_slice_split_tail_type grpc_slice_split_tail_import;
grpc_slice_split_head_type grpc_slice_split_head_import;
gpr_empty_slice_type gpr_empty_slice_import;
grpc_empty_slice_type grpc_empty_slice_import;
grpc_slice_cmp_type grpc_slice_cmp_import;
grpc_slice_str_cmp_type grpc_slice_str_cmp_import;
grpc_slice_buf_cmp_type grpc_slice_buf_cmp_import;
grpc_slice_buf_start_eq_type grpc_slice_buf_start_eq_import;
grpc_slice_hash_type grpc_slice_hash_import;
grpc_slice_buffer_init_type grpc_slice_buffer_init_import;
grpc_slice_buffer_destroy_type grpc_slice_buffer_destroy_import;
grpc_slice_buffer_add_type grpc_slice_buffer_add_import;
@ -463,9 +466,12 @@ void grpc_rb_load_imports(HMODULE library) {
grpc_slice_sub_no_ref_import = (grpc_slice_sub_no_ref_type) GetProcAddress(library, "grpc_slice_sub_no_ref");
grpc_slice_split_tail_import = (grpc_slice_split_tail_type) GetProcAddress(library, "grpc_slice_split_tail");
grpc_slice_split_head_import = (grpc_slice_split_head_type) GetProcAddress(library, "grpc_slice_split_head");
gpr_empty_slice_import = (gpr_empty_slice_type) GetProcAddress(library, "gpr_empty_slice");
grpc_empty_slice_import = (grpc_empty_slice_type) GetProcAddress(library, "grpc_empty_slice");
grpc_slice_cmp_import = (grpc_slice_cmp_type) GetProcAddress(library, "grpc_slice_cmp");
grpc_slice_str_cmp_import = (grpc_slice_str_cmp_type) GetProcAddress(library, "grpc_slice_str_cmp");
grpc_slice_buf_cmp_import = (grpc_slice_buf_cmp_type) GetProcAddress(library, "grpc_slice_buf_cmp");
grpc_slice_buf_start_eq_import = (grpc_slice_buf_start_eq_type) GetProcAddress(library, "grpc_slice_buf_start_eq");
grpc_slice_hash_import = (grpc_slice_hash_type) GetProcAddress(library, "grpc_slice_hash");
grpc_slice_buffer_init_import = (grpc_slice_buffer_init_type) GetProcAddress(library, "grpc_slice_buffer_init");
grpc_slice_buffer_destroy_import = (grpc_slice_buffer_destroy_type) GetProcAddress(library, "grpc_slice_buffer_destroy");
grpc_slice_buffer_add_import = (grpc_slice_buffer_add_type) GetProcAddress(library, "grpc_slice_buffer_add");

@ -176,7 +176,7 @@ extern census_resource_id_type census_resource_id_import;
typedef void(*census_record_values_type)(census_context *context, census_value *values, size_t nvalues);
extern census_record_values_type census_record_values_import;
#define census_record_values census_record_values_import
typedef int(*grpc_compression_algorithm_parse_type)(const char *name, size_t name_length, grpc_compression_algorithm *algorithm);
typedef int(*grpc_compression_algorithm_parse_type)(grpc_slice value, grpc_compression_algorithm *algorithm);
extern grpc_compression_algorithm_parse_type grpc_compression_algorithm_parse_import;
#define grpc_compression_algorithm_parse grpc_compression_algorithm_parse_import
typedef int(*grpc_compression_algorithm_name_type)(grpc_compression_algorithm algorithm, char **name);
@ -512,15 +512,24 @@ extern grpc_slice_split_tail_type grpc_slice_split_tail_import;
typedef grpc_slice(*grpc_slice_split_head_type)(grpc_slice *s, size_t split);
extern grpc_slice_split_head_type grpc_slice_split_head_import;
#define grpc_slice_split_head grpc_slice_split_head_import
typedef grpc_slice(*gpr_empty_slice_type)(void);
extern gpr_empty_slice_type gpr_empty_slice_import;
#define gpr_empty_slice gpr_empty_slice_import
typedef grpc_slice(*grpc_empty_slice_type)(void);
extern grpc_empty_slice_type grpc_empty_slice_import;
#define grpc_empty_slice grpc_empty_slice_import
typedef int(*grpc_slice_cmp_type)(grpc_slice a, grpc_slice b);
extern grpc_slice_cmp_type grpc_slice_cmp_import;
#define grpc_slice_cmp grpc_slice_cmp_import
typedef int(*grpc_slice_str_cmp_type)(grpc_slice a, const char *b);
extern grpc_slice_str_cmp_type grpc_slice_str_cmp_import;
#define grpc_slice_str_cmp grpc_slice_str_cmp_import
typedef int(*grpc_slice_buf_cmp_type)(grpc_slice a, const void *b, size_t blen);
extern grpc_slice_buf_cmp_type grpc_slice_buf_cmp_import;
#define grpc_slice_buf_cmp grpc_slice_buf_cmp_import
typedef int(*grpc_slice_buf_start_eq_type)(grpc_slice a, const void *b, size_t blen);
extern grpc_slice_buf_start_eq_type grpc_slice_buf_start_eq_import;
#define grpc_slice_buf_start_eq grpc_slice_buf_start_eq_import
typedef uint32_t(*grpc_slice_hash_type)(grpc_slice s);
extern grpc_slice_hash_type grpc_slice_hash_import;
#define grpc_slice_hash grpc_slice_hash_import
typedef void(*grpc_slice_buffer_init_type)(grpc_slice_buffer *sb);
extern grpc_slice_buffer_init_type grpc_slice_buffer_init_import;
#define grpc_slice_buffer_init grpc_slice_buffer_init_import

@ -287,7 +287,7 @@ print >>H, '#define GRPC_STATIC_MDSTR_COUNT %d' % len(all_strs)
print >>H, 'extern const grpc_slice grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT];'
for i, elem in enumerate(all_strs):
print >>H, '/* "%s" */' % elem
print >>H, '#define %s (&grpc_static_slice_table[%d])' % (mangle(elem).upper(), i)
print >>H, '#define %s (grpc_static_slice_table[%d])' % (mangle(elem).upper(), i)
print >>H
print >>H, 'bool grpc_is_static_metadata_string(grpc_slice slice);'
print >>H

@ -863,6 +863,7 @@ src/core/lib/json/json_common.h \
src/core/lib/json/json_reader.h \
src/core/lib/json/json_writer.h \
src/core/lib/slice/percent_encoding.h \
src/core/lib/slice/slice_hash_table.h \
src/core/lib/slice/slice_string_helpers.h \
src/core/lib/surface/api_trace.h \
src/core/lib/surface/call.h \
@ -877,7 +878,6 @@ src/core/lib/surface/lame_client.h \
src/core/lib/surface/server.h \
src/core/lib/transport/byte_stream.h \
src/core/lib/transport/connectivity_state.h \
src/core/lib/transport/mdstr_hash_table.h \
src/core/lib/transport/metadata.h \
src/core/lib/transport/metadata_batch.h \
src/core/lib/transport/method_config.h \
@ -1049,6 +1049,7 @@ src/core/lib/json/json_writer.c \
src/core/lib/slice/percent_encoding.c \
src/core/lib/slice/slice.c \
src/core/lib/slice/slice_buffer.c \
src/core/lib/slice/slice_hash_table.c \
src/core/lib/slice/slice_intern.c \
src/core/lib/slice/slice_string_helpers.c \
src/core/lib/surface/alarm.c \
@ -1071,7 +1072,6 @@ src/core/lib/surface/validate_metadata.c \
src/core/lib/surface/version.c \
src/core/lib/transport/byte_stream.c \
src/core/lib/transport/connectivity_state.c \
src/core/lib/transport/mdstr_hash_table.c \
src/core/lib/transport/metadata.c \
src/core/lib/transport/metadata_batch.c \
src/core/lib/transport/method_config.c \

@ -6689,6 +6689,7 @@
"src/core/lib/json/json_reader.h",
"src/core/lib/json/json_writer.h",
"src/core/lib/slice/percent_encoding.h",
"src/core/lib/slice/slice_hash_table.h",
"src/core/lib/slice/slice_string_helpers.h",
"src/core/lib/surface/api_trace.h",
"src/core/lib/surface/call.h",
@ -6703,7 +6704,6 @@
"src/core/lib/surface/server.h",
"src/core/lib/transport/byte_stream.h",
"src/core/lib/transport/connectivity_state.h",
"src/core/lib/transport/mdstr_hash_table.h",
"src/core/lib/transport/metadata.h",
"src/core/lib/transport/metadata_batch.h",
"src/core/lib/transport/method_config.h",
@ -6882,6 +6882,8 @@
"src/core/lib/slice/percent_encoding.h",
"src/core/lib/slice/slice.c",
"src/core/lib/slice/slice_buffer.c",
"src/core/lib/slice/slice_hash_table.c",
"src/core/lib/slice/slice_hash_table.h",
"src/core/lib/slice/slice_intern.c",
"src/core/lib/slice/slice_string_helpers.c",
"src/core/lib/slice/slice_string_helpers.h",
@ -6918,8 +6920,6 @@
"src/core/lib/transport/byte_stream.h",
"src/core/lib/transport/connectivity_state.c",
"src/core/lib/transport/connectivity_state.h",
"src/core/lib/transport/mdstr_hash_table.c",
"src/core/lib/transport/mdstr_hash_table.h",
"src/core/lib/transport/metadata.c",
"src/core/lib/transport/metadata.h",
"src/core/lib/transport/metadata_batch.c",

@ -372,6 +372,7 @@
<ClInclude Include="$(SolutionDir)\..\src\core\lib\json\json_reader.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\json\json_writer.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\slice\percent_encoding.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\slice\slice_hash_table.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\slice\slice_string_helpers.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\surface\api_trace.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\surface\call.h" />
@ -386,7 +387,6 @@
<ClInclude Include="$(SolutionDir)\..\src\core\lib\surface\server.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\transport\byte_stream.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\transport\connectivity_state.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\transport\mdstr_hash_table.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\transport\metadata.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\transport\metadata_batch.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\transport\method_config.h" />
@ -643,6 +643,8 @@
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\slice\slice_buffer.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\slice\slice_hash_table.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\slice\slice_intern.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\slice\slice_string_helpers.c">
@ -687,8 +689,6 @@
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\transport\connectivity_state.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\transport\mdstr_hash_table.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\transport\metadata.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\transport\metadata_batch.c">

@ -250,6 +250,9 @@
<ClCompile Include="$(SolutionDir)\..\src\core\lib\slice\slice_buffer.c">
<Filter>src\core\lib\slice</Filter>
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\slice\slice_hash_table.c">
<Filter>src\core\lib\slice</Filter>
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\slice\slice_intern.c">
<Filter>src\core\lib\slice</Filter>
</ClCompile>
@ -316,9 +319,6 @@
<ClCompile Include="$(SolutionDir)\..\src\core\lib\transport\connectivity_state.c">
<Filter>src\core\lib\transport</Filter>
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\transport\mdstr_hash_table.c">
<Filter>src\core\lib\transport</Filter>
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\transport\metadata.c">
<Filter>src\core\lib\transport</Filter>
</ClCompile>
@ -956,6 +956,9 @@
<ClInclude Include="$(SolutionDir)\..\src\core\lib\slice\percent_encoding.h">
<Filter>src\core\lib\slice</Filter>
</ClInclude>
<ClInclude Include="$(SolutionDir)\..\src\core\lib\slice\slice_hash_table.h">
<Filter>src\core\lib\slice</Filter>
</ClInclude>
<ClInclude Include="$(SolutionDir)\..\src\core\lib\slice\slice_string_helpers.h">
<Filter>src\core\lib\slice</Filter>
</ClInclude>
@ -998,9 +1001,6 @@
<ClInclude Include="$(SolutionDir)\..\src\core\lib\transport\connectivity_state.h">
<Filter>src\core\lib\transport</Filter>
</ClInclude>
<ClInclude Include="$(SolutionDir)\..\src\core\lib\transport\mdstr_hash_table.h">
<Filter>src\core\lib\transport</Filter>
</ClInclude>
<ClInclude Include="$(SolutionDir)\..\src\core\lib\transport\metadata.h">
<Filter>src\core\lib\transport</Filter>
</ClInclude>

@ -265,6 +265,7 @@
<ClInclude Include="$(SolutionDir)\..\src\core\lib\json\json_reader.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\json\json_writer.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\slice\percent_encoding.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\slice\slice_hash_table.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\slice\slice_string_helpers.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\surface\api_trace.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\surface\call.h" />
@ -279,7 +280,6 @@
<ClInclude Include="$(SolutionDir)\..\src\core\lib\surface\server.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\transport\byte_stream.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\transport\connectivity_state.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\transport\mdstr_hash_table.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\transport\metadata.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\transport\metadata_batch.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\transport\method_config.h" />
@ -494,6 +494,8 @@
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\slice\slice_buffer.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\slice\slice_hash_table.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\slice\slice_intern.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\slice\slice_string_helpers.c">
@ -538,8 +540,6 @@
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\transport\connectivity_state.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\transport\mdstr_hash_table.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\transport\metadata.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\transport\metadata_batch.c">

@ -307,6 +307,9 @@
<ClCompile Include="$(SolutionDir)\..\src\core\lib\slice\slice_buffer.c">
<Filter>src\core\lib\slice</Filter>
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\slice\slice_hash_table.c">
<Filter>src\core\lib\slice</Filter>
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\slice\slice_intern.c">
<Filter>src\core\lib\slice</Filter>
</ClCompile>
@ -373,9 +376,6 @@
<ClCompile Include="$(SolutionDir)\..\src\core\lib\transport\connectivity_state.c">
<Filter>src\core\lib\transport</Filter>
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\transport\mdstr_hash_table.c">
<Filter>src\core\lib\transport</Filter>
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\transport\metadata.c">
<Filter>src\core\lib\transport</Filter>
</ClCompile>
@ -752,6 +752,9 @@
<ClInclude Include="$(SolutionDir)\..\src\core\lib\slice\percent_encoding.h">
<Filter>src\core\lib\slice</Filter>
</ClInclude>
<ClInclude Include="$(SolutionDir)\..\src\core\lib\slice\slice_hash_table.h">
<Filter>src\core\lib\slice</Filter>
</ClInclude>
<ClInclude Include="$(SolutionDir)\..\src\core\lib\slice\slice_string_helpers.h">
<Filter>src\core\lib\slice</Filter>
</ClInclude>
@ -794,9 +797,6 @@
<ClInclude Include="$(SolutionDir)\..\src\core\lib\transport\connectivity_state.h">
<Filter>src\core\lib\transport</Filter>
</ClInclude>
<ClInclude Include="$(SolutionDir)\..\src\core\lib\transport\mdstr_hash_table.h">
<Filter>src\core\lib\transport</Filter>
</ClInclude>
<ClInclude Include="$(SolutionDir)\..\src\core\lib\transport\metadata.h">
<Filter>src\core\lib\transport</Filter>
</ClInclude>

@ -362,6 +362,7 @@
<ClInclude Include="$(SolutionDir)\..\src\core\lib\json\json_reader.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\json\json_writer.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\slice\percent_encoding.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\slice\slice_hash_table.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\slice\slice_string_helpers.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\surface\api_trace.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\surface\call.h" />
@ -376,7 +377,6 @@
<ClInclude Include="$(SolutionDir)\..\src\core\lib\surface\server.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\transport\byte_stream.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\transport\connectivity_state.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\transport\mdstr_hash_table.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\transport\metadata.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\transport\metadata_batch.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\transport\method_config.h" />
@ -611,6 +611,8 @@
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\slice\slice_buffer.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\slice\slice_hash_table.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\slice\slice_intern.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\slice\slice_string_helpers.c">
@ -655,8 +657,6 @@
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\transport\connectivity_state.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\transport\mdstr_hash_table.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\transport\metadata.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\transport\metadata_batch.c">

@ -253,6 +253,9 @@
<ClCompile Include="$(SolutionDir)\..\src\core\lib\slice\slice_buffer.c">
<Filter>src\core\lib\slice</Filter>
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\slice\slice_hash_table.c">
<Filter>src\core\lib\slice</Filter>
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\slice\slice_intern.c">
<Filter>src\core\lib\slice</Filter>
</ClCompile>
@ -319,9 +322,6 @@
<ClCompile Include="$(SolutionDir)\..\src\core\lib\transport\connectivity_state.c">
<Filter>src\core\lib\transport</Filter>
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\transport\mdstr_hash_table.c">
<Filter>src\core\lib\transport</Filter>
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\transport\metadata.c">
<Filter>src\core\lib\transport</Filter>
</ClCompile>
@ -869,6 +869,9 @@
<ClInclude Include="$(SolutionDir)\..\src\core\lib\slice\percent_encoding.h">
<Filter>src\core\lib\slice</Filter>
</ClInclude>
<ClInclude Include="$(SolutionDir)\..\src\core\lib\slice\slice_hash_table.h">
<Filter>src\core\lib\slice</Filter>
</ClInclude>
<ClInclude Include="$(SolutionDir)\..\src\core\lib\slice\slice_string_helpers.h">
<Filter>src\core\lib\slice</Filter>
</ClInclude>
@ -911,9 +914,6 @@
<ClInclude Include="$(SolutionDir)\..\src\core\lib\transport\connectivity_state.h">
<Filter>src\core\lib\transport</Filter>
</ClInclude>
<ClInclude Include="$(SolutionDir)\..\src\core\lib\transport\mdstr_hash_table.h">
<Filter>src\core\lib\transport</Filter>
</ClInclude>
<ClInclude Include="$(SolutionDir)\..\src\core\lib\transport\metadata.h">
<Filter>src\core\lib\transport</Filter>
</ClInclude>

Loading…
Cancel
Save