aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/lib/transport
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/lib/transport')
-rw-r--r--src/core/lib/transport/mdstr_hash_table.c118
-rw-r--r--src/core/lib/transport/mdstr_hash_table.h77
-rw-r--r--src/core/lib/transport/metadata.c530
-rw-r--r--src/core/lib/transport/metadata.h93
-rw-r--r--src/core/lib/transport/metadata_batch.c34
-rw-r--r--src/core/lib/transport/metadata_batch.h10
-rw-r--r--src/core/lib/transport/method_config.c248
-rw-r--r--src/core/lib/transport/method_config.h74
-rw-r--r--src/core/lib/transport/service_config.c39
-rw-r--r--src/core/lib/transport/service_config.h10
-rw-r--r--src/core/lib/transport/static_metadata.c847
-rw-r--r--src/core/lib/transport/static_metadata.h414
-rw-r--r--src/core/lib/transport/timeout_encoding.c13
-rw-r--r--src/core/lib/transport/timeout_encoding.h3
-rw-r--r--src/core/lib/transport/transport_op_string.c6
15 files changed, 1284 insertions, 1232 deletions
diff --git a/src/core/lib/transport/mdstr_hash_table.c b/src/core/lib/transport/mdstr_hash_table.c
deleted file mode 100644
index 2791bf653b..0000000000
--- a/src/core/lib/transport/mdstr_hash_table.c
+++ /dev/null
@@ -1,118 +0,0 @@
-//
-// Copyright 2016, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-
-#include "src/core/lib/transport/mdstr_hash_table.h"
-
-#include <stdbool.h>
-#include <string.h>
-
-#include <grpc/support/alloc.h>
-#include <grpc/support/log.h>
-
-#include "src/core/lib/transport/metadata.h"
-
-struct grpc_mdstr_hash_table {
- gpr_refcount refs;
- size_t size;
- grpc_mdstr_hash_table_entry* entries;
-};
-
-// 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) {
- 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;
- }
- 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) {
- GPR_ASSERT(value != NULL);
- const size_t idx =
- grpc_mdstr_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);
- 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));
- memset(table, 0, sizeof(*table));
- gpr_ref_init(&table->refs, 1);
- // 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;
- 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);
- }
- return table;
-}
-
-grpc_mdstr_hash_table* grpc_mdstr_hash_table_ref(grpc_mdstr_hash_table* table) {
- if (table != NULL) gpr_ref(&table->refs);
- return table;
-}
-
-void grpc_mdstr_hash_table_unref(grpc_exec_ctx* exec_ctx,
- grpc_mdstr_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);
- entry->vtable->destroy_value(exec_ctx, entry->value);
- }
- }
- gpr_free(table->entries);
- gpr_free(table);
- }
-}
-
-void* grpc_mdstr_hash_table_get(const grpc_mdstr_hash_table* table,
- const grpc_mdstr* key) {
- const size_t idx =
- grpc_mdstr_hash_table_find_index(table, key, false /* find_empty */);
- if (idx == table->size) return NULL; // Not found.
- return table->entries[idx].value;
-}
diff --git a/src/core/lib/transport/mdstr_hash_table.h b/src/core/lib/transport/mdstr_hash_table.h
deleted file mode 100644
index 57f497ee27..0000000000
--- a/src/core/lib/transport/mdstr_hash_table.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright 2016, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef GRPC_CORE_LIB_TRANSPORT_MDSTR_HASH_TABLE_H
-#define GRPC_CORE_LIB_TRANSPORT_MDSTR_HASH_TABLE_H
-
-#include "src/core/lib/transport/metadata.h"
-
-/** Hash table implementation.
- *
- * This implementation uses open addressing
- * (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
- * 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_mdstr_hash_table_vtable {
- void (*destroy_value)(grpc_exec_ctx* exec_ctx, void* value);
- void* (*copy_value)(void* value);
-} grpc_mdstr_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;
-
-/** 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_mdstr_hash_table* grpc_mdstr_hash_table_ref(grpc_mdstr_hash_table* table);
-void grpc_mdstr_hash_table_unref(grpc_exec_ctx* exec_ctx,
- grpc_mdstr_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);
-
-#endif /* GRPC_CORE_LIB_TRANSPORT_MDSTR_HASH_TABLE_H */
diff --git a/src/core/lib/transport/metadata.c b/src/core/lib/transport/metadata.c
index 54c39df6a7..c114cf9a30 100644
--- a/src/core/lib/transport/metadata.c
+++ b/src/core/lib/transport/metadata.c
@@ -52,8 +52,6 @@
#include "src/core/lib/support/string.h"
#include "src/core/lib/transport/static_metadata.h"
-grpc_slice (*grpc_chttp2_base64_encode_and_huffman_compress)(grpc_slice input);
-
/* There are two kinds of mdelem and mdstr instances.
* Static instances are declared in static_metadata.{h,c} and
* are initialized by grpc_mdctx_global_init().
@@ -63,9 +61,6 @@ grpc_slice (*grpc_chttp2_base64_encode_and_huffman_compress)(grpc_slice input);
* used to determine which kind of element a pointer refers to.
*/
-#define INITIAL_STRTAB_CAPACITY 4
-#define INITIAL_MDTAB_CAPACITY 4
-
#ifdef GRPC_METADATA_REFCOUNT_DEBUG
#define DEBUG_ARGS , const char *file, int line
#define FWD_DEBUG_ARGS , file, line
@@ -76,37 +71,20 @@ grpc_slice (*grpc_chttp2_base64_encode_and_huffman_compress)(grpc_slice input);
#define REF_MD_LOCKED(shard, s) ref_md_locked((shard), (s))
#endif
-#define TABLE_IDX(hash, log2_shards, capacity) \
- (((hash) >> (log2_shards)) % (capacity))
-#define SHARD_IDX(hash, log2_shards) ((hash) & ((1 << (log2_shards)) - 1))
-
-typedef void (*destroy_user_data_func)(void *user_data);
-
-#define SIZE_IN_DECODER_TABLE_NOT_SET -1
-/* Shadow structure for grpc_mdstr for non-static values */
-typedef struct internal_string {
- /* must be byte compatible with grpc_mdstr */
- grpc_slice slice;
- uint32_t hash;
-
- /* private only data */
- gpr_atm refcnt;
+#define INITIAL_SHARD_CAPACITY 8
+#define LOG2_SHARD_COUNT 4
+#define SHARD_COUNT ((size_t)(1 << LOG2_SHARD_COUNT))
- uint8_t has_base64_and_huffman_encoded;
- grpc_slice_refcount refcount;
+#define TABLE_IDX(hash, capacity) (((hash) >> (LOG2_SHARD_COUNT)) % (capacity))
+#define SHARD_IDX(hash) ((hash) & ((1 << (LOG2_SHARD_COUNT)) - 1))
- grpc_slice base64_and_huffman;
-
- gpr_atm size_in_decoder_table;
-
- struct internal_string *bucket_next;
-} internal_string;
+typedef void (*destroy_user_data_func)(void *user_data);
-/* Shadow structure for grpc_mdelem for non-static elements */
+/* Shadow structure for grpc_mdelem_data for non-static elements */
typedef struct internal_metadata {
/* must be byte compatible with grpc_mdelem */
- internal_string *key;
- internal_string *value;
+ grpc_slice key;
+ grpc_slice value;
/* private only data */
gpr_atm refcnt;
@@ -118,13 +96,6 @@ typedef struct internal_metadata {
struct internal_metadata *bucket_next;
} internal_metadata;
-typedef struct strtab_shard {
- gpr_mu mu;
- internal_string **strs;
- size_t count;
- size_t capacity;
-} strtab_shard;
-
typedef struct mdtab_shard {
gpr_mu mu;
internal_metadata **elems;
@@ -136,102 +107,26 @@ typedef struct mdtab_shard {
gpr_atm free_estimate;
} mdtab_shard;
-#define LOG2_STRTAB_SHARD_COUNT 5
-#define LOG2_MDTAB_SHARD_COUNT 4
-#define STRTAB_SHARD_COUNT ((size_t)(1 << LOG2_STRTAB_SHARD_COUNT))
-#define MDTAB_SHARD_COUNT ((size_t)(1 << LOG2_MDTAB_SHARD_COUNT))
-
-/* hash seed: decided at initialization time */
-static uint32_t g_hash_seed;
-static int g_forced_hash_seed = 0;
-
-/* linearly probed hash tables for static element lookup */
-static grpc_mdstr *g_static_strtab[GRPC_STATIC_MDSTR_COUNT * 2];
-static grpc_mdelem *g_static_mdtab[GRPC_STATIC_MDELEM_COUNT * 2];
-static size_t g_static_strtab_maxprobe;
-static size_t g_static_mdtab_maxprobe;
-
-static strtab_shard g_strtab_shard[STRTAB_SHARD_COUNT];
-static mdtab_shard g_mdtab_shard[MDTAB_SHARD_COUNT];
+static mdtab_shard g_shards[SHARD_COUNT];
static void gc_mdtab(grpc_exec_ctx *exec_ctx, mdtab_shard *shard);
-void grpc_test_only_set_metadata_hash_seed(uint32_t seed) {
- g_hash_seed = seed;
- g_forced_hash_seed = 1;
-}
-
void grpc_mdctx_global_init(void) {
- size_t i, j;
- if (!g_forced_hash_seed) {
- g_hash_seed = (uint32_t)gpr_now(GPR_CLOCK_REALTIME).tv_nsec;
- }
- g_static_strtab_maxprobe = 0;
- g_static_mdtab_maxprobe = 0;
- /* build static tables */
- 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];
- 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);
- *(uint32_t *)&elem->hash = hash;
- for (j = 0;; j++) {
- size_t idx = (hash + j) % GPR_ARRAY_SIZE(g_static_strtab);
- if (g_static_strtab[idx] == NULL) {
- g_static_strtab[idx] = &grpc_static_mdstr_table[i];
- break;
- }
- }
- if (j > g_static_strtab_maxprobe) {
- g_static_strtab_maxprobe = j;
- }
- }
- for (i = 0; i < GRPC_STATIC_MDELEM_COUNT; i++) {
- grpc_mdelem *elem = &grpc_static_mdelem_table[i];
- 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]];
- uint32_t hash = GRPC_MDSTR_KV_HASH(key->hash, value->hash);
- *(grpc_mdstr **)&elem->key = key;
- *(grpc_mdstr **)&elem->value = value;
- for (j = 0;; j++) {
- size_t idx = (hash + j) % GPR_ARRAY_SIZE(g_static_mdtab);
- if (g_static_mdtab[idx] == NULL) {
- g_static_mdtab[idx] = elem;
- break;
- }
- }
- if (j > g_static_mdtab_maxprobe) {
- g_static_mdtab_maxprobe = j;
- }
- }
/* initialize shards */
- for (i = 0; i < STRTAB_SHARD_COUNT; i++) {
- strtab_shard *shard = &g_strtab_shard[i];
- gpr_mu_init(&shard->mu);
- shard->count = 0;
- shard->capacity = INITIAL_STRTAB_CAPACITY;
- shard->strs = gpr_malloc(sizeof(*shard->strs) * shard->capacity);
- memset(shard->strs, 0, sizeof(*shard->strs) * shard->capacity);
- }
- for (i = 0; i < MDTAB_SHARD_COUNT; i++) {
- mdtab_shard *shard = &g_mdtab_shard[i];
+ for (size_t i = 0; i < SHARD_COUNT; i++) {
+ mdtab_shard *shard = &g_shards[i];
gpr_mu_init(&shard->mu);
shard->count = 0;
gpr_atm_no_barrier_store(&shard->free_estimate, 0);
- shard->capacity = INITIAL_MDTAB_CAPACITY;
+ shard->capacity = INITIAL_SHARD_CAPACITY;
shard->elems = gpr_malloc(sizeof(*shard->elems) * shard->capacity);
memset(shard->elems, 0, sizeof(*shard->elems) * shard->capacity);
}
}
void grpc_mdctx_global_shutdown(grpc_exec_ctx *exec_ctx) {
- size_t i;
- for (i = 0; i < MDTAB_SHARD_COUNT; i++) {
- mdtab_shard *shard = &g_mdtab_shard[i];
+ for (size_t i = 0; i < SHARD_COUNT; i++) {
+ mdtab_shard *shard = &g_shards[i];
gpr_mu_destroy(&shard->mu);
gc_mdtab(exec_ctx, shard);
/* TODO(ctiller): GPR_ASSERT(shard->count == 0); */
@@ -244,35 +139,11 @@ void grpc_mdctx_global_shutdown(grpc_exec_ctx *exec_ctx) {
}
gpr_free(shard->elems);
}
- for (i = 0; i < STRTAB_SHARD_COUNT; i++) {
- strtab_shard *shard = &g_strtab_shard[i];
- gpr_mu_destroy(&shard->mu);
- /* TODO(ctiller): GPR_ASSERT(shard->count == 0); */
- if (shard->count != 0) {
- gpr_log(GPR_DEBUG, "WARNING: %" PRIuPTR " metadata strings were leaked",
- shard->count);
- for (size_t j = 0; j < shard->capacity; j++) {
- for (internal_string *s = shard->strs[j]; s; s = s->bucket_next) {
- gpr_log(GPR_DEBUG, "LEAKED: %s",
- grpc_mdstr_as_c_string((grpc_mdstr *)s));
- }
- }
- if (grpc_iomgr_abort_on_leaks()) {
- abort();
- }
- }
- gpr_free(shard->strs);
- }
}
-static int is_mdstr_static(grpc_mdstr *s) {
- return s >= &grpc_static_mdstr_table[0] &&
- s < &grpc_static_mdstr_table[GRPC_STATIC_MDSTR_COUNT];
-}
-
-static int is_mdelem_static(grpc_mdelem *e) {
- return e >= &grpc_static_mdelem_table[0] &&
- e < &grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT];
+static int is_mdelem_static(grpc_mdelem e) {
+ return e.payload >= &grpc_static_mdelem_table[0] &&
+ e.payload < &grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT];
}
static void ref_md_locked(mdtab_shard *shard,
@@ -282,170 +153,14 @@ 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);
}
}
-static void grow_strtab(strtab_shard *shard) {
- size_t capacity = shard->capacity * 2;
- size_t i;
- internal_string **strtab;
- internal_string *s, *next;
-
- GPR_TIMER_BEGIN("grow_strtab", 0);
-
- strtab = gpr_malloc(sizeof(internal_string *) * capacity);
- memset(strtab, 0, sizeof(internal_string *) * capacity);
-
- for (i = 0; i < shard->capacity; i++) {
- for (s = shard->strs[i]; s; s = next) {
- size_t idx = TABLE_IDX(s->hash, LOG2_STRTAB_SHARD_COUNT, capacity);
- next = s->bucket_next;
- s->bucket_next = strtab[idx];
- strtab[idx] = s;
- }
- }
-
- gpr_free(shard->strs);
- shard->strs = strtab;
- shard->capacity = capacity;
-
- GPR_TIMER_END("grow_strtab", 0);
-}
-
-static void internal_destroy_string(grpc_exec_ctx *exec_ctx,
- strtab_shard *shard, internal_string *is) {
- internal_string **prev_next;
- internal_string *cur;
- GPR_TIMER_BEGIN("internal_destroy_string", 0);
- if (is->has_base64_and_huffman_encoded) {
- grpc_slice_unref_internal(exec_ctx, is->base64_and_huffman);
- }
- for (prev_next = &shard->strs[TABLE_IDX(is->hash, LOG2_STRTAB_SHARD_COUNT,
- shard->capacity)],
- cur = *prev_next;
- cur != is; prev_next = &cur->bucket_next, cur = cur->bucket_next)
- ;
- *prev_next = cur->bucket_next;
- shard->count--;
- gpr_free(is);
- GPR_TIMER_END("internal_destroy_string", 0);
-}
-
-static void slice_ref(void *p) {
- internal_string *is =
- (internal_string *)((char *)p - offsetof(internal_string, refcount));
- GRPC_MDSTR_REF((grpc_mdstr *)(is));
-}
-
-static void slice_unref(grpc_exec_ctx *exec_ctx, void *p) {
- internal_string *is =
- (internal_string *)((char *)p - offsetof(internal_string, refcount));
- GRPC_MDSTR_UNREF(exec_ctx, (grpc_mdstr *)(is));
-}
-
-grpc_mdstr *grpc_mdstr_from_string(const char *str) {
- return grpc_mdstr_from_buffer((const uint8_t *)str, strlen(str));
-}
-
-grpc_mdstr *grpc_mdstr_from_slice(grpc_exec_ctx *exec_ctx, grpc_slice slice) {
- grpc_mdstr *result = grpc_mdstr_from_buffer(GRPC_SLICE_START_PTR(slice),
- GRPC_SLICE_LENGTH(slice));
- grpc_slice_unref_internal(exec_ctx, slice);
- return result;
-}
-
-grpc_mdstr *grpc_mdstr_from_buffer(const uint8_t *buf, size_t length) {
- uint32_t hash = gpr_murmur_hash3(buf, length, g_hash_seed);
- internal_string *s;
- strtab_shard *shard =
- &g_strtab_shard[SHARD_IDX(hash, LOG2_STRTAB_SHARD_COUNT)];
- size_t i;
- size_t idx;
-
- GPR_TIMER_BEGIN("grpc_mdstr_from_buffer", 0);
-
- /* search for a static string */
- for (i = 0; i <= g_static_strtab_maxprobe; i++) {
- grpc_mdstr *ss;
- idx = (hash + i) % GPR_ARRAY_SIZE(g_static_strtab);
- ss = g_static_strtab[idx];
- if (ss == NULL) break;
- if (ss->hash == hash && GRPC_SLICE_LENGTH(ss->slice) == length &&
- (length == 0 ||
- 0 == memcmp(buf, GRPC_SLICE_START_PTR(ss->slice), length))) {
- GPR_TIMER_END("grpc_mdstr_from_buffer", 0);
- return ss;
- }
- }
-
- gpr_mu_lock(&shard->mu);
-
- /* search for an existing string */
- idx = TABLE_IDX(hash, LOG2_STRTAB_SHARD_COUNT, shard->capacity);
- for (s = shard->strs[idx]; s; s = s->bucket_next) {
- if (s->hash == hash && GRPC_SLICE_LENGTH(s->slice) == length &&
- 0 == memcmp(buf, GRPC_SLICE_START_PTR(s->slice), length)) {
- if (gpr_atm_full_fetch_add(&s->refcnt, 1) == 0) {
- /* If we get here, we've added a ref to something that was about to
- * die - drop it immediately.
- * The *only* possible path here (given the shard mutex) should be to
- * drop from one ref back to zero - assert that with a CAS */
- GPR_ASSERT(gpr_atm_rel_cas(&s->refcnt, 1, 0));
- /* and treat this as if we were never here... sshhh */
- } else {
- gpr_mu_unlock(&shard->mu);
- GPR_TIMER_END("grpc_mdstr_from_buffer", 0);
- return (grpc_mdstr *)s;
- }
- }
- }
-
- /* not found: create a new string */
- if (length + 1 < GRPC_SLICE_INLINED_SIZE) {
- /* string data goes directly into the slice */
- s = gpr_malloc(sizeof(internal_string));
- gpr_atm_rel_store(&s->refcnt, 1);
- s->slice.refcount = NULL;
- memcpy(s->slice.data.inlined.bytes, buf, length);
- s->slice.data.inlined.bytes[length] = 0;
- s->slice.data.inlined.length = (uint8_t)length;
- } else {
- /* string data goes after the internal_string header, and we +1 for null
- terminator */
- s = gpr_malloc(sizeof(internal_string) + length + 1);
- gpr_atm_rel_store(&s->refcnt, 1);
- s->refcount.ref = slice_ref;
- s->refcount.unref = slice_unref;
- s->slice.refcount = &s->refcount;
- s->slice.data.refcounted.bytes = (uint8_t *)(s + 1);
- s->slice.data.refcounted.length = length;
- memcpy(s->slice.data.refcounted.bytes, buf, length);
- /* add a null terminator for cheap c string conversion when desired */
- s->slice.data.refcounted.bytes[length] = 0;
- }
- s->has_base64_and_huffman_encoded = 0;
- s->hash = hash;
- s->size_in_decoder_table = SIZE_IN_DECODER_TABLE_NOT_SET;
- s->bucket_next = shard->strs[idx];
- shard->strs[idx] = s;
-
- shard->count++;
-
- if (shard->count > shard->capacity * 2) {
- grow_strtab(shard);
- }
-
- gpr_mu_unlock(&shard->mu);
- GPR_TIMER_END("grpc_mdstr_from_buffer", 0);
-
- return (grpc_mdstr *)s;
-}
-
static void gc_mdtab(grpc_exec_ctx *exec_ctx, mdtab_shard *shard) {
size_t i;
internal_metadata **prev_next;
@@ -459,8 +174,8 @@ static void gc_mdtab(grpc_exec_ctx *exec_ctx, mdtab_shard *shard) {
void *user_data = (void *)gpr_atm_no_barrier_load(&md->user_data);
next = md->bucket_next;
if (gpr_atm_acq_load(&md->refcnt) == 0) {
- GRPC_MDSTR_UNREF(exec_ctx, (grpc_mdstr *)md->key);
- GRPC_MDSTR_UNREF(exec_ctx, (grpc_mdstr *)md->value);
+ grpc_slice_unref_internal(exec_ctx, md->key);
+ grpc_slice_unref_internal(exec_ctx, md->value);
if (md->user_data) {
((destroy_user_data_func)gpr_atm_no_barrier_load(
&md->destroy_user_data))(user_data);
@@ -493,9 +208,10 @@ static void grow_mdtab(mdtab_shard *shard) {
for (i = 0; i < shard->capacity; i++) {
for (md = shard->elems[i]; md; md = next) {
size_t idx;
- hash = GRPC_MDSTR_KV_HASH(md->key->hash, md->value->hash);
+ hash = GRPC_MDSTR_KV_HASH(grpc_slice_hash(md->key),
+ grpc_slice_hash(md->value));
next = md->bucket_next;
- idx = TABLE_IDX(hash, LOG2_MDTAB_SHARD_COUNT, capacity);
+ idx = TABLE_IDX(hash, capacity);
md->bucket_next = mdtab[idx];
mdtab[idx] = md;
}
@@ -517,44 +233,38 @@ static void rehash_mdtab(grpc_exec_ctx *exec_ctx, mdtab_shard *shard) {
}
}
-grpc_mdelem *grpc_mdelem_from_metadata_strings(grpc_exec_ctx *exec_ctx,
- grpc_mdstr *mkey,
- grpc_mdstr *mvalue) {
- internal_string *key = (internal_string *)mkey;
- internal_string *value = (internal_string *)mvalue;
- uint32_t hash = GRPC_MDSTR_KV_HASH(mkey->hash, mvalue->hash);
+grpc_mdelem grpc_mdelem_from_slices(grpc_exec_ctx *exec_ctx, grpc_slice key,
+ grpc_slice value) {
+ grpc_slice_static_intern(&key);
+ grpc_slice_static_intern(&value);
+
+ grpc_mdelem static_elem = grpc_static_mdelem_for_static_strings(
+ grpc_static_metadata_index(key), grpc_static_metadata_index(value));
+ if (!GRPC_MDISNULL(static_elem)) {
+ return static_elem;
+ }
+
+ uint32_t hash =
+ GRPC_MDSTR_KV_HASH(grpc_slice_hash(key), grpc_slice_hash(value));
internal_metadata *md;
- mdtab_shard *shard = &g_mdtab_shard[SHARD_IDX(hash, LOG2_MDTAB_SHARD_COUNT)];
- size_t i;
+ mdtab_shard *shard = &g_shards[SHARD_IDX(hash)];
size_t idx;
GPR_TIMER_BEGIN("grpc_mdelem_from_metadata_strings", 0);
- if (is_mdstr_static(mkey) && is_mdstr_static(mvalue)) {
- for (i = 0; i <= g_static_mdtab_maxprobe; i++) {
- grpc_mdelem *smd;
- idx = (hash + i) % GPR_ARRAY_SIZE(g_static_mdtab);
- smd = g_static_mdtab[idx];
- if (smd == NULL) break;
- if (smd->key == mkey && smd->value == mvalue) {
- GPR_TIMER_END("grpc_mdelem_from_metadata_strings", 0);
- return smd;
- }
- }
- }
-
gpr_mu_lock(&shard->mu);
- idx = TABLE_IDX(hash, LOG2_MDTAB_SHARD_COUNT, shard->capacity);
+ idx = TABLE_IDX(hash, shard->capacity);
/* search for an existing pair */
for (md = shard->elems[idx]; md; md = md->bucket_next) {
- if (md->key == key && md->value == value) {
+ if (grpc_slice_cmp(key, md->key) == 0 &&
+ grpc_slice_cmp(value, md->value) == 0) {
REF_MD_LOCKED(shard, md);
- GRPC_MDSTR_UNREF(exec_ctx, (grpc_mdstr *)key);
- GRPC_MDSTR_UNREF(exec_ctx, (grpc_mdstr *)value);
gpr_mu_unlock(&shard->mu);
+ grpc_slice_unref_internal(exec_ctx, key);
+ grpc_slice_unref_internal(exec_ctx, value);
GPR_TIMER_END("grpc_mdelem_from_metadata_strings", 0);
- return (grpc_mdelem *)md;
+ return (grpc_mdelem){(grpc_mdelem_data *)md};
}
}
@@ -571,8 +281,8 @@ grpc_mdelem *grpc_mdelem_from_metadata_strings(grpc_exec_ctx *exec_ctx,
#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++;
@@ -584,29 +294,7 @@ grpc_mdelem *grpc_mdelem_from_metadata_strings(grpc_exec_ctx *exec_ctx,
GPR_TIMER_END("grpc_mdelem_from_metadata_strings", 0);
- return (grpc_mdelem *)md;
-}
-
-grpc_mdelem *grpc_mdelem_from_strings(grpc_exec_ctx *exec_ctx, const char *key,
- const char *value) {
- return grpc_mdelem_from_metadata_strings(
- exec_ctx, grpc_mdstr_from_string(key), grpc_mdstr_from_string(value));
-}
-
-grpc_mdelem *grpc_mdelem_from_slices(grpc_exec_ctx *exec_ctx, grpc_slice key,
- grpc_slice value) {
- return grpc_mdelem_from_metadata_strings(
- exec_ctx, grpc_mdstr_from_slice(exec_ctx, key),
- grpc_mdstr_from_slice(exec_ctx, value));
-}
-
-grpc_mdelem *grpc_mdelem_from_string_and_buffer(grpc_exec_ctx *exec_ctx,
- const char *key,
- const uint8_t *value,
- size_t value_length) {
- return grpc_mdelem_from_metadata_strings(
- exec_ctx, grpc_mdstr_from_string(key),
- grpc_mdstr_from_buffer(value, value_length));
+ return (grpc_mdelem){(grpc_mdelem_data *)md};
}
static size_t get_base64_encoded_size(size_t raw_length) {
@@ -614,44 +302,26 @@ static size_t get_base64_encoded_size(size_t raw_length) {
return raw_length / 3 * 4 + tail_xtra[raw_length % 3];
}
-size_t grpc_mdelem_get_size_in_hpack_table(grpc_mdelem *elem) {
- size_t overhead_and_key = 32 + GRPC_SLICE_LENGTH(elem->key->slice);
- size_t value_len = GRPC_SLICE_LENGTH(elem->value->slice);
- if (is_mdstr_static(elem->value)) {
- if (grpc_is_binary_header(
- (const char *)GRPC_SLICE_START_PTR(elem->key->slice),
- GRPC_SLICE_LENGTH(elem->key->slice))) {
- return overhead_and_key + get_base64_encoded_size(value_len);
- } else {
- return overhead_and_key + value_len;
- }
+size_t grpc_mdelem_get_size_in_hpack_table(grpc_mdelem elem) {
+ size_t overhead_and_key = 32 + GRPC_SLICE_LENGTH(GRPC_MDKEY(elem));
+ size_t value_len = GRPC_SLICE_LENGTH(GRPC_MDVALUE(elem));
+ if (grpc_is_binary_header(GRPC_MDKEY(elem))) {
+ return overhead_and_key + get_base64_encoded_size(value_len);
} else {
- internal_string *is = (internal_string *)elem->value;
- gpr_atm current_size = gpr_atm_acq_load(&is->size_in_decoder_table);
- if (current_size == SIZE_IN_DECODER_TABLE_NOT_SET) {
- if (grpc_is_binary_header(
- (const char *)GRPC_SLICE_START_PTR(elem->key->slice),
- GRPC_SLICE_LENGTH(elem->key->slice))) {
- current_size = (gpr_atm)get_base64_encoded_size(value_len);
- } else {
- current_size = (gpr_atm)value_len;
- }
- gpr_atm_rel_store(&is->size_in_decoder_table, current_size);
- }
- return overhead_and_key + (size_t)current_size;
+ return overhead_and_key + value_len;
}
}
-grpc_mdelem *grpc_mdelem_ref(grpc_mdelem *gmd DEBUG_ARGS) {
- internal_metadata *md = (internal_metadata *)gmd;
- if (is_mdelem_static(gmd)) return gmd;
+grpc_mdelem grpc_mdelem_ref(grpc_mdelem gmd DEBUG_ARGS) {
+ if (gmd.payload == NULL || is_mdelem_static(gmd)) return gmd;
+ internal_metadata *md = (internal_metadata *)gmd.payload;
#ifdef GRPC_METADATA_REFCOUNT_DEBUG
gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG,
"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,
@@ -662,71 +332,35 @@ grpc_mdelem *grpc_mdelem_ref(grpc_mdelem *gmd DEBUG_ARGS) {
return gmd;
}
-void grpc_mdelem_unref(grpc_exec_ctx *exec_ctx, grpc_mdelem *gmd DEBUG_ARGS) {
- internal_metadata *md = (internal_metadata *)gmd;
- if (!md) return;
- if (is_mdelem_static(gmd)) return;
+void grpc_mdelem_unref(grpc_exec_ctx *exec_ctx, grpc_mdelem gmd DEBUG_ARGS) {
+ if (gmd.payload == NULL || is_mdelem_static(gmd)) return;
+ internal_metadata *md = (internal_metadata *)gmd.payload;
#ifdef GRPC_METADATA_REFCOUNT_DEBUG
gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG,
"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(md->key->hash, md->value->hash);
+ uint32_t hash =
+ GRPC_MDSTR_KV_HASH(grpc_slice_hash(md->key), grpc_slice_hash(md->value));
const gpr_atm prev_refcount = gpr_atm_full_fetch_add(&md->refcnt, -1);
GPR_ASSERT(prev_refcount >= 1);
if (1 == prev_refcount) {
/* once the refcount hits zero, some other thread can come along and
free md at any time: it's unsafe from this point on to access it */
- mdtab_shard *shard =
- &g_mdtab_shard[SHARD_IDX(hash, LOG2_MDTAB_SHARD_COUNT)];
+ mdtab_shard *shard = &g_shards[SHARD_IDX(hash)];
gpr_atm_no_barrier_fetch_add(&shard->free_estimate, 1);
}
}
-const char *grpc_mdstr_as_c_string(const grpc_mdstr *s) {
- return (const char *)GRPC_SLICE_START_PTR(s->slice);
-}
-
-size_t grpc_mdstr_length(const grpc_mdstr *s) { return GRPC_MDSTR_LENGTH(s); }
-
-grpc_mdstr *grpc_mdstr_ref(grpc_mdstr *gs DEBUG_ARGS) {
- internal_string *s = (internal_string *)gs;
- if (is_mdstr_static(gs)) return gs;
-#ifdef GRPC_METADATA_REFCOUNT_DEBUG
- gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, "STR REF:%p:%zu->%zu: '%s'",
- (void *)s, gpr_atm_no_barrier_load(&s->refcnt),
- gpr_atm_no_barrier_load(&s->refcnt) + 1, grpc_mdstr_as_c_string(gs));
-#endif
- GPR_ASSERT(gpr_atm_full_fetch_add(&s->refcnt, 1) > 0);
- return gs;
-}
-
-void grpc_mdstr_unref(grpc_exec_ctx *exec_ctx, grpc_mdstr *gs DEBUG_ARGS) {
- internal_string *s = (internal_string *)gs;
- if (is_mdstr_static(gs)) return;
-#ifdef GRPC_METADATA_REFCOUNT_DEBUG
- gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, "STR UNREF:%p:%zu->%zu: '%s'",
- (void *)s, gpr_atm_no_barrier_load(&s->refcnt),
- gpr_atm_no_barrier_load(&s->refcnt) - 1, grpc_mdstr_as_c_string(gs));
-#endif
- if (1 == gpr_atm_full_fetch_add(&s->refcnt, -1)) {
- strtab_shard *shard =
- &g_strtab_shard[SHARD_IDX(s->hash, LOG2_STRTAB_SHARD_COUNT)];
- gpr_mu_lock(&shard->mu);
- GPR_ASSERT(0 == gpr_atm_no_barrier_load(&s->refcnt));
- internal_destroy_string(exec_ctx, shard, s);
- gpr_mu_unlock(&shard->mu);
- }
-}
-
-void *grpc_mdelem_get_user_data(grpc_mdelem *md, void (*destroy_func)(void *)) {
- internal_metadata *im = (internal_metadata *)md;
+void *grpc_mdelem_get_user_data(grpc_mdelem md, void (*destroy_func)(void *)) {
+ internal_metadata *im = (internal_metadata *)md.payload;
void *result;
if (is_mdelem_static(md)) {
- return (void *)grpc_static_mdelem_user_data[md - grpc_static_mdelem_table];
+ return (void *)
+ grpc_static_mdelem_user_data[md.payload - grpc_static_mdelem_table];
}
if (gpr_atm_acq_load(&im->destroy_user_data) == (gpr_atm)destroy_func) {
return (void *)gpr_atm_no_barrier_load(&im->user_data);
@@ -736,9 +370,9 @@ void *grpc_mdelem_get_user_data(grpc_mdelem *md, void (*destroy_func)(void *)) {
return result;
}
-void *grpc_mdelem_set_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;
+ internal_metadata *im = (internal_metadata *)md.payload;
GPR_ASSERT(!is_mdelem_static(md));
GPR_ASSERT((user_data == NULL) == (destroy_func == NULL));
gpr_mu_lock(&im->mu_user_data);
@@ -756,18 +390,8 @@ void *grpc_mdelem_set_user_data(grpc_mdelem *md, void (*destroy_func)(void *),
return user_data;
}
-grpc_slice grpc_mdstr_as_base64_encoded_and_huffman_compressed(grpc_mdstr *gs) {
- internal_string *s = (internal_string *)gs;
- grpc_slice slice;
- strtab_shard *shard =
- &g_strtab_shard[SHARD_IDX(s->hash, LOG2_STRTAB_SHARD_COUNT)];
- gpr_mu_lock(&shard->mu);
- if (!s->has_base64_and_huffman_encoded) {
- s->base64_and_huffman =
- grpc_chttp2_base64_encode_and_huffman_compress(s->slice);
- s->has_base64_and_huffman_encoded = 1;
- }
- slice = s->base64_and_huffman;
- gpr_mu_unlock(&shard->mu);
- return slice;
+bool grpc_mdelem_eq(grpc_mdelem a, grpc_mdelem b) {
+ if (a.payload == b.payload) return true;
+ return 0 == grpc_slice_cmp(GRPC_MDKEY(a), GRPC_MDKEY(b)) &&
+ 0 == grpc_slice_cmp(GRPC_MDVALUE(a), GRPC_MDVALUE(b));
}
diff --git a/src/core/lib/transport/metadata.h b/src/core/lib/transport/metadata.h
index 991eee96f1..da5416bf76 100644
--- a/src/core/lib/transport/metadata.h
+++ b/src/core/lib/transport/metadata.h
@@ -74,110 +74,67 @@ extern "C" {
declared here - in which case those functions are effectively no-ops. */
/* Forward declarations */
-typedef struct grpc_mdstr grpc_mdstr;
typedef struct grpc_mdelem grpc_mdelem;
-/* if changing this, make identical changes in internal_string in metadata.c */
-struct grpc_mdstr {
- const grpc_slice slice;
- const uint32_t hash;
- /* there is a private part to this in metadata.c */
-};
-
/* if changing this, make identical changes in internal_metadata in
metadata.c */
-struct grpc_mdelem {
- grpc_mdstr *const key;
- grpc_mdstr *const value;
+typedef struct grpc_mdelem_data {
+ const grpc_slice key;
+ const grpc_slice value;
/* there is a private part to this in metadata.c */
+} grpc_mdelem_data;
+
+struct grpc_mdelem {
+ grpc_mdelem_data *payload;
};
-void grpc_test_only_set_metadata_hash_seed(uint32_t seed);
-
-/* Constructors for grpc_mdstr instances; take a variety of data types that
- clients may have handy */
-grpc_mdstr *grpc_mdstr_from_string(const char *str);
-/* Unrefs the slice. */
-grpc_mdstr *grpc_mdstr_from_slice(grpc_exec_ctx *exec_ctx, grpc_slice slice);
-grpc_mdstr *grpc_mdstr_from_buffer(const uint8_t *str, size_t length);
-
-/* Returns a borrowed slice from the mdstr with its contents base64 encoded
- and huffman compressed */
-grpc_slice grpc_mdstr_as_base64_encoded_and_huffman_compressed(grpc_mdstr *str);
-
-/* Constructors for grpc_mdelem instances; take a variety of data types that
- clients may have handy */
-grpc_mdelem *grpc_mdelem_from_metadata_strings(grpc_exec_ctx *exec_ctx,
- grpc_mdstr *key,
- grpc_mdstr *value);
-grpc_mdelem *grpc_mdelem_from_strings(grpc_exec_ctx *exec_ctx, const char *key,
- const char *value);
/* Unrefs the slices. */
-grpc_mdelem *grpc_mdelem_from_slices(grpc_exec_ctx *exec_ctx, grpc_slice key,
- grpc_slice value);
-grpc_mdelem *grpc_mdelem_from_string_and_buffer(grpc_exec_ctx *exec_ctx,
- const char *key,
- const uint8_t *value,
- size_t value_length);
+grpc_mdelem grpc_mdelem_from_slices(grpc_exec_ctx *exec_ctx, grpc_slice key,
+ grpc_slice value);
+
+bool grpc_mdelem_eq(grpc_mdelem a, grpc_mdelem b);
-size_t grpc_mdelem_get_size_in_hpack_table(grpc_mdelem *elem);
+size_t grpc_mdelem_get_size_in_hpack_table(grpc_mdelem elem);
/* Mutator and accessor for grpc_mdelem user data. The destructor function
is used as a type tag and is checked during user_data fetch. */
-void *grpc_mdelem_get_user_data(grpc_mdelem *md,
+void *grpc_mdelem_get_user_data(grpc_mdelem md,
void (*if_destroy_func)(void *));
-void *grpc_mdelem_set_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);
/* Reference counting */
//#define GRPC_METADATA_REFCOUNT_DEBUG
#ifdef GRPC_METADATA_REFCOUNT_DEBUG
-#define GRPC_MDSTR_REF(s) grpc_mdstr_ref((s), __FILE__, __LINE__)
-#define GRPC_MDSTR_UNREF(exec_ctx, s) \
- grpc_mdstr_unref((exec_ctx), (s), __FILE__, __LINE__)
#define GRPC_MDELEM_REF(s) grpc_mdelem_ref((s), __FILE__, __LINE__)
#define GRPC_MDELEM_UNREF(exec_ctx, s) \
grpc_mdelem_unref((exec_ctx), (s), __FILE__, __LINE__)
-grpc_mdstr *grpc_mdstr_ref(grpc_mdstr *s, const char *file, int line);
-void grpc_mdstr_unref(grpc_exec_ctx *exec_ctx, grpc_mdstr *s, const char *file,
- int line);
-grpc_mdelem *grpc_mdelem_ref(grpc_mdelem *md, const char *file, int line);
-void grpc_mdelem_unref(grpc_exec_ctx *exec_ctx, grpc_mdelem *md,
+grpc_mdelem grpc_mdelem_ref(grpc_mdelem md, const char *file, int line);
+void grpc_mdelem_unref(grpc_exec_ctx *exec_ctx, grpc_mdelem md,
const char *file, int line);
#else
-#define GRPC_MDSTR_REF(s) grpc_mdstr_ref((s))
-#define GRPC_MDSTR_UNREF(exec_ctx, s) grpc_mdstr_unref((exec_ctx), (s))
#define GRPC_MDELEM_REF(s) grpc_mdelem_ref((s))
#define GRPC_MDELEM_UNREF(exec_ctx, s) grpc_mdelem_unref((exec_ctx), (s))
-grpc_mdstr *grpc_mdstr_ref(grpc_mdstr *s);
-void grpc_mdstr_unref(grpc_exec_ctx *exec_ctx, grpc_mdstr *s);
-grpc_mdelem *grpc_mdelem_ref(grpc_mdelem *md);
-void grpc_mdelem_unref(grpc_exec_ctx *exec_ctx, grpc_mdelem *md);
+grpc_mdelem grpc_mdelem_ref(grpc_mdelem md);
+void grpc_mdelem_unref(grpc_exec_ctx *exec_ctx, grpc_mdelem md);
#endif
-/* Recover a char* from a grpc_mdstr. The returned string is null terminated.
- Does not promise that the returned string has no embedded nulls however. */
-const char *grpc_mdstr_as_c_string(const grpc_mdstr *s);
+#define GRPC_MDKEY(md) ((md).payload->key)
+#define GRPC_MDVALUE(md) ((md).payload->value)
-#define GRPC_MDSTR_LENGTH(s) (GRPC_SLICE_LENGTH(s->slice))
+#define GRPC_MDNULL ((grpc_mdelem){NULL})
+#define GRPC_MDISNULL(md) ((md).payload == NULL)
/* We add 32 bytes of padding as per RFC-7540 section 6.5.2. */
-#define GRPC_MDELEM_LENGTH(e) \
- (GRPC_MDSTR_LENGTH((e)->key) + GRPC_MDSTR_LENGTH((e)->value) + 32)
-
-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);
+#define GRPC_MDELEM_LENGTH(e) \
+ (GRPC_SLICE_LENGTH(GRPC_MDKEY((e))) + GRPC_SLICE_LENGTH(GRPC_MDVALUE((e))) + \
+ 32)
#define GRPC_MDSTR_KV_HASH(k_hash, v_hash) (GPR_ROTL((k_hash), 2) ^ (v_hash))
void grpc_mdctx_global_init(void);
void grpc_mdctx_global_shutdown(grpc_exec_ctx *exec_ctx);
-/* Implementation provided by chttp2_transport */
-extern grpc_slice (*grpc_chttp2_base64_encode_and_huffman_compress)(
- grpc_slice input);
-
#ifdef __cplusplus
}
#endif
diff --git a/src/core/lib/transport/metadata_batch.c b/src/core/lib/transport/metadata_batch.c
index b62ecc3aa6..9e0a8fbbe1 100644
--- a/src/core/lib/transport/metadata_batch.c
+++ b/src/core/lib/transport/metadata_batch.c
@@ -52,7 +52,7 @@ static void assert_valid_list(grpc_mdelem_list *list) {
GPR_ASSERT((list->head == list->tail) == (list->head->next == NULL));
for (l = list->head; l; l = l->next) {
- GPR_ASSERT(l->md);
+ GPR_ASSERT(!GRPC_MDISNULL(l->md));
GPR_ASSERT((l->prev == NULL) == (l == list->head));
GPR_ASSERT((l->next == NULL) == (l == list->tail));
if (l->next) GPR_ASSERT(l->next->prev == l);
@@ -82,15 +82,15 @@ void grpc_metadata_batch_destroy(grpc_exec_ctx *exec_ctx,
void grpc_metadata_batch_add_head(grpc_metadata_batch *batch,
grpc_linked_mdelem *storage,
- grpc_mdelem *elem_to_add) {
- GPR_ASSERT(elem_to_add);
+ grpc_mdelem elem_to_add) {
+ GPR_ASSERT(!GRPC_MDISNULL(elem_to_add));
storage->md = elem_to_add;
grpc_metadata_batch_link_head(batch, storage);
}
static void link_head(grpc_mdelem_list *list, grpc_linked_mdelem *storage) {
assert_valid_list(list);
- GPR_ASSERT(storage->md);
+ GPR_ASSERT(!GRPC_MDISNULL(storage->md));
storage->prev = NULL;
storage->next = list->head;
if (list->head != NULL) {
@@ -109,15 +109,15 @@ void grpc_metadata_batch_link_head(grpc_metadata_batch *batch,
void grpc_metadata_batch_add_tail(grpc_metadata_batch *batch,
grpc_linked_mdelem *storage,
- grpc_mdelem *elem_to_add) {
- GPR_ASSERT(elem_to_add);
+ grpc_mdelem elem_to_add) {
+ GPR_ASSERT(!GRPC_MDISNULL(elem_to_add));
storage->md = elem_to_add;
grpc_metadata_batch_link_tail(batch, storage);
}
static void link_tail(grpc_mdelem_list *list, grpc_linked_mdelem *storage) {
assert_valid_list(list);
- GPR_ASSERT(storage->md);
+ GPR_ASSERT(!GRPC_MDISNULL(storage->md));
storage->prev = list->tail;
storage->next = NULL;
storage->reserved = NULL;
@@ -143,9 +143,9 @@ void grpc_metadata_batch_move(grpc_metadata_batch *dst,
void grpc_metadata_batch_filter(grpc_exec_ctx *exec_ctx,
grpc_metadata_batch *batch,
- grpc_mdelem *(*filter)(grpc_exec_ctx *exec_ctx,
- void *user_data,
- grpc_mdelem *elem),
+ grpc_mdelem (*filter)(grpc_exec_ctx *exec_ctx,
+ void *user_data,
+ grpc_mdelem elem),
void *user_data) {
grpc_linked_mdelem *l;
grpc_linked_mdelem *next;
@@ -154,10 +154,10 @@ void grpc_metadata_batch_filter(grpc_exec_ctx *exec_ctx,
assert_valid_list(&batch->list);
for (l = batch->list.head; l; l = next) {
- grpc_mdelem *orig = l->md;
- grpc_mdelem *filt = filter(exec_ctx, user_data, orig);
+ grpc_mdelem orig = l->md;
+ grpc_mdelem filt = filter(exec_ctx, user_data, orig);
next = l->next;
- if (filt == NULL) {
+ if (GRPC_MDISNULL(filt)) {
if (l->prev) {
l->prev->next = l->next;
}
@@ -172,7 +172,7 @@ void grpc_metadata_batch_filter(grpc_exec_ctx *exec_ctx,
}
assert_valid_list(&batch->list);
GRPC_MDELEM_UNREF(exec_ctx, l->md);
- } else if (filt != orig) {
+ } else if (!grpc_mdelem_eq(filt, orig)) {
GRPC_MDELEM_UNREF(exec_ctx, orig);
l->md = filt;
}
@@ -182,9 +182,9 @@ void grpc_metadata_batch_filter(grpc_exec_ctx *exec_ctx,
GPR_TIMER_END("grpc_metadata_batch_filter", 0);
}
-static grpc_mdelem *no_metadata_for_you(grpc_exec_ctx *exec_ctx,
- void *user_data, grpc_mdelem *elem) {
- return NULL;
+static grpc_mdelem no_metadata_for_you(grpc_exec_ctx *exec_ctx, void *user_data,
+ grpc_mdelem elem) {
+ return GRPC_MDNULL;
}
void grpc_metadata_batch_clear(grpc_exec_ctx *exec_ctx,
diff --git a/src/core/lib/transport/metadata_batch.h b/src/core/lib/transport/metadata_batch.h
index c0bd5174ab..2c82ed6983 100644
--- a/src/core/lib/transport/metadata_batch.h
+++ b/src/core/lib/transport/metadata_batch.h
@@ -47,7 +47,7 @@ extern "C" {
#endif
typedef struct grpc_linked_mdelem {
- grpc_mdelem *md;
+ grpc_mdelem md;
struct grpc_linked_mdelem *next;
struct grpc_linked_mdelem *prev;
void *reserved;
@@ -105,7 +105,7 @@ void grpc_metadata_batch_link_tail(grpc_metadata_batch *batch,
Takes ownership of \a elem_to_add */
void grpc_metadata_batch_add_head(grpc_metadata_batch *batch,
grpc_linked_mdelem *storage,
- grpc_mdelem *elem_to_add);
+ grpc_mdelem elem_to_add);
/** Add \a elem_to_add as the last element in \a batch, using
\a storage as backing storage for the linked list element.
\a storage is owned by the caller and must survive for the
@@ -114,7 +114,7 @@ void grpc_metadata_batch_add_head(grpc_metadata_batch *batch,
Takes ownership of \a elem_to_add */
void grpc_metadata_batch_add_tail(grpc_metadata_batch *batch,
grpc_linked_mdelem *storage,
- grpc_mdelem *elem_to_add);
+ grpc_mdelem elem_to_add);
/** For each element in \a batch, execute \a filter.
The return value from \a filter will be substituted for the
@@ -122,9 +122,9 @@ void grpc_metadata_batch_add_tail(grpc_metadata_batch *batch,
the element will be moved to the garbage list. */
void grpc_metadata_batch_filter(grpc_exec_ctx *exec_ctx,
grpc_metadata_batch *batch,
- grpc_mdelem *(*filter)(grpc_exec_ctx *exec_ctx,
+ grpc_mdelem (*filter)(grpc_exec_ctx *exec_ctx,
void *user_data,
- grpc_mdelem *elem),
+ grpc_mdelem elem),
void *user_data);
#ifndef NDEBUG
diff --git a/src/core/lib/transport/method_config.c b/src/core/lib/transport/method_config.c
index 25fb54b37d..75317d426d 100644
--- a/src/core/lib/transport/method_config.c
+++ b/src/core/lib/transport/method_config.c
@@ -39,8 +39,10 @@
#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/slice/slice_internal.h"
#include "src/core/lib/transport/metadata.h"
+#include "src/core/lib/transport/static_metadata.h"
//
// grpc_method_config
@@ -48,252 +50,224 @@
// bool vtable
-static void* bool_copy(void* valuep) {
- bool value = *(bool*)valuep;
- bool* new_value = gpr_malloc(sizeof(bool));
+static void *bool_copy(void *valuep) {
+ bool value = *(bool *)valuep;
+ bool *new_value = gpr_malloc(sizeof(bool));
*new_value = value;
return new_value;
}
-static int bool_cmp(void* v1, void* v2) {
- bool b1 = *(bool*)v1;
- bool b2 = *(bool*)v2;
+static int bool_cmp(void *v1, void *v2) {
+ bool b1 = *(bool *)v1;
+ bool b2 = *(bool *)v2;
if (!b1 && b2) return -1;
if (b1 && !b2) return 1;
return 0;
}
-static void free_mem(grpc_exec_ctx* exec_ctx, void* p) { gpr_free(p); }
+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
-static void* timespec_copy(void* valuep) {
- gpr_timespec value = *(gpr_timespec*)valuep;
- gpr_timespec* new_value = gpr_malloc(sizeof(gpr_timespec));
+static void *timespec_copy(void *valuep) {
+ gpr_timespec value = *(gpr_timespec *)valuep;
+ gpr_timespec *new_value = gpr_malloc(sizeof(gpr_timespec));
*new_value = value;
return new_value;
}
-static int timespec_cmp(void* v1, void* v2) {
- return gpr_time_cmp(*(gpr_timespec*)v1, *(gpr_timespec*)v2);
+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
-static void* int32_copy(void* valuep) {
- int32_t value = *(int32_t*)valuep;
- int32_t* new_value = gpr_malloc(sizeof(int32_t));
+static void *int32_copy(void *valuep) {
+ int32_t value = *(int32_t *)valuep;
+ int32_t *new_value = gpr_malloc(sizeof(int32_t));
*new_value = value;
return new_value;
}
-static int int32_cmp(void* v1, void* v2) {
- int32_t i1 = *(int32_t*)v1;
- int32_t i2 = *(int32_t*)v2;
+static int int32_cmp(void *v1, void *v2) {
+ int32_t i1 = *(int32_t *)v1;
+ int32_t i2 = *(int32_t *)v2;
if (i1 < i2) return -1;
if (i1 > i2) return 1;
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.
-#define GRPC_METHOD_CONFIG_WAIT_FOR_READY "grpc.wait_for_ready" // bool
-#define GRPC_METHOD_CONFIG_TIMEOUT "grpc.timeout" // gpr_timespec
-#define GRPC_METHOD_CONFIG_MAX_REQUEST_MESSAGE_BYTES \
- "grpc.max_request_message_bytes" // int32
-#define GRPC_METHOD_CONFIG_MAX_RESPONSE_MESSAGE_BYTES \
- "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_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* method_config = gpr_malloc(sizeof(grpc_method_config));
+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 *method_config = gpr_malloc(sizeof(grpc_method_config));
memset(method_config, 0, sizeof(grpc_method_config));
- method_config->wait_for_ready_key =
- grpc_mdstr_from_string(GRPC_METHOD_CONFIG_WAIT_FOR_READY);
- method_config->timeout_key =
- grpc_mdstr_from_string(GRPC_METHOD_CONFIG_TIMEOUT);
- method_config->max_request_message_bytes_key =
- 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;
+ entries[num_entries].key = GRPC_MDSTR_GRPC_DOT_WAIT_FOR_READY;
entries[num_entries].value = wait_for_ready;
entries[num_entries].vtable = &bool_vtable;
++num_entries;
}
if (timeout != NULL) {
- entries[num_entries].key = method_config->timeout_key;
+ entries[num_entries].key = GRPC_MDSTR_GRPC_DOT_TIMEOUT;
entries[num_entries].value = timeout;
entries[num_entries].vtable = &timespec_vtable;
++num_entries;
}
if (max_request_message_bytes != NULL) {
- entries[num_entries].key = method_config->max_request_message_bytes_key;
+ entries[num_entries].key = GRPC_MDSTR_GRPC_DOT_MAX_REQUEST_MESSAGE_BYTES;
entries[num_entries].value = max_request_message_bytes;
entries[num_entries].vtable = &int32_vtable;
++num_entries;
}
if (max_response_message_bytes != NULL) {
- entries[num_entries].key = method_config->max_response_message_bytes_key;
+ entries[num_entries].key = GRPC_MDSTR_GRPC_DOT_MAX_RESPONSE_MESSAGE_BYTES;
entries[num_entries].value = max_response_message_bytes;
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_method_config *grpc_method_config_ref(grpc_method_config *method_config) {
+ 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)) {
- 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);
- GRPC_MDSTR_UNREF(exec_ctx, method_config->max_response_message_bytes_key);
+void grpc_method_config_unref(grpc_exec_ctx *exec_ctx,
+ grpc_method_config *method_config) {
+ if (grpc_slice_hash_table_unref(exec_ctx, method_config->table)) {
gpr_free(method_config);
}
}
-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,
+int grpc_method_config_cmp(const grpc_method_config *method_config1,
+ const grpc_method_config *method_config2) {
+ 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,
- method_config->wait_for_ready_key);
+const bool *grpc_method_config_get_wait_for_ready(
+ const grpc_method_config *method_config) {
+ return grpc_slice_hash_table_get(method_config->table,
+ GRPC_MDSTR_GRPC_DOT_WAIT_FOR_READY);
}
-const gpr_timespec* grpc_method_config_get_timeout(
- const grpc_method_config* method_config) {
- return grpc_mdstr_hash_table_get(method_config->table,
- method_config->timeout_key);
+const gpr_timespec *grpc_method_config_get_timeout(
+ const grpc_method_config *method_config) {
+ return grpc_slice_hash_table_get(method_config->table,
+ GRPC_MDSTR_GRPC_DOT_TIMEOUT);
}
-const int32_t* grpc_method_config_get_max_request_message_bytes(
- const grpc_method_config* method_config) {
- return grpc_mdstr_hash_table_get(
- method_config->table, method_config->max_request_message_bytes_key);
+const int32_t *grpc_method_config_get_max_request_message_bytes(
+ const grpc_method_config *method_config) {
+ return grpc_slice_hash_table_get(
+ method_config->table, GRPC_MDSTR_GRPC_DOT_MAX_REQUEST_MESSAGE_BYTES);
}
-const int32_t* grpc_method_config_get_max_response_message_bytes(
- const grpc_method_config* method_config) {
- return grpc_mdstr_hash_table_get(
- method_config->table, method_config->max_response_message_bytes_key);
+const int32_t *grpc_method_config_get_max_response_message_bytes(
+ const grpc_method_config *method_config) {
+ return grpc_slice_hash_table_get(
+ method_config->table, GRPC_MDSTR_GRPC_DOT_MAX_RESPONSE_MESSAGE_BYTES);
}
//
// grpc_method_config_table
//
-static void method_config_unref(grpc_exec_ctx* exec_ctx, void* valuep) {
+static void method_config_unref(grpc_exec_ctx *exec_ctx, void *valuep) {
grpc_method_config_unref(exec_ctx, valuep);
}
-static void* method_config_ref(void* valuep) {
+static void *method_config_ref(void *valuep) {
return grpc_method_config_ref(valuep);
}
-static int method_config_cmp(void* valuep1, void* valuep2) {
+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_method_config_table *grpc_method_config_table_create(
+ size_t num_entries, grpc_method_config_table_entry *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_method_config_table *method_config_table =
+ 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);
+grpc_method_config_table *grpc_method_config_table_ref(
+ grpc_method_config_table *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);
+void grpc_method_config_table_unref(grpc_exec_ctx *exec_ctx,
+ grpc_method_config_table *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);
+int grpc_method_config_table_cmp(const grpc_method_config_table *table1,
+ const grpc_method_config_table *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);
+void *grpc_method_config_table_get(grpc_exec_ctx *exec_ctx,
+ 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) {
- const char* path_str = grpc_mdstr_as_c_string(path);
- const char* sep = strrchr(path_str, '/') + 1;
- const size_t len = (size_t)(sep - path_str);
- char* buf = gpr_malloc(len + 2); // '*' and NUL
- memcpy(buf, path_str, len);
- buf[len] = '*';
- buf[len + 1] = '\0';
- grpc_mdstr* wildcard_path = grpc_mdstr_from_string(buf);
- gpr_free(buf);
- value = grpc_mdstr_hash_table_get(table, wildcard_path);
- GRPC_MDSTR_UNREF(exec_ctx, wildcard_path);
+ int sep_pos = grpc_slice_rchr(path, '/') + 1;
+ grpc_slice search = grpc_slice_malloc((size_t)(sep_pos + 1));
+ memcpy(GRPC_SLICE_START_PTR(search), GRPC_SLICE_START_PTR(path),
+ (size_t)sep_pos);
+ GRPC_SLICE_START_PTR(search)[sep_pos] = '*';
+ value = grpc_slice_hash_table_get(table, search);
+ grpc_slice_unref_internal(exec_ctx, search);
}
return value;
}
-static void* copy_arg(void* p) { return grpc_method_config_table_ref(p); }
+static void *copy_arg(void *p) { return grpc_method_config_table_ref(p); }
-static void destroy_arg(grpc_exec_ctx* exec_ctx, void* p) {
+static void destroy_arg(grpc_exec_ctx *exec_ctx, void *p) {
grpc_method_config_table_unref(exec_ctx, p);
}
-static int cmp_arg(void* p1, void* p2) {
+static int cmp_arg(void *p1, void *p2) {
return grpc_method_config_table_cmp(p1, p2);
}
static grpc_arg_pointer_vtable arg_vtable = {copy_arg, destroy_arg, cmp_arg};
grpc_arg grpc_method_config_table_create_channel_arg(
- grpc_method_config_table* table) {
+ grpc_method_config_table *table) {
grpc_arg arg;
arg.type = GRPC_ARG_POINTER;
arg.key = GRPC_ARG_SERVICE_CONFIG;
@@ -304,41 +278,41 @@ 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;
+ void *(*convert_value)(const grpc_method_config *method_config);
+ 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,
- void* user_data) {
- conversion_state* state = user_data;
- state->entries[state->num_entries].key = GRPC_MDSTR_REF(entry->key);
+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_slice_ref_internal(entry->key);
state->entries[state->num_entries].value = state->convert_value(entry->value);
state->entries[state->num_entries].vtable = state->vtable;
++state->num_entries;
}
-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) {
// 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);
+ grpc_slice_unref_internal(exec_ctx, state.entries[i].key);
vtable->destroy_value(exec_ctx, state.entries[i].value);
}
gpr_free(state.entries);
diff --git a/src/core/lib/transport/method_config.h b/src/core/lib/transport/method_config.h
index d17a493fd4..3e266a6ecd 100644
--- a/src/core/lib/transport/method_config.h
+++ b/src/core/lib/transport/method_config.h
@@ -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 */
diff --git a/src/core/lib/transport/service_config.c b/src/core/lib/transport/service_config.c
index 552d3ec856..8073a46105 100644
--- a/src/core/lib/transport/service_config.c
+++ b/src/core/lib/transport/service_config.c
@@ -39,8 +39,10 @@
#include <grpc/support/string_util.h>
#include "src/core/lib/json/json.h"
+#include "src/core/lib/slice/slice_hash_table.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/mdstr_hash_table.h"
// The main purpose of the code here is to parse the service config in
// JSON form, which will look like this:
@@ -148,8 +150,8 @@ static char* parse_json_method_name(grpc_json* json) {
static bool parse_json_method_config(
grpc_exec_ctx* exec_ctx, grpc_json* json,
void* (*create_value)(const grpc_json* method_config_json),
- const grpc_mdstr_hash_table_vtable* vtable,
- grpc_mdstr_hash_table_entry* entries, size_t* idx) {
+ const grpc_slice_hash_table_vtable* vtable,
+ grpc_slice_hash_table_entry* entries, size_t* idx) {
// Construct value.
void* method_config = create_value(json);
if (method_config == NULL) return false;
@@ -170,7 +172,7 @@ static bool parse_json_method_config(
if (paths.count == 0) goto done; // No names specified.
// Add entry for each path.
for (size_t i = 0; i < paths.count; ++i) {
- entries[*idx].key = grpc_mdstr_from_string(paths.strs[i]);
+ entries[*idx].key = grpc_slice_from_copied_string(paths.strs[i]);
entries[*idx].value = vtable->copy_value(method_config);
entries[*idx].vtable = vtable;
++*idx;
@@ -182,15 +184,15 @@ done:
return success;
}
-grpc_mdstr_hash_table* grpc_service_config_create_method_config_table(
+grpc_slice_hash_table* grpc_service_config_create_method_config_table(
grpc_exec_ctx* exec_ctx, const grpc_service_config* service_config,
void* (*create_value)(const grpc_json* method_config_json),
- const grpc_mdstr_hash_table_vtable* vtable) {
+ const grpc_slice_hash_table_vtable* vtable) {
const grpc_json* json = service_config->json_tree;
// Traverse parsed JSON tree.
if (json->type != GRPC_JSON_OBJECT || json->key != NULL) return NULL;
size_t num_entries = 0;
- grpc_mdstr_hash_table_entry* entries = NULL;
+ grpc_slice_hash_table_entry* entries = NULL;
for (grpc_json* field = json->child; field != NULL; field = field->next) {
if (field->key == NULL) return NULL;
if (strcmp(field->key, "methodConfig") == 0) {
@@ -202,7 +204,7 @@ grpc_mdstr_hash_table* grpc_service_config_create_method_config_table(
num_entries += count_names_in_method_config_json(method);
}
// Populate method config table entries.
- entries = gpr_malloc(num_entries * sizeof(grpc_mdstr_hash_table_entry));
+ entries = gpr_malloc(num_entries * sizeof(grpc_slice_hash_table_entry));
size_t idx = 0;
for (grpc_json* method = field->child; method != NULL;
method = method->next) {
@@ -215,12 +217,12 @@ grpc_mdstr_hash_table* grpc_service_config_create_method_config_table(
}
}
// Instantiate method config table.
- grpc_mdstr_hash_table* method_config_table = NULL;
+ grpc_slice_hash_table* method_config_table = NULL;
if (entries != NULL) {
- method_config_table = grpc_mdstr_hash_table_create(num_entries, entries);
+ method_config_table = grpc_slice_hash_table_create(num_entries, entries);
// Clean up.
for (size_t i = 0; i < num_entries; ++i) {
- GRPC_MDSTR_UNREF(exec_ctx, entries[i].key);
+ grpc_slice_unref_internal(exec_ctx, entries[i].key);
vtable->destroy_value(exec_ctx, entries[i].value);
}
gpr_free(entries);
@@ -229,23 +231,24 @@ grpc_mdstr_hash_table* grpc_service_config_create_method_config_table(
}
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,
+ 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) {
- const char* path_str = grpc_mdstr_as_c_string(path);
+ char* path_str = grpc_dump_slice(path, GPR_DUMP_ASCII);
const char* sep = strrchr(path_str, '/') + 1;
const size_t len = (size_t)(sep - path_str);
char* buf = gpr_malloc(len + 2); // '*' and NUL
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_slice_from_copied_string(buf);
gpr_free(buf);
- value = grpc_mdstr_hash_table_get(table, wildcard_path);
- GRPC_MDSTR_UNREF(exec_ctx, wildcard_path);
+ value = grpc_slice_hash_table_get(table, wildcard_path);
+ grpc_slice_unref_internal(exec_ctx, wildcard_path);
+ gpr_free(path_str);
}
return value;
}
diff --git a/src/core/lib/transport/service_config.h b/src/core/lib/transport/service_config.h
index f0897170fa..ab964b3bae 100644
--- a/src/core/lib/transport/service_config.h
+++ b/src/core/lib/transport/service_config.h
@@ -35,7 +35,7 @@
#include <grpc/impl/codegen/grpc_types.h>
#include "src/core/lib/json/json.h"
-#include "src/core/lib/transport/mdstr_hash_table.h"
+#include "src/core/lib/slice/slice_hash_table.h"
typedef struct grpc_service_config grpc_service_config;
@@ -53,10 +53,10 @@ const char* grpc_service_config_get_lb_policy_name(
/// returned by \a create_value(), based on data parsed from the JSON tree.
/// \a vtable provides methods used to manage the values.
/// Returns NULL on error.
-grpc_mdstr_hash_table* grpc_service_config_create_method_config_table(
+grpc_slice_hash_table* grpc_service_config_create_method_config_table(
grpc_exec_ctx* exec_ctx, const grpc_service_config* service_config,
void* (*create_value)(const grpc_json* method_config_json),
- const grpc_mdstr_hash_table_vtable* vtable);
+ const grpc_slice_hash_table_vtable* vtable);
/// A helper function for looking up values in the table returned by
/// \a grpc_service_config_create_method_config_table().
@@ -65,7 +65,7 @@ grpc_mdstr_hash_table* grpc_service_config_create_method_config_table(
/// Returns NULL if the method has no config.
/// Caller does NOT own a reference to the result.
void* grpc_method_config_table_get(grpc_exec_ctx* exec_ctx,
- const grpc_mdstr_hash_table* table,
- const grpc_mdstr* path);
+ const grpc_slice_hash_table* table,
+ const grpc_slice path);
#endif /* GRPC_CORE_LIB_TRANSPORT_SERVICE_CONFIG_H */
diff --git a/src/core/lib/transport/static_metadata.c b/src/core/lib/transport/static_metadata.c
index 8b22592b45..42daabfd89 100644
--- a/src/core/lib/transport/static_metadata.c
+++ b/src/core/lib/transport/static_metadata.c
@@ -41,120 +41,753 @@
#include "src/core/lib/transport/static_metadata.h"
-grpc_mdstr grpc_static_mdstr_table[GRPC_STATIC_MDSTR_COUNT];
+#include "src/core/lib/slice/slice_internal.h"
+
+static uint8_t g_raw_bytes[] = {
+ 48, 49, 50, 50, 48, 48, 50, 48, 52, 50, 48, 54, 51, 48, 52,
+ 52, 48, 48, 52, 48, 52, 53, 48, 48, 97, 99, 99, 101, 112, 116,
+ 97, 99, 99, 101, 112, 116, 45, 99, 104, 97, 114, 115, 101, 116, 97,
+ 99, 99, 101, 112, 116, 45, 101, 110, 99, 111, 100, 105, 110, 103, 97,
+ 99, 99, 101, 112, 116, 45, 108, 97, 110, 103, 117, 97, 103, 101, 97,
+ 99, 99, 101, 112, 116, 45, 114, 97, 110, 103, 101, 115, 97, 99, 99,
+ 101, 115, 115, 45, 99, 111, 110, 116, 114, 111, 108, 45, 97, 108, 108,
+ 111, 119, 45, 111, 114, 105, 103, 105, 110, 97, 103, 101, 97, 108, 108,
+ 111, 119, 97, 112, 112, 108, 105, 99, 97, 116, 105, 111, 110, 47, 103,
+ 114, 112, 99, 58, 97, 117, 116, 104, 111, 114, 105, 116, 121, 97, 117,
+ 116, 104, 111, 114, 105, 122, 97, 116, 105, 111, 110, 99, 97, 99, 104,
+ 101, 45, 99, 111, 110, 116, 114, 111, 108, 99, 111, 110, 116, 101, 110,
+ 116, 45, 100, 105, 115, 112, 111, 115, 105, 116, 105, 111, 110, 99, 111,
+ 110, 116, 101, 110, 116, 45, 101, 110, 99, 111, 100, 105, 110, 103, 99,
+ 111, 110, 116, 101, 110, 116, 45, 108, 97, 110, 103, 117, 97, 103, 101,
+ 99, 111, 110, 116, 101, 110, 116, 45, 108, 101, 110, 103, 116, 104, 99,
+ 111, 110, 116, 101, 110, 116, 45, 108, 111, 99, 97, 116, 105, 111, 110,
+ 99, 111, 110, 116, 101, 110, 116, 45, 114, 97, 110, 103, 101, 99, 111,
+ 110, 116, 101, 110, 116, 45, 116, 121, 112, 101, 99, 111, 111, 107, 105,
+ 101, 100, 97, 116, 101, 100, 101, 102, 108, 97, 116, 101, 100, 101, 102,
+ 108, 97, 116, 101, 44, 103, 122, 105, 112, 101, 116, 97, 103, 101, 120,
+ 112, 101, 99, 116, 101, 120, 112, 105, 114, 101, 115, 102, 114, 111, 109,
+ 71, 69, 84, 103, 114, 112, 99, 103, 114, 112, 99, 45, 97, 99, 99,
+ 101, 112, 116, 45, 101, 110, 99, 111, 100, 105, 110, 103, 103, 114, 112,
+ 99, 46, 109, 97, 120, 95, 114, 101, 113, 117, 101, 115, 116, 95, 109,
+ 101, 115, 115, 97, 103, 101, 95, 98, 121, 116, 101, 115, 103, 114, 112,
+ 99, 46, 109, 97, 120, 95, 114, 101, 115, 112, 111, 110, 115, 101, 95,
+ 109, 101, 115, 115, 97, 103, 101, 95, 98, 121, 116, 101, 115, 103, 114,
+ 112, 99, 46, 116, 105, 109, 101, 111, 117, 116, 103, 114, 112, 99, 46,
+ 119, 97, 105, 116, 95, 102, 111, 114, 95, 114, 101, 97, 100, 121, 103,
+ 114, 112, 99, 45, 101, 110, 99, 111, 100, 105, 110, 103, 103, 114, 112,
+ 99, 45, 105, 110, 116, 101, 114, 110, 97, 108, 45, 101, 110, 99, 111,
+ 100, 105, 110, 103, 45, 114, 101, 113, 117, 101, 115, 116, 103, 114, 112,
+ 99, 45, 109, 101, 115, 115, 97, 103, 101, 103, 114, 112, 99, 45, 112,
+ 97, 121, 108, 111, 97, 100, 45, 98, 105, 110, 103, 114, 112, 99, 45,
+ 115, 116, 97, 116, 115, 45, 98, 105, 110, 103, 114, 112, 99, 45, 115,
+ 116, 97, 116, 117, 115, 103, 114, 112, 99, 45, 116, 105, 109, 101, 111,
+ 117, 116, 103, 114, 112, 99, 45, 116, 114, 97, 99, 105, 110, 103, 45,
+ 98, 105, 110, 103, 122, 105, 112, 103, 122, 105, 112, 44, 32, 100, 101,
+ 102, 108, 97, 116, 101, 104, 111, 115, 116, 104, 116, 116, 112, 104, 116,
+ 116, 112, 115, 105, 100, 101, 110, 116, 105, 116, 121, 105, 100, 101, 110,
+ 116, 105, 116, 121, 44, 100, 101, 102, 108, 97, 116, 101, 105, 100, 101,
+ 110, 116, 105, 116, 121, 44, 100, 101, 102, 108, 97, 116, 101, 44, 103,
+ 122, 105, 112, 105, 100, 101, 110, 116, 105, 116, 121, 44, 103, 122, 105,
+ 112, 105, 102, 45, 109, 97, 116, 99, 104, 105, 102, 45, 109, 111, 100,
+ 105, 102, 105, 101, 100, 45, 115, 105, 110, 99, 101, 105, 102, 45, 110,
+ 111, 110, 101, 45, 109, 97, 116, 99, 104, 105, 102, 45, 114, 97, 110,
+ 103, 101, 105, 102, 45, 117, 110, 109, 111, 100, 105, 102, 105, 101, 100,
+ 45, 115, 105, 110, 99, 101, 108, 97, 115, 116, 45, 109, 111, 100, 105,
+ 102, 105, 101, 100, 108, 98, 45, 99, 111, 115, 116, 45, 98, 105, 110,
+ 108, 98, 45, 116, 111, 107, 101, 110, 108, 105, 110, 107, 108, 111, 99,
+ 97, 116, 105, 111, 110, 109, 97, 120, 45, 102, 111, 114, 119, 97, 114,
+ 100, 115, 58, 109, 101, 116, 104, 111, 100, 58, 112, 97, 116, 104, 80,
+ 79, 83, 84, 112, 114, 111, 120, 121, 45, 97, 117, 116, 104, 101, 110,
+ 116, 105, 99, 97, 116, 101, 112, 114, 111, 120, 121, 45, 97, 117, 116,
+ 104, 111, 114, 105, 122, 97, 116, 105, 111, 110, 80, 85, 84, 114, 97,
+ 110, 103, 101, 114, 101, 102, 101, 114, 101, 114, 114, 101, 102, 114, 101,
+ 115, 104, 114, 101, 116, 114, 121, 45, 97, 102, 116, 101, 114, 58, 115,
+ 99, 104, 101, 109, 101, 115, 101, 114, 118, 101, 114, 115, 101, 116, 45,
+ 99, 111, 111, 107, 105, 101, 47, 47, 103, 114, 112, 99, 46, 108, 98,
+ 46, 118, 49, 46, 76, 111, 97, 100, 66, 97, 108, 97, 110, 99, 101,
+ 114, 47, 66, 97, 108, 97, 110, 99, 101, 76, 111, 97, 100, 47, 105,
+ 110, 100, 101, 120, 46, 104, 116, 109, 108, 58, 115, 116, 97, 116, 117,
+ 115, 115, 116, 114, 105, 99, 116, 45, 116, 114, 97, 110, 115, 112, 111,
+ 114, 116, 45, 115, 101, 99, 117, 114, 105, 116, 121, 116, 101, 116, 114,
+ 97, 105, 108, 101, 114, 115, 116, 114, 97, 110, 115, 102, 101, 114, 45,
+ 101, 110, 99, 111, 100, 105, 110, 103, 117, 115, 101, 114, 45, 97, 103,
+ 101, 110, 116, 118, 97, 114, 121, 118, 105, 97, 119, 119, 119, 45, 97,
+ 117, 116, 104, 101, 110, 116, 105, 99, 97, 116, 101};
+
+static void static_ref(void *unused) {}
+static void static_unref(grpc_exec_ctx *exec_ctx, void *unused) {}
+static const grpc_slice_refcount_vtable static_vtable = {
+ static_ref, static_unref, grpc_static_slice_hash};
+static grpc_slice_refcount g_refcnt = {&static_vtable};
+
+bool grpc_is_static_metadata_string(grpc_slice slice) {
+ return slice.refcount != NULL && slice.refcount->vtable == &static_vtable;
+}
+
+const grpc_slice grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT] = {
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 0, .length = 1}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 1, .length = 1}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 2, .length = 1}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 3, .length = 3}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 6, .length = 3}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 9, .length = 3}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 12, .length = 3}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 15, .length = 3}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 18, .length = 3}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 21, .length = 3}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 24, .length = 6}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 30, .length = 14}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 44, .length = 15}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 59, .length = 15}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 74, .length = 13}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 87, .length = 27}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 114, .length = 3}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 117, .length = 5}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 122, .length = 16}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 138, .length = 10}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 148, .length = 13}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 161, .length = 13}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 174, .length = 19}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 193, .length = 16}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 209, .length = 16}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 225, .length = 14}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 239, .length = 16}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 255, .length = 13}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 268, .length = 12}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 280, .length = 6}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 286, .length = 4}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 290, .length = 7}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 297, .length = 12}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 4}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 313, .length = 6}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 319, .length = 7}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 326, .length = 4}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 330, .length = 3}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 333, .length = 4}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 337, .length = 20}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 357, .length = 30}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 387, .length = 31}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 418, .length = 12}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 430, .length = 19}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 449, .length = 13}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 462, .length = 30}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 492, .length = 12}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 504, .length = 16}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 520, .length = 14}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 534, .length = 11}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 545, .length = 12}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 557, .length = 16}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 573, .length = 4}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 577, .length = 13}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 590, .length = 4}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 594, .length = 4}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 598, .length = 5}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 603, .length = 8}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 611, .length = 16}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 627, .length = 21}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 648, .length = 13}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 661, .length = 8}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 669, .length = 17}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 686, .length = 13}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 699, .length = 8}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 707, .length = 19}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 726, .length = 13}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 739, .length = 11}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 750, .length = 8}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 758, .length = 4}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 762, .length = 8}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 770, .length = 12}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 782, .length = 7}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 789, .length = 5}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 794, .length = 4}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 798, .length = 18}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 816, .length = 19}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 835, .length = 3}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 838, .length = 5}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 843, .length = 7}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 850, .length = 7}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 857, .length = 11}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 868, .length = 7}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 875, .length = 6}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 881, .length = 10}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 891, .length = 1}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 892, .length = 36}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 928, .length = 11}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 939, .length = 7}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 946, .length = 25}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 971, .length = 2}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 973, .length = 8}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 981, .length = 17}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 998, .length = 10}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 1008, .length = 4}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 1012, .length = 3}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 1015, .length = 16}},
+};
+
+static const uint8_t g_revmap[] = {
+ 0, 1, 2, 3, 255, 255, 4, 255, 255, 5, 255, 255, 6, 255, 255,
+ 7, 255, 255, 8, 255, 255, 9, 255, 255, 10, 255, 255, 255, 255, 255,
+ 11, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 12,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 13,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 14,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 15, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 16, 255, 255, 17, 255, 255,
+ 255, 255, 18, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 19, 255, 255, 255, 255, 255, 255, 255, 255, 255, 20, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 21, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 22, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 23, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 24,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 25, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 26,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 27, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 28, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 29, 255, 255, 255, 255,
+ 255, 30, 255, 255, 255, 31, 255, 255, 255, 255, 255, 255, 32, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 34, 255, 255, 255, 35, 255,
+ 255, 255, 255, 255, 36, 255, 255, 255, 255, 255, 255, 37, 255, 255, 255,
+ 38, 255, 255, 39, 255, 255, 255, 40, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 41, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 42, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 43, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 44, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 45,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 46, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 47, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 48, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 49, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 50, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 51, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 52, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 53, 255, 255, 255, 54, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 55, 255, 255, 255, 56, 255, 255, 255, 57, 255,
+ 255, 255, 255, 58, 255, 255, 255, 255, 255, 255, 255, 59, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 60, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 61, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 62, 255, 255, 255, 255, 255, 255, 255, 63, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 64, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 65, 255, 255, 255, 255, 255,
+ 255, 255, 66, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 67, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 68, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 69, 255, 255, 255, 255, 255, 255, 255, 70, 255, 255, 255, 71, 255, 255,
+ 255, 255, 255, 255, 255, 72, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 73, 255, 255, 255, 255, 255, 255, 74, 255, 255, 255, 255, 75,
+ 255, 255, 255, 76, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 77, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 78, 255, 255, 79, 255,
+ 255, 255, 255, 80, 255, 255, 255, 255, 255, 255, 81, 255, 255, 255, 255,
+ 255, 255, 82, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 83, 255,
+ 255, 255, 255, 255, 255, 84, 255, 255, 255, 255, 255, 85, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 86, 87, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 88, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 89, 255, 255, 255, 255, 255,
+ 255, 90, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 91, 255, 92, 255,
+ 255, 255, 255, 255, 255, 255, 93, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 94, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 95, 255, 255, 255, 96, 255, 255, 97, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255};
+
+int grpc_static_metadata_index(grpc_slice slice) {
+ if (GRPC_SLICE_LENGTH(slice) == 0) return 33;
+ if (slice.refcount != &g_refcnt) return -1;
+ size_t ofs = (size_t)(slice.data.refcounted.bytes - g_raw_bytes);
+ if (ofs > sizeof(g_revmap)) return -1;
+ uint8_t id = g_revmap[ofs];
+ return id == 255 ? -1 : (grpc_static_slice_table[id].data.refcounted.length ==
+ slice.data.refcounted.length
+ ? id
+ : -1);
+}
-grpc_mdelem grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT];
uintptr_t grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 4, 8, 6, 2, 4, 8, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
-const uint8_t grpc_static_metadata_elem_indices[GRPC_STATIC_MDELEM_COUNT * 2] =
- {11, 33, 10, 33, 12, 33, 12, 50, 13, 33, 14, 33, 15, 33, 16, 33, 17, 33,
- 19, 33, 20, 33, 21, 33, 22, 33, 23, 33, 24, 33, 25, 33, 26, 33, 27, 33,
- 28, 18, 28, 33, 29, 33, 30, 33, 34, 33, 35, 33, 36, 33, 37, 33, 40, 31,
- 40, 32, 40, 49, 40, 54, 40, 55, 40, 56, 40, 57, 41, 31, 41, 49, 41, 54,
- 46, 0, 46, 1, 46, 2, 51, 33, 58, 33, 59, 33, 60, 33, 61, 33, 62, 33,
- 63, 33, 64, 33, 65, 33, 66, 33, 67, 33, 68, 33, 69, 38, 69, 71, 69, 74,
- 70, 82, 70, 83, 72, 33, 73, 33, 75, 33, 76, 33, 77, 33, 78, 33, 79, 39,
- 79, 52, 79, 53, 80, 33, 81, 33, 84, 3, 84, 4, 84, 5, 84, 6, 84, 7,
- 84, 8, 84, 9, 85, 33, 86, 87, 88, 33, 89, 33, 90, 33, 91, 33, 92, 33};
-
-const char *const grpc_static_metadata_strings[GRPC_STATIC_MDSTR_COUNT] = {
- "0",
- "1",
- "2",
- "200",
- "204",
- "206",
- "304",
- "400",
- "404",
- "500",
- "accept",
- "accept-charset",
- "accept-encoding",
- "accept-language",
- "accept-ranges",
- "access-control-allow-origin",
- "age",
- "allow",
- "application/grpc",
- ":authority",
- "authorization",
- "cache-control",
- "content-disposition",
- "content-encoding",
- "content-language",
- "content-length",
- "content-location",
- "content-range",
- "content-type",
- "cookie",
- "date",
- "deflate",
- "deflate,gzip",
- "",
- "etag",
- "expect",
- "expires",
- "from",
- "GET",
- "grpc",
- "grpc-accept-encoding",
- "grpc-encoding",
- "grpc-internal-encoding-request",
- "grpc-message",
- "grpc-payload-bin",
- "grpc-stats-bin",
- "grpc-status",
- "grpc-timeout",
- "grpc-tracing-bin",
- "gzip",
- "gzip, deflate",
- "host",
- "http",
- "https",
- "identity",
- "identity,deflate",
- "identity,deflate,gzip",
- "identity,gzip",
- "if-match",
- "if-modified-since",
- "if-none-match",
- "if-range",
- "if-unmodified-since",
- "last-modified",
- "lb-cost-bin",
- "lb-token",
- "link",
- "location",
- "max-forwards",
- ":method",
- ":path",
- "POST",
- "proxy-authenticate",
- "proxy-authorization",
- "PUT",
- "range",
- "referer",
- "refresh",
- "retry-after",
- ":scheme",
- "server",
- "set-cookie",
- "/",
- "/index.html",
- ":status",
- "strict-transport-security",
- "te",
- "trailers",
- "transfer-encoding",
- "user-agent",
- "vary",
- "via",
- "www-authenticate"};
+#define ELEMS_PHASHLEN 0x40
+#define ELEMS_PHASHNKEYS 81
+#define ELEMS_PHASHRANGE 128
+#define ELEMS_PHASHSALT 0x9e3779b9
+
+static const uint8_t elems_tab[] = {
+ 0, 17, 61, 28, 4, 12, 47, 0, 0, 0, 61, 0, 47, 0, 61, 76,
+ 61, 70, 76, 0, 0, 10, 4, 60, 0, 0, 0, 16, 88, 47, 1, 76,
+ 76, 0, 76, 0, 61, 0, 23, 0, 0, 51, 1, 92, 32, 0, 25, 0,
+ 34, 0, 37, 0, 76, 76, 32, 38, 70, 79, 81, 0, 64, 0, 0, 0,
+};
+
+static uint32_t elems_phash(uint32_t val) {
+ val -= 917;
+
+ uint32_t a, b, rsl;
+
+ b = (val & 0x3f);
+ a = ((val << 18) >> 26);
+ rsl = (a ^ elems_tab[b]);
+ return rsl;
+}
+
+static const uint16_t elem_keys[] = {
+ 2091, 1405, 8728, 2777, 7192, 2287, 2581, 2483, 2973, 4441, 3561, 3951,
+ 6403, 4463, 9441, 8726, 2875, 5423, 8730, 7338, 6109, 6207, 6697, 6893,
+ 7229, 8363, 8729, 3952, 8173, 8191, 8725, 8853, 9245, 9343, 1601, 8727,
+ 7481, 7340, 7971, 7775, 6501, 3973, 3659, 3979, 3463, 3980, 1307, 8190,
+ 9010, 8731, 4901, 6599, 3365, 7579, 6795, 9147, 9539, 8069, 6305, 7873,
+ 1209, 1111, 1699, 1503, 7089, 4468, 2189, 4900, 7232, 2385, 6991, 3978,
+ 1993, 4902, 2679, 2762, 1013, 3981, 1230, 1895, 8265, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0};
+static const uint8_t elem_idxs[] = {
+ 11, 5, 70, 19, 51, 13, 16, 15, 21, 33, 24, 26, 43, 34, 79, 68, 20,
+ 39, 72, 54, 40, 41, 46, 48, 52, 66, 71, 27, 62, 64, 67, 74, 77, 78,
+ 7, 69, 56, 55, 60, 58, 44, 28, 25, 30, 23, 31, 4, 63, 75, 73, 37,
+ 45, 22, 57, 47, 76, 80, 61, 42, 59, 2, 0, 8, 6, 50, 35, 12, 36,
+ 53, 14, 49, 29, 10, 38, 17, 18, 1, 32, 3, 9, 65};
+
+grpc_mdelem grpc_static_mdelem_for_static_strings(int a, int b) {
+ if (a == -1 || b == -1) return GRPC_MDNULL;
+ uint32_t k = (uint32_t)(a * 98 + b);
+ uint32_t h = elems_phash(k);
+ return elem_keys[h] == k
+ ? (grpc_mdelem){&grpc_static_mdelem_table[elem_idxs[h]]}
+ : GRPC_MDNULL;
+}
+grpc_mdelem_data grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT] = {
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 30, .length = 14}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 24, .length = 6}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 44, .length = 15}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 44, .length = 15}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 577, .length = 13}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 59, .length = 15}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 74, .length = 13}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 87, .length = 27}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 114, .length = 3}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 117, .length = 5}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 138, .length = 10}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 148, .length = 13}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 161, .length = 13}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 174, .length = 19}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 193, .length = 16}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 209, .length = 16}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 225, .length = 14}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 239, .length = 16}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 255, .length = 13}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 268, .length = 12}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 122, .length = 16}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 268, .length = 12}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 280, .length = 6}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 286, .length = 4}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 4}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 313, .length = 6}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 319, .length = 7}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 326, .length = 4}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 337, .length = 20}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 290, .length = 7}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 337, .length = 20}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 297, .length = 12}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 337, .length = 20}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 573, .length = 4}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 337, .length = 20}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 603, .length = 8}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 337, .length = 20}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 611, .length = 16}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 337, .length = 20}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 627, .length = 21}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 337, .length = 20}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 648, .length = 13}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 449, .length = 13}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 290, .length = 7}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 449, .length = 13}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 573, .length = 4}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 449, .length = 13}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 603, .length = 8}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 534, .length = 11}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 0, .length = 1}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 534, .length = 11}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 1, .length = 1}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 534, .length = 11}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 2, .length = 1}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 590, .length = 4}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 661, .length = 8}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 669, .length = 17}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 686, .length = 13}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 699, .length = 8}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 707, .length = 19}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 726, .length = 13}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 739, .length = 11}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 750, .length = 8}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 758, .length = 4}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 762, .length = 8}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 770, .length = 12}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 782, .length = 7}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 330, .length = 3}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 782, .length = 7}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 794, .length = 4}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 782, .length = 7}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 835, .length = 3}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 789, .length = 5}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 891, .length = 1}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 789, .length = 5}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 928, .length = 11}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 798, .length = 18}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 816, .length = 19}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 838, .length = 5}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 843, .length = 7}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 850, .length = 7}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 857, .length = 11}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 868, .length = 7}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 333, .length = 4}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 868, .length = 7}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 594, .length = 4}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 868, .length = 7}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 598, .length = 5}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 875, .length = 6}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 881, .length = 10}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 939, .length = 7}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 3, .length = 3}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 939, .length = 7}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 6, .length = 3}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 939, .length = 7}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 9, .length = 3}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 939, .length = 7}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 12, .length = 3}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 939, .length = 7}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 15, .length = 3}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 939, .length = 7}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 18, .length = 3}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 939, .length = 7}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 21, .length = 3}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 946, .length = 25}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 971, .length = 2}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 973, .length = 8}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 981, .length = 17}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 998, .length = 10}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 1008, .length = 4}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 1012, .length = 3}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
+ {{.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 1015, .length = 16}},
+ {.refcount = &g_refcnt,
+ .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
+};
const uint8_t grpc_static_accept_encoding_metadata[8] = {0, 29, 26, 30,
28, 32, 27, 31};
diff --git a/src/core/lib/transport/static_metadata.h b/src/core/lib/transport/static_metadata.h
index 28ad6f2961..f5ef5d6dd7 100644
--- a/src/core/lib/transport/static_metadata.h
+++ b/src/core/lib/transport/static_metadata.h
@@ -44,375 +44,427 @@
#include "src/core/lib/transport/metadata.h"
-#define GRPC_STATIC_MDSTR_COUNT 93
-extern grpc_mdstr grpc_static_mdstr_table[GRPC_STATIC_MDSTR_COUNT];
+#define GRPC_STATIC_MDSTR_COUNT 98
+extern const grpc_slice grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT];
/* "0" */
-#define GRPC_MDSTR_0 (&grpc_static_mdstr_table[0])
+#define GRPC_MDSTR_0 (grpc_static_slice_table[0])
/* "1" */
-#define GRPC_MDSTR_1 (&grpc_static_mdstr_table[1])
+#define GRPC_MDSTR_1 (grpc_static_slice_table[1])
/* "2" */
-#define GRPC_MDSTR_2 (&grpc_static_mdstr_table[2])
+#define GRPC_MDSTR_2 (grpc_static_slice_table[2])
/* "200" */
-#define GRPC_MDSTR_200 (&grpc_static_mdstr_table[3])
+#define GRPC_MDSTR_200 (grpc_static_slice_table[3])
/* "204" */
-#define GRPC_MDSTR_204 (&grpc_static_mdstr_table[4])
+#define GRPC_MDSTR_204 (grpc_static_slice_table[4])
/* "206" */
-#define GRPC_MDSTR_206 (&grpc_static_mdstr_table[5])
+#define GRPC_MDSTR_206 (grpc_static_slice_table[5])
/* "304" */
-#define GRPC_MDSTR_304 (&grpc_static_mdstr_table[6])
+#define GRPC_MDSTR_304 (grpc_static_slice_table[6])
/* "400" */
-#define GRPC_MDSTR_400 (&grpc_static_mdstr_table[7])
+#define GRPC_MDSTR_400 (grpc_static_slice_table[7])
/* "404" */
-#define GRPC_MDSTR_404 (&grpc_static_mdstr_table[8])
+#define GRPC_MDSTR_404 (grpc_static_slice_table[8])
/* "500" */
-#define GRPC_MDSTR_500 (&grpc_static_mdstr_table[9])
+#define GRPC_MDSTR_500 (grpc_static_slice_table[9])
/* "accept" */
-#define GRPC_MDSTR_ACCEPT (&grpc_static_mdstr_table[10])
+#define GRPC_MDSTR_ACCEPT (grpc_static_slice_table[10])
/* "accept-charset" */
-#define GRPC_MDSTR_ACCEPT_CHARSET (&grpc_static_mdstr_table[11])
+#define GRPC_MDSTR_ACCEPT_CHARSET (grpc_static_slice_table[11])
/* "accept-encoding" */
-#define GRPC_MDSTR_ACCEPT_ENCODING (&grpc_static_mdstr_table[12])
+#define GRPC_MDSTR_ACCEPT_ENCODING (grpc_static_slice_table[12])
/* "accept-language" */
-#define GRPC_MDSTR_ACCEPT_LANGUAGE (&grpc_static_mdstr_table[13])
+#define GRPC_MDSTR_ACCEPT_LANGUAGE (grpc_static_slice_table[13])
/* "accept-ranges" */
-#define GRPC_MDSTR_ACCEPT_RANGES (&grpc_static_mdstr_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_mdstr_table[15])
+#define GRPC_MDSTR_ACCESS_CONTROL_ALLOW_ORIGIN (grpc_static_slice_table[15])
/* "age" */
-#define GRPC_MDSTR_AGE (&grpc_static_mdstr_table[16])
+#define GRPC_MDSTR_AGE (grpc_static_slice_table[16])
/* "allow" */
-#define GRPC_MDSTR_ALLOW (&grpc_static_mdstr_table[17])
+#define GRPC_MDSTR_ALLOW (grpc_static_slice_table[17])
/* "application/grpc" */
-#define GRPC_MDSTR_APPLICATION_SLASH_GRPC (&grpc_static_mdstr_table[18])
+#define GRPC_MDSTR_APPLICATION_SLASH_GRPC (grpc_static_slice_table[18])
/* ":authority" */
-#define GRPC_MDSTR_AUTHORITY (&grpc_static_mdstr_table[19])
+#define GRPC_MDSTR_AUTHORITY (grpc_static_slice_table[19])
/* "authorization" */
-#define GRPC_MDSTR_AUTHORIZATION (&grpc_static_mdstr_table[20])
+#define GRPC_MDSTR_AUTHORIZATION (grpc_static_slice_table[20])
/* "cache-control" */
-#define GRPC_MDSTR_CACHE_CONTROL (&grpc_static_mdstr_table[21])
+#define GRPC_MDSTR_CACHE_CONTROL (grpc_static_slice_table[21])
/* "content-disposition" */
-#define GRPC_MDSTR_CONTENT_DISPOSITION (&grpc_static_mdstr_table[22])
+#define GRPC_MDSTR_CONTENT_DISPOSITION (grpc_static_slice_table[22])
/* "content-encoding" */
-#define GRPC_MDSTR_CONTENT_ENCODING (&grpc_static_mdstr_table[23])
+#define GRPC_MDSTR_CONTENT_ENCODING (grpc_static_slice_table[23])
/* "content-language" */
-#define GRPC_MDSTR_CONTENT_LANGUAGE (&grpc_static_mdstr_table[24])
+#define GRPC_MDSTR_CONTENT_LANGUAGE (grpc_static_slice_table[24])
/* "content-length" */
-#define GRPC_MDSTR_CONTENT_LENGTH (&grpc_static_mdstr_table[25])
+#define GRPC_MDSTR_CONTENT_LENGTH (grpc_static_slice_table[25])
/* "content-location" */
-#define GRPC_MDSTR_CONTENT_LOCATION (&grpc_static_mdstr_table[26])
+#define GRPC_MDSTR_CONTENT_LOCATION (grpc_static_slice_table[26])
/* "content-range" */
-#define GRPC_MDSTR_CONTENT_RANGE (&grpc_static_mdstr_table[27])
+#define GRPC_MDSTR_CONTENT_RANGE (grpc_static_slice_table[27])
/* "content-type" */
-#define GRPC_MDSTR_CONTENT_TYPE (&grpc_static_mdstr_table[28])
+#define GRPC_MDSTR_CONTENT_TYPE (grpc_static_slice_table[28])
/* "cookie" */
-#define GRPC_MDSTR_COOKIE (&grpc_static_mdstr_table[29])
+#define GRPC_MDSTR_COOKIE (grpc_static_slice_table[29])
/* "date" */
-#define GRPC_MDSTR_DATE (&grpc_static_mdstr_table[30])
+#define GRPC_MDSTR_DATE (grpc_static_slice_table[30])
/* "deflate" */
-#define GRPC_MDSTR_DEFLATE (&grpc_static_mdstr_table[31])
+#define GRPC_MDSTR_DEFLATE (grpc_static_slice_table[31])
/* "deflate,gzip" */
-#define GRPC_MDSTR_DEFLATE_COMMA_GZIP (&grpc_static_mdstr_table[32])
+#define GRPC_MDSTR_DEFLATE_COMMA_GZIP (grpc_static_slice_table[32])
/* "" */
-#define GRPC_MDSTR_EMPTY (&grpc_static_mdstr_table[33])
+#define GRPC_MDSTR_EMPTY (grpc_static_slice_table[33])
/* "etag" */
-#define GRPC_MDSTR_ETAG (&grpc_static_mdstr_table[34])
+#define GRPC_MDSTR_ETAG (grpc_static_slice_table[34])
/* "expect" */
-#define GRPC_MDSTR_EXPECT (&grpc_static_mdstr_table[35])
+#define GRPC_MDSTR_EXPECT (grpc_static_slice_table[35])
/* "expires" */
-#define GRPC_MDSTR_EXPIRES (&grpc_static_mdstr_table[36])
+#define GRPC_MDSTR_EXPIRES (grpc_static_slice_table[36])
/* "from" */
-#define GRPC_MDSTR_FROM (&grpc_static_mdstr_table[37])
+#define GRPC_MDSTR_FROM (grpc_static_slice_table[37])
/* "GET" */
-#define GRPC_MDSTR_GET (&grpc_static_mdstr_table[38])
+#define GRPC_MDSTR_GET (grpc_static_slice_table[38])
/* "grpc" */
-#define GRPC_MDSTR_GRPC (&grpc_static_mdstr_table[39])
+#define GRPC_MDSTR_GRPC (grpc_static_slice_table[39])
/* "grpc-accept-encoding" */
-#define GRPC_MDSTR_GRPC_ACCEPT_ENCODING (&grpc_static_mdstr_table[40])
+#define GRPC_MDSTR_GRPC_ACCEPT_ENCODING (grpc_static_slice_table[40])
+/* "grpc.max_request_message_bytes" */
+#define GRPC_MDSTR_GRPC_DOT_MAX_REQUEST_MESSAGE_BYTES \
+ (grpc_static_slice_table[41])
+/* "grpc.max_response_message_bytes" */
+#define GRPC_MDSTR_GRPC_DOT_MAX_RESPONSE_MESSAGE_BYTES \
+ (grpc_static_slice_table[42])
+/* "grpc.timeout" */
+#define GRPC_MDSTR_GRPC_DOT_TIMEOUT (grpc_static_slice_table[43])
+/* "grpc.wait_for_ready" */
+#define GRPC_MDSTR_GRPC_DOT_WAIT_FOR_READY (grpc_static_slice_table[44])
/* "grpc-encoding" */
-#define GRPC_MDSTR_GRPC_ENCODING (&grpc_static_mdstr_table[41])
+#define GRPC_MDSTR_GRPC_ENCODING (grpc_static_slice_table[45])
/* "grpc-internal-encoding-request" */
-#define GRPC_MDSTR_GRPC_INTERNAL_ENCODING_REQUEST (&grpc_static_mdstr_table[42])
+#define GRPC_MDSTR_GRPC_INTERNAL_ENCODING_REQUEST (grpc_static_slice_table[46])
/* "grpc-message" */
-#define GRPC_MDSTR_GRPC_MESSAGE (&grpc_static_mdstr_table[43])
+#define GRPC_MDSTR_GRPC_MESSAGE (grpc_static_slice_table[47])
/* "grpc-payload-bin" */
-#define GRPC_MDSTR_GRPC_PAYLOAD_BIN (&grpc_static_mdstr_table[44])
+#define GRPC_MDSTR_GRPC_PAYLOAD_BIN (grpc_static_slice_table[48])
/* "grpc-stats-bin" */
-#define GRPC_MDSTR_GRPC_STATS_BIN (&grpc_static_mdstr_table[45])
+#define GRPC_MDSTR_GRPC_STATS_BIN (grpc_static_slice_table[49])
/* "grpc-status" */
-#define GRPC_MDSTR_GRPC_STATUS (&grpc_static_mdstr_table[46])
+#define GRPC_MDSTR_GRPC_STATUS (grpc_static_slice_table[50])
/* "grpc-timeout" */
-#define GRPC_MDSTR_GRPC_TIMEOUT (&grpc_static_mdstr_table[47])
+#define GRPC_MDSTR_GRPC_TIMEOUT (grpc_static_slice_table[51])
/* "grpc-tracing-bin" */
-#define GRPC_MDSTR_GRPC_TRACING_BIN (&grpc_static_mdstr_table[48])
+#define GRPC_MDSTR_GRPC_TRACING_BIN (grpc_static_slice_table[52])
/* "gzip" */
-#define GRPC_MDSTR_GZIP (&grpc_static_mdstr_table[49])
+#define GRPC_MDSTR_GZIP (grpc_static_slice_table[53])
/* "gzip, deflate" */
-#define GRPC_MDSTR_GZIP_COMMA_DEFLATE (&grpc_static_mdstr_table[50])
+#define GRPC_MDSTR_GZIP_COMMA_DEFLATE (grpc_static_slice_table[54])
/* "host" */
-#define GRPC_MDSTR_HOST (&grpc_static_mdstr_table[51])
+#define GRPC_MDSTR_HOST (grpc_static_slice_table[55])
/* "http" */
-#define GRPC_MDSTR_HTTP (&grpc_static_mdstr_table[52])
+#define GRPC_MDSTR_HTTP (grpc_static_slice_table[56])
/* "https" */
-#define GRPC_MDSTR_HTTPS (&grpc_static_mdstr_table[53])
+#define GRPC_MDSTR_HTTPS (grpc_static_slice_table[57])
/* "identity" */
-#define GRPC_MDSTR_IDENTITY (&grpc_static_mdstr_table[54])
+#define GRPC_MDSTR_IDENTITY (grpc_static_slice_table[58])
/* "identity,deflate" */
-#define GRPC_MDSTR_IDENTITY_COMMA_DEFLATE (&grpc_static_mdstr_table[55])
+#define GRPC_MDSTR_IDENTITY_COMMA_DEFLATE (grpc_static_slice_table[59])
/* "identity,deflate,gzip" */
#define GRPC_MDSTR_IDENTITY_COMMA_DEFLATE_COMMA_GZIP \
- (&grpc_static_mdstr_table[56])
+ (grpc_static_slice_table[60])
/* "identity,gzip" */
-#define GRPC_MDSTR_IDENTITY_COMMA_GZIP (&grpc_static_mdstr_table[57])
+#define GRPC_MDSTR_IDENTITY_COMMA_GZIP (grpc_static_slice_table[61])
/* "if-match" */
-#define GRPC_MDSTR_IF_MATCH (&grpc_static_mdstr_table[58])
+#define GRPC_MDSTR_IF_MATCH (grpc_static_slice_table[62])
/* "if-modified-since" */
-#define GRPC_MDSTR_IF_MODIFIED_SINCE (&grpc_static_mdstr_table[59])
+#define GRPC_MDSTR_IF_MODIFIED_SINCE (grpc_static_slice_table[63])
/* "if-none-match" */
-#define GRPC_MDSTR_IF_NONE_MATCH (&grpc_static_mdstr_table[60])
+#define GRPC_MDSTR_IF_NONE_MATCH (grpc_static_slice_table[64])
/* "if-range" */
-#define GRPC_MDSTR_IF_RANGE (&grpc_static_mdstr_table[61])
+#define GRPC_MDSTR_IF_RANGE (grpc_static_slice_table[65])
/* "if-unmodified-since" */
-#define GRPC_MDSTR_IF_UNMODIFIED_SINCE (&grpc_static_mdstr_table[62])
+#define GRPC_MDSTR_IF_UNMODIFIED_SINCE (grpc_static_slice_table[66])
/* "last-modified" */
-#define GRPC_MDSTR_LAST_MODIFIED (&grpc_static_mdstr_table[63])
+#define GRPC_MDSTR_LAST_MODIFIED (grpc_static_slice_table[67])
/* "lb-cost-bin" */
-#define GRPC_MDSTR_LB_COST_BIN (&grpc_static_mdstr_table[64])
+#define GRPC_MDSTR_LB_COST_BIN (grpc_static_slice_table[68])
/* "lb-token" */
-#define GRPC_MDSTR_LB_TOKEN (&grpc_static_mdstr_table[65])
+#define GRPC_MDSTR_LB_TOKEN (grpc_static_slice_table[69])
/* "link" */
-#define GRPC_MDSTR_LINK (&grpc_static_mdstr_table[66])
+#define GRPC_MDSTR_LINK (grpc_static_slice_table[70])
/* "location" */
-#define GRPC_MDSTR_LOCATION (&grpc_static_mdstr_table[67])
+#define GRPC_MDSTR_LOCATION (grpc_static_slice_table[71])
/* "max-forwards" */
-#define GRPC_MDSTR_MAX_FORWARDS (&grpc_static_mdstr_table[68])
+#define GRPC_MDSTR_MAX_FORWARDS (grpc_static_slice_table[72])
/* ":method" */
-#define GRPC_MDSTR_METHOD (&grpc_static_mdstr_table[69])
+#define GRPC_MDSTR_METHOD (grpc_static_slice_table[73])
/* ":path" */
-#define GRPC_MDSTR_PATH (&grpc_static_mdstr_table[70])
+#define GRPC_MDSTR_PATH (grpc_static_slice_table[74])
/* "POST" */
-#define GRPC_MDSTR_POST (&grpc_static_mdstr_table[71])
+#define GRPC_MDSTR_POST (grpc_static_slice_table[75])
/* "proxy-authenticate" */
-#define GRPC_MDSTR_PROXY_AUTHENTICATE (&grpc_static_mdstr_table[72])
+#define GRPC_MDSTR_PROXY_AUTHENTICATE (grpc_static_slice_table[76])
/* "proxy-authorization" */
-#define GRPC_MDSTR_PROXY_AUTHORIZATION (&grpc_static_mdstr_table[73])
+#define GRPC_MDSTR_PROXY_AUTHORIZATION (grpc_static_slice_table[77])
/* "PUT" */
-#define GRPC_MDSTR_PUT (&grpc_static_mdstr_table[74])
+#define GRPC_MDSTR_PUT (grpc_static_slice_table[78])
/* "range" */
-#define GRPC_MDSTR_RANGE (&grpc_static_mdstr_table[75])
+#define GRPC_MDSTR_RANGE (grpc_static_slice_table[79])
/* "referer" */
-#define GRPC_MDSTR_REFERER (&grpc_static_mdstr_table[76])
+#define GRPC_MDSTR_REFERER (grpc_static_slice_table[80])
/* "refresh" */
-#define GRPC_MDSTR_REFRESH (&grpc_static_mdstr_table[77])
+#define GRPC_MDSTR_REFRESH (grpc_static_slice_table[81])
/* "retry-after" */
-#define GRPC_MDSTR_RETRY_AFTER (&grpc_static_mdstr_table[78])
+#define GRPC_MDSTR_RETRY_AFTER (grpc_static_slice_table[82])
/* ":scheme" */
-#define GRPC_MDSTR_SCHEME (&grpc_static_mdstr_table[79])
+#define GRPC_MDSTR_SCHEME (grpc_static_slice_table[83])
/* "server" */
-#define GRPC_MDSTR_SERVER (&grpc_static_mdstr_table[80])
+#define GRPC_MDSTR_SERVER (grpc_static_slice_table[84])
/* "set-cookie" */
-#define GRPC_MDSTR_SET_COOKIE (&grpc_static_mdstr_table[81])
+#define GRPC_MDSTR_SET_COOKIE (grpc_static_slice_table[85])
/* "/" */
-#define GRPC_MDSTR_SLASH (&grpc_static_mdstr_table[82])
+#define GRPC_MDSTR_SLASH (grpc_static_slice_table[86])
+/* "/grpc.lb.v1.LoadBalancer/BalanceLoad" */
+#define GRPC_MDSTR_SLASH_GRPC_DOT_LB_DOT_V1_DOT_LOADBALANCER_SLASH_BALANCELOAD \
+ (grpc_static_slice_table[87])
/* "/index.html" */
-#define GRPC_MDSTR_SLASH_INDEX_DOT_HTML (&grpc_static_mdstr_table[83])
+#define GRPC_MDSTR_SLASH_INDEX_DOT_HTML (grpc_static_slice_table[88])
/* ":status" */
-#define GRPC_MDSTR_STATUS (&grpc_static_mdstr_table[84])
+#define GRPC_MDSTR_STATUS (grpc_static_slice_table[89])
/* "strict-transport-security" */
-#define GRPC_MDSTR_STRICT_TRANSPORT_SECURITY (&grpc_static_mdstr_table[85])
+#define GRPC_MDSTR_STRICT_TRANSPORT_SECURITY (grpc_static_slice_table[90])
/* "te" */
-#define GRPC_MDSTR_TE (&grpc_static_mdstr_table[86])
+#define GRPC_MDSTR_TE (grpc_static_slice_table[91])
/* "trailers" */
-#define GRPC_MDSTR_TRAILERS (&grpc_static_mdstr_table[87])
+#define GRPC_MDSTR_TRAILERS (grpc_static_slice_table[92])
/* "transfer-encoding" */
-#define GRPC_MDSTR_TRANSFER_ENCODING (&grpc_static_mdstr_table[88])
+#define GRPC_MDSTR_TRANSFER_ENCODING (grpc_static_slice_table[93])
/* "user-agent" */
-#define GRPC_MDSTR_USER_AGENT (&grpc_static_mdstr_table[89])
+#define GRPC_MDSTR_USER_AGENT (grpc_static_slice_table[94])
/* "vary" */
-#define GRPC_MDSTR_VARY (&grpc_static_mdstr_table[90])
+#define GRPC_MDSTR_VARY (grpc_static_slice_table[95])
/* "via" */
-#define GRPC_MDSTR_VIA (&grpc_static_mdstr_table[91])
+#define GRPC_MDSTR_VIA (grpc_static_slice_table[96])
/* "www-authenticate" */
-#define GRPC_MDSTR_WWW_AUTHENTICATE (&grpc_static_mdstr_table[92])
+#define GRPC_MDSTR_WWW_AUTHENTICATE (grpc_static_slice_table[97])
+bool grpc_is_static_metadata_string(grpc_slice slice);
+
+int grpc_static_metadata_index(grpc_slice slice);
#define GRPC_STATIC_MDELEM_COUNT 81
-extern grpc_mdelem grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT];
+extern grpc_mdelem_data grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT];
extern uintptr_t grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT];
/* "accept-charset": "" */
-#define GRPC_MDELEM_ACCEPT_CHARSET_EMPTY (&grpc_static_mdelem_table[0])
+#define GRPC_MDELEM_ACCEPT_CHARSET_EMPTY \
+ ((grpc_mdelem){&grpc_static_mdelem_table[0]})
/* "accept": "" */
-#define GRPC_MDELEM_ACCEPT_EMPTY (&grpc_static_mdelem_table[1])
+#define GRPC_MDELEM_ACCEPT_EMPTY ((grpc_mdelem){&grpc_static_mdelem_table[1]})
/* "accept-encoding": "" */
-#define GRPC_MDELEM_ACCEPT_ENCODING_EMPTY (&grpc_static_mdelem_table[2])
+#define GRPC_MDELEM_ACCEPT_ENCODING_EMPTY \
+ ((grpc_mdelem){&grpc_static_mdelem_table[2]})
/* "accept-encoding": "gzip, deflate" */
#define GRPC_MDELEM_ACCEPT_ENCODING_GZIP_COMMA_DEFLATE \
- (&grpc_static_mdelem_table[3])
+ ((grpc_mdelem){&grpc_static_mdelem_table[3]})
/* "accept-language": "" */
-#define GRPC_MDELEM_ACCEPT_LANGUAGE_EMPTY (&grpc_static_mdelem_table[4])
+#define GRPC_MDELEM_ACCEPT_LANGUAGE_EMPTY \
+ ((grpc_mdelem){&grpc_static_mdelem_table[4]})
/* "accept-ranges": "" */
-#define GRPC_MDELEM_ACCEPT_RANGES_EMPTY (&grpc_static_mdelem_table[5])
+#define GRPC_MDELEM_ACCEPT_RANGES_EMPTY \
+ ((grpc_mdelem){&grpc_static_mdelem_table[5]})
/* "access-control-allow-origin": "" */
#define GRPC_MDELEM_ACCESS_CONTROL_ALLOW_ORIGIN_EMPTY \
- (&grpc_static_mdelem_table[6])
+ ((grpc_mdelem){&grpc_static_mdelem_table[6]})
/* "age": "" */
-#define GRPC_MDELEM_AGE_EMPTY (&grpc_static_mdelem_table[7])
+#define GRPC_MDELEM_AGE_EMPTY ((grpc_mdelem){&grpc_static_mdelem_table[7]})
/* "allow": "" */
-#define GRPC_MDELEM_ALLOW_EMPTY (&grpc_static_mdelem_table[8])
+#define GRPC_MDELEM_ALLOW_EMPTY ((grpc_mdelem){&grpc_static_mdelem_table[8]})
/* ":authority": "" */
-#define GRPC_MDELEM_AUTHORITY_EMPTY (&grpc_static_mdelem_table[9])
+#define GRPC_MDELEM_AUTHORITY_EMPTY \
+ ((grpc_mdelem){&grpc_static_mdelem_table[9]})
/* "authorization": "" */
-#define GRPC_MDELEM_AUTHORIZATION_EMPTY (&grpc_static_mdelem_table[10])
+#define GRPC_MDELEM_AUTHORIZATION_EMPTY \
+ ((grpc_mdelem){&grpc_static_mdelem_table[10]})
/* "cache-control": "" */
-#define GRPC_MDELEM_CACHE_CONTROL_EMPTY (&grpc_static_mdelem_table[11])
+#define GRPC_MDELEM_CACHE_CONTROL_EMPTY \
+ ((grpc_mdelem){&grpc_static_mdelem_table[11]})
/* "content-disposition": "" */
-#define GRPC_MDELEM_CONTENT_DISPOSITION_EMPTY (&grpc_static_mdelem_table[12])
+#define GRPC_MDELEM_CONTENT_DISPOSITION_EMPTY \
+ ((grpc_mdelem){&grpc_static_mdelem_table[12]})
/* "content-encoding": "" */
-#define GRPC_MDELEM_CONTENT_ENCODING_EMPTY (&grpc_static_mdelem_table[13])
+#define GRPC_MDELEM_CONTENT_ENCODING_EMPTY \
+ ((grpc_mdelem){&grpc_static_mdelem_table[13]})
/* "content-language": "" */
-#define GRPC_MDELEM_CONTENT_LANGUAGE_EMPTY (&grpc_static_mdelem_table[14])
+#define GRPC_MDELEM_CONTENT_LANGUAGE_EMPTY \
+ ((grpc_mdelem){&grpc_static_mdelem_table[14]})
/* "content-length": "" */
-#define GRPC_MDELEM_CONTENT_LENGTH_EMPTY (&grpc_static_mdelem_table[15])
+#define GRPC_MDELEM_CONTENT_LENGTH_EMPTY \
+ ((grpc_mdelem){&grpc_static_mdelem_table[15]})
/* "content-location": "" */
-#define GRPC_MDELEM_CONTENT_LOCATION_EMPTY (&grpc_static_mdelem_table[16])
+#define GRPC_MDELEM_CONTENT_LOCATION_EMPTY \
+ ((grpc_mdelem){&grpc_static_mdelem_table[16]})
/* "content-range": "" */
-#define GRPC_MDELEM_CONTENT_RANGE_EMPTY (&grpc_static_mdelem_table[17])
+#define GRPC_MDELEM_CONTENT_RANGE_EMPTY \
+ ((grpc_mdelem){&grpc_static_mdelem_table[17]})
/* "content-type": "application/grpc" */
#define GRPC_MDELEM_CONTENT_TYPE_APPLICATION_SLASH_GRPC \
- (&grpc_static_mdelem_table[18])
+ ((grpc_mdelem){&grpc_static_mdelem_table[18]})
/* "content-type": "" */
-#define GRPC_MDELEM_CONTENT_TYPE_EMPTY (&grpc_static_mdelem_table[19])
+#define GRPC_MDELEM_CONTENT_TYPE_EMPTY \
+ ((grpc_mdelem){&grpc_static_mdelem_table[19]})
/* "cookie": "" */
-#define GRPC_MDELEM_COOKIE_EMPTY (&grpc_static_mdelem_table[20])
+#define GRPC_MDELEM_COOKIE_EMPTY ((grpc_mdelem){&grpc_static_mdelem_table[20]})
/* "date": "" */
-#define GRPC_MDELEM_DATE_EMPTY (&grpc_static_mdelem_table[21])
+#define GRPC_MDELEM_DATE_EMPTY ((grpc_mdelem){&grpc_static_mdelem_table[21]})
/* "etag": "" */
-#define GRPC_MDELEM_ETAG_EMPTY (&grpc_static_mdelem_table[22])
+#define GRPC_MDELEM_ETAG_EMPTY ((grpc_mdelem){&grpc_static_mdelem_table[22]})
/* "expect": "" */
-#define GRPC_MDELEM_EXPECT_EMPTY (&grpc_static_mdelem_table[23])
+#define GRPC_MDELEM_EXPECT_EMPTY ((grpc_mdelem){&grpc_static_mdelem_table[23]})
/* "expires": "" */
-#define GRPC_MDELEM_EXPIRES_EMPTY (&grpc_static_mdelem_table[24])
+#define GRPC_MDELEM_EXPIRES_EMPTY ((grpc_mdelem){&grpc_static_mdelem_table[24]})
/* "from": "" */
-#define GRPC_MDELEM_FROM_EMPTY (&grpc_static_mdelem_table[25])
+#define GRPC_MDELEM_FROM_EMPTY ((grpc_mdelem){&grpc_static_mdelem_table[25]})
/* "grpc-accept-encoding": "deflate" */
-#define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_DEFLATE (&grpc_static_mdelem_table[26])
+#define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_DEFLATE \
+ ((grpc_mdelem){&grpc_static_mdelem_table[26]})
/* "grpc-accept-encoding": "deflate,gzip" */
#define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_DEFLATE_COMMA_GZIP \
- (&grpc_static_mdelem_table[27])
+ ((grpc_mdelem){&grpc_static_mdelem_table[27]})
/* "grpc-accept-encoding": "gzip" */
-#define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_GZIP (&grpc_static_mdelem_table[28])
+#define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_GZIP \
+ ((grpc_mdelem){&grpc_static_mdelem_table[28]})
/* "grpc-accept-encoding": "identity" */
#define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY \
- (&grpc_static_mdelem_table[29])
+ ((grpc_mdelem){&grpc_static_mdelem_table[29]})
/* "grpc-accept-encoding": "identity,deflate" */
#define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY_COMMA_DEFLATE \
- (&grpc_static_mdelem_table[30])
+ ((grpc_mdelem){&grpc_static_mdelem_table[30]})
/* "grpc-accept-encoding": "identity,deflate,gzip" */
#define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY_COMMA_DEFLATE_COMMA_GZIP \
- (&grpc_static_mdelem_table[31])
+ ((grpc_mdelem){&grpc_static_mdelem_table[31]})
/* "grpc-accept-encoding": "identity,gzip" */
#define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY_COMMA_GZIP \
- (&grpc_static_mdelem_table[32])
+ ((grpc_mdelem){&grpc_static_mdelem_table[32]})
/* "grpc-encoding": "deflate" */
-#define GRPC_MDELEM_GRPC_ENCODING_DEFLATE (&grpc_static_mdelem_table[33])
+#define GRPC_MDELEM_GRPC_ENCODING_DEFLATE \
+ ((grpc_mdelem){&grpc_static_mdelem_table[33]})
/* "grpc-encoding": "gzip" */
-#define GRPC_MDELEM_GRPC_ENCODING_GZIP (&grpc_static_mdelem_table[34])
+#define GRPC_MDELEM_GRPC_ENCODING_GZIP \
+ ((grpc_mdelem){&grpc_static_mdelem_table[34]})
/* "grpc-encoding": "identity" */
-#define GRPC_MDELEM_GRPC_ENCODING_IDENTITY (&grpc_static_mdelem_table[35])
+#define GRPC_MDELEM_GRPC_ENCODING_IDENTITY \
+ ((grpc_mdelem){&grpc_static_mdelem_table[35]})
/* "grpc-status": "0" */
-#define GRPC_MDELEM_GRPC_STATUS_0 (&grpc_static_mdelem_table[36])
+#define GRPC_MDELEM_GRPC_STATUS_0 ((grpc_mdelem){&grpc_static_mdelem_table[36]})
/* "grpc-status": "1" */
-#define GRPC_MDELEM_GRPC_STATUS_1 (&grpc_static_mdelem_table[37])
+#define GRPC_MDELEM_GRPC_STATUS_1 ((grpc_mdelem){&grpc_static_mdelem_table[37]})
/* "grpc-status": "2" */
-#define GRPC_MDELEM_GRPC_STATUS_2 (&grpc_static_mdelem_table[38])
+#define GRPC_MDELEM_GRPC_STATUS_2 ((grpc_mdelem){&grpc_static_mdelem_table[38]})
/* "host": "" */
-#define GRPC_MDELEM_HOST_EMPTY (&grpc_static_mdelem_table[39])
+#define GRPC_MDELEM_HOST_EMPTY ((grpc_mdelem){&grpc_static_mdelem_table[39]})
/* "if-match": "" */
-#define GRPC_MDELEM_IF_MATCH_EMPTY (&grpc_static_mdelem_table[40])
+#define GRPC_MDELEM_IF_MATCH_EMPTY \
+ ((grpc_mdelem){&grpc_static_mdelem_table[40]})
/* "if-modified-since": "" */
-#define GRPC_MDELEM_IF_MODIFIED_SINCE_EMPTY (&grpc_static_mdelem_table[41])
+#define GRPC_MDELEM_IF_MODIFIED_SINCE_EMPTY \
+ ((grpc_mdelem){&grpc_static_mdelem_table[41]})
/* "if-none-match": "" */
-#define GRPC_MDELEM_IF_NONE_MATCH_EMPTY (&grpc_static_mdelem_table[42])
+#define GRPC_MDELEM_IF_NONE_MATCH_EMPTY \
+ ((grpc_mdelem){&grpc_static_mdelem_table[42]})
/* "if-range": "" */
-#define GRPC_MDELEM_IF_RANGE_EMPTY (&grpc_static_mdelem_table[43])
+#define GRPC_MDELEM_IF_RANGE_EMPTY \
+ ((grpc_mdelem){&grpc_static_mdelem_table[43]})
/* "if-unmodified-since": "" */
-#define GRPC_MDELEM_IF_UNMODIFIED_SINCE_EMPTY (&grpc_static_mdelem_table[44])
+#define GRPC_MDELEM_IF_UNMODIFIED_SINCE_EMPTY \
+ ((grpc_mdelem){&grpc_static_mdelem_table[44]})
/* "last-modified": "" */
-#define GRPC_MDELEM_LAST_MODIFIED_EMPTY (&grpc_static_mdelem_table[45])
+#define GRPC_MDELEM_LAST_MODIFIED_EMPTY \
+ ((grpc_mdelem){&grpc_static_mdelem_table[45]})
/* "lb-cost-bin": "" */
-#define GRPC_MDELEM_LB_COST_BIN_EMPTY (&grpc_static_mdelem_table[46])
+#define GRPC_MDELEM_LB_COST_BIN_EMPTY \
+ ((grpc_mdelem){&grpc_static_mdelem_table[46]})
/* "lb-token": "" */
-#define GRPC_MDELEM_LB_TOKEN_EMPTY (&grpc_static_mdelem_table[47])
+#define GRPC_MDELEM_LB_TOKEN_EMPTY \
+ ((grpc_mdelem){&grpc_static_mdelem_table[47]})
/* "link": "" */
-#define GRPC_MDELEM_LINK_EMPTY (&grpc_static_mdelem_table[48])
+#define GRPC_MDELEM_LINK_EMPTY ((grpc_mdelem){&grpc_static_mdelem_table[48]})
/* "location": "" */
-#define GRPC_MDELEM_LOCATION_EMPTY (&grpc_static_mdelem_table[49])
+#define GRPC_MDELEM_LOCATION_EMPTY \
+ ((grpc_mdelem){&grpc_static_mdelem_table[49]})
/* "max-forwards": "" */
-#define GRPC_MDELEM_MAX_FORWARDS_EMPTY (&grpc_static_mdelem_table[50])
+#define GRPC_MDELEM_MAX_FORWARDS_EMPTY \
+ ((grpc_mdelem){&grpc_static_mdelem_table[50]})
/* ":method": "GET" */
-#define GRPC_MDELEM_METHOD_GET (&grpc_static_mdelem_table[51])
+#define GRPC_MDELEM_METHOD_GET ((grpc_mdelem){&grpc_static_mdelem_table[51]})
/* ":method": "POST" */
-#define GRPC_MDELEM_METHOD_POST (&grpc_static_mdelem_table[52])
+#define GRPC_MDELEM_METHOD_POST ((grpc_mdelem){&grpc_static_mdelem_table[52]})
/* ":method": "PUT" */
-#define GRPC_MDELEM_METHOD_PUT (&grpc_static_mdelem_table[53])
+#define GRPC_MDELEM_METHOD_PUT ((grpc_mdelem){&grpc_static_mdelem_table[53]})
/* ":path": "/" */
-#define GRPC_MDELEM_PATH_SLASH (&grpc_static_mdelem_table[54])
+#define GRPC_MDELEM_PATH_SLASH ((grpc_mdelem){&grpc_static_mdelem_table[54]})
/* ":path": "/index.html" */
-#define GRPC_MDELEM_PATH_SLASH_INDEX_DOT_HTML (&grpc_static_mdelem_table[55])
+#define GRPC_MDELEM_PATH_SLASH_INDEX_DOT_HTML \
+ ((grpc_mdelem){&grpc_static_mdelem_table[55]})
/* "proxy-authenticate": "" */
-#define GRPC_MDELEM_PROXY_AUTHENTICATE_EMPTY (&grpc_static_mdelem_table[56])
+#define GRPC_MDELEM_PROXY_AUTHENTICATE_EMPTY \
+ ((grpc_mdelem){&grpc_static_mdelem_table[56]})
/* "proxy-authorization": "" */
-#define GRPC_MDELEM_PROXY_AUTHORIZATION_EMPTY (&grpc_static_mdelem_table[57])
+#define GRPC_MDELEM_PROXY_AUTHORIZATION_EMPTY \
+ ((grpc_mdelem){&grpc_static_mdelem_table[57]})
/* "range": "" */
-#define GRPC_MDELEM_RANGE_EMPTY (&grpc_static_mdelem_table[58])
+#define GRPC_MDELEM_RANGE_EMPTY ((grpc_mdelem){&grpc_static_mdelem_table[58]})
/* "referer": "" */
-#define GRPC_MDELEM_REFERER_EMPTY (&grpc_static_mdelem_table[59])
+#define GRPC_MDELEM_REFERER_EMPTY ((grpc_mdelem){&grpc_static_mdelem_table[59]})
/* "refresh": "" */
-#define GRPC_MDELEM_REFRESH_EMPTY (&grpc_static_mdelem_table[60])
+#define GRPC_MDELEM_REFRESH_EMPTY ((grpc_mdelem){&grpc_static_mdelem_table[60]})
/* "retry-after": "" */
-#define GRPC_MDELEM_RETRY_AFTER_EMPTY (&grpc_static_mdelem_table[61])
+#define GRPC_MDELEM_RETRY_AFTER_EMPTY \
+ ((grpc_mdelem){&grpc_static_mdelem_table[61]})
/* ":scheme": "grpc" */
-#define GRPC_MDELEM_SCHEME_GRPC (&grpc_static_mdelem_table[62])
+#define GRPC_MDELEM_SCHEME_GRPC ((grpc_mdelem){&grpc_static_mdelem_table[62]})
/* ":scheme": "http" */
-#define GRPC_MDELEM_SCHEME_HTTP (&grpc_static_mdelem_table[63])
+#define GRPC_MDELEM_SCHEME_HTTP ((grpc_mdelem){&grpc_static_mdelem_table[63]})
/* ":scheme": "https" */
-#define GRPC_MDELEM_SCHEME_HTTPS (&grpc_static_mdelem_table[64])
+#define GRPC_MDELEM_SCHEME_HTTPS ((grpc_mdelem){&grpc_static_mdelem_table[64]})
/* "server": "" */
-#define GRPC_MDELEM_SERVER_EMPTY (&grpc_static_mdelem_table[65])
+#define GRPC_MDELEM_SERVER_EMPTY ((grpc_mdelem){&grpc_static_mdelem_table[65]})
/* "set-cookie": "" */
-#define GRPC_MDELEM_SET_COOKIE_EMPTY (&grpc_static_mdelem_table[66])
+#define GRPC_MDELEM_SET_COOKIE_EMPTY \
+ ((grpc_mdelem){&grpc_static_mdelem_table[66]})
/* ":status": "200" */
-#define GRPC_MDELEM_STATUS_200 (&grpc_static_mdelem_table[67])
+#define GRPC_MDELEM_STATUS_200 ((grpc_mdelem){&grpc_static_mdelem_table[67]})
/* ":status": "204" */
-#define GRPC_MDELEM_STATUS_204 (&grpc_static_mdelem_table[68])
+#define GRPC_MDELEM_STATUS_204 ((grpc_mdelem){&grpc_static_mdelem_table[68]})
/* ":status": "206" */
-#define GRPC_MDELEM_STATUS_206 (&grpc_static_mdelem_table[69])
+#define GRPC_MDELEM_STATUS_206 ((grpc_mdelem){&grpc_static_mdelem_table[69]})
/* ":status": "304" */
-#define GRPC_MDELEM_STATUS_304 (&grpc_static_mdelem_table[70])
+#define GRPC_MDELEM_STATUS_304 ((grpc_mdelem){&grpc_static_mdelem_table[70]})
/* ":status": "400" */
-#define GRPC_MDELEM_STATUS_400 (&grpc_static_mdelem_table[71])
+#define GRPC_MDELEM_STATUS_400 ((grpc_mdelem){&grpc_static_mdelem_table[71]})
/* ":status": "404" */
-#define GRPC_MDELEM_STATUS_404 (&grpc_static_mdelem_table[72])
+#define GRPC_MDELEM_STATUS_404 ((grpc_mdelem){&grpc_static_mdelem_table[72]})
/* ":status": "500" */
-#define GRPC_MDELEM_STATUS_500 (&grpc_static_mdelem_table[73])
+#define GRPC_MDELEM_STATUS_500 ((grpc_mdelem){&grpc_static_mdelem_table[73]})
/* "strict-transport-security": "" */
#define GRPC_MDELEM_STRICT_TRANSPORT_SECURITY_EMPTY \
- (&grpc_static_mdelem_table[74])
+ ((grpc_mdelem){&grpc_static_mdelem_table[74]})
/* "te": "trailers" */
-#define GRPC_MDELEM_TE_TRAILERS (&grpc_static_mdelem_table[75])
+#define GRPC_MDELEM_TE_TRAILERS ((grpc_mdelem){&grpc_static_mdelem_table[75]})
/* "transfer-encoding": "" */
-#define GRPC_MDELEM_TRANSFER_ENCODING_EMPTY (&grpc_static_mdelem_table[76])
+#define GRPC_MDELEM_TRANSFER_ENCODING_EMPTY \
+ ((grpc_mdelem){&grpc_static_mdelem_table[76]})
/* "user-agent": "" */
-#define GRPC_MDELEM_USER_AGENT_EMPTY (&grpc_static_mdelem_table[77])
+#define GRPC_MDELEM_USER_AGENT_EMPTY \
+ ((grpc_mdelem){&grpc_static_mdelem_table[77]})
/* "vary": "" */
-#define GRPC_MDELEM_VARY_EMPTY (&grpc_static_mdelem_table[78])
+#define GRPC_MDELEM_VARY_EMPTY ((grpc_mdelem){&grpc_static_mdelem_table[78]})
/* "via": "" */
-#define GRPC_MDELEM_VIA_EMPTY (&grpc_static_mdelem_table[79])
+#define GRPC_MDELEM_VIA_EMPTY ((grpc_mdelem){&grpc_static_mdelem_table[79]})
/* "www-authenticate": "" */
-#define GRPC_MDELEM_WWW_AUTHENTICATE_EMPTY (&grpc_static_mdelem_table[80])
+#define GRPC_MDELEM_WWW_AUTHENTICATE_EMPTY \
+ ((grpc_mdelem){&grpc_static_mdelem_table[80]})
-extern const uint8_t
- grpc_static_metadata_elem_indices[GRPC_STATIC_MDELEM_COUNT * 2];
-extern const char *const grpc_static_metadata_strings[GRPC_STATIC_MDSTR_COUNT];
+grpc_mdelem grpc_static_mdelem_for_static_strings(int a, int b);
extern const uint8_t grpc_static_accept_encoding_metadata[8];
#define GRPC_MDELEM_ACCEPT_ENCODING_FOR_ALGORITHMS(algs) \
- (&grpc_static_mdelem_table[grpc_static_accept_encoding_metadata[(algs)]])
+ ((grpc_mdelem){&grpc_static_mdelem_table \
+ [grpc_static_accept_encoding_metadata[(algs)]]})
#endif /* GRPC_CORE_LIB_TRANSPORT_STATIC_METADATA_H */
diff --git a/src/core/lib/transport/timeout_encoding.c b/src/core/lib/transport/timeout_encoding.c
index b58ebbd0a8..b2060be59e 100644
--- a/src/core/lib/transport/timeout_encoding.c
+++ b/src/core/lib/transport/timeout_encoding.c
@@ -136,15 +136,17 @@ static int is_all_whitespace(const char *p) {
return *p == 0;
}
-int grpc_http2_decode_timeout(const char *buffer, gpr_timespec *timeout) {
+int grpc_http2_decode_timeout(const uint8_t *buffer, size_t length,
+ gpr_timespec *timeout) {
int32_t x = 0;
- const uint8_t *p = (const uint8_t *)buffer;
+ const uint8_t *p = buffer;
+ const uint8_t *end = p + length;
int have_digit = 0;
/* skip whitespace */
- for (; *p == ' '; p++)
+ for (; p != end && *p == ' '; p++)
;
/* decode numeric part */
- for (; *p >= '0' && *p <= '9'; p++) {
+ for (; p != end && *p >= '0' && *p <= '9'; p++) {
int32_t digit = (int32_t)(*p - (uint8_t)'0');
have_digit = 1;
/* spec allows max. 8 digits, but we allow values up to 1,000,000,000 */
@@ -158,8 +160,9 @@ int grpc_http2_decode_timeout(const char *buffer, gpr_timespec *timeout) {
}
if (!have_digit) return 0;
/* skip whitespace */
- for (; *p == ' '; p++)
+ for (; p != end && *p == ' '; p++)
;
+ if (p == end) return 0;
/* decode unit specifier */
switch (*p) {
case 'n':
diff --git a/src/core/lib/transport/timeout_encoding.h b/src/core/lib/transport/timeout_encoding.h
index 92f02f6ecd..838892595f 100644
--- a/src/core/lib/transport/timeout_encoding.h
+++ b/src/core/lib/transport/timeout_encoding.h
@@ -42,6 +42,7 @@
/* Encode/decode timeouts to the GRPC over HTTP/2 format;
encoding may round up arbitrarily */
void grpc_http2_encode_timeout(gpr_timespec timeout, char *buffer);
-int grpc_http2_decode_timeout(const char *buffer, gpr_timespec *timeout);
+int grpc_http2_decode_timeout(const uint8_t *buffer, size_t length,
+ gpr_timespec *timeout);
#endif /* GRPC_CORE_LIB_TRANSPORT_TIMEOUT_ENCODING_H */
diff --git a/src/core/lib/transport/transport_op_string.c b/src/core/lib/transport/transport_op_string.c
index 58d6ad508e..b36e4f22d0 100644
--- a/src/core/lib/transport/transport_op_string.c
+++ b/src/core/lib/transport/transport_op_string.c
@@ -47,14 +47,14 @@
/* These routines are here to facilitate debugging - they produce string
representations of various transport data structures */
-static void put_metadata(gpr_strvec *b, grpc_mdelem *md) {
+static void put_metadata(gpr_strvec *b, grpc_mdelem md) {
gpr_strvec_add(b, gpr_strdup("key="));
gpr_strvec_add(
- b, grpc_dump_slice(md->key->slice, GPR_DUMP_HEX | GPR_DUMP_ASCII));
+ b, grpc_dump_slice(GRPC_MDKEY(md), GPR_DUMP_HEX | GPR_DUMP_ASCII));
gpr_strvec_add(b, gpr_strdup(" value="));
gpr_strvec_add(
- b, grpc_dump_slice(md->value->slice, GPR_DUMP_HEX | GPR_DUMP_ASCII));
+ b, grpc_dump_slice(GRPC_MDVALUE(md), GPR_DUMP_HEX | GPR_DUMP_ASCII));
}
static void put_metadata_list(gpr_strvec *b, grpc_metadata_batch md) {