You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

166 lines
5.8 KiB

  1. diff --git a/src/http-heads.h b/src/http-heads.h
  2. new file mode 100644
  3. index 0000000..9f0927b
  4. --- /dev/null
  5. +++ b/src/http-heads.h
  6. @@ -0,0 +1,160 @@
  7. +/* ANSI-C code produced by gperf version 3.0.4 */
  8. +/* Command-line: gperf --global-table -t http-heads.gperf */
  9. +/* Computed positions: -k'3,8' */
  10. +
  11. +#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
  12. + && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
  13. + && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
  14. + && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
  15. + && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
  16. + && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
  17. + && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
  18. + && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
  19. + && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
  20. + && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
  21. + && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
  22. + && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
  23. + && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
  24. + && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
  25. + && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
  26. + && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
  27. + && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
  28. + && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
  29. + && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
  30. + && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
  31. + && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
  32. + && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
  33. + && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
  34. +/* The character set is not based on ISO-646. */
  35. +#error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>."
  36. +#endif
  37. +
  38. +#line 1 "http-heads.gperf"
  39. +
  40. +#include "vpn.h"
  41. +#line 6 "http-heads.gperf"
  42. +struct http_headers_st { const char *name; unsigned id; };
  43. +
  44. +#define TOTAL_KEYWORDS 12
  45. +#define MIN_WORD_LENGTH 6
  46. +#define MAX_WORD_LENGTH 34
  47. +#define MIN_HASH_VALUE 6
  48. +#define MAX_HASH_VALUE 35
  49. +/* maximum key range = 30, duplicates = 0 */
  50. +
  51. +#ifdef __GNUC__
  52. +__inline
  53. +#else
  54. +#ifdef __cplusplus
  55. +inline
  56. +#endif
  57. +#endif
  58. +static unsigned int
  59. +hash (register const char *str, register unsigned int len)
  60. +{
  61. + static const unsigned char asso_values[] =
  62. + {
  63. + 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
  64. + 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
  65. + 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
  66. + 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
  67. + 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
  68. + 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
  69. + 36, 36, 36, 36, 36, 0, 15, 5, 0, 36,
  70. + 0, 36, 10, 36, 36, 36, 36, 5, 36, 36,
  71. + 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
  72. + 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
  73. + 36, 5, 36, 36, 36, 0, 36, 36, 36, 36,
  74. + 0, 0, 36, 36, 36, 36, 36, 36, 36, 36,
  75. + 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
  76. + 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
  77. + 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
  78. + 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
  79. + 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
  80. + 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
  81. + 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
  82. + 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
  83. + 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
  84. + 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
  85. + 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
  86. + 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
  87. + 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
  88. + 36, 36, 36, 36, 36, 36
  89. + };
  90. + register int hval = len;
  91. +
  92. + switch (hval)
  93. + {
  94. + default:
  95. + hval += asso_values[(unsigned char)str[7]];
  96. + /*FALLTHROUGH*/
  97. + case 7:
  98. + case 6:
  99. + case 5:
  100. + case 4:
  101. + case 3:
  102. + hval += asso_values[(unsigned char)str[2]];
  103. + break;
  104. + }
  105. + return hval;
  106. +}
  107. +
  108. +static const struct http_headers_st wordlist[] =
  109. + {
  110. + {""}, {""}, {""}, {""}, {""}, {""},
  111. +#line 8 "http-heads.gperf"
  112. + {"Cookie", HEADER_COOKIE},
  113. + {""}, {""}, {""},
  114. +#line 12 "http-heads.gperf"
  115. + {"Connection", HEADER_CONNECTION},
  116. + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
  117. +#line 9 "http-heads.gperf"
  118. + {"User-Agent", HEADER_USER_AGENT},
  119. + {""},
  120. +#line 11 "http-heads.gperf"
  121. + {"X-DTLS-Accept-Encoding", HEADER_DTLS_ENCODING},
  122. +#line 14 "http-heads.gperf"
  123. + {"X-DTLS-CipherSuite", HEADER_DTLS_CIPHERSUITE},
  124. +#line 16 "http-heads.gperf"
  125. + {"X-CSTP-Address-Type", HEADER_CSTP_ATYPE},
  126. +#line 13 "http-heads.gperf"
  127. + {"X-DTLS-Master-Secret", HEADER_MASTER_SECRET},
  128. + {""},
  129. +#line 10 "http-heads.gperf"
  130. + {"X-CSTP-Accept-Encoding", HEADER_CSTP_ENCODING},
  131. + {""}, {""},
  132. +#line 17 "http-heads.gperf"
  133. + {"X-CSTP-Hostname", HEADER_HOSTNAME},
  134. + {""},
  135. +#line 18 "http-heads.gperf"
  136. + {"X-CSTP-Full-IPv6-Capability", HEADER_FULL_IPV6},
  137. + {""},
  138. +#line 19 "http-heads.gperf"
  139. + {"X-AnyConnect-Identifier-DeviceType", HEADER_DEVICE_TYPE},
  140. +#line 15 "http-heads.gperf"
  141. + {"X-CSTP-Base-MTU", HEADER_CSTP_BASE_MTU}
  142. + };
  143. +
  144. +#ifdef __GNUC__
  145. +__inline
  146. +#if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__
  147. +__attribute__ ((__gnu_inline__))
  148. +#endif
  149. +#endif
  150. +const struct http_headers_st *
  151. +in_word_set (register const char *str, register unsigned int len)
  152. +{
  153. + if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
  154. + {
  155. + register int key = hash (str, len);
  156. +
  157. + if (key <= MAX_HASH_VALUE && key >= 0)
  158. + {
  159. + register const char *s = wordlist[key].name;
  160. +
  161. + if (*str == *s && !strcmp (str + 1, s + 1))
  162. + return &wordlist[key];
  163. + }
  164. + }
  165. + return 0;
  166. +}