diff options
author | Craig Tiller <ctiller@google.com> | 2015-11-19 17:09:49 -0800 |
---|---|---|
committer | Craig Tiller <ctiller@google.com> | 2015-11-19 17:09:49 -0800 |
commit | ebdef9d674b33e7bd117e2a4a2da7762c35bbdfc (patch) | |
tree | 4ae8484d1f35f667bef4e55c36560527cc7cbb91 /src/core/transport | |
parent | f6e40fd2aaf50e075a6c91eab33acc9f72bf9ab0 (diff) |
Remove metadata context from the channel stack
Diffstat (limited to 'src/core/transport')
-rw-r--r-- | src/core/transport/metadata.c | 97 | ||||
-rw-r--r-- | src/core/transport/metadata.h | 21 | ||||
-rw-r--r-- | src/core/transport/static_metadata.c | 23 | ||||
-rw-r--r-- | src/core/transport/static_metadata.h | 275 |
4 files changed, 278 insertions, 138 deletions
diff --git a/src/core/transport/metadata.c b/src/core/transport/metadata.c index fa941a73c6..cbec63c868 100644 --- a/src/core/transport/metadata.c +++ b/src/core/transport/metadata.c @@ -37,12 +37,15 @@ #include <stddef.h> #include <string.h> +#include <grpc/compression.h> #include <grpc/support/alloc.h> #include <grpc/support/atm.h> #include <grpc/support/log.h> +#include <grpc/support/string_util.h> #include <grpc/support/time.h> #include "src/core/profiling/timers.h" #include "src/core/support/murmur_hash.h" +#include "src/core/support/string.h" #include "src/core/transport/chttp2/bin_encoder.h" #include "src/core/transport/static_metadata.h" @@ -157,6 +160,11 @@ struct grpc_mdctx { size_t mdtab_count; size_t mdtab_free; size_t mdtab_capacity; + + /* cache slots */ + gpr_atm cache_slots[GRPC_MDELEM_CACHE_SLOT_COUNT]; + /* compression algorithm mdelems: one per algorithm bitmask */ + gpr_atm compression_algorithm_mdelem[1 << GRPC_COMPRESS_ALGORITHMS_COUNT]; }; static void internal_string_ref(internal_string *s DEBUG_ARGS); @@ -175,8 +183,10 @@ 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_static_mdstr_table[2 * i + 0]; - grpc_mdstr *value = &grpc_static_mdstr_table[2 * i + 1]; + grpc_mdstr *key = + &grpc_static_mdstr_table[grpc_static_metadata_elem_indices[2 * i + 0]]; + grpc_mdstr *value = + &grpc_static_mdstr_table[grpc_static_metadata_elem_indices[2 * i + 1]]; *(grpc_mdstr **)&elem->key = key; *(grpc_mdstr **)&elem->value = value; } @@ -304,6 +314,42 @@ grpc_mdctx *grpc_mdctx_create(void) { (gpr_uint32)gpr_now(GPR_CLOCK_REALTIME).tv_nsec); } +static void drop_cached_elem(gpr_atm *slot) { + gpr_atm value = gpr_atm_no_barrier_load(slot); + gpr_atm_rel_store(slot, 0); + GRPC_MDELEM_UNREF((grpc_mdelem *)value); +} + +void grpc_mdctx_drop_caches(grpc_mdctx *ctx) { + size_t i; + for (i = 0; i < GRPC_MDELEM_CACHE_SLOT_COUNT; i++) { + drop_cached_elem(&ctx->cache_slots[i]); + } + for (i = 0; i < GPR_ARRAY_SIZE(ctx->compression_algorithm_mdelem); i++) { + drop_cached_elem(&ctx->compression_algorithm_mdelem[i]); + } +} + +static void set_cache(gpr_atm *slot, grpc_mdelem *elem) { + if (!gpr_atm_rel_cas(slot, 0, (gpr_atm)elem)) { + GRPC_MDELEM_UNREF(elem); + } +} + +void grpc_mdctx_set_mdelem_cache(grpc_mdctx *ctx, grpc_mdelem_cache_slot slot, + grpc_mdelem *elem) { + set_cache(&ctx->cache_slots[slot], elem); +} + +static grpc_mdelem *get_cache(gpr_atm *slot) { + return (grpc_mdelem *)gpr_atm_acq_load(slot); +} + +grpc_mdelem *grpc_mdelem_from_cache(grpc_mdctx *ctx, + grpc_mdelem_cache_slot slot) { + return get_cache(&ctx->cache_slots[slot]); +} + static void discard_metadata(grpc_mdctx *ctx) { size_t i; internal_metadata *next, *cur; @@ -780,6 +826,7 @@ void *grpc_mdelem_get_user_data(grpc_mdelem *md, void (*destroy_func)(void *)) { void grpc_mdelem_set_user_data(grpc_mdelem *md, void (*destroy_func)(void *), void *user_data) { internal_metadata *im = (internal_metadata *)md; + GPR_ASSERT(!is_mdelem_static(md)); GPR_ASSERT((user_data == NULL) == (destroy_func == NULL)); gpr_mu_lock(&im->mu_user_data); if (gpr_atm_no_barrier_load(&im->destroy_user_data)) { @@ -838,6 +885,52 @@ int grpc_mdstr_is_legal_nonbin_header(grpc_mdstr *s) { return conforms_to(s, legal_header_bits); } +static grpc_mdelem *make_accept_encoding_mdelem_for_compression_algorithms( + grpc_mdctx *mdctx, gpr_uint32 algorithms) { + gpr_strvec sv; + int i; + char *str; + grpc_mdelem *out; + + gpr_strvec_init(&sv); + for (i = 0; algorithms != 0; i++, algorithms >>= 1) { + if (algorithms & 1) { + char *name; + GPR_ASSERT(grpc_compression_algorithm_name((grpc_compression_algorithm)i, + &name)); + if (sv.count) { + gpr_strvec_add(&sv, gpr_strdup(",")); + } + gpr_strvec_add(&sv, gpr_strdup(name)); + } + } + str = gpr_strvec_flatten(&sv, NULL); + out = + grpc_mdelem_from_metadata_strings(mdctx, GRPC_MDSTR_GRPC_ACCEPT_ENCODING, + grpc_mdstr_from_string(mdctx, str)); + gpr_strvec_destroy(&sv); + gpr_free(str); + return out; +} + +grpc_mdelem *grpc_accept_encoding_mdelem_from_compression_algorithms( + grpc_mdctx *ctx, gpr_uint32 algorithms) { + grpc_mdelem *ret; + gpr_atm *slot; + GPR_ASSERT(algorithms < GPR_ARRAY_SIZE(ctx->compression_algorithm_mdelem)); + + slot = &ctx->compression_algorithm_mdelem[algorithms]; + ret = get_cache(slot); + if (ret == NULL) { + set_cache(slot, make_accept_encoding_mdelem_for_compression_algorithms( + ctx, algorithms)); + ret = get_cache(slot); + GPR_ASSERT(ret != NULL); + } + + return ret; +} + int grpc_mdstr_is_bin_suffixed(grpc_mdstr *s) { /* TODO(ctiller): consider caching this */ return grpc_is_binary_header((const char *)GPR_SLICE_START_PTR(s->slice), diff --git a/src/core/transport/metadata.h b/src/core/transport/metadata.h index 7d70883fa4..0f12a7392c 100644 --- a/src/core/transport/metadata.h +++ b/src/core/transport/metadata.h @@ -93,6 +93,8 @@ grpc_mdctx *grpc_mdctx_create_with_seed(gpr_uint32 seed); void grpc_mdctx_ref(grpc_mdctx *mdctx); void grpc_mdctx_unref(grpc_mdctx *mdctx); +void grpc_mdctx_drop_caches(grpc_mdctx *mdctx); + /* Test only accessors to internal state - only for testing this code - do not rely on it outside of metadata_test.c */ size_t grpc_mdctx_get_mdtab_capacity_test_only(grpc_mdctx *mdctx); @@ -161,6 +163,25 @@ int grpc_mdstr_is_legal_header(grpc_mdstr *s); int grpc_mdstr_is_legal_nonbin_header(grpc_mdstr *s); int grpc_mdstr_is_bin_suffixed(grpc_mdstr *s); +/* Gross layering hack (that we seem to need): + * metadata context keeps a cache of algorithm bitset to + * 'accept-encoding: algorithm1,algorithm2' in order to accelerate sending + * compression metadata */ +grpc_mdelem *grpc_accept_encoding_mdelem_from_compression_algorithms( + grpc_mdctx *ctx, gpr_uint32 algorithm_mask); + +/* Cache-slots + * A metadata context can cache (on behalf of its owner) some small set of + * metadata elements. */ +typedef enum { + GRPC_MDELEM_CACHED_USER_AGENT = 0, + GRPC_MDELEM_CACHE_SLOT_COUNT +} grpc_mdelem_cache_slot; +void grpc_mdctx_set_mdelem_cache(grpc_mdctx *ctx, grpc_mdelem_cache_slot slot, + grpc_mdelem *elem); +grpc_mdelem *grpc_mdelem_from_cache(grpc_mdctx *ctx, + grpc_mdelem_cache_slot slot); + #define GRPC_MDSTR_KV_HASH(k_hash, v_hash) (GPR_ROTL((k_hash), 2) ^ (v_hash)) void grpc_mdctx_global_init(void); diff --git a/src/core/transport/static_metadata.c b/src/core/transport/static_metadata.c index f359ce5c20..fb7c5006e1 100644 --- a/src/core/transport/static_metadata.c +++ b/src/core/transport/static_metadata.c @@ -47,18 +47,21 @@ grpc_mdstr grpc_static_mdstr_table[GRPC_STATIC_MDSTR_COUNT]; grpc_mdelem grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT]; -const gpr_uint8 grpc_static_metadata_elem_indices[GRPC_STATIC_MDELEM_COUNT * - 2] = { - 9, 29, 8, 29, 10, 29, 10, 42, 11, 29, 12, 29, 13, 29, 14, 29, 15, 29, 16, - 29, 17, 29, 18, 29, 19, 29, 20, 29, 21, 29, 22, 29, 23, 29, 24, 29, 25, 29, - 26, 29, 27, 29, 30, 29, 31, 29, 32, 29, 33, 29, 39, 0, 43, 29, 47, 29, 48, - 29, 49, 29, 50, 29, 51, 29, 52, 29, 53, 29, 54, 29, 55, 29, 56, 34, 56, 58, - 57, 68, 57, 69, 59, 29, 60, 29, 61, 29, 62, 29, 63, 29, 64, 29, 65, 35, 65, - 44, 65, 45, 66, 29, 67, 29, 70, 1, 70, 2, 70, 3, 70, 4, 70, 5, 70, 6, - 70, 7, 71, 29, 72, 73, 74, 29, 75, 29, 76, 29, 77, 29, 78, 29}; +const gpr_uint8 + grpc_static_metadata_elem_indices[GRPC_STATIC_MDELEM_COUNT * 2] = { + 11, 32, 10, 32, 12, 32, 12, 46, 13, 32, 14, 32, 15, 32, 16, 32, 17, 32, + 19, 32, 20, 32, 21, 32, 22, 32, 23, 32, 24, 32, 25, 32, 26, 32, 27, 32, + 28, 18, 28, 32, 29, 32, 30, 32, 33, 32, 34, 32, 35, 32, 36, 32, 40, 31, + 40, 45, 40, 50, 43, 0, 43, 1, 43, 2, 47, 32, 51, 32, 52, 32, 53, 32, + 54, 32, 55, 32, 56, 32, 57, 32, 58, 32, 59, 32, 60, 37, 60, 62, 61, 72, + 61, 73, 63, 32, 64, 32, 65, 32, 66, 32, 67, 32, 68, 32, 69, 38, 69, 48, + 69, 49, 70, 32, 71, 32, 74, 3, 74, 4, 74, 5, 74, 6, 74, 7, 74, 8, + 74, 9, 75, 32, 76, 77, 78, 32, 79, 32, 80, 32, 81, 32, 82, 32}; const char *const grpc_static_metadata_strings[GRPC_STATIC_MDSTR_COUNT] = { "0", + "1", + "2", "200", "204", "206", @@ -74,6 +77,7 @@ const char *const grpc_static_metadata_strings[GRPC_STATIC_MDSTR_COUNT] = { "access-control-allow-origin", "age", "allow", + "application/grpc", ":authority", "authorization", "cache-control", @@ -96,6 +100,7 @@ const char *const grpc_static_metadata_strings[GRPC_STATIC_MDSTR_COUNT] = { "grpc", "grpc-accept-encoding", "grpc-encoding", + "grpc-internal-encoding-request", "grpc-message", "grpc-status", "grpc-timeout", diff --git a/src/core/transport/static_metadata.h b/src/core/transport/static_metadata.h index 4a7bee1da8..671801636b 100644 --- a/src/core/transport/static_metadata.h +++ b/src/core/transport/static_metadata.h @@ -46,168 +46,176 @@ #include "src/core/transport/metadata.h" -#define GRPC_STATIC_MDSTR_COUNT 79 +#define GRPC_STATIC_MDSTR_COUNT 83 extern grpc_mdstr grpc_static_mdstr_table[GRPC_STATIC_MDSTR_COUNT]; /* "0" */ #define GRPC_MDSTR_0 (&grpc_static_mdstr_table[0]) +/* "1" */ +#define GRPC_MDSTR_1 (&grpc_static_mdstr_table[1]) +/* "2" */ +#define GRPC_MDSTR_2 (&grpc_static_mdstr_table[2]) /* "200" */ -#define GRPC_MDSTR_200 (&grpc_static_mdstr_table[1]) +#define GRPC_MDSTR_200 (&grpc_static_mdstr_table[3]) /* "204" */ -#define GRPC_MDSTR_204 (&grpc_static_mdstr_table[2]) +#define GRPC_MDSTR_204 (&grpc_static_mdstr_table[4]) /* "206" */ -#define GRPC_MDSTR_206 (&grpc_static_mdstr_table[3]) +#define GRPC_MDSTR_206 (&grpc_static_mdstr_table[5]) /* "304" */ -#define GRPC_MDSTR_304 (&grpc_static_mdstr_table[4]) +#define GRPC_MDSTR_304 (&grpc_static_mdstr_table[6]) /* "400" */ -#define GRPC_MDSTR_400 (&grpc_static_mdstr_table[5]) +#define GRPC_MDSTR_400 (&grpc_static_mdstr_table[7]) /* "404" */ -#define GRPC_MDSTR_404 (&grpc_static_mdstr_table[6]) +#define GRPC_MDSTR_404 (&grpc_static_mdstr_table[8]) /* "500" */ -#define GRPC_MDSTR_500 (&grpc_static_mdstr_table[7]) +#define GRPC_MDSTR_500 (&grpc_static_mdstr_table[9]) /* "accept" */ -#define GRPC_MDSTR_ACCEPT (&grpc_static_mdstr_table[8]) +#define GRPC_MDSTR_ACCEPT (&grpc_static_mdstr_table[10]) /* "accept-charset" */ -#define GRPC_MDSTR_ACCEPT_CHARSET (&grpc_static_mdstr_table[9]) +#define GRPC_MDSTR_ACCEPT_CHARSET (&grpc_static_mdstr_table[11]) /* "accept-encoding" */ -#define GRPC_MDSTR_ACCEPT_ENCODING (&grpc_static_mdstr_table[10]) +#define GRPC_MDSTR_ACCEPT_ENCODING (&grpc_static_mdstr_table[12]) /* "accept-language" */ -#define GRPC_MDSTR_ACCEPT_LANGUAGE (&grpc_static_mdstr_table[11]) +#define GRPC_MDSTR_ACCEPT_LANGUAGE (&grpc_static_mdstr_table[13]) /* "accept-ranges" */ -#define GRPC_MDSTR_ACCEPT_RANGES (&grpc_static_mdstr_table[12]) +#define GRPC_MDSTR_ACCEPT_RANGES (&grpc_static_mdstr_table[14]) /* "access-control-allow-origin" */ -#define GRPC_MDSTR_ACCESS_CONTROL_ALLOW_ORIGIN (&grpc_static_mdstr_table[13]) +#define GRPC_MDSTR_ACCESS_CONTROL_ALLOW_ORIGIN (&grpc_static_mdstr_table[15]) /* "age" */ -#define GRPC_MDSTR_AGE (&grpc_static_mdstr_table[14]) +#define GRPC_MDSTR_AGE (&grpc_static_mdstr_table[16]) /* "allow" */ -#define GRPC_MDSTR_ALLOW (&grpc_static_mdstr_table[15]) +#define GRPC_MDSTR_ALLOW (&grpc_static_mdstr_table[17]) +/* "application/grpc" */ +#define GRPC_MDSTR_APPLICATION_SLASH_GRPC (&grpc_static_mdstr_table[18]) /* ":authority" */ -#define GRPC_MDSTR_AUTHORITY (&grpc_static_mdstr_table[16]) +#define GRPC_MDSTR_AUTHORITY (&grpc_static_mdstr_table[19]) /* "authorization" */ -#define GRPC_MDSTR_AUTHORIZATION (&grpc_static_mdstr_table[17]) +#define GRPC_MDSTR_AUTHORIZATION (&grpc_static_mdstr_table[20]) /* "cache-control" */ -#define GRPC_MDSTR_CACHE_CONTROL (&grpc_static_mdstr_table[18]) +#define GRPC_MDSTR_CACHE_CONTROL (&grpc_static_mdstr_table[21]) /* "content-disposition" */ -#define GRPC_MDSTR_CONTENT_DISPOSITION (&grpc_static_mdstr_table[19]) +#define GRPC_MDSTR_CONTENT_DISPOSITION (&grpc_static_mdstr_table[22]) /* "content-encoding" */ -#define GRPC_MDSTR_CONTENT_ENCODING (&grpc_static_mdstr_table[20]) +#define GRPC_MDSTR_CONTENT_ENCODING (&grpc_static_mdstr_table[23]) /* "content-language" */ -#define GRPC_MDSTR_CONTENT_LANGUAGE (&grpc_static_mdstr_table[21]) +#define GRPC_MDSTR_CONTENT_LANGUAGE (&grpc_static_mdstr_table[24]) /* "content-length" */ -#define GRPC_MDSTR_CONTENT_LENGTH (&grpc_static_mdstr_table[22]) +#define GRPC_MDSTR_CONTENT_LENGTH (&grpc_static_mdstr_table[25]) /* "content-location" */ -#define GRPC_MDSTR_CONTENT_LOCATION (&grpc_static_mdstr_table[23]) +#define GRPC_MDSTR_CONTENT_LOCATION (&grpc_static_mdstr_table[26]) /* "content-range" */ -#define GRPC_MDSTR_CONTENT_RANGE (&grpc_static_mdstr_table[24]) +#define GRPC_MDSTR_CONTENT_RANGE (&grpc_static_mdstr_table[27]) /* "content-type" */ -#define GRPC_MDSTR_CONTENT_TYPE (&grpc_static_mdstr_table[25]) +#define GRPC_MDSTR_CONTENT_TYPE (&grpc_static_mdstr_table[28]) /* "cookie" */ -#define GRPC_MDSTR_COOKIE (&grpc_static_mdstr_table[26]) +#define GRPC_MDSTR_COOKIE (&grpc_static_mdstr_table[29]) /* "date" */ -#define GRPC_MDSTR_DATE (&grpc_static_mdstr_table[27]) +#define GRPC_MDSTR_DATE (&grpc_static_mdstr_table[30]) /* "deflate" */ -#define GRPC_MDSTR_DEFLATE (&grpc_static_mdstr_table[28]) +#define GRPC_MDSTR_DEFLATE (&grpc_static_mdstr_table[31]) /* "" */ -#define GRPC_MDSTR_EMPTY (&grpc_static_mdstr_table[29]) +#define GRPC_MDSTR_EMPTY (&grpc_static_mdstr_table[32]) /* "etag" */ -#define GRPC_MDSTR_ETAG (&grpc_static_mdstr_table[30]) +#define GRPC_MDSTR_ETAG (&grpc_static_mdstr_table[33]) /* "expect" */ -#define GRPC_MDSTR_EXPECT (&grpc_static_mdstr_table[31]) +#define GRPC_MDSTR_EXPECT (&grpc_static_mdstr_table[34]) /* "expires" */ -#define GRPC_MDSTR_EXPIRES (&grpc_static_mdstr_table[32]) +#define GRPC_MDSTR_EXPIRES (&grpc_static_mdstr_table[35]) /* "from" */ -#define GRPC_MDSTR_FROM (&grpc_static_mdstr_table[33]) +#define GRPC_MDSTR_FROM (&grpc_static_mdstr_table[36]) /* "GET" */ -#define GRPC_MDSTR_GET (&grpc_static_mdstr_table[34]) +#define GRPC_MDSTR_GET (&grpc_static_mdstr_table[37]) /* "grpc" */ -#define GRPC_MDSTR_GRPC (&grpc_static_mdstr_table[35]) +#define GRPC_MDSTR_GRPC (&grpc_static_mdstr_table[38]) /* "grpc-accept-encoding" */ -#define GRPC_MDSTR_GRPC_ACCEPT_ENCODING (&grpc_static_mdstr_table[36]) +#define GRPC_MDSTR_GRPC_ACCEPT_ENCODING (&grpc_static_mdstr_table[39]) /* "grpc-encoding" */ -#define GRPC_MDSTR_GRPC_ENCODING (&grpc_static_mdstr_table[37]) +#define GRPC_MDSTR_GRPC_ENCODING (&grpc_static_mdstr_table[40]) +/* "grpc-internal-encoding-request" */ +#define GRPC_MDSTR_GRPC_INTERNAL_ENCODING_REQUEST (&grpc_static_mdstr_table[41]) /* "grpc-message" */ -#define GRPC_MDSTR_GRPC_MESSAGE (&grpc_static_mdstr_table[38]) +#define GRPC_MDSTR_GRPC_MESSAGE (&grpc_static_mdstr_table[42]) /* "grpc-status" */ -#define GRPC_MDSTR_GRPC_STATUS (&grpc_static_mdstr_table[39]) +#define GRPC_MDSTR_GRPC_STATUS (&grpc_static_mdstr_table[43]) /* "grpc-timeout" */ -#define GRPC_MDSTR_GRPC_TIMEOUT (&grpc_static_mdstr_table[40]) +#define GRPC_MDSTR_GRPC_TIMEOUT (&grpc_static_mdstr_table[44]) /* "gzip" */ -#define GRPC_MDSTR_GZIP (&grpc_static_mdstr_table[41]) +#define GRPC_MDSTR_GZIP (&grpc_static_mdstr_table[45]) /* "gzip, deflate" */ -#define GRPC_MDSTR_GZIP_COMMA_DEFLATE (&grpc_static_mdstr_table[42]) +#define GRPC_MDSTR_GZIP_COMMA_DEFLATE (&grpc_static_mdstr_table[46]) /* "host" */ -#define GRPC_MDSTR_HOST (&grpc_static_mdstr_table[43]) +#define GRPC_MDSTR_HOST (&grpc_static_mdstr_table[47]) /* "http" */ -#define GRPC_MDSTR_HTTP (&grpc_static_mdstr_table[44]) +#define GRPC_MDSTR_HTTP (&grpc_static_mdstr_table[48]) /* "https" */ -#define GRPC_MDSTR_HTTPS (&grpc_static_mdstr_table[45]) +#define GRPC_MDSTR_HTTPS (&grpc_static_mdstr_table[49]) /* "identity" */ -#define GRPC_MDSTR_IDENTITY (&grpc_static_mdstr_table[46]) +#define GRPC_MDSTR_IDENTITY (&grpc_static_mdstr_table[50]) /* "if-match" */ -#define GRPC_MDSTR_IF_MATCH (&grpc_static_mdstr_table[47]) +#define GRPC_MDSTR_IF_MATCH (&grpc_static_mdstr_table[51]) /* "if-modified-since" */ -#define GRPC_MDSTR_IF_MODIFIED_SINCE (&grpc_static_mdstr_table[48]) +#define GRPC_MDSTR_IF_MODIFIED_SINCE (&grpc_static_mdstr_table[52]) /* "if-none-match" */ -#define GRPC_MDSTR_IF_NONE_MATCH (&grpc_static_mdstr_table[49]) +#define GRPC_MDSTR_IF_NONE_MATCH (&grpc_static_mdstr_table[53]) /* "if-range" */ -#define GRPC_MDSTR_IF_RANGE (&grpc_static_mdstr_table[50]) +#define GRPC_MDSTR_IF_RANGE (&grpc_static_mdstr_table[54]) /* "if-unmodified-since" */ -#define GRPC_MDSTR_IF_UNMODIFIED_SINCE (&grpc_static_mdstr_table[51]) +#define GRPC_MDSTR_IF_UNMODIFIED_SINCE (&grpc_static_mdstr_table[55]) /* "last-modified" */ -#define GRPC_MDSTR_LAST_MODIFIED (&grpc_static_mdstr_table[52]) +#define GRPC_MDSTR_LAST_MODIFIED (&grpc_static_mdstr_table[56]) /* "link" */ -#define GRPC_MDSTR_LINK (&grpc_static_mdstr_table[53]) +#define GRPC_MDSTR_LINK (&grpc_static_mdstr_table[57]) /* "location" */ -#define GRPC_MDSTR_LOCATION (&grpc_static_mdstr_table[54]) +#define GRPC_MDSTR_LOCATION (&grpc_static_mdstr_table[58]) /* "max-forwards" */ -#define GRPC_MDSTR_MAX_FORWARDS (&grpc_static_mdstr_table[55]) +#define GRPC_MDSTR_MAX_FORWARDS (&grpc_static_mdstr_table[59]) /* ":method" */ -#define GRPC_MDSTR_METHOD (&grpc_static_mdstr_table[56]) +#define GRPC_MDSTR_METHOD (&grpc_static_mdstr_table[60]) /* ":path" */ -#define GRPC_MDSTR_PATH (&grpc_static_mdstr_table[57]) +#define GRPC_MDSTR_PATH (&grpc_static_mdstr_table[61]) /* "POST" */ -#define GRPC_MDSTR_POST (&grpc_static_mdstr_table[58]) +#define GRPC_MDSTR_POST (&grpc_static_mdstr_table[62]) /* "proxy-authenticate" */ -#define GRPC_MDSTR_PROXY_AUTHENTICATE (&grpc_static_mdstr_table[59]) +#define GRPC_MDSTR_PROXY_AUTHENTICATE (&grpc_static_mdstr_table[63]) /* "proxy-authorization" */ -#define GRPC_MDSTR_PROXY_AUTHORIZATION (&grpc_static_mdstr_table[60]) +#define GRPC_MDSTR_PROXY_AUTHORIZATION (&grpc_static_mdstr_table[64]) /* "range" */ -#define GRPC_MDSTR_RANGE (&grpc_static_mdstr_table[61]) +#define GRPC_MDSTR_RANGE (&grpc_static_mdstr_table[65]) /* "referer" */ -#define GRPC_MDSTR_REFERER (&grpc_static_mdstr_table[62]) +#define GRPC_MDSTR_REFERER (&grpc_static_mdstr_table[66]) /* "refresh" */ -#define GRPC_MDSTR_REFRESH (&grpc_static_mdstr_table[63]) +#define GRPC_MDSTR_REFRESH (&grpc_static_mdstr_table[67]) /* "retry-after" */ -#define GRPC_MDSTR_RETRY_AFTER (&grpc_static_mdstr_table[64]) +#define GRPC_MDSTR_RETRY_AFTER (&grpc_static_mdstr_table[68]) /* ":scheme" */ -#define GRPC_MDSTR_SCHEME (&grpc_static_mdstr_table[65]) +#define GRPC_MDSTR_SCHEME (&grpc_static_mdstr_table[69]) /* "server" */ -#define GRPC_MDSTR_SERVER (&grpc_static_mdstr_table[66]) +#define GRPC_MDSTR_SERVER (&grpc_static_mdstr_table[70]) /* "set-cookie" */ -#define GRPC_MDSTR_SET_COOKIE (&grpc_static_mdstr_table[67]) +#define GRPC_MDSTR_SET_COOKIE (&grpc_static_mdstr_table[71]) /* "/" */ -#define GRPC_MDSTR_SLASH (&grpc_static_mdstr_table[68]) +#define GRPC_MDSTR_SLASH (&grpc_static_mdstr_table[72]) /* "/index.html" */ -#define GRPC_MDSTR_SLASH_INDEX_DOT_HTML (&grpc_static_mdstr_table[69]) +#define GRPC_MDSTR_SLASH_INDEX_DOT_HTML (&grpc_static_mdstr_table[73]) /* ":status" */ -#define GRPC_MDSTR_STATUS (&grpc_static_mdstr_table[70]) +#define GRPC_MDSTR_STATUS (&grpc_static_mdstr_table[74]) /* "strict-transport-security" */ -#define GRPC_MDSTR_STRICT_TRANSPORT_SECURITY (&grpc_static_mdstr_table[71]) +#define GRPC_MDSTR_STRICT_TRANSPORT_SECURITY (&grpc_static_mdstr_table[75]) /* "te" */ -#define GRPC_MDSTR_TE (&grpc_static_mdstr_table[72]) +#define GRPC_MDSTR_TE (&grpc_static_mdstr_table[76]) /* "trailers" */ -#define GRPC_MDSTR_TRAILERS (&grpc_static_mdstr_table[73]) +#define GRPC_MDSTR_TRAILERS (&grpc_static_mdstr_table[77]) /* "transfer-encoding" */ -#define GRPC_MDSTR_TRANSFER_ENCODING (&grpc_static_mdstr_table[74]) +#define GRPC_MDSTR_TRANSFER_ENCODING (&grpc_static_mdstr_table[78]) /* "user-agent" */ -#define GRPC_MDSTR_USER_AGENT (&grpc_static_mdstr_table[75]) +#define GRPC_MDSTR_USER_AGENT (&grpc_static_mdstr_table[79]) /* "vary" */ -#define GRPC_MDSTR_VARY (&grpc_static_mdstr_table[76]) +#define GRPC_MDSTR_VARY (&grpc_static_mdstr_table[80]) /* "via" */ -#define GRPC_MDSTR_VIA (&grpc_static_mdstr_table[77]) +#define GRPC_MDSTR_VIA (&grpc_static_mdstr_table[81]) /* "www-authenticate" */ -#define GRPC_MDSTR_WWW_AUTHENTICATE (&grpc_static_mdstr_table[78]) +#define GRPC_MDSTR_WWW_AUTHENTICATE (&grpc_static_mdstr_table[82]) -#define GRPC_STATIC_MDELEM_COUNT 65 +#define GRPC_STATIC_MDELEM_COUNT 71 extern grpc_mdelem grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT]; /* "accept-charset": "" */ #define GRPC_MDELEM_ACCEPT_CHARSET_EMPTY (&grpc_static_mdelem_table[0]) @@ -247,101 +255,114 @@ extern grpc_mdelem grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT]; #define GRPC_MDELEM_CONTENT_LOCATION_EMPTY (&grpc_static_mdelem_table[16]) /* "content-range": "" */ #define GRPC_MDELEM_CONTENT_RANGE_EMPTY (&grpc_static_mdelem_table[17]) +/* "content-type": "application/grpc" */ +#define GRPC_MDELEM_CONTENT_TYPE_APPLICATION_SLASH_GRPC \ + (&grpc_static_mdelem_table[18]) /* "content-type": "" */ -#define GRPC_MDELEM_CONTENT_TYPE_EMPTY (&grpc_static_mdelem_table[18]) +#define GRPC_MDELEM_CONTENT_TYPE_EMPTY (&grpc_static_mdelem_table[19]) /* "cookie": "" */ -#define GRPC_MDELEM_COOKIE_EMPTY (&grpc_static_mdelem_table[19]) +#define GRPC_MDELEM_COOKIE_EMPTY (&grpc_static_mdelem_table[20]) /* "date": "" */ -#define GRPC_MDELEM_DATE_EMPTY (&grpc_static_mdelem_table[20]) +#define GRPC_MDELEM_DATE_EMPTY (&grpc_static_mdelem_table[21]) /* "etag": "" */ -#define GRPC_MDELEM_ETAG_EMPTY (&grpc_static_mdelem_table[21]) +#define GRPC_MDELEM_ETAG_EMPTY (&grpc_static_mdelem_table[22]) /* "expect": "" */ -#define GRPC_MDELEM_EXPECT_EMPTY (&grpc_static_mdelem_table[22]) +#define GRPC_MDELEM_EXPECT_EMPTY (&grpc_static_mdelem_table[23]) /* "expires": "" */ -#define GRPC_MDELEM_EXPIRES_EMPTY (&grpc_static_mdelem_table[23]) +#define GRPC_MDELEM_EXPIRES_EMPTY (&grpc_static_mdelem_table[24]) /* "from": "" */ -#define GRPC_MDELEM_FROM_EMPTY (&grpc_static_mdelem_table[24]) +#define GRPC_MDELEM_FROM_EMPTY (&grpc_static_mdelem_table[25]) +/* "grpc-encoding": "deflate" */ +#define GRPC_MDELEM_GRPC_ENCODING_DEFLATE (&grpc_static_mdelem_table[26]) +/* "grpc-encoding": "gzip" */ +#define GRPC_MDELEM_GRPC_ENCODING_GZIP (&grpc_static_mdelem_table[27]) +/* "grpc-encoding": "identity" */ +#define GRPC_MDELEM_GRPC_ENCODING_IDENTITY (&grpc_static_mdelem_table[28]) /* "grpc-status": "0" */ -#define GRPC_MDELEM_GRPC_STATUS_0 (&grpc_static_mdelem_table[25]) +#define GRPC_MDELEM_GRPC_STATUS_0 (&grpc_static_mdelem_table[29]) +/* "grpc-status": "1" */ +#define GRPC_MDELEM_GRPC_STATUS_1 (&grpc_static_mdelem_table[30]) +/* "grpc-status": "2" */ +#define GRPC_MDELEM_GRPC_STATUS_2 (&grpc_static_mdelem_table[31]) /* "host": "" */ -#define GRPC_MDELEM_HOST_EMPTY (&grpc_static_mdelem_table[26]) +#define GRPC_MDELEM_HOST_EMPTY (&grpc_static_mdelem_table[32]) /* "if-match": "" */ -#define GRPC_MDELEM_IF_MATCH_EMPTY (&grpc_static_mdelem_table[27]) +#define GRPC_MDELEM_IF_MATCH_EMPTY (&grpc_static_mdelem_table[33]) /* "if-modified-since": "" */ -#define GRPC_MDELEM_IF_MODIFIED_SINCE_EMPTY (&grpc_static_mdelem_table[28]) +#define GRPC_MDELEM_IF_MODIFIED_SINCE_EMPTY (&grpc_static_mdelem_table[34]) /* "if-none-match": "" */ -#define GRPC_MDELEM_IF_NONE_MATCH_EMPTY (&grpc_static_mdelem_table[29]) +#define GRPC_MDELEM_IF_NONE_MATCH_EMPTY (&grpc_static_mdelem_table[35]) /* "if-range": "" */ -#define GRPC_MDELEM_IF_RANGE_EMPTY (&grpc_static_mdelem_table[30]) +#define GRPC_MDELEM_IF_RANGE_EMPTY (&grpc_static_mdelem_table[36]) /* "if-unmodified-since": "" */ -#define GRPC_MDELEM_IF_UNMODIFIED_SINCE_EMPTY (&grpc_static_mdelem_table[31]) +#define GRPC_MDELEM_IF_UNMODIFIED_SINCE_EMPTY (&grpc_static_mdelem_table[37]) /* "last-modified": "" */ -#define GRPC_MDELEM_LAST_MODIFIED_EMPTY (&grpc_static_mdelem_table[32]) +#define GRPC_MDELEM_LAST_MODIFIED_EMPTY (&grpc_static_mdelem_table[38]) /* "link": "" */ -#define GRPC_MDELEM_LINK_EMPTY (&grpc_static_mdelem_table[33]) +#define GRPC_MDELEM_LINK_EMPTY (&grpc_static_mdelem_table[39]) /* "location": "" */ -#define GRPC_MDELEM_LOCATION_EMPTY (&grpc_static_mdelem_table[34]) +#define GRPC_MDELEM_LOCATION_EMPTY (&grpc_static_mdelem_table[40]) /* "max-forwards": "" */ -#define GRPC_MDELEM_MAX_FORWARDS_EMPTY (&grpc_static_mdelem_table[35]) +#define GRPC_MDELEM_MAX_FORWARDS_EMPTY (&grpc_static_mdelem_table[41]) /* ":method": "GET" */ -#define GRPC_MDELEM_METHOD_GET (&grpc_static_mdelem_table[36]) +#define GRPC_MDELEM_METHOD_GET (&grpc_static_mdelem_table[42]) /* ":method": "POST" */ -#define GRPC_MDELEM_METHOD_POST (&grpc_static_mdelem_table[37]) +#define GRPC_MDELEM_METHOD_POST (&grpc_static_mdelem_table[43]) /* ":path": "/" */ -#define GRPC_MDELEM_PATH_SLASH (&grpc_static_mdelem_table[38]) +#define GRPC_MDELEM_PATH_SLASH (&grpc_static_mdelem_table[44]) /* ":path": "/index.html" */ -#define GRPC_MDELEM_PATH_SLASH_INDEX_DOT_HTML (&grpc_static_mdelem_table[39]) +#define GRPC_MDELEM_PATH_SLASH_INDEX_DOT_HTML (&grpc_static_mdelem_table[45]) /* "proxy-authenticate": "" */ -#define GRPC_MDELEM_PROXY_AUTHENTICATE_EMPTY (&grpc_static_mdelem_table[40]) +#define GRPC_MDELEM_PROXY_AUTHENTICATE_EMPTY (&grpc_static_mdelem_table[46]) /* "proxy-authorization": "" */ -#define GRPC_MDELEM_PROXY_AUTHORIZATION_EMPTY (&grpc_static_mdelem_table[41]) +#define GRPC_MDELEM_PROXY_AUTHORIZATION_EMPTY (&grpc_static_mdelem_table[47]) /* "range": "" */ -#define GRPC_MDELEM_RANGE_EMPTY (&grpc_static_mdelem_table[42]) +#define GRPC_MDELEM_RANGE_EMPTY (&grpc_static_mdelem_table[48]) /* "referer": "" */ -#define GRPC_MDELEM_REFERER_EMPTY (&grpc_static_mdelem_table[43]) +#define GRPC_MDELEM_REFERER_EMPTY (&grpc_static_mdelem_table[49]) /* "refresh": "" */ -#define GRPC_MDELEM_REFRESH_EMPTY (&grpc_static_mdelem_table[44]) +#define GRPC_MDELEM_REFRESH_EMPTY (&grpc_static_mdelem_table[50]) /* "retry-after": "" */ -#define GRPC_MDELEM_RETRY_AFTER_EMPTY (&grpc_static_mdelem_table[45]) +#define GRPC_MDELEM_RETRY_AFTER_EMPTY (&grpc_static_mdelem_table[51]) /* ":scheme": "grpc" */ -#define GRPC_MDELEM_SCHEME_GRPC (&grpc_static_mdelem_table[46]) +#define GRPC_MDELEM_SCHEME_GRPC (&grpc_static_mdelem_table[52]) /* ":scheme": "http" */ -#define GRPC_MDELEM_SCHEME_HTTP (&grpc_static_mdelem_table[47]) +#define GRPC_MDELEM_SCHEME_HTTP (&grpc_static_mdelem_table[53]) /* ":scheme": "https" */ -#define GRPC_MDELEM_SCHEME_HTTPS (&grpc_static_mdelem_table[48]) +#define GRPC_MDELEM_SCHEME_HTTPS (&grpc_static_mdelem_table[54]) /* "server": "" */ -#define GRPC_MDELEM_SERVER_EMPTY (&grpc_static_mdelem_table[49]) +#define GRPC_MDELEM_SERVER_EMPTY (&grpc_static_mdelem_table[55]) /* "set-cookie": "" */ -#define GRPC_MDELEM_SET_COOKIE_EMPTY (&grpc_static_mdelem_table[50]) +#define GRPC_MDELEM_SET_COOKIE_EMPTY (&grpc_static_mdelem_table[56]) /* ":status": "200" */ -#define GRPC_MDELEM_STATUS_200 (&grpc_static_mdelem_table[51]) +#define GRPC_MDELEM_STATUS_200 (&grpc_static_mdelem_table[57]) /* ":status": "204" */ -#define GRPC_MDELEM_STATUS_204 (&grpc_static_mdelem_table[52]) +#define GRPC_MDELEM_STATUS_204 (&grpc_static_mdelem_table[58]) /* ":status": "206" */ -#define GRPC_MDELEM_STATUS_206 (&grpc_static_mdelem_table[53]) +#define GRPC_MDELEM_STATUS_206 (&grpc_static_mdelem_table[59]) /* ":status": "304" */ -#define GRPC_MDELEM_STATUS_304 (&grpc_static_mdelem_table[54]) +#define GRPC_MDELEM_STATUS_304 (&grpc_static_mdelem_table[60]) /* ":status": "400" */ -#define GRPC_MDELEM_STATUS_400 (&grpc_static_mdelem_table[55]) +#define GRPC_MDELEM_STATUS_400 (&grpc_static_mdelem_table[61]) /* ":status": "404" */ -#define GRPC_MDELEM_STATUS_404 (&grpc_static_mdelem_table[56]) +#define GRPC_MDELEM_STATUS_404 (&grpc_static_mdelem_table[62]) /* ":status": "500" */ -#define GRPC_MDELEM_STATUS_500 (&grpc_static_mdelem_table[57]) +#define GRPC_MDELEM_STATUS_500 (&grpc_static_mdelem_table[63]) /* "strict-transport-security": "" */ #define GRPC_MDELEM_STRICT_TRANSPORT_SECURITY_EMPTY \ - (&grpc_static_mdelem_table[58]) + (&grpc_static_mdelem_table[64]) /* "te": "trailers" */ -#define GRPC_MDELEM_TE_TRAILERS (&grpc_static_mdelem_table[59]) +#define GRPC_MDELEM_TE_TRAILERS (&grpc_static_mdelem_table[65]) /* "transfer-encoding": "" */ -#define GRPC_MDELEM_TRANSFER_ENCODING_EMPTY (&grpc_static_mdelem_table[60]) +#define GRPC_MDELEM_TRANSFER_ENCODING_EMPTY (&grpc_static_mdelem_table[66]) /* "user-agent": "" */ -#define GRPC_MDELEM_USER_AGENT_EMPTY (&grpc_static_mdelem_table[61]) +#define GRPC_MDELEM_USER_AGENT_EMPTY (&grpc_static_mdelem_table[67]) /* "vary": "" */ -#define GRPC_MDELEM_VARY_EMPTY (&grpc_static_mdelem_table[62]) +#define GRPC_MDELEM_VARY_EMPTY (&grpc_static_mdelem_table[68]) /* "via": "" */ -#define GRPC_MDELEM_VIA_EMPTY (&grpc_static_mdelem_table[63]) +#define GRPC_MDELEM_VIA_EMPTY (&grpc_static_mdelem_table[69]) /* "www-authenticate": "" */ -#define GRPC_MDELEM_WWW_AUTHENTICATE_EMPTY (&grpc_static_mdelem_table[64]) +#define GRPC_MDELEM_WWW_AUTHENTICATE_EMPTY (&grpc_static_mdelem_table[70]) const gpr_uint8 grpc_static_metadata_elem_indices[GRPC_STATIC_MDELEM_COUNT * 2]; const char *const grpc_static_metadata_strings[GRPC_STATIC_MDSTR_COUNT]; |