lsqpack 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +19 -0
  3. data/Gemfile.lock +82 -0
  4. data/LICENSE +21 -0
  5. data/README.md +36 -0
  6. data/Rakefile +19 -0
  7. data/Steepfile +6 -0
  8. data/ext/lsqpack/extconf.rb +18 -0
  9. data/ext/lsqpack/lsqpack.c +426 -0
  10. data/ext/lsqpack/lsqpack.h +6 -0
  11. data/lib/lsqpack/version.rb +5 -0
  12. data/lib/lsqpack.rb +30 -0
  13. data/ls-qpack/.appveyor.yml +14 -0
  14. data/ls-qpack/.cirrus.yml +6 -0
  15. data/ls-qpack/.travis.yml +32 -0
  16. data/ls-qpack/CMakeLists.txt +66 -0
  17. data/ls-qpack/LICENSE +21 -0
  18. data/ls-qpack/README.md +65 -0
  19. data/ls-qpack/bin/CMakeLists.txt +21 -0
  20. data/ls-qpack/bin/encode-int.c +87 -0
  21. data/ls-qpack/bin/fuzz-decode.c +247 -0
  22. data/ls-qpack/bin/interop-decode.c +433 -0
  23. data/ls-qpack/bin/interop-encode.c +554 -0
  24. data/ls-qpack/deps/xxhash/xxhash.c +941 -0
  25. data/ls-qpack/deps/xxhash/xxhash.h +160 -0
  26. data/ls-qpack/fuzz/decode/a/README +3 -0
  27. data/ls-qpack/fuzz/decode/a/preamble +0 -0
  28. data/ls-qpack/fuzz/decode/a/test-cases/id_000000,sig_06,src_000390,op_havoc,rep_4 +0 -0
  29. data/ls-qpack/fuzz/decode/a/test-cases/id_000000,sig_06,src_000579,op_flip1,pos_14 +0 -0
  30. data/ls-qpack/fuzz/decode/a/test-cases/id_000000,src_000000,op_flip2,pos_12 +0 -0
  31. data/ls-qpack/fuzz/decode/a/test-cases/id_000001,sig_11,src_000579,op_havoc,rep_4 +0 -0
  32. data/ls-qpack/fuzz/decode/a/test-cases/id_000002,sig_11,src_000481,op_int16,pos_15,val_-1 +0 -0
  33. data/ls-qpack/fuzz/decode/a/test-cases/id_000002,src_000000,op_havoc,rep_8 +0 -0
  34. data/ls-qpack/fuzz/decode/a/test-cases/id_000006,src_000285,op_flip2,pos_14 +0 -0
  35. data/ls-qpack/fuzz/decode/a/test-cases/id_000008,src_000285,op_flip2,pos_20 +0 -0
  36. data/ls-qpack/fuzz/decode/a/test-cases/id_000010,src_000306,op_flip2,pos_75 +0 -0
  37. data/ls-qpack/fuzz/decode/a/test-cases/id_000011,src_000344,op_havoc,rep_2 +0 -0
  38. data/ls-qpack/fuzz/decode/a/test-cases/id_000014,src_000366,op_flip2,pos_28 +0 -0
  39. data/ls-qpack/fuzz/decode/b/README +1 -0
  40. data/ls-qpack/fuzz/decode/b/preamble +0 -0
  41. data/ls-qpack/fuzz/decode/b/test-cases/seed +0 -0
  42. data/ls-qpack/fuzz/decode/c/setup.sh +3 -0
  43. data/ls-qpack/fuzz/decode/c/test-cases/fb-req.qif.proxygen.out.256.100.0-chopped +0 -0
  44. data/ls-qpack/fuzz/decode/d/preamble +0 -0
  45. data/ls-qpack/fuzz/decode/d/setup.sh +3 -0
  46. data/ls-qpack/fuzz/decode/d/test-cases/fb-resp.minhq.256.128.0.ack +0 -0
  47. data/ls-qpack/fuzz/input/256.100.1/fb-req.out.256.100.1 +0 -0
  48. data/ls-qpack/fuzz/input/256.100.1/fb-resp.out.256.100.1 +0 -0
  49. data/ls-qpack/fuzz/input/256.100.1/netbsd.out.256.100.1 +0 -0
  50. data/ls-qpack/huff-tables.h +136247 -0
  51. data/ls-qpack/lsqpack.c +5547 -0
  52. data/ls-qpack/lsqpack.h +768 -0
  53. data/ls-qpack/test/CMakeLists.txt +76 -0
  54. data/ls-qpack/test/lsqpack-test.h +43 -0
  55. data/ls-qpack/test/qifs/fb-req.qif +4917 -0
  56. data/ls-qpack/test/qifs/fb-resp.qif +5982 -0
  57. data/ls-qpack/test/qifs/long-codes.qif +5984 -0
  58. data/ls-qpack/test/qifs/netbsd.qif +235 -0
  59. data/ls-qpack/test/run-qif.pl +97 -0
  60. data/ls-qpack/test/run-scenario.sh +68 -0
  61. data/ls-qpack/test/scenarios/0.95-reset.sce +10 -0
  62. data/ls-qpack/test/scenarios/cancel-stream.sce +22 -0
  63. data/ls-qpack/test/scenarios/drain-2.sce +37 -0
  64. data/ls-qpack/test/scenarios/drain.sce +37 -0
  65. data/ls-qpack/test/scenarios/end-dst-2.sce +14 -0
  66. data/ls-qpack/test/scenarios/end-dst.sce +14 -0
  67. data/ls-qpack/test/scenarios/incl-name.sce +13 -0
  68. data/ls-qpack/test/scenarios/multi-byte-int-dyn-ref-1.sce +110 -0
  69. data/ls-qpack/test/scenarios/multi-byte-int-dyn-ref-2.sce +161 -0
  70. data/ls-qpack/test/scenarios/post-base-1.sce +10 -0
  71. data/ls-qpack/test/scenarios/post-base-2.sce +13 -0
  72. data/ls-qpack/test/scenarios/post-base-nr.sce +10 -0
  73. data/ls-qpack/test/scenarios/set-max-cap.sce +15 -0
  74. data/ls-qpack/test/test_enc_str.c +139 -0
  75. data/ls-qpack/test/test_get_stx_id.c +144 -0
  76. data/ls-qpack/test/test_huff_dec.c +399 -0
  77. data/ls-qpack/test/test_int.c +220 -0
  78. data/ls-qpack/test/test_qpack.c +856 -0
  79. data/ls-qpack/test/test_read_enc_stream.c +256 -0
  80. data/ls-qpack/tools/har2qif.pl +139 -0
  81. data/ls-qpack/tools/randomize-cookies.pl +41 -0
  82. data/ls-qpack/tools/sort-qif.pl +31 -0
  83. data/ls-qpack/wincompat/getopt.c +758 -0
  84. data/ls-qpack/wincompat/getopt.h +131 -0
  85. data/ls-qpack/wincompat/getopt1.c +188 -0
  86. data/ls-qpack/wincompat/sys/queue.h +859 -0
  87. data/lsqpack.gemspec +39 -0
  88. data/sig/lsqpack.rbs +29 -0
  89. metadata +135 -0
