diff options
author | Hope Casey-Allen <hcaseyal@google.com> | 2018-09-04 12:47:09 -0700 |
---|---|---|
committer | Hope Casey-Allen <hcaseyal@google.com> | 2018-09-04 12:49:45 -0700 |
commit | 6e7e29aaae698d03dab71715c1913a5f813337ef (patch) | |
tree | 19490742734b649edb884d837e12b8da60df0c31 /src/core/lib/transport | |
parent | 73d0cd4d2d16e59a5b2ec21614b1511822e2039a (diff) |
WIP. Created static data for size of metadata and callouts index
Diffstat (limited to 'src/core/lib/transport')
-rw-r--r-- | src/core/lib/transport/metadata.cc | 65 | ||||
-rw-r--r-- | src/core/lib/transport/metadata.h | 11 |
2 files changed, 74 insertions, 2 deletions
diff --git a/src/core/lib/transport/metadata.cc b/src/core/lib/transport/metadata.cc index d10194a2fe..793a1fcd53 100644 --- a/src/core/lib/transport/metadata.cc +++ b/src/core/lib/transport/metadata.cc @@ -69,6 +69,71 @@ grpc_core::DebugOnlyTraceFlag grpc_trace_metadata(false, "metadata"); #define TABLE_IDX(hash, capacity) (((hash) >> (LOG2_SHARD_COUNT)) % (capacity)) #define SHARD_IDX(hash) ((hash) & ((1 << (LOG2_SHARD_COUNT)) - 1)) +static_hpack_table_metadata_info static_hpack_table_metadata[] = { + {0, 0, 0}, // NOT USED + {GRPC_MDELEM_AUTHORITY_EMPTY_INDEX, 10 + 32, 3}, + {GRPC_MDELEM_METHOD_GET_INDEX, 10 + 32, 1}, + {GRPC_MDELEM_METHOD_POST_INDEX, 11 + 32, 1}, + {GRPC_MDELEM_PATH_SLASH_INDEX, 6 + 32, 0}, + {GRPC_MDELEM_PATH_SLASH_INDEX_DOT_HTML_INDEX, 16 + 32, 0}, + {GRPC_MDELEM_SCHEME_HTTP_INDEX, 11 + 32, 4}, + {GRPC_MDELEM_SCHEME_HTTPS_INDEX, 12 + 32, 4}, + {GRPC_MDELEM_STATUS_200_INDEX, 10 + 32, 2}, + {GRPC_MDELEM_STATUS_204_INDEX, 10 + 32, 2}, + {GRPC_MDELEM_STATUS_206_INDEX, 10 + 32, 2}, + {GRPC_MDELEM_STATUS_304_INDEX, 10 + 32, 2}, + {GRPC_MDELEM_STATUS_400_INDEX, 10 + 32, 2}, + {GRPC_MDELEM_STATUS_404_INDEX, 10 + 32, 2}, + {GRPC_MDELEM_STATUS_500_INDEX, 10 + 32, 2}, + {GRPC_MDELEM_ACCEPT_CHARSET_EMPTY_INDEX, 14 + 32, 24}, // Not a callout + {GRPC_MDELEM_ACCEPT_ENCODING_GZIP_DEFLATE_INDEX, 28 + 32, 16}, + {GRPC_MDELEM_MDELEM_ACCEPT_LANGUAGE_EMPTY_INDEX, 15 + 32, 24}, // Not a callout + {GRPC_MDELEM_MDELEM_ACCEPT_RANGES_EMPTY_INDEX, 13 + 32, 24}, // Not a callout + {GRPC_MDELEM_ACCEPT_EMPTY_INDEX, 6 + 32, 24}, // Not a callout + {GRPC_MDELEM_ACCESS_CONTROL_ALLOW_ORIGIN_EMPTY_INDEX, 27 + 32, 24}, // Not a callout + {GRPC_MDELEM_AGE_EMPTY_INDEX, 3 + 32, 24}, // Not a callout + {GRPC_MDELEM_ALLOW_EMPTY_INDEX, 5 + 32, 24}, // Not a callout + {GRPC_MDELEM_AUTHORIZATION_EMPTY_INDEX, 13 + 32, 24}, // Not a callout + {GRPC_MDELEM_CACHE_CONTROL_EMPTY_INDEX, 13 + 32, 24}, // Not a callout + {GRPC_MDELEM_CONTENT_DISPOSITION_EMPTY_INDEX, 19 + 32, 24}, // Not a callout + {GRPC_MDELEM_CONTENT_ENCODING_EMPTY_INDEX, 16 + 32, 15}, + {GRPC_MDELEM_CONTENT_LANGUAGE_EMPTY_INDEX, 16 + 32, 24}, // Not a callout + {GRPC_MDELEM_CONTENT_LENGTH_EMPTY_INDEX, 14 + 32, 24}, // Not a callout + {GRPC_MDELEM_CONTENT_LOCATION_EMPTY_INDEX, 16 + 32, 24}, // Not a callout + {GRPC_MDELEM_CONTENT_RANGE_EMPTY_INDEX, 13 + 32, 24}, // Not a callout + {GRPC_MDELEM_CONTENT_TYPE_EMPTY_INDEX, 12 + 32, 15}, + {GRPC_MDELEM_COOKIE_EMPTY_INDEX, 6 + 32, 24}, // Not a callout + {GRPC_MDELEM_DATE_EMPTY_INDEX, 4 + 32, 24}, // Not a callout + {GRPC_MDELEM_ETAG_EMPTY_INDEX, 4 + 32, 24}, // Not a callout + {GRPC_MDELEM_EXPECT_EMPTY_INDEX, 6 + 32, 24}, // Not a callout + {GRPC_MDELEM_EXPIRES_EMPTY_INDEX, 7 + 32, 24}, // Not a callout + {GRPC_MDELEM_FROM_EMPTY_INDEX, 4 + 32, 24}, // Not a callout + {GRPC_MDELEM_HOST_EMPTY_INDEX, 4 + 32, 20}, + {GRPC_MDELEM_IF_MATCH_EMPTY_INDEX, 8 + 32, 24}, // Not a callout + {GRPC_MDELEM_IF_MODIFIED_SINCE_EMPTY_INDEX, 17 + 32, 24}, // Not a callout + {GRPC_MDELEM_IF_NONE_MATCH_EMPTY_INDEX, 13 + 32, 24}, // Not a callout + {GRPC_MDELEM_IF_RANGE_EMPTY_INDEX, 8 + 32, 24}, // Not a callout + {GRPC_MDELEM_IF_UNMODIFIED_SINCE_EMPTY_INDEX, 19 + 32, 24}, // Not a callout + {GRPC_MDELEM_LAST_MODIFIED_EMPTY_INDEX, 13 + 32, 24}, // Not a callout + {GRPC_MDELEM_LINK_EMPTY_INDEX, 4 + 32, 24}, // Not a callout + {GRPC_MDELEM_LOCATION_EMPTY_INDEX, 8 + 32, 24}, // Not a callout + {GRPC_MDELEM_MAX_FORWARDS_EMPTY_INDEX, 12 + 32, 24}, // Not a callout + {GRPC_MDELEM_PROXY_AUTHENTICATE_EMPTY_INDEX, 18 + 32, 24}, // Not a callout + {GRPC_MDELEM_PROXY_AUTHORIZATION_EMPTY_INDEX, 19 + 32, 24}, // Not a callout + {GRPC_MDELEM_RANGE_EMPTY_INDEX, 5 + 32, 24}, // Not a callout + {GRPC_MDELEM_REFERER_EMPTY_INDEX, 7 + 32, 24}, // Not a callout + {GRPC_MDELEM_REFRESH_EMPTY_INDEX, 7 + 32, 24}, // Not a callout + {GRPC_MDELEM_RETRY_AFTER_EMPTY_INDEX, 11 + 32, 24}, // Not a callout + {GRPC_MDELEM_SERVER_EMPTY_INDEX, 6 + 32, 24}, // Not a callout + {GRPC_MDELEM_SET_COOKIE_EMPTY_INDEX, 10 + 32, 24}, // Not a callout + {GRPC_MDELEM_STRICT_TRANSPORT_SECURITY_EMPTY_INDEX, 25 + 32, 24}, // Not a callout + {GRPC_MDELEM_TRANSFER_ENCODING_EMPTY_INDEX, 17 + 32, 24}, // Not a callout + {GRPC_MDELEM_USER_AGENT_EMPTY_INDEX, 10 + 32, 19}, + {GRPC_MDELEM_VARY_EMPTY_INDEX, 4 + 32, 24}, // Not a callout + {GRPC_MDELEM_VIA_EMPTY_INDEX, 3 + 32, 24}, // Not a callout + {GRPC_MDELEM_WWW_AUTHENTICATE_EMPTY_INDEX, 16 + 32, 24}, // Not a callout + }; + typedef void (*destroy_user_data_func)(void* user_data); /* Shadow structure for grpc_mdelem_data for interned elements */ diff --git a/src/core/lib/transport/metadata.h b/src/core/lib/transport/metadata.h index eeb09aff97..998d2fc64a 100644 --- a/src/core/lib/transport/metadata.h +++ b/src/core/lib/transport/metadata.h @@ -165,8 +165,6 @@ void grpc_mdctx_global_shutdown(); #define MIN_STATIC_HPACK_TABLE_IDX 1 #define MAX_STATIC_HPACK_TABLE_IDX 61 -/* Static hpack table metadata indices */ - /* {:authority, ""} */ #define GRPC_MDELEM_AUTHORITY_EMPTY_INDEX 1 @@ -350,6 +348,15 @@ void grpc_mdctx_global_shutdown(); /* {"www-authenticate", ""} */ #define GRPC_MDELEM_WWW_AUTHENTICATE_EMPTY_INDEX 61 +/* Static hpack table metadata info */ +typedef struct static_hpack_table_metadata_info { + uint8_t index; // Index in the static hpack table + uint8_t size; // Size of the metadata per RFC-7540 section 6.5.2., including 32 bytes of padding + uint8_t callouts_index; // For duplicate metadata detection. If GRPC_BATCH_CALLOUTS_COUNT, then the metadata is not one of the callouts. +} static_hpack_table_metadata_info; + +extern static_hpack_table_metadata_info static_hpack_table_metadata[]; + /* Forward declarations */ typedef struct grpc_mdelem grpc_mdelem; #endif /* GRPC_CORE_LIB_TRANSPORT_METADATA_H */ |