Roll WebRTC 9745:9761, Libjingle 9742:9761
[chromium-blink-merge.git] / net / spdy / spdy_protocol.cc
blob46b080f940a47ba5b746d76fa451d36b14699a26
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 SpdyFrameWithHeaderBlockIR::SpdyFrameWithHeaderBlockIR(SpdyStreamId stream_id)
10 : SpdyFrameWithFinIR(stream_id) {}
12 SpdyFrameWithHeaderBlockIR::~SpdyFrameWithHeaderBlockIR() {}
14 SpdyDataIR::SpdyDataIR(SpdyStreamId stream_id, base::StringPiece data)
15 : SpdyFrameWithFinIR(stream_id), padded_(false), padding_payload_len_(0) {
16 SetDataDeep(data);
19 SpdyDataIR::SpdyDataIR(SpdyStreamId stream_id)
20 : SpdyFrameWithFinIR(stream_id),
21 padded_(false),
22 padding_payload_len_(0) {}
24 SpdyDataIR::~SpdyDataIR() {}
26 bool SpdyConstants::IsValidFrameType(SpdyMajorVersion version,
27 int frame_type_field) {
28 switch (version) {
29 case SPDY2:
30 case SPDY3:
31 // SYN_STREAM is the first valid frame.
32 if (frame_type_field < SerializeFrameType(version, SYN_STREAM)) {
33 return false;
36 // WINDOW_UPDATE is the last valid frame.
37 if (frame_type_field > SerializeFrameType(version, WINDOW_UPDATE)) {
38 return false;
41 return true;
42 case HTTP2:
43 // Check for recognized extensions.
44 if (frame_type_field == SerializeFrameType(version, ALTSVC) ||
45 frame_type_field == SerializeFrameType(version, BLOCKED)) {
46 return true;
49 // DATA is the first valid frame.
50 if (frame_type_field < SerializeFrameType(version, DATA)) {
51 return false;
54 // CONTINUATION is the last valid frame.
55 if (frame_type_field > SerializeFrameType(version, CONTINUATION)) {
56 return false;
59 return true;
62 LOG(DFATAL) << "Unhandled SPDY version " << version;
63 return false;
66 SpdyFrameType SpdyConstants::ParseFrameType(SpdyMajorVersion version,
67 int frame_type_field) {
68 switch (version) {
69 case SPDY2:
70 case SPDY3:
71 switch (frame_type_field) {
72 case 1:
73 return SYN_STREAM;
74 case 2:
75 return SYN_REPLY;
76 case 3:
77 return RST_STREAM;
78 case 4:
79 return SETTINGS;
80 case 6:
81 return PING;
82 case 7:
83 return GOAWAY;
84 case 8:
85 return HEADERS;
86 case 9:
87 return WINDOW_UPDATE;
89 break;
90 case HTTP2:
91 switch (frame_type_field) {
92 case 0:
93 return DATA;
94 case 1:
95 return HEADERS;
96 case 2:
97 return PRIORITY;
98 case 3:
99 return RST_STREAM;
100 case 4:
101 return SETTINGS;
102 case 5:
103 return PUSH_PROMISE;
104 case 6:
105 return PING;
106 case 7:
107 return GOAWAY;
108 case 8:
109 return WINDOW_UPDATE;
110 case 9:
111 return CONTINUATION;
112 case 10:
113 return ALTSVC;
114 case 11:
115 return BLOCKED;
117 break;
120 LOG(DFATAL) << "Unhandled frame type " << frame_type_field;
121 return DATA;
124 int SpdyConstants::SerializeFrameType(SpdyMajorVersion version,
125 SpdyFrameType frame_type) {
126 switch (version) {
127 case SPDY2:
128 case SPDY3:
129 switch (frame_type) {
130 case SYN_STREAM:
131 return 1;
132 case SYN_REPLY:
133 return 2;
134 case RST_STREAM:
135 return 3;
136 case SETTINGS:
137 return 4;
138 case PING:
139 return 6;
140 case GOAWAY:
141 return 7;
142 case HEADERS:
143 return 8;
144 case WINDOW_UPDATE:
145 return 9;
146 default:
147 LOG(DFATAL) << "Serializing unhandled frame type " << frame_type;
148 return -1;
150 case HTTP2:
151 switch (frame_type) {
152 case DATA:
153 return 0;
154 case HEADERS:
155 return 1;
156 case PRIORITY:
157 return 2;
158 case RST_STREAM:
159 return 3;
160 case SETTINGS:
161 return 4;
162 case PUSH_PROMISE:
163 return 5;
164 case PING:
165 return 6;
166 case GOAWAY:
167 return 7;
168 case WINDOW_UPDATE:
169 return 8;
170 case CONTINUATION:
171 return 9;
172 // ALTSVC and BLOCKED are extensions.
173 case ALTSVC:
174 return 10;
175 case BLOCKED:
176 return 11;
177 default:
178 LOG(DFATAL) << "Serializing unhandled frame type " << frame_type;
179 return -1;
183 LOG(DFATAL) << "Unhandled SPDY version " << version;
184 return -1;
187 int SpdyConstants::DataFrameType(SpdyMajorVersion version) {
188 switch (version) {
189 case SPDY2:
190 case SPDY3:
191 return 0;
192 case HTTP2:
193 return SerializeFrameType(version, DATA);
196 LOG(DFATAL) << "Unhandled SPDY version " << version;
197 return 0;
200 bool SpdyConstants::IsValidSettingId(SpdyMajorVersion version,
201 int setting_id_field) {
202 switch (version) {
203 case SPDY2:
204 case SPDY3:
205 // UPLOAD_BANDWIDTH is the first valid setting id.
206 if (setting_id_field <
207 SerializeSettingId(version, SETTINGS_UPLOAD_BANDWIDTH)) {
208 return false;
211 // INITIAL_WINDOW_SIZE is the last valid setting id.
212 if (setting_id_field >
213 SerializeSettingId(version, SETTINGS_INITIAL_WINDOW_SIZE)) {
214 return false;
217 return true;
218 case HTTP2:
219 // HEADER_TABLE_SIZE is the first valid setting id.
220 if (setting_id_field <
221 SerializeSettingId(version, SETTINGS_HEADER_TABLE_SIZE)) {
222 return false;
225 // MAX_HEADER_LIST_SIZE is the last valid setting id.
226 if (setting_id_field >
227 SerializeSettingId(version, SETTINGS_MAX_HEADER_LIST_SIZE)) {
228 return false;
231 return true;
234 LOG(DFATAL) << "Unhandled SPDY version " << version;
235 return false;
238 SpdySettingsIds SpdyConstants::ParseSettingId(SpdyMajorVersion version,
239 int setting_id_field) {
240 switch (version) {
241 case SPDY2:
242 case SPDY3:
243 switch (setting_id_field) {
244 case 1:
245 return SETTINGS_UPLOAD_BANDWIDTH;
246 case 2:
247 return SETTINGS_DOWNLOAD_BANDWIDTH;
248 case 3:
249 return SETTINGS_ROUND_TRIP_TIME;
250 case 4:
251 return SETTINGS_MAX_CONCURRENT_STREAMS;
252 case 5:
253 return SETTINGS_CURRENT_CWND;
254 case 6:
255 return SETTINGS_DOWNLOAD_RETRANS_RATE;
256 case 7:
257 return SETTINGS_INITIAL_WINDOW_SIZE;
259 break;
260 case HTTP2:
261 switch (setting_id_field) {
262 case 1:
263 return SETTINGS_HEADER_TABLE_SIZE;
264 case 2:
265 return SETTINGS_ENABLE_PUSH;
266 case 3:
267 return SETTINGS_MAX_CONCURRENT_STREAMS;
268 case 4:
269 return SETTINGS_INITIAL_WINDOW_SIZE;
270 case 5:
271 return SETTINGS_MAX_FRAME_SIZE;
272 case 6:
273 return SETTINGS_MAX_HEADER_LIST_SIZE;
275 break;
278 LOG(DFATAL) << "Unhandled setting ID " << setting_id_field;
279 return SETTINGS_UPLOAD_BANDWIDTH;
282 int SpdyConstants::SerializeSettingId(SpdyMajorVersion version,
283 SpdySettingsIds id) {
284 switch (version) {
285 case SPDY2:
286 case SPDY3:
287 switch (id) {
288 case SETTINGS_UPLOAD_BANDWIDTH:
289 return 1;
290 case SETTINGS_DOWNLOAD_BANDWIDTH:
291 return 2;
292 case SETTINGS_ROUND_TRIP_TIME:
293 return 3;
294 case SETTINGS_MAX_CONCURRENT_STREAMS:
295 return 4;
296 case SETTINGS_CURRENT_CWND:
297 return 5;
298 case SETTINGS_DOWNLOAD_RETRANS_RATE:
299 return 6;
300 case SETTINGS_INITIAL_WINDOW_SIZE:
301 return 7;
302 default:
303 LOG(DFATAL) << "Serializing unhandled setting id " << id;
304 return -1;
306 case HTTP2:
307 switch (id) {
308 case SETTINGS_HEADER_TABLE_SIZE:
309 return 1;
310 case SETTINGS_ENABLE_PUSH:
311 return 2;
312 case SETTINGS_MAX_CONCURRENT_STREAMS:
313 return 3;
314 case SETTINGS_INITIAL_WINDOW_SIZE:
315 return 4;
316 case SETTINGS_MAX_FRAME_SIZE:
317 return 5;
318 case SETTINGS_MAX_HEADER_LIST_SIZE:
319 return 6;
320 default:
321 LOG(DFATAL) << "Serializing unhandled setting id " << id;
322 return -1;
325 LOG(DFATAL) << "Unhandled SPDY version " << version;
326 return -1;
329 bool SpdyConstants::IsValidRstStreamStatus(SpdyMajorVersion version,
330 int rst_stream_status_field) {
331 switch (version) {
332 case SPDY2:
333 case SPDY3:
334 // PROTOCOL_ERROR is the valid first status code.
335 if (rst_stream_status_field <
336 SerializeRstStreamStatus(version, RST_STREAM_PROTOCOL_ERROR)) {
337 return false;
340 // FRAME_TOO_LARGE is the valid last status code.
341 if (rst_stream_status_field >
342 SerializeRstStreamStatus(version, RST_STREAM_FRAME_TOO_LARGE)) {
343 return false;
346 return true;
347 case HTTP2:
348 // NO_ERROR is the first valid status code.
349 if (rst_stream_status_field <
350 SerializeRstStreamStatus(version, RST_STREAM_PROTOCOL_ERROR)) {
351 return false;
354 // TODO(hkhalil): Omit COMPRESSION_ERROR and SETTINGS_TIMEOUT
356 // This works because GOAWAY and RST_STREAM share a namespace.
357 if (rst_stream_status_field ==
358 SerializeGoAwayStatus(version, GOAWAY_COMPRESSION_ERROR) ||
359 rst_stream_status_field ==
360 SerializeGoAwayStatus(version, GOAWAY_SETTINGS_TIMEOUT)) {
361 return false;
365 // HTTP_1_1_REQUIRED is the last valid status code.
366 if (rst_stream_status_field >
367 SerializeRstStreamStatus(version, RST_STREAM_HTTP_1_1_REQUIRED)) {
368 return false;
371 return true;
373 LOG(DFATAL) << "Unhandled SPDY version " << version;
374 return false;
377 SpdyRstStreamStatus SpdyConstants::ParseRstStreamStatus(
378 SpdyMajorVersion version,
379 int rst_stream_status_field) {
380 switch (version) {
381 case SPDY2:
382 case SPDY3:
383 switch (rst_stream_status_field) {
384 case 1:
385 return RST_STREAM_PROTOCOL_ERROR;
386 case 2:
387 return RST_STREAM_INVALID_STREAM;
388 case 3:
389 return RST_STREAM_REFUSED_STREAM;
390 case 4:
391 return RST_STREAM_UNSUPPORTED_VERSION;
392 case 5:
393 return RST_STREAM_CANCEL;
394 case 6:
395 return RST_STREAM_INTERNAL_ERROR;
396 case 7:
397 return RST_STREAM_FLOW_CONTROL_ERROR;
398 case 8:
399 return RST_STREAM_STREAM_IN_USE;
400 case 9:
401 return RST_STREAM_STREAM_ALREADY_CLOSED;
402 case 10:
403 return RST_STREAM_INVALID_CREDENTIALS;
404 case 11:
405 return RST_STREAM_FRAME_TOO_LARGE;
407 break;
408 case HTTP2:
409 switch (rst_stream_status_field) {
410 case 1:
411 return RST_STREAM_PROTOCOL_ERROR;
412 case 2:
413 return RST_STREAM_INTERNAL_ERROR;
414 case 3:
415 return RST_STREAM_FLOW_CONTROL_ERROR;
416 case 5:
417 return RST_STREAM_STREAM_CLOSED;
418 case 6:
419 return RST_STREAM_FRAME_SIZE_ERROR;
420 case 7:
421 return RST_STREAM_REFUSED_STREAM;
422 case 8:
423 return RST_STREAM_CANCEL;
424 case 10:
425 return RST_STREAM_CONNECT_ERROR;
426 case 11:
427 return RST_STREAM_ENHANCE_YOUR_CALM;
428 case 12:
429 return RST_STREAM_INADEQUATE_SECURITY;
430 case 13:
431 return RST_STREAM_HTTP_1_1_REQUIRED;
433 break;
436 LOG(DFATAL) << "Invalid RST_STREAM status " << rst_stream_status_field;
437 return RST_STREAM_PROTOCOL_ERROR;
440 int SpdyConstants::SerializeRstStreamStatus(
441 SpdyMajorVersion version,
442 SpdyRstStreamStatus rst_stream_status) {
443 switch (version) {
444 case SPDY2:
445 case SPDY3:
446 switch (rst_stream_status) {
447 case RST_STREAM_PROTOCOL_ERROR:
448 return 1;
449 case RST_STREAM_INVALID_STREAM:
450 return 2;
451 case RST_STREAM_REFUSED_STREAM:
452 return 3;
453 case RST_STREAM_UNSUPPORTED_VERSION:
454 return 4;
455 case RST_STREAM_CANCEL:
456 return 5;
457 case RST_STREAM_INTERNAL_ERROR:
458 return 6;
459 case RST_STREAM_FLOW_CONTROL_ERROR:
460 return 7;
461 case RST_STREAM_STREAM_IN_USE:
462 return 8;
463 case RST_STREAM_STREAM_ALREADY_CLOSED:
464 return 9;
465 case RST_STREAM_INVALID_CREDENTIALS:
466 return 10;
467 case RST_STREAM_FRAME_TOO_LARGE:
468 return 11;
469 default:
470 LOG(DFATAL) << "Unhandled RST_STREAM status "
471 << rst_stream_status;
472 return -1;
474 case HTTP2:
475 switch (rst_stream_status) {
476 case RST_STREAM_PROTOCOL_ERROR:
477 return 1;
478 case RST_STREAM_INTERNAL_ERROR:
479 return 2;
480 case RST_STREAM_FLOW_CONTROL_ERROR:
481 return 3;
482 case RST_STREAM_STREAM_CLOSED:
483 return 5;
484 case RST_STREAM_FRAME_SIZE_ERROR:
485 return 6;
486 case RST_STREAM_REFUSED_STREAM:
487 return 7;
488 case RST_STREAM_CANCEL:
489 return 8;
490 case RST_STREAM_CONNECT_ERROR:
491 return 10;
492 case RST_STREAM_ENHANCE_YOUR_CALM:
493 return 11;
494 case RST_STREAM_INADEQUATE_SECURITY:
495 return 12;
496 case RST_STREAM_HTTP_1_1_REQUIRED:
497 return 13;
498 default:
499 LOG(DFATAL) << "Unhandled RST_STREAM status "
500 << rst_stream_status;
501 return -1;
504 LOG(DFATAL) << "Unhandled SPDY version " << version;
505 return -1;
508 bool SpdyConstants::IsValidGoAwayStatus(SpdyMajorVersion version,
509 int goaway_status_field) {
510 switch (version) {
511 case SPDY2:
512 case SPDY3:
513 // GOAWAY_OK is the first valid status.
514 if (goaway_status_field < SerializeGoAwayStatus(version, GOAWAY_OK)) {
515 return false;
518 // GOAWAY_INTERNAL_ERROR is the last valid status.
519 if (goaway_status_field > SerializeGoAwayStatus(version,
520 GOAWAY_INTERNAL_ERROR)) {
521 return false;
524 return true;
525 case HTTP2:
526 // GOAWAY_NO_ERROR is the first valid status.
527 if (goaway_status_field < SerializeGoAwayStatus(version,
528 GOAWAY_NO_ERROR)) {
529 return false;
532 // GOAWAY_HTTP_1_1_REQUIRED is the last valid status.
533 if (goaway_status_field >
534 SerializeGoAwayStatus(version, GOAWAY_HTTP_1_1_REQUIRED)) {
535 return false;
538 return true;
540 LOG(DFATAL) << "Unknown SpdyMajorVersion " << version;
541 return false;
544 SpdyGoAwayStatus SpdyConstants::ParseGoAwayStatus(SpdyMajorVersion version,
545 int goaway_status_field) {
546 switch (version) {
547 case SPDY2:
548 case SPDY3:
549 switch (goaway_status_field) {
550 case 0:
551 return GOAWAY_OK;
552 case 1:
553 return GOAWAY_PROTOCOL_ERROR;
554 case 2:
555 return GOAWAY_INTERNAL_ERROR;
557 break;
558 case HTTP2:
559 switch (goaway_status_field) {
560 case 0:
561 return GOAWAY_NO_ERROR;
562 case 1:
563 return GOAWAY_PROTOCOL_ERROR;
564 case 2:
565 return GOAWAY_INTERNAL_ERROR;
566 case 3:
567 return GOAWAY_FLOW_CONTROL_ERROR;
568 case 4:
569 return GOAWAY_SETTINGS_TIMEOUT;
570 case 5:
571 return GOAWAY_STREAM_CLOSED;
572 case 6:
573 return GOAWAY_FRAME_SIZE_ERROR;
574 case 7:
575 return GOAWAY_REFUSED_STREAM;
576 case 8:
577 return GOAWAY_CANCEL;
578 case 9:
579 return GOAWAY_COMPRESSION_ERROR;
580 case 10:
581 return GOAWAY_CONNECT_ERROR;
582 case 11:
583 return GOAWAY_ENHANCE_YOUR_CALM;
584 case 12:
585 return GOAWAY_INADEQUATE_SECURITY;
586 case 13:
587 return GOAWAY_HTTP_1_1_REQUIRED;
589 break;
592 LOG(DFATAL) << "Unhandled GOAWAY status " << goaway_status_field;
593 return GOAWAY_PROTOCOL_ERROR;
596 SpdyMajorVersion SpdyConstants::ParseMajorVersion(int version_number) {
597 switch (version_number) {
598 case 2:
599 return SPDY2;
600 case 3:
601 return SPDY3;
602 case 4:
603 return HTTP2;
604 default:
605 LOG(DFATAL) << "Unsupported SPDY version number: " << version_number;
606 return SPDY3;
610 int SpdyConstants::SerializeMajorVersion(SpdyMajorVersion version) {
611 switch (version) {
612 case SPDY2:
613 return 2;
614 case SPDY3:
615 return 3;
616 case HTTP2:
617 return 4;
618 default:
619 LOG(DFATAL) << "Unsupported SPDY major version: " << version;
620 return -1;
624 std::string SpdyConstants::GetVersionString(SpdyMajorVersion version) {
625 switch (version) {
626 case SPDY2:
627 return "spdy/2";
628 case SPDY3:
629 return "spdy/3";
630 case HTTP2:
631 return "h2";
632 default:
633 LOG(DFATAL) << "Unsupported SPDY major version: " << version;
634 return "spdy/3";
638 int SpdyConstants::SerializeGoAwayStatus(SpdyMajorVersion version,
639 SpdyGoAwayStatus status) {
640 switch (version) {
641 case SPDY2:
642 case SPDY3:
643 // TODO(jgraettinger): Merge this back to server-side.
644 switch (status) {
645 case GOAWAY_NO_ERROR:
646 return 0;
647 case GOAWAY_PROTOCOL_ERROR:
648 case GOAWAY_INTERNAL_ERROR:
649 case GOAWAY_FLOW_CONTROL_ERROR:
650 case GOAWAY_SETTINGS_TIMEOUT:
651 case GOAWAY_STREAM_CLOSED:
652 case GOAWAY_FRAME_SIZE_ERROR:
653 case GOAWAY_REFUSED_STREAM:
654 case GOAWAY_CANCEL:
655 case GOAWAY_COMPRESSION_ERROR:
656 case GOAWAY_CONNECT_ERROR:
657 case GOAWAY_ENHANCE_YOUR_CALM:
658 case GOAWAY_INADEQUATE_SECURITY:
659 case GOAWAY_HTTP_1_1_REQUIRED:
660 return 1; // PROTOCOL_ERROR.
661 default:
662 LOG(DFATAL) << "Serializing unhandled GOAWAY status " << status;
663 return -1;
665 case HTTP2:
666 switch (status) {
667 case GOAWAY_NO_ERROR:
668 return 0;
669 case GOAWAY_PROTOCOL_ERROR:
670 return 1;
671 case GOAWAY_INTERNAL_ERROR:
672 return 2;
673 case GOAWAY_FLOW_CONTROL_ERROR:
674 return 3;
675 case GOAWAY_SETTINGS_TIMEOUT:
676 return 4;
677 case GOAWAY_STREAM_CLOSED:
678 return 5;
679 case GOAWAY_FRAME_SIZE_ERROR:
680 return 6;
681 case GOAWAY_REFUSED_STREAM:
682 return 7;
683 case GOAWAY_CANCEL:
684 return 8;
685 case GOAWAY_COMPRESSION_ERROR:
686 return 9;
687 case GOAWAY_CONNECT_ERROR:
688 return 10;
689 case GOAWAY_ENHANCE_YOUR_CALM:
690 return 11;
691 case GOAWAY_INADEQUATE_SECURITY:
692 return 12;
693 case GOAWAY_HTTP_1_1_REQUIRED:
694 return 13;
695 default:
696 LOG(DFATAL) << "Serializing unhandled GOAWAY status " << status;
697 return -1;
700 LOG(DFATAL) << "Unknown SpdyMajorVersion " << version;
701 return -1;
704 size_t SpdyConstants::GetDataFrameMinimumSize(SpdyMajorVersion version) {
705 switch (version) {
706 case SPDY2:
707 case SPDY3:
708 return 8;
709 case HTTP2:
710 return 9;
712 LOG(DFATAL) << "Unhandled SPDY version.";
713 return 0;
716 size_t SpdyConstants::GetControlFrameHeaderSize(SpdyMajorVersion version) {
717 switch (version) {
718 case SPDY2:
719 case SPDY3:
720 return 8;
721 case HTTP2:
722 return 9;
724 LOG(DFATAL) << "Unhandled SPDY version.";
725 return 0;
728 size_t SpdyConstants::GetPrefixLength(SpdyFrameType type,
729 SpdyMajorVersion version) {
730 if (type != DATA) {
731 return GetControlFrameHeaderSize(version);
732 } else {
733 return GetDataFrameMinimumSize(version);
737 size_t SpdyConstants::GetFrameMaximumSize(SpdyMajorVersion version) {
738 if (version < HTTP2) {
739 // 24-bit length field plus eight-byte frame header.
740 return ((1<<24) - 1) + 8;
741 } else {
742 // Max payload of 2^14 plus nine-byte frame header.
743 // TODO(mlavan): In HTTP/2 this is actually not a constant;
744 // payload size can be set using the MAX_FRAME_SIZE setting to
745 // anything between 1 << 14 and (1 << 24) - 1
746 return (1 << 14) + 9;
750 size_t SpdyConstants::GetSizeOfSizeField(SpdyMajorVersion version) {
751 return (version < SPDY3) ? sizeof(uint16) : sizeof(uint32);
754 size_t SpdyConstants::GetSettingSize(SpdyMajorVersion version) {
755 return version <= SPDY3 ? 8 : 6;
758 int32 SpdyConstants::GetInitialStreamWindowSize(SpdyMajorVersion version) {
759 return (version <= SPDY3) ? (64 * 1024) : (64 * 1024 - 1);
762 int32 SpdyConstants::GetInitialSessionWindowSize(SpdyMajorVersion version) {
763 return (version <= SPDY3) ? (64 * 1024) : (64 * 1024 - 1);
766 void SpdyDataIR::Visit(SpdyFrameVisitor* visitor) const {
767 return visitor->VisitData(*this);
770 void SpdySynStreamIR::Visit(SpdyFrameVisitor* visitor) const {
771 return visitor->VisitSynStream(*this);
774 void SpdySynReplyIR::Visit(SpdyFrameVisitor* visitor) const {
775 return visitor->VisitSynReply(*this);
778 SpdyRstStreamIR::SpdyRstStreamIR(SpdyStreamId stream_id,
779 SpdyRstStreamStatus status,
780 base::StringPiece description)
781 : SpdyFrameWithStreamIdIR(stream_id),
782 description_(description) {
783 set_status(status);
786 SpdyRstStreamIR::~SpdyRstStreamIR() {}
788 void SpdyRstStreamIR::Visit(SpdyFrameVisitor* visitor) const {
789 return visitor->VisitRstStream(*this);
792 SpdySettingsIR::SpdySettingsIR()
793 : clear_settings_(false),
794 is_ack_(false) {}
796 SpdySettingsIR::~SpdySettingsIR() {}
798 void SpdySettingsIR::Visit(SpdyFrameVisitor* visitor) const {
799 return visitor->VisitSettings(*this);
802 void SpdyPingIR::Visit(SpdyFrameVisitor* visitor) const {
803 return visitor->VisitPing(*this);
806 SpdyGoAwayIR::SpdyGoAwayIR(SpdyStreamId last_good_stream_id,
807 SpdyGoAwayStatus status,
808 base::StringPiece description)
809 : description_(description) {
810 set_last_good_stream_id(last_good_stream_id);
811 set_status(status);
814 SpdyGoAwayIR::~SpdyGoAwayIR() {}
816 const base::StringPiece& SpdyGoAwayIR::description() const {
817 return description_;
820 void SpdyGoAwayIR::Visit(SpdyFrameVisitor* visitor) const {
821 return visitor->VisitGoAway(*this);
824 void SpdyHeadersIR::Visit(SpdyFrameVisitor* visitor) const {
825 return visitor->VisitHeaders(*this);
828 void SpdyWindowUpdateIR::Visit(SpdyFrameVisitor* visitor) const {
829 return visitor->VisitWindowUpdate(*this);
832 void SpdyBlockedIR::Visit(SpdyFrameVisitor* visitor) const {
833 return visitor->VisitBlocked(*this);
836 void SpdyPushPromiseIR::Visit(SpdyFrameVisitor* visitor) const {
837 return visitor->VisitPushPromise(*this);
840 void SpdyContinuationIR::Visit(SpdyFrameVisitor* visitor) const {
841 return visitor->VisitContinuation(*this);
844 SpdyAltSvcIR::SpdyAltSvcIR(SpdyStreamId stream_id)
845 : SpdyFrameWithStreamIdIR(stream_id) {
848 SpdyAltSvcIR::~SpdyAltSvcIR() {
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