Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(621)

Unified Diff: net/http2/tools/random_util.h

Issue 2606733004: Add HpackDecoderTables, static and dynamic tables for decoding HPACK. (Closed)
Patch Set: Rebase. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/http2/tools/http2_random.cc ('k') | net/http2/tools/random_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http2/tools/random_util.h
diff --git a/net/http2/tools/random_util.h b/net/http2/tools/random_util.h
new file mode 100644
index 0000000000000000000000000000000000000000..d29609a1de8d84a53e668f54fbb16ca56e107cbc
--- /dev/null
+++ b/net/http2/tools/random_util.h
@@ -0,0 +1,39 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef NET_HTTP2_TOOLS_RANDOM_UTIL_H_
+#define NET_HTTP2_TOOLS_RANDOM_UTIL_H_
+
+#include <stddef.h>
+
+#include <string>
+
+#include "base/strings/string_piece.h"
+
+namespace net {
+namespace test {
+
+class RandomBase;
+
+// Returns a random string of length |len|, each character drawn uniformly and
+// independently fom |alphabet|.
+std::string RandomString(RandomBase* rng, int len, base::StringPiece alphabet);
+
+// Returns a random integer in the range [lo, hi).
+size_t GenerateUniformInRange(size_t lo, size_t hi, RandomBase* rng);
+
+// Generate a string with the allowed character set for HTTP/2 / HPACK header
+// names.
+std::string GenerateHttp2HeaderName(size_t len, RandomBase* rng);
+
+// Generate a string with the web-safe string character set of specified len.
+std::string GenerateWebSafeString(size_t len, RandomBase* rng);
+
+// Generate a string with the web-safe string character set of length [lo, hi).
+std::string GenerateWebSafeString(size_t lo, size_t hi, RandomBase* rng);
+
+} // namespace test
+} // namespace net
+
+#endif // NET_HTTP2_TOOLS_RANDOM_UTIL_H_
« no previous file with comments | « net/http2/tools/http2_random.cc ('k') | net/http2/tools/random_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698