OLD | NEW |
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 #ifndef NET_SPDY_SPDY_FRAMER_H_ | 5 #ifndef NET_SPDY_SPDY_FRAMER_H_ |
6 #define NET_SPDY_SPDY_FRAMER_H_ | 6 #define NET_SPDY_SPDY_FRAMER_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
10 #include <memory> | 10 #include <memory> |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 // OnControlFrameHeaderData(). | 277 // OnControlFrameHeaderData(). |
278 virtual void OnContinuation(SpdyStreamId stream_id, bool end) = 0; | 278 virtual void OnContinuation(SpdyStreamId stream_id, bool end) = 0; |
279 | 279 |
280 // Called when an ALTSVC frame has been parsed. | 280 // Called when an ALTSVC frame has been parsed. |
281 virtual void OnAltSvc(SpdyStreamId stream_id, | 281 virtual void OnAltSvc(SpdyStreamId stream_id, |
282 uint32 max_age, | 282 uint32 max_age, |
283 uint16 port, | 283 uint16 port, |
284 base::StringPiece protocol_id, | 284 base::StringPiece protocol_id, |
285 base::StringPiece host, | 285 base::StringPiece host, |
286 base::StringPiece origin) {} | 286 base::StringPiece origin) {} |
| 287 |
| 288 // Called when a PRIORITY frame is received. |
| 289 virtual void OnPriority(SpdyStreamId stream_id, |
| 290 SpdyStreamId parent_stream_id, |
| 291 uint8 weight, |
| 292 bool exclusive) {}; |
287 }; | 293 }; |
288 | 294 |
289 // Optionally, and in addition to SpdyFramerVisitorInterface, a class supporting | 295 // Optionally, and in addition to SpdyFramerVisitorInterface, a class supporting |
290 // SpdyFramerDebugVisitorInterface may be used in conjunction with SpdyFramer in | 296 // SpdyFramerDebugVisitorInterface may be used in conjunction with SpdyFramer in |
291 // order to extract debug/internal information about the SpdyFramer as it | 297 // order to extract debug/internal information about the SpdyFramer as it |
292 // operates. | 298 // operates. |
293 // | 299 // |
294 // Most SPDY implementations need not bother with this interface at all. | 300 // Most SPDY implementations need not bother with this interface at all. |
295 class NET_EXPORT_PRIVATE SpdyFramerDebugVisitorInterface { | 301 class NET_EXPORT_PRIVATE SpdyFramerDebugVisitorInterface { |
296 public: | 302 public: |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 // TODO(jgraettinger): This implementation is incorrect. The continuation | 477 // TODO(jgraettinger): This implementation is incorrect. The continuation |
472 // frame continues a previously-begun HPACK encoding; it doesn't begin a | 478 // frame continues a previously-begun HPACK encoding; it doesn't begin a |
473 // new one. Figure out whether it makes sense to keep SerializeContinuation(). | 479 // new one. Figure out whether it makes sense to keep SerializeContinuation(). |
474 SpdySerializedFrame* SerializeContinuation( | 480 SpdySerializedFrame* SerializeContinuation( |
475 const SpdyContinuationIR& continuation); | 481 const SpdyContinuationIR& continuation); |
476 | 482 |
477 // Serializes an ALTSVC frame. The ALTSVC frame advertises the | 483 // Serializes an ALTSVC frame. The ALTSVC frame advertises the |
478 // availability of an alternative service to the client. | 484 // availability of an alternative service to the client. |
479 SpdySerializedFrame* SerializeAltSvc(const SpdyAltSvcIR& altsvc); | 485 SpdySerializedFrame* SerializeAltSvc(const SpdyAltSvcIR& altsvc); |
480 | 486 |
| 487 // Serializes a PRIORITY frame. The PRIORITY frame advises a change in |
| 488 // the relative priority of the given stream. |
| 489 SpdySerializedFrame* SerializePriority(const SpdyPriorityIR& priority); |
| 490 |
481 // Serialize a frame of unknown type. | 491 // Serialize a frame of unknown type. |
482 SpdySerializedFrame* SerializeFrame(const SpdyFrameIR& frame); | 492 SpdySerializedFrame* SerializeFrame(const SpdyFrameIR& frame); |
483 | 493 |
484 // NOTES about frame compression. | 494 // NOTES about frame compression. |
485 // We want spdy to compress headers across the entire session. As long as | 495 // We want spdy to compress headers across the entire session. As long as |
486 // the session is over TCP, frames are sent serially. The client & server | 496 // the session is over TCP, frames are sent serially. The client & server |
487 // can each compress frames in the same order and then compress them in that | 497 // can each compress frames in the same order and then compress them in that |
488 // order, and the remote can do the reverse. However, we ultimately want | 498 // order, and the remote can do the reverse. However, we ultimately want |
489 // the creation of frames to be less sensitive to order so that they can be | 499 // the creation of frames to be less sensitive to order so that they can be |
490 // placed over a UDP based protocol and yet still benefit from some | 500 // placed over a UDP based protocol and yet still benefit from some |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
719 SpdyError error_code_; | 729 SpdyError error_code_; |
720 | 730 |
721 // Note that for DATA frame, remaining_data_length_ is sum of lengths of | 731 // Note that for DATA frame, remaining_data_length_ is sum of lengths of |
722 // frame header, padding length field (optional), data payload (optional) and | 732 // frame header, padding length field (optional), data payload (optional) and |
723 // padding payload (optional). | 733 // padding payload (optional). |
724 size_t remaining_data_length_; | 734 size_t remaining_data_length_; |
725 | 735 |
726 // The length (in bytes) of the padding payload to be processed. | 736 // The length (in bytes) of the padding payload to be processed. |
727 size_t remaining_padding_payload_length_; | 737 size_t remaining_padding_payload_length_; |
728 | 738 |
729 // The length (in bytes) of the padding length field to be processed. | |
730 size_t remaining_padding_length_fields_; | |
731 | |
732 // The number of bytes remaining to read from the current control frame's | 739 // The number of bytes remaining to read from the current control frame's |
733 // headers. Note that header data blocks (for control types that have them) | 740 // headers. Note that header data blocks (for control types that have them) |
734 // are part of the frame's payload, and not the frame's headers. | 741 // are part of the frame's payload, and not the frame's headers. |
735 size_t remaining_control_header_; | 742 size_t remaining_control_header_; |
736 | 743 |
737 scoped_ptr<char[]> current_frame_buffer_; | 744 scoped_ptr<char[]> current_frame_buffer_; |
738 // Number of bytes read into the current_frame_buffer_. | 745 // Number of bytes read into the current_frame_buffer_. |
739 size_t current_frame_buffer_length_; | 746 size_t current_frame_buffer_length_; |
740 | 747 |
741 // The type of the frame currently being read. | 748 // The type of the frame currently being read. |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
797 // If a HEADERS frame is followed by a CONTINUATION frame, the FIN/END_STREAM | 804 // If a HEADERS frame is followed by a CONTINUATION frame, the FIN/END_STREAM |
798 // flag is still carried in the HEADERS frame. If it's set, flip this so that | 805 // flag is still carried in the HEADERS frame. If it's set, flip this so that |
799 // we know to terminate the stream when the entire header block has been | 806 // we know to terminate the stream when the entire header block has been |
800 // processed. | 807 // processed. |
801 bool end_stream_when_done_; | 808 bool end_stream_when_done_; |
802 }; | 809 }; |
803 | 810 |
804 } // namespace net | 811 } // namespace net |
805 | 812 |
806 #endif // NET_SPDY_SPDY_FRAMER_H_ | 813 #endif // NET_SPDY_SPDY_FRAMER_H_ |
OLD | NEW |