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

Side by Side Diff: net/http2/decoder/payload_decoders/goaway_payload_decoder.h

Issue 2293613002: Add new HTTP/2 and HPACK decoder in net/http2/. (Closed)
Patch Set: Replace LOG(INFO) by VLOG(2) in DecodeBufferTest.SlowDecodeTestStruct so that trybots do not fail. Created 4 years 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
OLDNEW
(Empty)
1 // Copyright 2016 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.
4
5 #ifndef NET_HTTP2_DECODER_PAYLOAD_DECODERS_GOAWAY_PAYLOAD_DECODER_H_
6 #define NET_HTTP2_DECODER_PAYLOAD_DECODERS_GOAWAY_PAYLOAD_DECODER_H_
7
8 // Decodes the payload of a GOAWAY frame.
9
10 // TODO(jamessynge): Sweep through all payload decoders, changing the names of
11 // the PayloadState enums so that they are really states, and not actions.
12
13 #include "net/base/net_export.h"
14 #include "net/http2/decoder/decode_buffer.h"
15 #include "net/http2/decoder/decode_status.h"
16 #include "net/http2/decoder/frame_decoder_state.h"
17 #include "net/http2/http2_structures.h"
18
19 namespace net {
20 namespace test {
21 class GoAwayPayloadDecoderPeer;
22 } // namespace test
23
24 class NET_EXPORT_PRIVATE GoAwayPayloadDecoder {
25 public:
26 // States during decoding of a GOAWAY frame.
27 enum class PayloadState {
28 // At the start of the GOAWAY frame payload, ready to start decoding the
29 // fixed size fields into goaway_fields_.
30 kStartDecodingFixedFields,
31
32 // Handle the DecodeStatus returned from starting or resuming the
33 // decoding of Http2GoAwayFields into goaway_fields_. If complete,
34 // calls OnGoAwayStart.
35 kHandleFixedFieldsStatus,
36
37 // Report the Opaque Data portion of the payload to the listener's
38 // OnGoAwayOpaqueData method, and call OnGoAwayEnd when the end of the
39 // payload is reached.
40 kReadOpaqueData,
41
42 // The fixed size fields weren't all available when the decoder first
43 // tried to decode them (state kStartDecodingFixedFields); this state
44 // resumes the decoding when ResumeDecodingPayload is called later.
45 kResumeDecodingFixedFields,
46 };
47
48 // Starts the decoding of a GOAWAY frame's payload, and completes it if
49 // the entire payload is in the provided decode buffer.
50 DecodeStatus StartDecodingPayload(FrameDecoderState* state, DecodeBuffer* db);
51
52 // Resumes decoding a GOAWAY frame's payload that has been split across
53 // decode buffers.
54 DecodeStatus ResumeDecodingPayload(FrameDecoderState* state,
55 DecodeBuffer* db);
56
57 private:
58 friend class test::GoAwayPayloadDecoderPeer;
59
60 Http2GoAwayFields goaway_fields_;
61 PayloadState payload_state_;
62 };
63
64 } // namespace net
65
66 #endif // NET_HTTP2_DECODER_PAYLOAD_DECODERS_GOAWAY_PAYLOAD_DECODER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698