Port Android relocation packer to chromium build
[chromium-blink-merge.git] / net / spdy / spdy_protocol.cc
blob9f311d6b63e500f5c3cc9b2dd9665f5c6ce4c2c6
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
3 // found in the LICENSE file.
5 #include "net/spdy/spdy_protocol.h"
7 namespace net {
9 SpdyFrameWithNameValueBlockIR::SpdyFrameWithNameValueBlockIR(
10 SpdyStreamId stream_id) : SpdyFrameWithFinIR(stream_id) {}
12 SpdyFrameWithNameValueBlockIR::~SpdyFrameWithNameValueBlockIR() {}
14 SpdyDataIR::SpdyDataIR(SpdyStreamId stream_id, const base::StringPiece& data)
15 : SpdyFrameWithFinIR(stream_id),
16 padded_(false),
17 padding_payload_len_(0) {
18 SetDataDeep(data);
21 SpdyDataIR::SpdyDataIR(SpdyStreamId stream_id)
22 : SpdyFrameWithFinIR(stream_id),
23 padded_(false),
24 padding_payload_len_(0) {}
26 SpdyDataIR::~SpdyDataIR() {}
28 bool SpdyConstants::IsValidFrameType(SpdyMajorVersion version,
29 int frame_type_field) {
30 switch (version) {
31 case SPDY2:
32 case SPDY3:
33 // SYN_STREAM is the first valid frame.
34 if (frame_type_field < SerializeFrameType(version, SYN_STREAM)) {
35 return false;
38 // WINDOW_UPDATE is the last valid frame.
39 if (frame_type_field > SerializeFrameType(version, WINDOW_UPDATE)) {
40 return false;
43 return true;
44 case SPDY4:
45 // Check for recognized extensions.
46 if (frame_type_field == SerializeFrameType(version, ALTSVC) ||
47 frame_type_field == SerializeFrameType(version, BLOCKED)) {
48 return true;
51 // DATA is the first valid frame.
52 if (frame_type_field < SerializeFrameType(version, DATA)) {
53 return false;
56 // CONTINUATION is the last valid frame.
57 if (frame_type_field > SerializeFrameType(version, CONTINUATION)) {
58 return false;
61 return true;
64 LOG(DFATAL) << "Unhandled SPDY version " << version;
65 return false;
68 SpdyFrameType SpdyConstants::ParseFrameType(SpdyMajorVersion version,
69 int frame_type_field) {
70 switch (version) {
71 case SPDY2:
72 case SPDY3:
73 switch (frame_type_field) {
74 case 1:
75 return SYN_STREAM;
76 case 2:
77 return SYN_REPLY;
78 case 3:
79 return RST_STREAM;
80 case 4:
81 return SETTINGS;
82 case 6:
83 return PING;
84 case 7:
85 return GOAWAY;
86 case 8:
87 return HEADERS;
88 case 9:
89 return WINDOW_UPDATE;
91 break;
92 case SPDY4:
93 switch (frame_type_field) {
94 case 0:
95 return DATA;
96 case 1:
97 return HEADERS;
98 case 2:
99 return PRIORITY;
100 case 3:
101 return RST_STREAM;
102 case 4:
103 return SETTINGS;
104 case 5:
105 return PUSH_PROMISE;
106 case 6:
107 return PING;
108 case 7:
109 return GOAWAY;
110 case 8:
111 return WINDOW_UPDATE;
112 case 9:
113 return CONTINUATION;
114 case 10:
115 return ALTSVC;
116 case 11:
117 return BLOCKED;
119 break;
122 LOG(DFATAL) << "Unhandled frame type " << frame_type_field;
123 return DATA;
126 int SpdyConstants::SerializeFrameType(SpdyMajorVersion version,
127 SpdyFrameType frame_type) {
128 switch (version) {
129 case SPDY2:
130 case SPDY3:
131 switch (frame_type) {
132 case SYN_STREAM:
133 return 1;
134 case SYN_REPLY:
135 return 2;
136 case RST_STREAM:
137 return 3;
138 case SETTINGS:
139 return 4;
140 case PING:
141 return 6;
142 case GOAWAY:
143 return 7;
144 case HEADERS:
145 return 8;
146 case WINDOW_UPDATE:
147 return 9;
148 default:
149 LOG(DFATAL) << "Serializing unhandled frame type " << frame_type;
150 return -1;
152 case SPDY4:
153 switch (frame_type) {
154 case DATA:
155 return 0;
156 case HEADERS:
157 return 1;
158 case PRIORITY:
159 return 2;
160 case RST_STREAM:
161 return 3;
162 case SETTINGS:
163 return 4;
164 case PUSH_PROMISE:
165 return 5;
166 case PING:
167 return 6;
168 case GOAWAY:
169 return 7;
170 case WINDOW_UPDATE:
171 return 8;
172 case CONTINUATION:
173 return 9;
174 // ALTSVC and BLOCKED are extensions.
175 case ALTSVC:
176 return 10;
177 case BLOCKED:
178 return 11;
179 default:
180 LOG(DFATAL) << "Serializing unhandled frame type " << frame_type;
181 return -1;
185 LOG(DFATAL) << "Unhandled SPDY version " << version;
186 return -1;
189 int SpdyConstants::DataFrameType(SpdyMajorVersion version) {
190 switch (version) {
191 case SPDY2:
192 case SPDY3:
193 return 0;
194 case SPDY4:
195 return SerializeFrameType(version, DATA);
198 LOG(DFATAL) << "Unhandled SPDY version " << version;
199 return 0;
202 bool SpdyConstants::IsValidSettingId(SpdyMajorVersion version,
203 int setting_id_field) {
204 switch (version) {
205 case SPDY2:
206 case SPDY3:
207 // UPLOAD_BANDWIDTH is the first valid setting id.
208 if (setting_id_field <
209 SerializeSettingId(version, SETTINGS_UPLOAD_BANDWIDTH)) {
210 return false;
213 // INITIAL_WINDOW_SIZE is the last valid setting id.
214 if (setting_id_field >
215 SerializeSettingId(version, SETTINGS_INITIAL_WINDOW_SIZE)) {
216 return false;
219 return true;
220 case SPDY4:
221 // HEADER_TABLE_SIZE is the first valid setting id.
222 if (setting_id_field <
223 SerializeSettingId(version, SETTINGS_HEADER_TABLE_SIZE)) {
224 return false;
227 // MAX_HEADER_LIST_SIZE is the last valid setting id.
228 if (setting_id_field >
229 SerializeSettingId(version, SETTINGS_MAX_HEADER_LIST_SIZE)) {
230 return false;
233 return true;
236 LOG(DFATAL) << "Unhandled SPDY version " << version;
237 return false;
240 SpdySettingsIds SpdyConstants::ParseSettingId(SpdyMajorVersion version,
241 int setting_id_field) {
242 switch (version) {
243 case SPDY2:
244 case SPDY3:
245 switch (setting_id_field) {
246 case 1:
247 return SETTINGS_UPLOAD_BANDWIDTH;
248 case 2:
249 return SETTINGS_DOWNLOAD_BANDWIDTH;
250 case 3:
251 return SETTINGS_ROUND_TRIP_TIME;
252 case 4:
253 return SETTINGS_MAX_CONCURRENT_STREAMS;
254 case 5:
255 return SETTINGS_CURRENT_CWND;
256 case 6:
257 return SETTINGS_DOWNLOAD_RETRANS_RATE;
258 case 7:
259 return SETTINGS_INITIAL_WINDOW_SIZE;
261 break;
262 case SPDY4:
263 switch (setting_id_field) {
264 case 1:
265 return SETTINGS_HEADER_TABLE_SIZE;
266 case 2:
267 return SETTINGS_ENABLE_PUSH;
268 case 3:
269 return SETTINGS_MAX_CONCURRENT_STREAMS;
270 case 4:
271 return SETTINGS_INITIAL_WINDOW_SIZE;
272 case 5:
273 return SETTINGS_MAX_FRAME_SIZE;
274 case 6:
275 return SETTINGS_MAX_HEADER_LIST_SIZE;
277 break;
280 LOG(DFATAL) << "Unhandled setting ID " << setting_id_field;
281 return SETTINGS_UPLOAD_BANDWIDTH;
284 int SpdyConstants::SerializeSettingId(SpdyMajorVersion version,
285 SpdySettingsIds id) {
286 switch (version) {
287 case SPDY2:
288 case SPDY3:
289 switch (id) {
290 case SETTINGS_UPLOAD_BANDWIDTH:
291 return 1;
292 case SETTINGS_DOWNLOAD_BANDWIDTH:
293 return 2;
294 case SETTINGS_ROUND_TRIP_TIME:
295 return 3;
296 case SETTINGS_MAX_CONCURRENT_STREAMS:
297 return 4;
298 case SETTINGS_CURRENT_CWND:
299 return 5;
300 case SETTINGS_DOWNLOAD_RETRANS_RATE:
301 return 6;
302 case SETTINGS_INITIAL_WINDOW_SIZE:
303 return 7;
304 default:
305 LOG(DFATAL) << "Serializing unhandled setting id " << id;
306 return -1;
308 case SPDY4:
309 switch (id) {
310 case SETTINGS_HEADER_TABLE_SIZE:
311 return 1;
312 case SETTINGS_ENABLE_PUSH:
313 return 2;
314 case SETTINGS_MAX_CONCURRENT_STREAMS:
315 return 3;
316 case SETTINGS_INITIAL_WINDOW_SIZE:
317 return 4;
318 case SETTINGS_MAX_FRAME_SIZE:
319 return 5;
320 case SETTINGS_MAX_HEADER_LIST_SIZE:
321 return 6;
322 default:
323 LOG(DFATAL) << "Serializing unhandled setting id " << id;
324 return -1;
327 LOG(DFATAL) << "Unhandled SPDY version " << version;
328 return -1;
331 bool SpdyConstants::IsValidRstStreamStatus(SpdyMajorVersion version,
332 int rst_stream_status_field) {
333 switch (version) {
334 case SPDY2:
335 case SPDY3:
336 // PROTOCOL_ERROR is the valid first status code.
337 if (rst_stream_status_field <
338 SerializeRstStreamStatus(version, RST_STREAM_PROTOCOL_ERROR)) {
339 return false;
342 // FRAME_TOO_LARGE is the valid last status code.
343 if (rst_stream_status_field >
344 SerializeRstStreamStatus(version, RST_STREAM_FRAME_TOO_LARGE)) {
345 return false;
348 return true;
349 case SPDY4:
350 // NO_ERROR is the first valid status code.
351 if (rst_stream_status_field <
352 SerializeRstStreamStatus(version, RST_STREAM_PROTOCOL_ERROR)) {
353 return false;
356 // TODO(hkhalil): Omit COMPRESSION_ERROR and SETTINGS_TIMEOUT
358 // This works because GOAWAY and RST_STREAM share a namespace.
359 if (rst_stream_status_field ==
360 SerializeGoAwayStatus(version, GOAWAY_COMPRESSION_ERROR) ||
361 rst_stream_status_field ==
362 SerializeGoAwayStatus(version, GOAWAY_SETTINGS_TIMEOUT)) {
363 return false;
367 // HTTP_1_1_REQUIRED is the last valid status code.
368 if (rst_stream_status_field >
369 SerializeRstStreamStatus(version, RST_STREAM_HTTP_1_1_REQUIRED)) {
370 return false;
373 return true;
375 LOG(DFATAL) << "Unhandled SPDY version " << version;
376 return false;
379 SpdyRstStreamStatus SpdyConstants::ParseRstStreamStatus(
380 SpdyMajorVersion version,
381 int rst_stream_status_field) {
382 switch (version) {
383 case SPDY2:
384 case SPDY3:
385 switch (rst_stream_status_field) {
386 case 1:
387 return RST_STREAM_PROTOCOL_ERROR;
388 case 2:
389 return RST_STREAM_INVALID_STREAM;
390 case 3:
391 return RST_STREAM_REFUSED_STREAM;
392 case 4:
393 return RST_STREAM_UNSUPPORTED_VERSION;
394 case 5:
395 return RST_STREAM_CANCEL;
396 case 6:
397 return RST_STREAM_INTERNAL_ERROR;
398 case 7:
399 return RST_STREAM_FLOW_CONTROL_ERROR;
400 case 8:
401 return RST_STREAM_STREAM_IN_USE;
402 case 9:
403 return RST_STREAM_STREAM_ALREADY_CLOSED;
404 case 10:
405 return RST_STREAM_INVALID_CREDENTIALS;
406 case 11:
407 return RST_STREAM_FRAME_TOO_LARGE;
409 break;
410 case SPDY4:
411 switch (rst_stream_status_field) {
412 case 1:
413 return RST_STREAM_PROTOCOL_ERROR;
414 case 2:
415 return RST_STREAM_INTERNAL_ERROR;
416 case 3:
417 return RST_STREAM_FLOW_CONTROL_ERROR;
418 case 5:
419 return RST_STREAM_STREAM_CLOSED;
420 case 6:
421 return RST_STREAM_FRAME_SIZE_ERROR;
422 case 7:
423 return RST_STREAM_REFUSED_STREAM;
424 case 8:
425 return RST_STREAM_CANCEL;
426 case 10:
427 return RST_STREAM_CONNECT_ERROR;
428 case 11:
429 return RST_STREAM_ENHANCE_YOUR_CALM;
430 case 12:
431 return RST_STREAM_INADEQUATE_SECURITY;
432 case 13:
433 return RST_STREAM_HTTP_1_1_REQUIRED;
435 break;
438 LOG(DFATAL) << "Invalid RST_STREAM status " << rst_stream_status_field;
439 return RST_STREAM_PROTOCOL_ERROR;
442 int SpdyConstants::SerializeRstStreamStatus(
443 SpdyMajorVersion version,
444 SpdyRstStreamStatus rst_stream_status) {
445 switch (version) {
446 case SPDY2:
447 case SPDY3:
448 switch (rst_stream_status) {
449 case RST_STREAM_PROTOCOL_ERROR:
450 return 1;
451 case RST_STREAM_INVALID_STREAM:
452 return 2;
453 case RST_STREAM_REFUSED_STREAM:
454 return 3;
455 case RST_STREAM_UNSUPPORTED_VERSION:
456 return 4;
457 case RST_STREAM_CANCEL:
458 return 5;
459 case RST_STREAM_INTERNAL_ERROR:
460 return 6;
461 case RST_STREAM_FLOW_CONTROL_ERROR:
462 return 7;
463 case RST_STREAM_STREAM_IN_USE:
464 return 8;
465 case RST_STREAM_STREAM_ALREADY_CLOSED:
466 return 9;
467 case RST_STREAM_INVALID_CREDENTIALS:
468 return 10;
469 case RST_STREAM_FRAME_TOO_LARGE:
470 return 11;
471 default:
472 LOG(DFATAL) << "Unhandled RST_STREAM status "
473 << rst_stream_status;
474 return -1;
476 case SPDY4:
477 switch (rst_stream_status) {
478 case RST_STREAM_PROTOCOL_ERROR:
479 return 1;
480 case RST_STREAM_INTERNAL_ERROR:
481 return 2;
482 case RST_STREAM_FLOW_CONTROL_ERROR:
483 return 3;
484 case RST_STREAM_STREAM_CLOSED:
485 return 5;
486 case RST_STREAM_FRAME_SIZE_ERROR:
487 return 6;
488 case RST_STREAM_REFUSED_STREAM:
489 return 7;
490 case RST_STREAM_CANCEL:
491 return 8;
492 case RST_STREAM_CONNECT_ERROR:
493 return 10;
494 case RST_STREAM_ENHANCE_YOUR_CALM:
495 return 11;
496 case RST_STREAM_INADEQUATE_SECURITY:
497 return 12;
498 case RST_STREAM_HTTP_1_1_REQUIRED:
499 return 13;
500 default:
501 LOG(DFATAL) << "Unhandled RST_STREAM status "
502 << rst_stream_status;
503 return -1;
506 LOG(DFATAL) << "Unhandled SPDY version " << version;
507 return -1;
510 bool SpdyConstants::IsValidGoAwayStatus(SpdyMajorVersion version,
511 int goaway_status_field) {
512 switch (version) {
513 case SPDY2:
514 case SPDY3:
515 // GOAWAY_OK is the first valid status.
516 if (goaway_status_field < SerializeGoAwayStatus(version, GOAWAY_OK)) {
517 return false;
520 // GOAWAY_INTERNAL_ERROR is the last valid status.
521 if (goaway_status_field > SerializeGoAwayStatus(version,
522 GOAWAY_INTERNAL_ERROR)) {
523 return false;
526 return true;
527 case SPDY4:
528 // GOAWAY_NO_ERROR is the first valid status.
529 if (goaway_status_field < SerializeGoAwayStatus(version,
530 GOAWAY_NO_ERROR)) {
531 return false;
534 // GOAWAY_HTTP_1_1_REQUIRED is the last valid status.
535 if (goaway_status_field >
536 SerializeGoAwayStatus(version, GOAWAY_HTTP_1_1_REQUIRED)) {
537 return false;
540 return true;
542 LOG(DFATAL) << "Unknown SpdyMajorVersion " << version;
543 return false;
546 SpdyGoAwayStatus SpdyConstants::ParseGoAwayStatus(SpdyMajorVersion version,
547 int goaway_status_field) {
548 switch (version) {
549 case SPDY2:
550 case SPDY3:
551 switch (goaway_status_field) {
552 case 0:
553 return GOAWAY_OK;
554 case 1:
555 return GOAWAY_PROTOCOL_ERROR;
556 case 2:
557 return GOAWAY_INTERNAL_ERROR;
559 break;
560 case SPDY4:
561 switch (goaway_status_field) {
562 case 0:
563 return GOAWAY_NO_ERROR;
564 case 1:
565 return GOAWAY_PROTOCOL_ERROR;
566 case 2:
567 return GOAWAY_INTERNAL_ERROR;
568 case 3:
569 return GOAWAY_FLOW_CONTROL_ERROR;
570 case 4:
571 return GOAWAY_SETTINGS_TIMEOUT;
572 case 5:
573 return GOAWAY_STREAM_CLOSED;
574 case 6:
575 return GOAWAY_FRAME_SIZE_ERROR;
576 case 7:
577 return GOAWAY_REFUSED_STREAM;
578 case 8:
579 return GOAWAY_CANCEL;
580 case 9:
581 return GOAWAY_COMPRESSION_ERROR;
582 case 10:
583 return GOAWAY_CONNECT_ERROR;
584 case 11:
585 return GOAWAY_ENHANCE_YOUR_CALM;
586 case 12:
587 return GOAWAY_INADEQUATE_SECURITY;
588 case 13:
589 return GOAWAY_HTTP_1_1_REQUIRED;
591 break;
594 LOG(DFATAL) << "Unhandled GOAWAY status " << goaway_status_field;
595 return GOAWAY_PROTOCOL_ERROR;
598 SpdyMajorVersion SpdyConstants::ParseMajorVersion(int version_number) {
599 switch (version_number) {
600 case 2:
601 return SPDY2;
602 case 3:
603 return SPDY3;
604 case 4:
605 return SPDY4;
606 default:
607 LOG(DFATAL) << "Unsupported SPDY version number: " << version_number;
608 return SPDY3;
612 int SpdyConstants::SerializeMajorVersion(SpdyMajorVersion version) {
613 switch (version) {
614 case SPDY2:
615 return 2;
616 case SPDY3:
617 return 3;
618 case SPDY4:
619 return 4;
620 default:
621 LOG(DFATAL) << "Unsupported SPDY major version: " << version;
622 return -1;
626 std::string SpdyConstants::GetVersionString(SpdyMajorVersion version) {
627 switch (version) {
628 case SPDY2:
629 return "spdy/2";
630 case SPDY3:
631 return "spdy/3";
632 case SPDY4:
633 return "h2-14";
634 default:
635 LOG(DFATAL) << "Unsupported SPDY major version: " << version;
636 return "spdy/3";
640 int SpdyConstants::SerializeGoAwayStatus(SpdyMajorVersion version,
641 SpdyGoAwayStatus status) {
642 switch (version) {
643 case SPDY2:
644 case SPDY3:
645 // TODO(jgraettinger): Merge this back to server-side.
646 switch (status) {
647 case GOAWAY_NO_ERROR:
648 return 0;
649 case GOAWAY_PROTOCOL_ERROR:
650 case GOAWAY_INTERNAL_ERROR:
651 case GOAWAY_FLOW_CONTROL_ERROR:
652 case GOAWAY_SETTINGS_TIMEOUT:
653 case GOAWAY_STREAM_CLOSED:
654 case GOAWAY_FRAME_SIZE_ERROR:
655 case GOAWAY_REFUSED_STREAM:
656 case GOAWAY_CANCEL:
657 case GOAWAY_COMPRESSION_ERROR:
658 case GOAWAY_CONNECT_ERROR:
659 case GOAWAY_ENHANCE_YOUR_CALM:
660 case GOAWAY_INADEQUATE_SECURITY:
661 case GOAWAY_HTTP_1_1_REQUIRED:
662 return 1; // PROTOCOL_ERROR.
663 default:
664 LOG(DFATAL) << "Serializing unhandled GOAWAY status " << status;
665 return -1;
667 case SPDY4:
668 switch (status) {
669 case GOAWAY_NO_ERROR:
670 return 0;
671 case GOAWAY_PROTOCOL_ERROR:
672 return 1;
673 case GOAWAY_INTERNAL_ERROR:
674 return 2;
675 case GOAWAY_FLOW_CONTROL_ERROR:
676 return 3;
677 case GOAWAY_SETTINGS_TIMEOUT:
678 return 4;
679 case GOAWAY_STREAM_CLOSED:
680 return 5;
681 case GOAWAY_FRAME_SIZE_ERROR:
682 return 6;
683 case GOAWAY_REFUSED_STREAM:
684 return 7;
685 case GOAWAY_CANCEL:
686 return 8;
687 case GOAWAY_COMPRESSION_ERROR:
688 return 9;
689 case GOAWAY_CONNECT_ERROR:
690 return 10;
691 case GOAWAY_ENHANCE_YOUR_CALM:
692 return 11;
693 case GOAWAY_INADEQUATE_SECURITY:
694 return 12;
695 case GOAWAY_HTTP_1_1_REQUIRED:
696 return 13;
697 default:
698 LOG(DFATAL) << "Serializing unhandled GOAWAY status " << status;
699 return -1;
702 LOG(DFATAL) << "Unknown SpdyMajorVersion " << version;
703 return -1;
706 size_t SpdyConstants::GetDataFrameMinimumSize(SpdyMajorVersion version) {
707 switch (version) {
708 case SPDY2:
709 case SPDY3:
710 return 8;
711 case SPDY4:
712 return 9;
714 LOG(DFATAL) << "Unhandled SPDY version.";
715 return 0;
718 size_t SpdyConstants::GetControlFrameHeaderSize(SpdyMajorVersion version) {
719 switch (version) {
720 case SPDY2:
721 case SPDY3:
722 return 8;
723 case SPDY4:
724 return 9;
726 LOG(DFATAL) << "Unhandled SPDY version.";
727 return 0;
730 size_t SpdyConstants::GetPrefixLength(SpdyFrameType type,
731 SpdyMajorVersion version) {
732 if (type != DATA) {
733 return GetControlFrameHeaderSize(version);
734 } else {
735 return GetDataFrameMinimumSize(version);
739 size_t SpdyConstants::GetFrameMaximumSize(SpdyMajorVersion version) {
740 if (version < SPDY4) {
741 // 24-bit length field plus eight-byte frame header.
742 return ((1<<24) - 1) + 8;
743 } else {
744 // Max payload of 2^14 plus nine-byte frame header.
745 // TODO(mlavan): In HTTP/2 this is actually not a constant;
746 // payload size can be set using the MAX_FRAME_SIZE setting to
747 // anything between 1 << 14 and (1 << 24) - 1
748 return (1 << 14) + 9;
752 size_t SpdyConstants::GetSizeOfSizeField(SpdyMajorVersion version) {
753 return (version < SPDY3) ? sizeof(uint16) : sizeof(uint32);
756 size_t SpdyConstants::GetSettingSize(SpdyMajorVersion version) {
757 return version <= SPDY3 ? 8 : 6;
760 int32 SpdyConstants::GetInitialStreamWindowSize(SpdyMajorVersion version) {
761 return (version <= SPDY3) ? (64 * 1024) : (64 * 1024 - 1);
764 int32 SpdyConstants::GetInitialSessionWindowSize(SpdyMajorVersion version) {
765 return (version <= SPDY3) ? (64 * 1024) : (64 * 1024 - 1);
768 void SpdyDataIR::Visit(SpdyFrameVisitor* visitor) const {
769 return visitor->VisitData(*this);
772 void SpdySynStreamIR::Visit(SpdyFrameVisitor* visitor) const {
773 return visitor->VisitSynStream(*this);
776 void SpdySynReplyIR::Visit(SpdyFrameVisitor* visitor) const {
777 return visitor->VisitSynReply(*this);
780 SpdyRstStreamIR::SpdyRstStreamIR(SpdyStreamId stream_id,
781 SpdyRstStreamStatus status,
782 base::StringPiece description)
783 : SpdyFrameWithStreamIdIR(stream_id),
784 description_(description) {
785 set_status(status);
788 SpdyRstStreamIR::~SpdyRstStreamIR() {}
790 void SpdyRstStreamIR::Visit(SpdyFrameVisitor* visitor) const {
791 return visitor->VisitRstStream(*this);
794 SpdySettingsIR::SpdySettingsIR()
795 : clear_settings_(false),
796 is_ack_(false) {}
798 SpdySettingsIR::~SpdySettingsIR() {}
800 void SpdySettingsIR::Visit(SpdyFrameVisitor* visitor) const {
801 return visitor->VisitSettings(*this);
804 void SpdyPingIR::Visit(SpdyFrameVisitor* visitor) const {
805 return visitor->VisitPing(*this);
808 SpdyGoAwayIR::SpdyGoAwayIR(SpdyStreamId last_good_stream_id,
809 SpdyGoAwayStatus status,
810 const base::StringPiece& description)
811 : description_(description) {
812 set_last_good_stream_id(last_good_stream_id);
813 set_status(status);
816 SpdyGoAwayIR::~SpdyGoAwayIR() {}
818 const base::StringPiece& SpdyGoAwayIR::description() const {
819 return description_;
822 void SpdyGoAwayIR::Visit(SpdyFrameVisitor* visitor) const {
823 return visitor->VisitGoAway(*this);
826 void SpdyHeadersIR::Visit(SpdyFrameVisitor* visitor) const {
827 return visitor->VisitHeaders(*this);
830 void SpdyWindowUpdateIR::Visit(SpdyFrameVisitor* visitor) const {
831 return visitor->VisitWindowUpdate(*this);
834 void SpdyBlockedIR::Visit(SpdyFrameVisitor* visitor) const {
835 return visitor->VisitBlocked(*this);
838 void SpdyPushPromiseIR::Visit(SpdyFrameVisitor* visitor) const {
839 return visitor->VisitPushPromise(*this);
842 void SpdyContinuationIR::Visit(SpdyFrameVisitor* visitor) const {
843 return visitor->VisitContinuation(*this);
846 SpdyAltSvcIR::SpdyAltSvcIR(SpdyStreamId stream_id)
847 : SpdyFrameWithStreamIdIR(stream_id),
848 max_age_(0),
849 port_(0) {}
851 void SpdyAltSvcIR::Visit(SpdyFrameVisitor* visitor) const {
852 return visitor->VisitAltSvc(*this);
855 void SpdyPriorityIR::Visit(SpdyFrameVisitor* visitor) const {
856 return visitor->VisitPriority(*this);
859 } // namespace net