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

Side by Side Diff: net/spdy/spdy_protocol.h

Issue 288373004: Add handling + parsing for HTTP/2 ALTSVC frame. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Non-static initializer fixes. Created 6 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/spdy/spdy_framer_test.cc ('k') | net/spdy/spdy_protocol.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This file contains some protocol structures for use with SPDY 2 and 3 5 // This file contains some protocol structures for use with SPDY 2 and 3
6 // The SPDY 2 spec can be found at: 6 // The SPDY 2 spec can be found at:
7 // http://dev.chromium.org/spdy/spdy-protocol/spdy-protocol-draft2 7 // http://dev.chromium.org/spdy/spdy-protocol/spdy-protocol-draft2
8 // The SPDY 3 spec can be found at: 8 // The SPDY 3 spec can be found at:
9 // http://dev.chromium.org/spdy/spdy-protocol/spdy-protocol-draft3 9 // http://dev.chromium.org/spdy/spdy-protocol/spdy-protocol-draft3
10 10
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 SETTINGS, 280 SETTINGS,
281 NOOP, // Because it is valid in SPDY/2, kept for identifiability/enum order. 281 NOOP, // Because it is valid in SPDY/2, kept for identifiability/enum order.
282 PING, 282 PING,
283 GOAWAY, 283 GOAWAY,
284 HEADERS, 284 HEADERS,
285 WINDOW_UPDATE, 285 WINDOW_UPDATE,
286 CREDENTIAL, // No longer valid. Kept for identifiability/enum order. 286 CREDENTIAL, // No longer valid. Kept for identifiability/enum order.
287 BLOCKED, 287 BLOCKED,
288 PUSH_PROMISE, 288 PUSH_PROMISE,
289 CONTINUATION, 289 CONTINUATION,
290 LAST_CONTROL_TYPE = CONTINUATION 290 ALTSVC,
291 LAST_CONTROL_TYPE = ALTSVC
291 }; 292 };
292 293
293 // Flags on data packets. 294 // Flags on data packets.
294 enum SpdyDataFlags { 295 enum SpdyDataFlags {
295 DATA_FLAG_NONE = 0x00, 296 DATA_FLAG_NONE = 0x00,
296 DATA_FLAG_FIN = 0x01, 297 DATA_FLAG_FIN = 0x01,
297 DATA_FLAG_END_SEGMENT = 0x02, 298 DATA_FLAG_END_SEGMENT = 0x02,
298 DATA_FLAG_PAD_LOW = 0x10, 299 DATA_FLAG_PAD_LOW = 0x10,
299 DATA_FLAG_PAD_HIGH = 0x20 300 DATA_FLAG_PAD_HIGH = 0x20
300 }; 301 };
301 302
302 // Flags on control packets 303 // Flags on control packets
303 enum SpdyControlFlags { 304 enum SpdyControlFlags {
304 CONTROL_FLAG_NONE = 0, 305 CONTROL_FLAG_NONE = 0,
305 CONTROL_FLAG_FIN = 1, 306 CONTROL_FLAG_FIN = 1,
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 402
402 // A SPDY priority is a number between 0 and 7 (inclusive). 403 // A SPDY priority is a number between 0 and 7 (inclusive).
403 // SPDY priority range is version-dependent. For SPDY 2 and below, priority is a 404 // SPDY priority range is version-dependent. For SPDY 2 and below, priority is a
404 // number between 0 and 3. 405 // number between 0 and 3.
405 typedef uint8 SpdyPriority; 406 typedef uint8 SpdyPriority;
406 407
407 typedef std::map<std::string, std::string> SpdyNameValueBlock; 408 typedef std::map<std::string, std::string> SpdyNameValueBlock;
408 409
409 typedef uint64 SpdyPingId; 410 typedef uint64 SpdyPingId;
410 411
412 typedef std::string SpdyProtocolId;
413
411 // TODO(hkhalil): Add direct testing for this? It won't increase coverage any, 414 // TODO(hkhalil): Add direct testing for this? It won't increase coverage any,
412 // but is good to do anyway. 415 // but is good to do anyway.
413 class NET_EXPORT_PRIVATE SpdyConstants { 416 class NET_EXPORT_PRIVATE SpdyConstants {
414 public: 417 public:
415 // Returns true if a given on-the-wire enumeration of a frame type is valid 418 // Returns true if a given on-the-wire enumeration of a frame type is valid
416 // for a given protocol version, false otherwise. 419 // for a given protocol version, false otherwise.
417 static bool IsValidFrameType(SpdyMajorVersion version, int frame_type_field); 420 static bool IsValidFrameType(SpdyMajorVersion version, int frame_type_field);
418 421
419 // Parses a frame type from an on-the-wire enumeration of a given protocol 422 // Parses a frame type from an on-the-wire enumeration of a given protocol
420 // version. 423 // version.
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
908 virtual void Visit(SpdyFrameVisitor* visitor) const OVERRIDE; 911 virtual void Visit(SpdyFrameVisitor* visitor) const OVERRIDE;
909 912
910 bool end_headers() const { return end_headers_; } 913 bool end_headers() const { return end_headers_; }
911 void set_end_headers(bool end_headers) {end_headers_ = end_headers;} 914 void set_end_headers(bool end_headers) {end_headers_ = end_headers;}
912 915
913 private: 916 private:
914 bool end_headers_; 917 bool end_headers_;
915 DISALLOW_COPY_AND_ASSIGN(SpdyContinuationIR); 918 DISALLOW_COPY_AND_ASSIGN(SpdyContinuationIR);
916 }; 919 };
917 920
921 class NET_EXPORT_PRIVATE SpdyAltSvcIR : public SpdyFrameWithStreamIdIR {
922 public:
923 explicit SpdyAltSvcIR(SpdyStreamId stream_id);
924
925 uint32 max_age() const { return max_age_; }
926 uint16 port() const { return port_; }
927 SpdyProtocolId protocol_id() const {
928 return protocol_id_;
929 }
930 std::string host() const { return host_; }
931 std::string origin() const { return origin_; }
932
933 void set_max_age(uint32 max_age) { max_age_ = max_age; }
934 void set_port(uint16 port) { port_ = port; }
935 void set_protocol_id(SpdyProtocolId protocol_id) {
936 protocol_id_ = protocol_id;
937 }
938 void set_host(std::string host) {
939 host_ = host;
940 }
941 void set_origin(std::string origin) {
942 origin_ = origin;
943 }
944
945 virtual void Visit(SpdyFrameVisitor* visitor) const OVERRIDE;
946
947 private:
948 uint32 max_age_;
949 uint16 port_;
950 SpdyProtocolId protocol_id_;
951 std::string host_;
952 std::string origin_;
953 DISALLOW_COPY_AND_ASSIGN(SpdyAltSvcIR);
954 };
955
918 // ------------------------------------------------------------------------- 956 // -------------------------------------------------------------------------
919 // Wrapper classes for various SPDY frames. 957 // Wrapper classes for various SPDY frames.
920 958
921 // All Spdy Frame types derive from this SpdyFrame class. 959 // All Spdy Frame types derive from this SpdyFrame class.
922 class SpdyFrame { 960 class SpdyFrame {
923 public: 961 public:
924 // Create a SpdyFrame using a pre-created buffer. 962 // Create a SpdyFrame using a pre-created buffer.
925 // If |owns_buffer| is true, this class takes ownership of the buffer 963 // If |owns_buffer| is true, this class takes ownership of the buffer
926 // and will delete it on cleanup. The buffer must have been created using 964 // and will delete it on cleanup. The buffer must have been created using
927 // new char[]. 965 // new char[].
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
968 virtual void VisitSynReply(const SpdySynReplyIR& syn_reply) = 0; 1006 virtual void VisitSynReply(const SpdySynReplyIR& syn_reply) = 0;
969 virtual void VisitRstStream(const SpdyRstStreamIR& rst_stream) = 0; 1007 virtual void VisitRstStream(const SpdyRstStreamIR& rst_stream) = 0;
970 virtual void VisitSettings(const SpdySettingsIR& settings) = 0; 1008 virtual void VisitSettings(const SpdySettingsIR& settings) = 0;
971 virtual void VisitPing(const SpdyPingIR& ping) = 0; 1009 virtual void VisitPing(const SpdyPingIR& ping) = 0;
972 virtual void VisitGoAway(const SpdyGoAwayIR& goaway) = 0; 1010 virtual void VisitGoAway(const SpdyGoAwayIR& goaway) = 0;
973 virtual void VisitHeaders(const SpdyHeadersIR& headers) = 0; 1011 virtual void VisitHeaders(const SpdyHeadersIR& headers) = 0;
974 virtual void VisitWindowUpdate(const SpdyWindowUpdateIR& window_update) = 0; 1012 virtual void VisitWindowUpdate(const SpdyWindowUpdateIR& window_update) = 0;
975 virtual void VisitBlocked(const SpdyBlockedIR& blocked) = 0; 1013 virtual void VisitBlocked(const SpdyBlockedIR& blocked) = 0;
976 virtual void VisitPushPromise(const SpdyPushPromiseIR& push_promise) = 0; 1014 virtual void VisitPushPromise(const SpdyPushPromiseIR& push_promise) = 0;
977 virtual void VisitContinuation(const SpdyContinuationIR& continuation) = 0; 1015 virtual void VisitContinuation(const SpdyContinuationIR& continuation) = 0;
1016 virtual void VisitAltSvc(const SpdyAltSvcIR& altsvc) = 0;
978 virtual void VisitData(const SpdyDataIR& data) = 0; 1017 virtual void VisitData(const SpdyDataIR& data) = 0;
979 1018
980 protected: 1019 protected:
981 SpdyFrameVisitor() {} 1020 SpdyFrameVisitor() {}
982 virtual ~SpdyFrameVisitor() {} 1021 virtual ~SpdyFrameVisitor() {}
983 1022
984 private: 1023 private:
985 DISALLOW_COPY_AND_ASSIGN(SpdyFrameVisitor); 1024 DISALLOW_COPY_AND_ASSIGN(SpdyFrameVisitor);
986 }; 1025 };
987 1026
988 } // namespace net 1027 } // namespace net
989 1028
990 #endif // NET_SPDY_SPDY_PROTOCOL_H_ 1029 #endif // NET_SPDY_SPDY_PROTOCOL_H_
OLDNEW
« 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