160620859SDmitri Tikhonov#!/usr/bin/perl 260620859SDmitri Tikhonov# Generate static table enums 360620859SDmitri Tikhonov 460620859SDmitri Tikhonovuse strict; 560620859SDmitri Tikhonovuse warnings; 660620859SDmitri Tikhonov 760620859SDmitri Tikhonovmy @table = ( 860620859SDmitri Tikhonov ":authority", "", 960620859SDmitri Tikhonov ":path", "/", 1060620859SDmitri Tikhonov "age", "0", 1160620859SDmitri Tikhonov "content-disposition", "", 1260620859SDmitri Tikhonov "content-length", "0", 1360620859SDmitri Tikhonov "cookie", "", 1460620859SDmitri Tikhonov "date", "", 1560620859SDmitri Tikhonov "etag", "", 1660620859SDmitri Tikhonov "if-modified-since", "", 1760620859SDmitri Tikhonov "if-none-match", "", 1860620859SDmitri Tikhonov "last-modified", "", 1960620859SDmitri Tikhonov "link", "", 2060620859SDmitri Tikhonov "location", "", 2160620859SDmitri Tikhonov "referer", "", 2260620859SDmitri Tikhonov "set-cookie", "", 2360620859SDmitri Tikhonov ":method", "CONNECT", 2460620859SDmitri Tikhonov ":method", "DELETE", 2560620859SDmitri Tikhonov ":method", "GET", 2660620859SDmitri Tikhonov ":method", "HEAD", 2760620859SDmitri Tikhonov ":method", "OPTIONS", 2860620859SDmitri Tikhonov ":method", "POST", 2960620859SDmitri Tikhonov ":method", "PUT", 3060620859SDmitri Tikhonov ":scheme", "http", 3160620859SDmitri Tikhonov ":scheme", "https", 3260620859SDmitri Tikhonov ":status", "103", 3360620859SDmitri Tikhonov ":status", "200", 3460620859SDmitri Tikhonov ":status", "304", 3560620859SDmitri Tikhonov ":status", "404", 3660620859SDmitri Tikhonov ":status", "503", 3760620859SDmitri Tikhonov "accept", "*/*", 3860620859SDmitri Tikhonov "accept", "application/dns-message", 3960620859SDmitri Tikhonov "accept-encoding", "gzip, deflate, br", 4060620859SDmitri Tikhonov "accept-ranges", "bytes", 4160620859SDmitri Tikhonov "access-control-allow-headers", "cache-control", 4260620859SDmitri Tikhonov "access-control-allow-headers", "content-type", 4360620859SDmitri Tikhonov "access-control-allow-origin", "*", 4460620859SDmitri Tikhonov "cache-control", "max-age=0", 4560620859SDmitri Tikhonov "cache-control", "max-age=2592000", 4660620859SDmitri Tikhonov "cache-control", "max-age=604800", 4760620859SDmitri Tikhonov "cache-control", "no-cache", 4860620859SDmitri Tikhonov "cache-control", "no-store", 4960620859SDmitri Tikhonov "cache-control", "public, max-age=31536000", 5060620859SDmitri Tikhonov "content-encoding", "br", 5160620859SDmitri Tikhonov "content-encoding", "gzip", 5260620859SDmitri Tikhonov "content-type", "application/dns-message", 5360620859SDmitri Tikhonov "content-type", "application/javascript", 5460620859SDmitri Tikhonov "content-type", "application/json", 5560620859SDmitri Tikhonov "content-type", "application/x-www-form-urlencoded", 5660620859SDmitri Tikhonov "content-type", "image/gif", 5760620859SDmitri Tikhonov "content-type", "image/jpeg", 5860620859SDmitri Tikhonov "content-type", "image/png", 5960620859SDmitri Tikhonov "content-type", "text/css", 6060620859SDmitri Tikhonov "content-type", "text/html; charset=utf-8", 6160620859SDmitri Tikhonov "content-type", "text/plain", 6260620859SDmitri Tikhonov "content-type", "text/plain;charset=utf-8", 6360620859SDmitri Tikhonov "range", "bytes=0-", 6460620859SDmitri Tikhonov "strict-transport-security", "max-age=31536000", 6560620859SDmitri Tikhonov "strict-transport-security", "max-age=31536000; includesubdomains", 6660620859SDmitri Tikhonov "strict-transport-security", "max-age=31536000; includesubdomains; preload", 6760620859SDmitri Tikhonov "vary", "accept-encoding", 6860620859SDmitri Tikhonov "vary", "origin", 6960620859SDmitri Tikhonov "x-content-type-options", "nosniff", 7060620859SDmitri Tikhonov "x-xss-protection", "1; mode=block", 7160620859SDmitri Tikhonov ":status", "100", 7260620859SDmitri Tikhonov ":status", "204", 7360620859SDmitri Tikhonov ":status", "206", 7460620859SDmitri Tikhonov ":status", "302", 7560620859SDmitri Tikhonov ":status", "400", 7660620859SDmitri Tikhonov ":status", "403", 7760620859SDmitri Tikhonov ":status", "421", 7860620859SDmitri Tikhonov ":status", "425", 7960620859SDmitri Tikhonov ":status", "500", 8060620859SDmitri Tikhonov "accept-language", "", 8160620859SDmitri Tikhonov "access-control-allow-credentials", "FALSE", 8260620859SDmitri Tikhonov "access-control-allow-credentials", "TRUE", 8360620859SDmitri Tikhonov "access-control-allow-headers", "*", 8460620859SDmitri Tikhonov "access-control-allow-methods", "get", 8560620859SDmitri Tikhonov "access-control-allow-methods", "get, post, options", 8660620859SDmitri Tikhonov "access-control-allow-methods", "options", 8760620859SDmitri Tikhonov "access-control-expose-headers", "content-length", 8860620859SDmitri Tikhonov "access-control-request-headers", "content-type", 8960620859SDmitri Tikhonov "access-control-request-method", "get", 9060620859SDmitri Tikhonov "access-control-request-method", "post", 9160620859SDmitri Tikhonov "alt-svc", "clear", 9260620859SDmitri Tikhonov "authorization", "", 9360620859SDmitri Tikhonov "content-security-policy", "script-src 'none'; object-src 'none'; base-uri 'none'", 9460620859SDmitri Tikhonov "early-data", "1", 9560620859SDmitri Tikhonov "expect-ct", "", 9660620859SDmitri Tikhonov "forwarded", "", 9760620859SDmitri Tikhonov "if-range", "", 9860620859SDmitri Tikhonov "origin", "", 9960620859SDmitri Tikhonov "purpose", "prefetch", 10060620859SDmitri Tikhonov "server", "", 10160620859SDmitri Tikhonov "timing-allow-origin", "*", 10260620859SDmitri Tikhonov "upgrade-insecure-requests", "1", 10360620859SDmitri Tikhonov "user-agent", "", 10460620859SDmitri Tikhonov "x-forwarded-for", "", 10560620859SDmitri Tikhonov "x-frame-options", "deny", 10660620859SDmitri Tikhonov "x-frame-options", "sameorigin", 10760620859SDmitri Tikhonov); 10860620859SDmitri Tikhonov 10960620859SDmitri Tikhonov 11060620859SDmitri Tikhonovmy $idx = 0; 11160620859SDmitri Tikhonovprint "enum lsqpack_tnam {\n"; 11260620859SDmitri Tikhonovwhile (my ($name, $value) = splice(@table, 0, 2)) { 11360620859SDmitri Tikhonov my $enum = "$name-$value"; 11460620859SDmitri Tikhonov $enum =~ tr/a-z/A-Z/; 11560620859SDmitri Tikhonov $enum =~ tr/-/_/; 11660620859SDmitri Tikhonov $enum =~ s~[^A-Z0-9_]~_~g; 11760620859SDmitri Tikhonov $enum =~ s/_+/_/g; 11860620859SDmitri Tikhonov $enum =~ s/_+$//; 11960620859SDmitri Tikhonov $enum =~ s/^_+//; 12060620859SDmitri Tikhonov print " LSQPACK_TNV_$enum = $idx, /* \"$name\" \"$value\" */\n"; 12160620859SDmitri Tikhonov ++$idx; 12260620859SDmitri Tikhonov} 12360620859SDmitri Tikhonovprint "};\n\n"; 124