1 //
2 //
3 // Copyright 2015 gRPC authors.
4 //
5 // Licensed under the Apache License, Version 2.0 (the "License");
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17 //
18 
19 #ifndef GRPC_SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_DATA_H
20 #define GRPC_SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_DATA_H
21 
22 // Parser for GRPC streams embedded in DATA frames
23 
24 #include <grpc/support/port_platform.h>
25 
26 #include <stdint.h>
27 
28 #include "absl/status/status.h"
29 
30 #include <grpc/slice.h>
31 
32 #include "src/core/ext/transport/chttp2/transport/frame.h"
33 #include "src/core/lib/iomgr/error.h"
34 #include "src/core/lib/promise/poll.h"
35 #include "src/core/lib/slice/slice_buffer.h"
36 #include "src/core/lib/transport/transport.h"
37 
38 // start processing a new data frame
39 absl::Status grpc_chttp2_data_parser_begin_frame(uint8_t flags,
40                                                  uint32_t stream_id,
41                                                  grpc_chttp2_stream* s);
42 
43 // handle a slice of a data frame - is_last indicates the last slice of a
44 // frame
45 grpc_error_handle grpc_chttp2_data_parser_parse(void* parser,
46                                                 grpc_chttp2_transport* t,
47                                                 grpc_chttp2_stream* s,
48                                                 const grpc_slice& slice,
49                                                 int is_last);
50 
51 void grpc_chttp2_encode_data(uint32_t id, grpc_slice_buffer* inbuf,
52                              uint32_t write_bytes, int is_eof,
53                              grpc_transport_one_way_stats* stats,
54                              grpc_slice_buffer* outbuf);
55 
56 grpc_core::Poll<grpc_error_handle> grpc_deframe_unprocessed_incoming_frames(
57     grpc_chttp2_stream* s, int64_t* min_progress_size,
58     grpc_core::SliceBuffer* stream_out, uint32_t* message_flags);
59 
60 #endif  // GRPC_SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_DATA_H
61