| 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 #include "net/spdy/spdy_protocol.h" | 5 #include "net/spdy/spdy_protocol.h" |
| 6 | 6 |
| 7 namespace net { | 7 namespace net { |
| 8 | 8 |
| 9 SpdyFrameWithNameValueBlockIR::SpdyFrameWithNameValueBlockIR( | 9 SpdyFrameWithNameValueBlockIR::SpdyFrameWithNameValueBlockIR( |
| 10 SpdyStreamId stream_id) : SpdyFrameWithFinIR(stream_id) {} | 10 SpdyStreamId stream_id) : SpdyFrameWithFinIR(stream_id) {} |
| (...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 596 return 11; | 596 return 11; |
| 597 case GOAWAY_INADEQUATE_SECURITY: | 597 case GOAWAY_INADEQUATE_SECURITY: |
| 598 return 12; | 598 return 12; |
| 599 default: | 599 default: |
| 600 LOG(DFATAL) << "Serializing unhandled GOAWAY status " << status; | 600 LOG(DFATAL) << "Serializing unhandled GOAWAY status " << status; |
| 601 return -1; | 601 return -1; |
| 602 } | 602 } |
| 603 } | 603 } |
| 604 } | 604 } |
| 605 | 605 |
| 606 size_t SpdyConstants::GetDataFrameMinimumSize() { |
| 607 return 8; |
| 608 } |
| 609 |
| 610 size_t SpdyConstants::GetControlFrameHeaderSize(SpdyMajorVersion version) { |
| 611 switch (version) { |
| 612 case SPDY2: |
| 613 case SPDY3: |
| 614 case SPDY4: |
| 615 return 8; |
| 616 } |
| 617 LOG(DFATAL) << "Unhandled SPDY version."; |
| 618 return 0; |
| 619 } |
| 620 |
| 621 size_t SpdyConstants::GetPrefixLength(SpdyFrameType type, |
| 622 SpdyMajorVersion version) { |
| 623 if (type != DATA) { |
| 624 return GetControlFrameHeaderSize(version); |
| 625 } else { |
| 626 return GetDataFrameMinimumSize(); |
| 627 } |
| 628 } |
| 629 |
| 630 size_t SpdyConstants::GetFrameMaximumSize(SpdyMajorVersion version) { |
| 631 if (version < SPDY4) { |
| 632 // 24-bit length field plus eight-byte frame header. |
| 633 return ((1<<24) - 1) + 8; |
| 634 } else { |
| 635 // 14-bit length field. |
| 636 return (1<<14) - 1; |
| 637 } |
| 638 } |
| 639 |
| 606 void SpdyDataIR::Visit(SpdyFrameVisitor* visitor) const { | 640 void SpdyDataIR::Visit(SpdyFrameVisitor* visitor) const { |
| 607 return visitor->VisitData(*this); | 641 return visitor->VisitData(*this); |
| 608 } | 642 } |
| 609 | 643 |
| 610 void SpdySynStreamIR::Visit(SpdyFrameVisitor* visitor) const { | 644 void SpdySynStreamIR::Visit(SpdyFrameVisitor* visitor) const { |
| 611 return visitor->VisitSynStream(*this); | 645 return visitor->VisitSynStream(*this); |
| 612 } | 646 } |
| 613 | 647 |
| 614 void SpdySynReplyIR::Visit(SpdyFrameVisitor* visitor) const { | 648 void SpdySynReplyIR::Visit(SpdyFrameVisitor* visitor) const { |
| 615 return visitor->VisitSynReply(*this); | 649 return visitor->VisitSynReply(*this); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 675 | 709 |
| 676 void SpdyPushPromiseIR::Visit(SpdyFrameVisitor* visitor) const { | 710 void SpdyPushPromiseIR::Visit(SpdyFrameVisitor* visitor) const { |
| 677 return visitor->VisitPushPromise(*this); | 711 return visitor->VisitPushPromise(*this); |
| 678 } | 712 } |
| 679 | 713 |
| 680 void SpdyContinuationIR::Visit(SpdyFrameVisitor* visitor) const { | 714 void SpdyContinuationIR::Visit(SpdyFrameVisitor* visitor) const { |
| 681 return visitor->VisitContinuation(*this); | 715 return visitor->VisitContinuation(*this); |
| 682 } | 716 } |
| 683 | 717 |
| 684 } // namespace net | 718 } // namespace net |
| OLD | NEW |