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

Unified Diff: net/spdy/spdy_protocol.h

Issue 202073003: Introduce new SpdyConstants class (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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/spdy/spdy_framer_test.cc ('k') | net/spdy/spdy_protocol.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/spdy_protocol.h
diff --git a/net/spdy/spdy_protocol.h b/net/spdy/spdy_protocol.h
index fd1351a487e48b3f8eb7f774689881325c7434a5..e871d2c24c8d1a47f20162864ff94be5267212a8 100644
--- a/net/spdy/spdy_protocol.h
+++ b/net/spdy/spdy_protocol.h
@@ -384,6 +384,28 @@ typedef std::map<std::string, std::string> SpdyNameValueBlock;
typedef uint64 SpdyPingId;
+// TODO(hkhalil): Add direct testing for this? It won't increase coverage any,
+// but is good to do anyway.
+class SpdyConstants {
+ public:
+ // Returns true if a given on-the-wire enumeration of a frame type is valid
+ // for a given protocol version, false otherwise.
+ static bool IsValidFrameType(SpdyMajorVersion version, int frame_type_field);
+
+ // Parses a frame type from an on-the-wire enumeration of a given protocol
+ // version.
+ // Behavior is undefined for invalid frame type fields; consumers should first
+ // use IsValidFrameType() to verify validity of frame type fields.
+ static SpdyFrameType ParseFrameType(SpdyMajorVersion version,
+ int frame_type_field);
+
+ // Serializes a given frame type to the on-the-wire enumeration value for the
+ // given protocol version.
+ // Returns -1 on failure (I.E. Invalid frame type for the given version).
+ static int SerializeFrameType(SpdyMajorVersion version,
+ SpdyFrameType frame_type);
+};
+
class SpdyFrame;
typedef SpdyFrame SpdySerializedFrame;
« no previous file with comments | « net/spdy/spdy_framer_test.cc ('k') | net/spdy/spdy_protocol.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698