mirror of https://github.com/grpc/grpc.git
parent
e24913b35b
commit
2e7687c5ef
14 changed files with 767 additions and 0 deletions
@ -0,0 +1,127 @@ |
||||
/*
|
||||
* Copyright 2015, 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. |
||||
*/ |
||||
|
||||
/*
|
||||
* WARNING: Auto-generated code. |
||||
*
|
||||
* To make changes to this file, change tools/codegen/core/gen_static_metadata.py, |
||||
* and then re-run it. |
||||
*/ |
||||
|
||||
#include "src/core/transport/static_metadata.h" |
||||
|
||||
grpc_mdstr grpc_static_mdstr_table[GRPC_STATIC_MDSTR_COUNT]; |
||||
|
||||
grpc_mdelem grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT]; |
||||
|
||||
gpr_uint8 grpc_static_metadata_elem_indices[GRPC_STATIC_MDELEM_COUNT*2] = { |
||||
9,28,8,28,10,28,10,40,11,28,12,28,13,28,14,28,15,28,16,28,17,28,18,28,19,28,20,28,21,28,22,28,23,28,24,28,25,28,26,28,27,28,29,28,30,28,31,28,32,28,38,0,41,28,44,28,45,28,46,28,47,28,48,28,49,28,50,28,51,28,52,28,53,33,53,55,54,65,54,66,56,28,57,28,58,28,59,28,60,28,61,28,62,34,62,42,62,43,63,28,64,28,67,1,67,2,67,3,67,4,67,5,67,6,67,7,68,28,69,70,71,28,72,28,73,28,74,28,75,28 |
||||
}; |
||||
|
||||
const char *grpc_static_metadata_strings[GRPC_STATIC_MDSTR_COUNT] = { |
||||
"0", |
||||
"200", |
||||
"204", |
||||
"206", |
||||
"304", |
||||
"400", |
||||
"404", |
||||
"500", |
||||
"accept", |
||||
"accept-charset", |
||||
"accept-encoding", |
||||
"accept-language", |
||||
"accept-ranges", |
||||
"access-control-allow-origin", |
||||
"age", |
||||
"allow", |
||||
":authority", |
||||
"authorization", |
||||
"cache-control", |
||||
"content-disposition", |
||||
"content-encoding", |
||||
"content-language", |
||||
"content-length", |
||||
"content-location", |
||||
"content-range", |
||||
"content-type", |
||||
"cookie", |
||||
"date", |
||||
"", |
||||
"etag", |
||||
"expect", |
||||
"expires", |
||||
"from", |
||||
"GET", |
||||
"grpc", |
||||
"grpc-accept-encoding", |
||||
"grpc-encoding", |
||||
"grpc-message", |
||||
"grpc-status", |
||||
"grpc-timeout", |
||||
"gzip, deflate", |
||||
"host", |
||||
"http", |
||||
"https", |
||||
"if-match", |
||||
"if-modified-since", |
||||
"if-none-match", |
||||
"if-range", |
||||
"if-unmodified-since", |
||||
"last-modified", |
||||
"link", |
||||
"location", |
||||
"max-forwards", |
||||
":method", |
||||
":path", |
||||
"POST", |
||||
"proxy-authenticate", |
||||
"proxy-authorization", |
||||
"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" |
||||
}; |
||||
|
@ -0,0 +1,334 @@ |
||||
/*
|
||||
* Copyright 2015, 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. |
||||
*/ |
||||
|
||||
/*
|
||||
* WARNING: Auto-generated code. |
||||
*
|
||||
* To make changes to this file, change tools/codegen/core/gen_static_metadata.py, |
||||
* and then re-run it. |
||||
*/ |
||||
|
||||
#ifndef GRPC_INTERNAL_CORE_TRANSPORT_STATIC_METADATA_H |
||||
#define GRPC_INTERNAL_CORE_TRANSPORT_STATIC_METADATA_H |
||||
|
||||
#include "src/core/transport/metadata.h" |
||||
|
||||
#define GRPC_STATIC_MDSTR_COUNT 76 |
||||
extern grpc_mdstr grpc_static_mdstr_table[GRPC_STATIC_MDSTR_COUNT]; |
||||
/* "0" */ |
||||
#define GRPC_MDSTR_0 (&grpc_static_mdstr_table[0]) |
||||
/* "200" */ |
||||
#define GRPC_MDSTR_200 (&grpc_static_mdstr_table[1]) |
||||
/* "204" */ |
||||
#define GRPC_MDSTR_204 (&grpc_static_mdstr_table[2]) |
||||
/* "206" */ |
||||
#define GRPC_MDSTR_206 (&grpc_static_mdstr_table[3]) |
||||
/* "304" */ |
||||
#define GRPC_MDSTR_304 (&grpc_static_mdstr_table[4]) |
||||
/* "400" */ |
||||
#define GRPC_MDSTR_400 (&grpc_static_mdstr_table[5]) |
||||
/* "404" */ |
||||
#define GRPC_MDSTR_404 (&grpc_static_mdstr_table[6]) |
||||
/* "500" */ |
||||
#define GRPC_MDSTR_500 (&grpc_static_mdstr_table[7]) |
||||
/* "accept" */ |
||||
#define GRPC_MDSTR_ACCEPT (&grpc_static_mdstr_table[8]) |
||||
/* "accept-charset" */ |
||||
#define GRPC_MDSTR_ACCEPT_CHARSET (&grpc_static_mdstr_table[9]) |
||||
/* "accept-encoding" */ |
||||
#define GRPC_MDSTR_ACCEPT_ENCODING (&grpc_static_mdstr_table[10]) |
||||
/* "accept-language" */ |
||||
#define GRPC_MDSTR_ACCEPT_LANGUAGE (&grpc_static_mdstr_table[11]) |
||||
/* "accept-ranges" */ |
||||
#define GRPC_MDSTR_ACCEPT_RANGES (&grpc_static_mdstr_table[12]) |
||||
/* "access-control-allow-origin" */ |
||||
#define GRPC_MDSTR_ACCESS_CONTROL_ALLOW_ORIGIN (&grpc_static_mdstr_table[13]) |
||||
/* "age" */ |
||||
#define GRPC_MDSTR_AGE (&grpc_static_mdstr_table[14]) |
||||
/* "allow" */ |
||||
#define GRPC_MDSTR_ALLOW (&grpc_static_mdstr_table[15]) |
||||
/* ":authority" */ |
||||
#define GRPC_MDSTR_AUTHORITY (&grpc_static_mdstr_table[16]) |
||||
/* "authorization" */ |
||||
#define GRPC_MDSTR_AUTHORIZATION (&grpc_static_mdstr_table[17]) |
||||
/* "cache-control" */ |
||||
#define GRPC_MDSTR_CACHE_CONTROL (&grpc_static_mdstr_table[18]) |
||||
/* "content-disposition" */ |
||||
#define GRPC_MDSTR_CONTENT_DISPOSITION (&grpc_static_mdstr_table[19]) |
||||
/* "content-encoding" */ |
||||
#define GRPC_MDSTR_CONTENT_ENCODING (&grpc_static_mdstr_table[20]) |
||||
/* "content-language" */ |
||||
#define GRPC_MDSTR_CONTENT_LANGUAGE (&grpc_static_mdstr_table[21]) |
||||
/* "content-length" */ |
||||
#define GRPC_MDSTR_CONTENT_LENGTH (&grpc_static_mdstr_table[22]) |
||||
/* "content-location" */ |
||||
#define GRPC_MDSTR_CONTENT_LOCATION (&grpc_static_mdstr_table[23]) |
||||
/* "content-range" */ |
||||
#define GRPC_MDSTR_CONTENT_RANGE (&grpc_static_mdstr_table[24]) |
||||
/* "content-type" */ |
||||
#define GRPC_MDSTR_CONTENT_TYPE (&grpc_static_mdstr_table[25]) |
||||
/* "cookie" */ |
||||
#define GRPC_MDSTR_COOKIE (&grpc_static_mdstr_table[26]) |
||||
/* "date" */ |
||||
#define GRPC_MDSTR_DATE (&grpc_static_mdstr_table[27]) |
||||
/* "" */ |
||||
#define GRPC_MDSTR_EMPTY (&grpc_static_mdstr_table[28]) |
||||
/* "etag" */ |
||||
#define GRPC_MDSTR_ETAG (&grpc_static_mdstr_table[29]) |
||||
/* "expect" */ |
||||
#define GRPC_MDSTR_EXPECT (&grpc_static_mdstr_table[30]) |
||||
/* "expires" */ |
||||
#define GRPC_MDSTR_EXPIRES (&grpc_static_mdstr_table[31]) |
||||
/* "from" */ |
||||
#define GRPC_MDSTR_FROM (&grpc_static_mdstr_table[32]) |
||||
/* "GET" */ |
||||
#define GRPC_MDSTR_GET (&grpc_static_mdstr_table[33]) |
||||
/* "grpc" */ |
||||
#define GRPC_MDSTR_GRPC (&grpc_static_mdstr_table[34]) |
||||
/* "grpc-accept-encoding" */ |
||||
#define GRPC_MDSTR_GRPC_ACCEPT_ENCODING (&grpc_static_mdstr_table[35]) |
||||
/* "grpc-encoding" */ |
||||
#define GRPC_MDSTR_GRPC_ENCODING (&grpc_static_mdstr_table[36]) |
||||
/* "grpc-message" */ |
||||
#define GRPC_MDSTR_GRPC_MESSAGE (&grpc_static_mdstr_table[37]) |
||||
/* "grpc-status" */ |
||||
#define GRPC_MDSTR_GRPC_STATUS (&grpc_static_mdstr_table[38]) |
||||
/* "grpc-timeout" */ |
||||
#define GRPC_MDSTR_GRPC_TIMEOUT (&grpc_static_mdstr_table[39]) |
||||
/* "gzip, deflate" */ |
||||
#define GRPC_MDSTR_GZIP_COMMA_DEFLATE (&grpc_static_mdstr_table[40]) |
||||
/* "host" */ |
||||
#define GRPC_MDSTR_HOST (&grpc_static_mdstr_table[41]) |
||||
/* "http" */ |
||||
#define GRPC_MDSTR_HTTP (&grpc_static_mdstr_table[42]) |
||||
/* "https" */ |
||||
#define GRPC_MDSTR_HTTPS (&grpc_static_mdstr_table[43]) |
||||
/* "if-match" */ |
||||
#define GRPC_MDSTR_IF_MATCH (&grpc_static_mdstr_table[44]) |
||||
/* "if-modified-since" */ |
||||
#define GRPC_MDSTR_IF_MODIFIED_SINCE (&grpc_static_mdstr_table[45]) |
||||
/* "if-none-match" */ |
||||
#define GRPC_MDSTR_IF_NONE_MATCH (&grpc_static_mdstr_table[46]) |
||||
/* "if-range" */ |
||||
#define GRPC_MDSTR_IF_RANGE (&grpc_static_mdstr_table[47]) |
||||
/* "if-unmodified-since" */ |
||||
#define GRPC_MDSTR_IF_UNMODIFIED_SINCE (&grpc_static_mdstr_table[48]) |
||||
/* "last-modified" */ |
||||
#define GRPC_MDSTR_LAST_MODIFIED (&grpc_static_mdstr_table[49]) |
||||
/* "link" */ |
||||
#define GRPC_MDSTR_LINK (&grpc_static_mdstr_table[50]) |
||||
/* "location" */ |
||||
#define GRPC_MDSTR_LOCATION (&grpc_static_mdstr_table[51]) |
||||
/* "max-forwards" */ |
||||
#define GRPC_MDSTR_MAX_FORWARDS (&grpc_static_mdstr_table[52]) |
||||
/* ":method" */ |
||||
#define GRPC_MDSTR_METHOD (&grpc_static_mdstr_table[53]) |
||||
/* ":path" */ |
||||
#define GRPC_MDSTR_PATH (&grpc_static_mdstr_table[54]) |
||||
/* "POST" */ |
||||
#define GRPC_MDSTR_POST (&grpc_static_mdstr_table[55]) |
||||
/* "proxy-authenticate" */ |
||||
#define GRPC_MDSTR_PROXY_AUTHENTICATE (&grpc_static_mdstr_table[56]) |
||||
/* "proxy-authorization" */ |
||||
#define GRPC_MDSTR_PROXY_AUTHORIZATION (&grpc_static_mdstr_table[57]) |
||||
/* "range" */ |
||||
#define GRPC_MDSTR_RANGE (&grpc_static_mdstr_table[58]) |
||||
/* "referer" */ |
||||
#define GRPC_MDSTR_REFERER (&grpc_static_mdstr_table[59]) |
||||
/* "refresh" */ |
||||
#define GRPC_MDSTR_REFRESH (&grpc_static_mdstr_table[60]) |
||||
/* "retry-after" */ |
||||
#define GRPC_MDSTR_RETRY_AFTER (&grpc_static_mdstr_table[61]) |
||||
/* ":scheme" */ |
||||
#define GRPC_MDSTR_SCHEME (&grpc_static_mdstr_table[62]) |
||||
/* "server" */ |
||||
#define GRPC_MDSTR_SERVER (&grpc_static_mdstr_table[63]) |
||||
/* "set-cookie" */ |
||||
#define GRPC_MDSTR_SET_COOKIE (&grpc_static_mdstr_table[64]) |
||||
/* "/" */ |
||||
#define GRPC_MDSTR_SLASH (&grpc_static_mdstr_table[65]) |
||||
/* "/index.html" */ |
||||
#define GRPC_MDSTR_SLASH_INDEX_DOT_HTML (&grpc_static_mdstr_table[66]) |
||||
/* ":status" */ |
||||
#define GRPC_MDSTR_STATUS (&grpc_static_mdstr_table[67]) |
||||
/* "strict-transport-security" */ |
||||
#define GRPC_MDSTR_STRICT_TRANSPORT_SECURITY (&grpc_static_mdstr_table[68]) |
||||
/* "te" */ |
||||
#define GRPC_MDSTR_TE (&grpc_static_mdstr_table[69]) |
||||
/* "trailers" */ |
||||
#define GRPC_MDSTR_TRAILERS (&grpc_static_mdstr_table[70]) |
||||
/* "transfer-encoding" */ |
||||
#define GRPC_MDSTR_TRANSFER_ENCODING (&grpc_static_mdstr_table[71]) |
||||
/* "user-agent" */ |
||||
#define GRPC_MDSTR_USER_AGENT (&grpc_static_mdstr_table[72]) |
||||
/* "vary" */ |
||||
#define GRPC_MDSTR_VARY (&grpc_static_mdstr_table[73]) |
||||
/* "via" */ |
||||
#define GRPC_MDSTR_VIA (&grpc_static_mdstr_table[74]) |
||||
/* "www-authenticate" */ |
||||
#define GRPC_MDSTR_WWW_AUTHENTICATE (&grpc_static_mdstr_table[75]) |
||||
|
||||
#define GRPC_STATIC_MDELEM_COUNT 65 |
||||
extern grpc_mdelem grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT]; |
||||
/* "accept-charset": "" */ |
||||
#define GRPC_MDELEM_ACCEPT_CHARSET_EMPTY (&grpc_static_mdelem_table[0]) |
||||
/* "accept": "" */ |
||||
#define GRPC_MDELEM_ACCEPT_EMPTY (&grpc_static_mdelem_table[1]) |
||||
/* "accept-encoding": "" */ |
||||
#define GRPC_MDELEM_ACCEPT_ENCODING_EMPTY (&grpc_static_mdelem_table[2]) |
||||
/* "accept-encoding": "gzip, deflate" */ |
||||
#define GRPC_MDELEM_ACCEPT_ENCODING_GZIP_COMMA_DEFLATE (&grpc_static_mdelem_table[3]) |
||||
/* "accept-language": "" */ |
||||
#define GRPC_MDELEM_ACCEPT_LANGUAGE_EMPTY (&grpc_static_mdelem_table[4]) |
||||
/* "accept-ranges": "" */ |
||||
#define GRPC_MDELEM_ACCEPT_RANGES_EMPTY (&grpc_static_mdelem_table[5]) |
||||
/* "access-control-allow-origin": "" */ |
||||
#define GRPC_MDELEM_ACCESS_CONTROL_ALLOW_ORIGIN_EMPTY (&grpc_static_mdelem_table[6]) |
||||
/* "age": "" */ |
||||
#define GRPC_MDELEM_AGE_EMPTY (&grpc_static_mdelem_table[7]) |
||||
/* "allow": "" */ |
||||
#define GRPC_MDELEM_ALLOW_EMPTY (&grpc_static_mdelem_table[8]) |
||||
/* ":authority": "" */ |
||||
#define GRPC_MDELEM_AUTHORITY_EMPTY (&grpc_static_mdelem_table[9]) |
||||
/* "authorization": "" */ |
||||
#define GRPC_MDELEM_AUTHORIZATION_EMPTY (&grpc_static_mdelem_table[10]) |
||||
/* "cache-control": "" */ |
||||
#define GRPC_MDELEM_CACHE_CONTROL_EMPTY (&grpc_static_mdelem_table[11]) |
||||
/* "content-disposition": "" */ |
||||
#define GRPC_MDELEM_CONTENT_DISPOSITION_EMPTY (&grpc_static_mdelem_table[12]) |
||||
/* "content-encoding": "" */ |
||||
#define GRPC_MDELEM_CONTENT_ENCODING_EMPTY (&grpc_static_mdelem_table[13]) |
||||
/* "content-language": "" */ |
||||
#define GRPC_MDELEM_CONTENT_LANGUAGE_EMPTY (&grpc_static_mdelem_table[14]) |
||||
/* "content-length": "" */ |
||||
#define GRPC_MDELEM_CONTENT_LENGTH_EMPTY (&grpc_static_mdelem_table[15]) |
||||
/* "content-location": "" */ |
||||
#define GRPC_MDELEM_CONTENT_LOCATION_EMPTY (&grpc_static_mdelem_table[16]) |
||||
/* "content-range": "" */ |
||||
#define GRPC_MDELEM_CONTENT_RANGE_EMPTY (&grpc_static_mdelem_table[17]) |
||||
/* "content-type": "" */ |
||||
#define GRPC_MDELEM_CONTENT_TYPE_EMPTY (&grpc_static_mdelem_table[18]) |
||||
/* "cookie": "" */ |
||||
#define GRPC_MDELEM_COOKIE_EMPTY (&grpc_static_mdelem_table[19]) |
||||
/* "date": "" */ |
||||
#define GRPC_MDELEM_DATE_EMPTY (&grpc_static_mdelem_table[20]) |
||||
/* "etag": "" */ |
||||
#define GRPC_MDELEM_ETAG_EMPTY (&grpc_static_mdelem_table[21]) |
||||
/* "expect": "" */ |
||||
#define GRPC_MDELEM_EXPECT_EMPTY (&grpc_static_mdelem_table[22]) |
||||
/* "expires": "" */ |
||||
#define GRPC_MDELEM_EXPIRES_EMPTY (&grpc_static_mdelem_table[23]) |
||||
/* "from": "" */ |
||||
#define GRPC_MDELEM_FROM_EMPTY (&grpc_static_mdelem_table[24]) |
||||
/* "grpc-status": "0" */ |
||||
#define GRPC_MDELEM_GRPC_STATUS_0 (&grpc_static_mdelem_table[25]) |
||||
/* "host": "" */ |
||||
#define GRPC_MDELEM_HOST_EMPTY (&grpc_static_mdelem_table[26]) |
||||
/* "if-match": "" */ |
||||
#define GRPC_MDELEM_IF_MATCH_EMPTY (&grpc_static_mdelem_table[27]) |
||||
/* "if-modified-since": "" */ |
||||
#define GRPC_MDELEM_IF_MODIFIED_SINCE_EMPTY (&grpc_static_mdelem_table[28]) |
||||
/* "if-none-match": "" */ |
||||
#define GRPC_MDELEM_IF_NONE_MATCH_EMPTY (&grpc_static_mdelem_table[29]) |
||||
/* "if-range": "" */ |
||||
#define GRPC_MDELEM_IF_RANGE_EMPTY (&grpc_static_mdelem_table[30]) |
||||
/* "if-unmodified-since": "" */ |
||||
#define GRPC_MDELEM_IF_UNMODIFIED_SINCE_EMPTY (&grpc_static_mdelem_table[31]) |
||||
/* "last-modified": "" */ |
||||
#define GRPC_MDELEM_LAST_MODIFIED_EMPTY (&grpc_static_mdelem_table[32]) |
||||
/* "link": "" */ |
||||
#define GRPC_MDELEM_LINK_EMPTY (&grpc_static_mdelem_table[33]) |
||||
/* "location": "" */ |
||||
#define GRPC_MDELEM_LOCATION_EMPTY (&grpc_static_mdelem_table[34]) |
||||
/* "max-forwards": "" */ |
||||
#define GRPC_MDELEM_MAX_FORWARDS_EMPTY (&grpc_static_mdelem_table[35]) |
||||
/* ":method": "GET" */ |
||||
#define GRPC_MDELEM_METHOD_GET (&grpc_static_mdelem_table[36]) |
||||
/* ":method": "POST" */ |
||||
#define GRPC_MDELEM_METHOD_POST (&grpc_static_mdelem_table[37]) |
||||
/* ":path": "/" */ |
||||
#define GRPC_MDELEM_PATH_SLASH (&grpc_static_mdelem_table[38]) |
||||
/* ":path": "/index.html" */ |
||||
#define GRPC_MDELEM_PATH_SLASH_INDEX_DOT_HTML (&grpc_static_mdelem_table[39]) |
||||
/* "proxy-authenticate": "" */ |
||||
#define GRPC_MDELEM_PROXY_AUTHENTICATE_EMPTY (&grpc_static_mdelem_table[40]) |
||||
/* "proxy-authorization": "" */ |
||||
#define GRPC_MDELEM_PROXY_AUTHORIZATION_EMPTY (&grpc_static_mdelem_table[41]) |
||||
/* "range": "" */ |
||||
#define GRPC_MDELEM_RANGE_EMPTY (&grpc_static_mdelem_table[42]) |
||||
/* "referer": "" */ |
||||
#define GRPC_MDELEM_REFERER_EMPTY (&grpc_static_mdelem_table[43]) |
||||
/* "refresh": "" */ |
||||
#define GRPC_MDELEM_REFRESH_EMPTY (&grpc_static_mdelem_table[44]) |
||||
/* "retry-after": "" */ |
||||
#define GRPC_MDELEM_RETRY_AFTER_EMPTY (&grpc_static_mdelem_table[45]) |
||||
/* ":scheme": "grpc" */ |
||||
#define GRPC_MDELEM_SCHEME_GRPC (&grpc_static_mdelem_table[46]) |
||||
/* ":scheme": "http" */ |
||||
#define GRPC_MDELEM_SCHEME_HTTP (&grpc_static_mdelem_table[47]) |
||||
/* ":scheme": "https" */ |
||||
#define GRPC_MDELEM_SCHEME_HTTPS (&grpc_static_mdelem_table[48]) |
||||
/* "server": "" */ |
||||
#define GRPC_MDELEM_SERVER_EMPTY (&grpc_static_mdelem_table[49]) |
||||
/* "set-cookie": "" */ |
||||
#define GRPC_MDELEM_SET_COOKIE_EMPTY (&grpc_static_mdelem_table[50]) |
||||
/* ":status": "200" */ |
||||
#define GRPC_MDELEM_STATUS_200 (&grpc_static_mdelem_table[51]) |
||||
/* ":status": "204" */ |
||||
#define GRPC_MDELEM_STATUS_204 (&grpc_static_mdelem_table[52]) |
||||
/* ":status": "206" */ |
||||
#define GRPC_MDELEM_STATUS_206 (&grpc_static_mdelem_table[53]) |
||||
/* ":status": "304" */ |
||||
#define GRPC_MDELEM_STATUS_304 (&grpc_static_mdelem_table[54]) |
||||
/* ":status": "400" */ |
||||
#define GRPC_MDELEM_STATUS_400 (&grpc_static_mdelem_table[55]) |
||||
/* ":status": "404" */ |
||||
#define GRPC_MDELEM_STATUS_404 (&grpc_static_mdelem_table[56]) |
||||
/* ":status": "500" */ |
||||
#define GRPC_MDELEM_STATUS_500 (&grpc_static_mdelem_table[57]) |
||||
/* "strict-transport-security": "" */ |
||||
#define GRPC_MDELEM_STRICT_TRANSPORT_SECURITY_EMPTY (&grpc_static_mdelem_table[58]) |
||||
/* "te": "trailers" */ |
||||
#define GRPC_MDELEM_TE_TRAILERS (&grpc_static_mdelem_table[59]) |
||||
/* "transfer-encoding": "" */ |
||||
#define GRPC_MDELEM_TRANSFER_ENCODING_EMPTY (&grpc_static_mdelem_table[60]) |
||||
/* "user-agent": "" */ |
||||
#define GRPC_MDELEM_USER_AGENT_EMPTY (&grpc_static_mdelem_table[61]) |
||||
/* "vary": "" */ |
||||
#define GRPC_MDELEM_VARY_EMPTY (&grpc_static_mdelem_table[62]) |
||||
/* "via": "" */ |
||||
#define GRPC_MDELEM_VIA_EMPTY (&grpc_static_mdelem_table[63]) |
||||
/* "www-authenticate": "" */ |
||||
#define GRPC_MDELEM_WWW_AUTHENTICATE_EMPTY (&grpc_static_mdelem_table[64]) |
||||
|
||||
gpr_uint8 grpc_static_metadata_elem_indices[GRPC_STATIC_MDELEM_COUNT*2]; |
||||
const char *grpc_static_metadata_strings[GRPC_STATIC_MDSTR_COUNT]; |
||||
#endif /* GRPC_INTERNAL_CORE_TRANSPORT_STATIC_METADATA_H */ |
@ -0,0 +1,266 @@ |
||||
#!/usr/bin/env python2.7 |
||||
|
||||
# Copyright 2015, 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. |
||||
|
||||
import hashlib |
||||
import itertools |
||||
import os |
||||
import sys |
||||
|
||||
# configuration: a list of either strings or 2-tuples of strings |
||||
# a single string represents a static grpc_mdstr |
||||
# a 2-tuple represents a static grpc_mdelem (and appropriate grpc_mdstrs will |
||||
# also be created) |
||||
|
||||
CONFIG = [ |
||||
'grpc-timeout', |
||||
':path', |
||||
'grpc-encoding', |
||||
'grpc-accept-encoding', |
||||
'user-agent', |
||||
':authority', |
||||
'host', |
||||
'grpc-message', |
||||
'grpc-status', |
||||
'', |
||||
('grpc-status', '0'), |
||||
('te', 'trailers'), |
||||
(':method', 'POST'), |
||||
(':status', '200'), |
||||
(':status', '404'), |
||||
(':scheme', 'http'), |
||||
(':scheme', 'https'), |
||||
(':scheme', 'grpc'), |
||||
(':authority', ''), |
||||
(':method', 'GET'), |
||||
(':path', '/'), |
||||
(':path', '/index.html'), |
||||
(':status', '204'), |
||||
(':status', '206'), |
||||
(':status', '304'), |
||||
(':status', '400'), |
||||
(':status', '500'), |
||||
('accept-charset', ''), |
||||
('accept-encoding', ''), |
||||
('accept-encoding', 'gzip, deflate'), |
||||
('accept-language', ''), |
||||
('accept-ranges', ''), |
||||
('accept', ''), |
||||
('access-control-allow-origin', ''), |
||||
('age', ''), |
||||
('allow', ''), |
||||
('authorization', ''), |
||||
('cache-control', ''), |
||||
('content-disposition', ''), |
||||
('content-encoding', ''), |
||||
('content-language', ''), |
||||
('content-length', ''), |
||||
('content-location', ''), |
||||
('content-range', ''), |
||||
('content-type', ''), |
||||
('cookie', ''), |
||||
('date', ''), |
||||
('etag', ''), |
||||
('expect', ''), |
||||
('expires', ''), |
||||
('from', ''), |
||||
('host', ''), |
||||
('if-match', ''), |
||||
('if-modified-since', ''), |
||||
('if-none-match', ''), |
||||
('if-range', ''), |
||||
('if-unmodified-since', ''), |
||||
('last-modified', ''), |
||||
('link', ''), |
||||
('location', ''), |
||||
('max-forwards', ''), |
||||
('proxy-authenticate', ''), |
||||
('proxy-authorization', ''), |
||||
('range', ''), |
||||
('referer', ''), |
||||
('refresh', ''), |
||||
('retry-after', ''), |
||||
('server', ''), |
||||
('set-cookie', ''), |
||||
('strict-transport-security', ''), |
||||
('transfer-encoding', ''), |
||||
('user-agent', ''), |
||||
('vary', ''), |
||||
('via', ''), |
||||
('www-authenticate', ''), |
||||
] |
||||
|
||||
# utility: mangle the name of a config |
||||
def mangle(elem): |
||||
xl = { |
||||
'-': '_', |
||||
':': '', |
||||
'/': 'slash', |
||||
'.': 'dot', |
||||
',': 'comma', |
||||
' ': '_', |
||||
} |
||||
def m0(x): |
||||
if not x: return 'empty' |
||||
r = '' |
||||
for c in x: |
||||
put = xl.get(c, c.lower()) |
||||
if not put: continue |
||||
last_is_underscore = r[-1] == '_' if r else True |
||||
if last_is_underscore and put == '_': continue |
||||
elif len(put) > 1: |
||||
if not last_is_underscore: r += '_' |
||||
r += put |
||||
r += '_' |
||||
else: |
||||
r += put |
||||
if r[-1] == '_': r = r[:-1] |
||||
return r |
||||
if isinstance(elem, tuple): |
||||
return 'grpc_mdelem_%s_%s' % (m0(elem[0]), m0(elem[1])) |
||||
else: |
||||
return 'grpc_mdstr_%s' % (m0(elem)) |
||||
|
||||
# utility: generate some hash value for a string |
||||
def fake_hash(elem): |
||||
return hashlib.md5(elem).hexdigest()[0:8] |
||||
|
||||
# utility: print a big comment block into a set of files |
||||
def put_banner(files, banner): |
||||
for f in files: |
||||
print >>f, '/*' |
||||
for line in banner: |
||||
print >>f, ' * %s' % line |
||||
print >>f, ' */' |
||||
print >>f |
||||
|
||||
# build a list of all the strings we need |
||||
all_strs = set() |
||||
all_elems = set() |
||||
for elem in CONFIG: |
||||
if isinstance(elem, tuple): |
||||
all_strs.add(elem[0]) |
||||
all_strs.add(elem[1]) |
||||
all_elems.add(elem) |
||||
else: |
||||
all_strs.add(elem) |
||||
all_strs = sorted(list(all_strs), key=mangle) |
||||
all_elems = sorted(list(all_elems), key=mangle) |
||||
|
||||
# output configuration |
||||
args = sys.argv[1:] |
||||
H = None |
||||
C = None |
||||
if args: |
||||
if 'header' in args: |
||||
H = sys.stdout |
||||
else: |
||||
H = open('/dev/null', 'w') |
||||
if 'source' in args: |
||||
C = sys.stdout |
||||
else: |
||||
C = open('/dev/null', 'w') |
||||
else: |
||||
H = open(os.path.join( |
||||
os.path.dirname(sys.argv[0]), '../../../src/core/transport/static_metadata.h'), 'w') |
||||
C = open(os.path.join( |
||||
os.path.dirname(sys.argv[0]), '../../../src/core/transport/static_metadata.c'), 'w') |
||||
|
||||
# copy-paste copyright notice from this file |
||||
with open(sys.argv[0]) as my_source: |
||||
copyright = [] |
||||
for line in my_source: |
||||
if line[0] != '#': break |
||||
for line in my_source: |
||||
if line[0] == '#': |
||||
copyright.append(line) |
||||
break |
||||
for line in my_source: |
||||
if line[0] != '#': |
||||
break |
||||
copyright.append(line) |
||||
put_banner([H,C], [line[1:].strip() for line in copyright]) |
||||
|
||||
put_banner([H,C], |
||||
"""WARNING: Auto-generated code. |
||||
|
||||
To make changes to this file, change tools/codegen/core/gen_static_metadata.py, |
||||
and then re-run it. |
||||
""".splitlines()) |
||||
|
||||
print >>H, '#ifndef GRPC_INTERNAL_CORE_TRANSPORT_STATIC_METADATA_H' |
||||
print >>H, '#define GRPC_INTERNAL_CORE_TRANSPORT_STATIC_METADATA_H' |
||||
print >>H |
||||
print >>H, '#include "src/core/transport/metadata.h"' |
||||
print >>H |
||||
|
||||
print >>C, '#include "src/core/transport/static_metadata.h"' |
||||
print >>C |
||||
|
||||
print >>H, '#define GRPC_STATIC_MDSTR_COUNT %d' % len(all_strs) |
||||
print >>H, 'extern grpc_mdstr grpc_static_mdstr_table[GRPC_STATIC_MDSTR_COUNT];' |
||||
for i, elem in enumerate(all_strs): |
||||
print >>H, '/* "%s" */' % elem |
||||
print >>H, '#define %s (&grpc_static_mdstr_table[%d])' % (mangle(elem).upper(), i) |
||||
print >>H |
||||
print >>C, 'grpc_mdstr grpc_static_mdstr_table[GRPC_STATIC_MDSTR_COUNT];' |
||||
print >>C |
||||
|
||||
print >>H, '#define GRPC_STATIC_MDELEM_COUNT %d' % len(all_elems) |
||||
print >>H, 'extern grpc_mdelem grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT];' |
||||
for i, elem in enumerate(all_elems): |
||||
print >>H, '/* "%s": "%s" */' % elem |
||||
print >>H, '#define %s (&grpc_static_mdelem_table[%d])' % (mangle(elem).upper(), i) |
||||
print >>H |
||||
print >>C, 'grpc_mdelem grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT];' |
||||
print >>C |
||||
|
||||
def str_idx(s): |
||||
for i, s2 in enumerate(all_strs): |
||||
if s == s2: |
||||
return i |
||||
|
||||
print >>H, 'gpr_uint8 grpc_static_metadata_elem_indices[GRPC_STATIC_MDELEM_COUNT*2];' |
||||
print >>C, 'gpr_uint8 grpc_static_metadata_elem_indices[GRPC_STATIC_MDELEM_COUNT*2] = {' |
||||
print >>C, ','.join('%d' % str_idx(x) for x in itertools.chain.from_iterable([a,b] for a, b in all_elems)) |
||||
print >>C, '};' |
||||
print >>C |
||||
|
||||
print >>H, 'const char *grpc_static_metadata_strings[GRPC_STATIC_MDSTR_COUNT];' |
||||
print >>C, 'const char *grpc_static_metadata_strings[GRPC_STATIC_MDSTR_COUNT] = {' |
||||
print >>C, '%s' % ',\n'.join(' "%s"' % s for s in all_strs) |
||||
print >>C, '};' |
||||
print >>C |
||||
|
||||
print >>H, '#endif /* GRPC_INTERNAL_CORE_TRANSPORT_STATIC_METADATA_H */' |
||||
|
||||
H.close() |
||||
C.close() |
||||
|
Loading…
Reference in new issue