@@ -0,0 +1,131 @@
1
+ /* Declarations for getopt.
2
+ Copyright (C) 1989, 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
3
+
4
+ This program is free software; you can redistribute it and/or modify it
5
+ under the terms of the GNU General Public License as published by the
6
+ Free Software Foundation; either version 2, or (at your option) any
7
+ later version.
8
+
9
+ This program is distributed in the hope that it will be useful,
10
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ GNU General Public License for more details.
13
+
14
+ You should have received a copy of the GNU General Public License
15
+ along with this program; if not, write to the Free Software
16
+ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
17
+
18
+ /* $CVSid: @(#)getopt.h 1.7 94/09/21 $ */
19
+
20
+ #ifndef _GETOPT_H
21
+ #define _GETOPT_H 1
22
+
23
+ #ifdef __cplusplus
24
+ extern "C" {
25
+ #endif
26
+
27
+ /* For communication from `getopt' to the caller.
28
+ When `getopt' finds an option that takes an argument,
29
+ the argument value is returned here.
30
+ Also, when `ordering' is RETURN_IN_ORDER,
31
+ each non-option ARGV-element is returned here. */
32
+
33
+ extern char *optarg;
34
+
35
+ /* Index in ARGV of the next element to be scanned.
36
+ This is used for communication to and from the caller
37
+ and for communication between successive calls to `getopt'.
38
+
39
+ On entry to `getopt', zero means this is the first call; initialize.
40
+
41
+ When `getopt' returns EOF, this is the index of the first of the
42
+ non-option elements that the caller should itself scan.
43
+
44
+ Otherwise, `optind' communicates from one call to the next
45
+ how much of ARGV has been scanned so far. */
46
+
47
+ extern int optind;
48
+
49
+ /* Callers store zero here to inhibit the error message `getopt' prints
50
+ for unrecognized options. */
51
+
52
+ extern int opterr;
53
+
54
+ /* Set to an option character which was unrecognized. */
55
+
56
+ extern int optopt;
57
+
58
+ /* Describe the long-named options requested by the application.
59
+ The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
60
+ of `struct option' terminated by an element containing a name which is
61
+ zero.
62
+
63
+ The field `has_arg' is:
64
+ no_argument (or 0) if the option does not take an argument,
65
+ required_argument (or 1) if the option requires an argument,
66
+ optional_argument (or 2) if the option takes an optional argument.
67
+
68
+ If the field `flag' is not NULL, it points to a variable that is set
69
+ to the value given in the field `val' when the option is found, but
70
+ left unchanged if the option is not found.
71
+
72
+ To have a long-named option do something other than set an `int' to
73
+ a compiled-in constant, such as set a value from `optarg', set the
74
+ option's `flag' field to zero and its `val' field to a nonzero
75
+ value (the equivalent single-letter option character, if there is
76
+ one). For long options that have a zero `flag' field, `getopt'
77
+ returns the contents of the `val' field. */
78
+
79
+ struct option
80
+ {
81
+ #if __STDC__
82
+ const char *name;
83
+ #else
84
+ char *name;
85
+ #endif
86
+ /* has_arg can't be an enum because some compilers complain about
87
+ type mismatches in all the code that assumes it is an int. */
88
+ int has_arg;
89
+ int *flag;
90
+ int val;
91
+ };
92
+
93
+ /* Names for the values of the `has_arg' field of `struct option'. */
94
+
95
+ #define no_argument 0
96
+ #define required_argument 1
97
+ #define optional_argument 2
98
+
99
+ #if __STDC__
100
+ #if defined(__GNU_LIBRARY__)
101
+ /* Many other libraries have conflicting prototypes for getopt, with
102
+ differences in the consts, in stdlib.h. To avoid compilation
103
+ errors, only prototype getopt for the GNU C library. */
104
+ extern int getopt (int argc, char *const *argv, const char *shortopts);
105
+ #else /* not __GNU_LIBRARY__ */
106
+ extern int getopt ();
107
+ #endif /* not __GNU_LIBRARY__ */
108
+ extern int getopt_long (int argc, char *const *argv, const char *shortopts,
109
+ const struct option *longopts, int *longind);
110
+ extern int getopt_long_only (int argc, char *const *argv,
111
+ const char *shortopts,
112
+ const struct option *longopts, int *longind);
113
+
114
+ /* Internal only. Users should not call this directly. */
115
+ extern int _getopt_internal (int argc, char *const *argv,
116
+ const char *shortopts,
117
+ const struct option *longopts, int *longind,
118
+ int long_only);
119
+ #else /* not __STDC__ */
120
+ extern int getopt ();
121
+ extern int getopt_long ();
122
+ extern int getopt_long_only ();
123
+
124
+ extern int _getopt_internal ();
125
+ #endif /* not __STDC__ */
126
+
127
+ #ifdef __cplusplus
128
+ }
129
+ #endif
130
+
131
+ #endif /* _GETOPT_H */
@@ -0,0 +1,188 @@
1
+ /* getopt_long and getopt_long_only entry points for GNU getopt.
2
+ Copyright (C) 1987, 88, 89, 90, 91, 92, 1993
3
+ Free Software Foundation, Inc.
4
+
5
+ This program is free software; you can redistribute it and/or modify it
6
+ under the terms of the GNU General Public License as published by the
7
+ Free Software Foundation; either version 2, or (at your option) any
8
+ later version.
9
+
10
+ This program is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ GNU General Public License for more details.
14
+
15
+ You should have received a copy of the GNU General Public License
16
+ along with this program; if not, write to the Free Software
17
+ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
18
+
19
+ #ifdef HAVE_CONFIG_H
20
+ #if defined (emacs) || defined (CONFIG_BROKETS)
21
+ /* We use <config.h> instead of "config.h" so that a compilation
22
+ using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h
23
+ (which it would do because it found this file in $srcdir). */
24
+ #include <config.h>
25
+ #else
26
+ #include "config.h"
27
+ #endif
28
+ #endif
29
+
30
+ #pragma warning(disable:4131)
31
+ #include "getopt.h"
32
+
33
+ #ifndef __STDC__
34
+ /* This is a separate conditional since some stdc systems
35
+ reject `defined (const)'. */
36
+ #ifndef const
37
+ #define const
38
+ #endif
39
+ #endif
40
+
41
+ #include <stdio.h>
42
+
43
+ /* Comment out all this code if we are using the GNU C Library, and are not
44
+ actually compiling the library itself. This code is part of the GNU C
45
+ Library, but also included in many other GNU distributions. Compiling
46
+ and linking in this code is a waste when using the GNU C library
47
+ (especially if it is a shared library). Rather than having every GNU
48
+ program understand `configure --with-gnu-libc' and omit the object files,
49
+ it is simpler to just do this in the source for each such file. */
50
+
51
+ #if defined (_LIBC) || !defined (__GNU_LIBRARY__)
52
+
53
+
54
+ /* This needs to come after some library #include
55
+ to get __GNU_LIBRARY__ defined. */
56
+ #ifdef __GNU_LIBRARY__
57
+ #include <stdlib.h>
58
+ #else
59
+ char *getenv ();
60
+ #endif
61
+
62
+ #ifndef NULL
63
+ #define NULL 0
64
+ #endif
65
+
66
+ int
67
+ getopt_long (argc, argv, options, long_options, opt_index)
68
+ int argc;
69
+ char *const *argv;
70
+ const char *options;
71
+ const struct option *long_options;
72
+ int *opt_index;
73
+ {
74
+ return _getopt_internal (argc, argv, options, long_options, opt_index, 0);
75
+ }
76
+
77
+ /* Like getopt_long, but '-' as well as '--' can indicate a long option.
78
+ If an option that starts with '-' (not '--') doesn't match a long option,
79
+ but does match a short option, it is parsed as a short option
80
+ instead. */
81
+
82
+ int
83
+ getopt_long_only (argc, argv, options, long_options, opt_index)
84
+ int argc;
85
+ char *const *argv;
86
+ const char *options;
87
+ const struct option *long_options;
88
+ int *opt_index;
89
+ {
90
+ return _getopt_internal (argc, argv, options, long_options, opt_index, 1);
91
+ }
92
+
93
+
94
+ #endif /* _LIBC or not __GNU_LIBRARY__. */
95
+
96
+ #ifdef TEST
97
+
98
+ #include <stdio.h>
99
+
100
+ int
101
+ main (argc, argv)
102
+ int argc;
103
+ char **argv;
104
+ {
105
+ int c;
106
+ int digit_optind = 0;
107
+
108
+ while (1)
109
+ {
110
+ int this_option_optind = optind ? optind : 1;
111
+ int option_index = 0;
112
+ static struct option long_options[] =
113
+ {
114
+ {"add", 1, 0, 0},
115
+ {"append", 0, 0, 0},
116
+ {"delete", 1, 0, 0},
117
+ {"verbose", 0, 0, 0},
118
+ {"create", 0, 0, 0},
119
+ {"file", 1, 0, 0},
120
+ {0, 0, 0, 0}
121
+ };
122
+
123
+ c = getopt_long (argc, argv, "abc:d:0123456789",
124
+ long_options, &option_index);
125
+ if (c == EOF)
126
+ break;
127
+
128
+ switch (c)
129
+ {
130
+ case 0:
131
+ printf ("option %s", long_options[option_index].name);
132
+ if (optarg)
133
+ printf (" with arg %s", optarg);
134
+ printf ("\n");
135
+ break;
136
+
137
+ case '0':
138
+ case '1':
139
+ case '2':
140
+ case '3':
141
+ case '4':
142
+ case '5':
143
+ case '6':
144
+ case '7':
145
+ case '8':
146
+ case '9':
147
+ if (digit_optind != 0 && digit_optind != this_option_optind)
148
+ printf ("digits occur in two different argv-elements.\n");
149
+ digit_optind = this_option_optind;
150
+ printf ("option %c\n", c);
151
+ break;
152
+
153
+ case 'a':
154
+ printf ("option a\n");
155
+ break;
156
+
157
+ case 'b':
158
+ printf ("option b\n");
159
+ break;
160
+
161
+ case 'c':
162
+ printf ("option c with value `%s'\n", optarg);
163
+ break;
164
+
165
+ case 'd':
166
+ printf ("option d with value `%s'\n", optarg);
167
+ break;
168
+
169
+ case '?':
170
+ break;
171
+
172
+ default:
173
+ printf ("?? getopt returned character code 0%o ??\n", c);
174
+ }
175
+ }
176
+
177
+ if (optind < argc)
178
+ {
179
+ printf ("non-option ARGV-elements: ");
180
+ while (optind < argc)
181
+ printf ("%s ", argv[optind++]);
182
+ printf ("\n");
183
+ }
184
+
185
+ exit (0);
186
+ }
187
+
188
+ #endif /* TEST */