Go to the documentation of this file.
   26 #include "absl/base/attributes.h" 
   27 #include "absl/status/status.h" 
   28 #include "absl/strings/str_cat.h" 
   29 #include "absl/strings/str_format.h" 
   79   return static_cast<unsigned char>(
c) < 128 ? 
c : 32;
 
   91   switch (t->deframe_state) {
 
  119               "Connect string mismatch: expected '%c' (%d) got '%c' (%d) " 
  123               static_cast<int>(
static_cast<uint8_t>(
 
  131             1 + 
static_cast<int>(t->deframe_state));
 
  140       t->incoming_frame_size = (
static_cast<uint32_t>(*cur)) << 16;
 
  148       t->incoming_frame_size |= (
static_cast<uint32_t>(*cur)) << 8;
 
  156       t->incoming_frame_size |= *
cur;
 
  164       t->incoming_frame_type = *
cur;
 
  172       t->incoming_frame_flags = *
cur;
 
  180       t->incoming_stream_id = ((
static_cast<uint32_t>(*cur)) & 0x7f) << 24;
 
  188       t->incoming_stream_id |= (
static_cast<uint32_t>(*cur)) << 16;
 
  196       t->incoming_stream_id |= (
static_cast<uint32_t>(*cur)) << 8;
 
  204       t->incoming_stream_id |= (
static_cast<uint32_t>(*cur));
 
  210       if (t->incoming_frame_size == 0) {
 
  215         t->incoming_stream = 
nullptr;
 
  221       } 
else if (t->incoming_frame_size >
 
  226                             t->incoming_frame_size,
 
  240                                   static_cast<size_t>(
end - beg)),
 
  246         t->incoming_stream = 
nullptr;
 
  248       } 
else if (
static_cast<uint32_t>(
end - 
cur) > t->incoming_frame_size) {
 
  249         size_t cur_offset = 
static_cast<size_t>(
cur - beg);
 
  253                                   cur_offset + t->incoming_frame_size),
 
  258         cur += t->incoming_frame_size;
 
  259         t->incoming_stream = 
nullptr;
 
  265                                   static_cast<size_t>(
end - beg)),
 
  280   if (t->is_first_frame &&
 
  283         "Expected SETTINGS frame as the first frame, got frame type ",
 
  284         t->incoming_frame_type));
 
  286   t->is_first_frame = 
false;
 
  287   if (t->expect_continuation_stream_id != 0) {
 
  291                           t->incoming_frame_type));
 
  293     if (t->expect_continuation_stream_id != t->incoming_stream_id) {
 
  295           "Expected CONTINUATION frame for grpc_chttp2_stream %08x, got " 
  296           "grpc_chttp2_stream %08x",
 
  297           t->expect_continuation_stream_id, t->incoming_stream_id));
 
  301   switch (t->incoming_frame_type) {
 
  308           "Unexpected CONTINUATION frame");
 
  339       return HPackParser::Boundary::EndOfStream;
 
  341       return HPackParser::Boundary::EndOfHeaders;
 
  350   return HPackParser::LogInfo{
 
  351       t->incoming_stream_id,
 
  359   bool is_eoh = t->expect_continuation_stream_id != 0;
 
  361   t->parser_data = &t->hpack_parser;
 
  362   t->hpack_parser.BeginFrame(
 
  379     t->hpack_parser.StopBufferingFrame();
 
  389     if (t->bdp_ping_blocked) {
 
  390       t->bdp_ping_blocked = 
false;
 
  418   s->received_bytes += t->incoming_frame_size;
 
  419   s->stats.incoming.framing_bytes += 9;
 
  420   if (s->read_closed) {
 
  427     t->incoming_stream = s;
 
  430     t->parser_data = 
nullptr;
 
  433   } 
else if (s != 
nullptr) {
 
  447                                                   int is_continuation) {
 
  455     t->expect_continuation_stream_id = 0;
 
  457     t->expect_continuation_stream_id = t->incoming_stream_id;
 
  460   if (!is_continuation) {
 
  465   const auto priority_type = !is_continuation && (t->incoming_frame_flags &
 
  467                                  ? HPackParser::Priority::Included
 
  478                   "grpc_chttp2_stream disbanded before CONTINUATION received"));
 
  483                      t->incoming_stream_id < t->next_stream_id)) {
 
  487             GPR_ERROR, 
"ignoring new grpc_chttp2_stream creation on client"));
 
  490     } 
else if (
GPR_UNLIKELY(t->last_new_stream_id >= t->incoming_stream_id)) {
 
  493           "ignoring out of order new grpc_chttp2_stream request on server; " 
  494           "last grpc_chttp2_stream " 
  495           "id=%d, new grpc_chttp2_stream id=%d",
 
  496           t->last_new_stream_id, t->incoming_stream_id));
 
  498     } 
else if (
GPR_UNLIKELY((t->incoming_stream_id & 1) == 0)) {
 
  501           "ignoring grpc_chttp2_stream with non-client generated index %d",
 
  502           t->incoming_stream_id));
 
  512           "transport:%p SERVER peer:%s Final GOAWAY sent. Ignoring new " 
  513           "grpc_chttp2_stream request id=%d, last grpc_chttp2_stream id=%d",
 
  514           t, t->peer_string.c_str(), t->incoming_stream_id,
 
  515           t->last_new_stream_id));
 
  518     t->last_new_stream_id = t->incoming_stream_id;
 
  519     s = t->incoming_stream =
 
  526     if (t->channelz_socket != 
nullptr) {
 
  527       t->channelz_socket->RecordStreamStartedFromRemote();
 
  530     t->incoming_stream = s;
 
  533   s->stats.incoming.framing_bytes += 9;
 
  536         GPR_ERROR, 
"skipping already closed grpc_chttp2_stream header"));
 
  537     t->incoming_stream = 
nullptr;
 
  541   t->parser_data = &t->hpack_parser;
 
  543     s->eos_received = 
true;
 
  547   switch (s->header_frames_received) {
 
  549       if (t->is_client && t->header_eof) {
 
  551         if (s->trailing_metadata_available != 
nullptr) {
 
  552           *s->trailing_metadata_available = 
true;
 
  554         incoming_metadata_buffer = &s->trailing_metadata_buffer;
 
  555         frame_type = HPackParser::LogInfo::kTrailers;
 
  558         incoming_metadata_buffer = &s->initial_metadata_buffer;
 
  559         frame_type = HPackParser::LogInfo::kHeaders;
 
  564       incoming_metadata_buffer = &s->trailing_metadata_buffer;
 
  565       frame_type = HPackParser::LogInfo::kTrailers;
 
  571   if (frame_type == HPackParser::LogInfo::kTrailers && !t->header_eof) {
 
  573         "Trailing metadata frame received without an end-o-stream");
 
  575   t->hpack_parser.BeginFrame(
 
  576       incoming_metadata_buffer,
 
  587       &t->simple.window_update, t->incoming_frame_size,
 
  588       t->incoming_frame_flags);
 
  590   if (t->incoming_stream_id != 0) {
 
  596     s->stats.incoming.framing_bytes += 9;
 
  599   t->parser_data = &t->simple.window_update;
 
  605       &t->simple.ping, t->incoming_frame_size, t->incoming_frame_flags);
 
  608   t->parser_data = &t->simple.ping;
 
  614       &t->simple.rst_stream, t->incoming_frame_size, t->incoming_frame_flags);
 
  618   if (!t->incoming_stream) {
 
  621   s->stats.incoming.framing_bytes += 9;
 
  623   t->parser_data = &t->simple.rst_stream;
 
  629       &t->goaway_parser, t->incoming_frame_size, t->incoming_frame_flags);
 
  632   t->parser_data = &t->goaway_parser;
 
  637   if (t->incoming_stream_id != 0) {
 
  639         "Settings frame received for grpc_chttp2_stream");
 
  643       &t->simple.settings, t->incoming_frame_size, t->incoming_frame_flags,
 
  651     t->hpack_parser.hpack_table()->SetMaxBytes(
 
  654     t->flow_control.SetAckedInitialWindow(
 
  657     t->sent_local_settings = 
false;
 
  660   t->parser_data = &t->simple.settings;
 
  678       s->forced_close_error = 
err;
 
  
@ GRPC_DTS_CLIENT_PREFIX_11
static char get_utf8_safe_char(char c)
@ GRPC_DTS_CLIENT_PREFIX_8
std::string StrCat(const AlphaNum &a, const AlphaNum &b)
grpc_chttp2_stream * grpc_chttp2_parsing_lookup_stream(grpc_chttp2_transport *t, uint32_t id)
ABSL_MUST_USE_RESULT std::string StrFormat(const FormatSpec< Args... > &format, const Args &... args)
#define GPR_DEBUG_ASSERT(x)
#define GRPC_CHTTP2_FRAME_WINDOW_UPDATE
grpc_chttp2_stream * grpc_chttp2_parsing_accept_stream(grpc_chttp2_transport *t, uint32_t id)
#define GRPC_CHTTP2_FLAG_ACK
grpc_error_handle grpc_chttp2_ping_parser_begin_frame(grpc_chttp2_ping_parser *parser, uint32_t length, uint8_t flags)
static grpc_error_handle init_header_skip_frame_parser(grpc_chttp2_transport *t, HPackParser::Priority priority_type)
@ GRPC_DTS_CLIENT_PREFIX_16
static grpc_error_handle init_frame_parser(grpc_chttp2_transport *t)
grpc_error_handle grpc_chttp2_rst_stream_parser_parse(void *parser, grpc_chttp2_transport *t, grpc_chttp2_stream *s, const grpc_slice &slice, int is_last)
@ GRPC_DTS_CLIENT_PREFIX_0
static grpc_error_handle init_settings_frame_parser(grpc_chttp2_transport *t)
@ GRPC_DTS_CLIENT_PREFIX_12
@ GRPC_DTS_CLIENT_PREFIX_6
@ GRPC_DTS_CLIENT_PREFIX_19
grpc_core::TraceFlag grpc_http_trace(false, "http")
#define GRPC_CHTTP2_DATA_FLAG_END_HEADERS
grpc_error_handle grpc_chttp2_settings_parser_parse(void *p, grpc_chttp2_transport *t, grpc_chttp2_stream *, const grpc_slice &slice, int is_last)
static constexpr Timestamp InfPast()
@ GRPC_CHTTP2_SETTINGS_HEADER_TABLE_SIZE
void grpc_chttp2_parsing_become_skip_parser(grpc_chttp2_transport *t)
static grpc_error_handle skip_parser(void *, grpc_chttp2_transport *, grpc_chttp2_stream *, const grpc_slice &, int)
@ GRPC_CHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS
@ GRPC_DTS_CLIENT_PREFIX_10
grpc_error_handle grpc_chttp2_window_update_parser_parse(void *parser, grpc_chttp2_transport *t, grpc_chttp2_stream *s, const grpc_slice &slice, int is_last)
GPRAPI grpc_slice grpc_slice_sub_no_ref(grpc_slice s, size_t begin, size_t end)
#define GRPC_TRACE_FLAG_ENABLED(f)
#define GRPC_CHTTP2_FRAME_HEADER
FlowControlAction MakeAction()
static grpc_error_handle init_goaway_parser(grpc_chttp2_transport *t)
@ GRPC_DTS_CLIENT_PREFIX_18
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))
@ GRPC_DTS_CLIENT_PREFIX_7
grpc_error_handle grpc_chttp2_goaway_parser_begin_frame(grpc_chttp2_goaway_parser *p, uint32_t length, uint8_t)
static grpc_error_handle init_rst_stream_parser(grpc_chttp2_transport *t)
def c_str(s, encoding='ascii')
@ GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE
@ GRPC_DTS_CLIENT_PREFIX_3
grpc_error_handle grpc_chttp2_goaway_parser_parse(void *parser, grpc_chttp2_transport *t, grpc_chttp2_stream *, const grpc_slice &slice, int is_last)
GPRAPI void gpr_log(const char *file, int line, gpr_log_severity severity, const char *format,...) GPR_PRINT_FORMAT_CHECK(4
static grpc_error_handle init_header_frame_parser(grpc_chttp2_transport *t, int is_continuation)
@ GRPC_CHTTP2_FINAL_GOAWAY_SENT
@ GRPC_DTS_CLIENT_PREFIX_4
void grpc_chttp2_act_on_flowctl_action(const grpc_core::chttp2::FlowControlAction &action, grpc_chttp2_transport *t, grpc_chttp2_stream *s)
#define GRPC_CHTTP2_FRAME_PING
grpc_error_handle grpc_chttp2_window_update_parser_begin_frame(grpc_chttp2_window_update_parser *parser, uint32_t length, uint8_t flags)
@ GRPC_ERROR_INT_STREAM_ID
#define GRPC_SLICE_START_PTR(slice)
#define GRPC_CHTTP2_FRAME_CONTINUATION
bool grpc_error_get_int(grpc_error_handle err, grpc_error_ints which, intptr_t *p)
GPRAPI grpc_slice grpc_empty_slice(void)
@ GRPC_DTS_CLIENT_PREFIX_22
static grpc_error_handle init_window_update_frame_parser(grpc_chttp2_transport *t)
absl::Status RecvData(int64_t incoming_frame_size, absl::FunctionRef< absl::Status()> stream=[]() { return absl::OkStatus();})
grpc_error_handle grpc_chttp2_settings_parser_begin_frame(grpc_chttp2_settings_parser *parser, uint32_t length, uint8_t flags, uint32_t *settings)
#define GRPC_SLICE_END_PTR(slice)
@ GRPC_DTS_CLIENT_PREFIX_23
grpc_error_handle grpc_chttp2_data_parser_parse(void *, grpc_chttp2_transport *t, grpc_chttp2_stream *s, const grpc_slice &slice, int is_last)
void schedule_bdp_ping_locked(grpc_chttp2_transport *t)
#define GRPC_CHTTP2_FRAME_GOAWAY
grpc_chttp2_deframe_transport_state
#define GRPC_CHTTP2_FRAME_RST_STREAM
#define GRPC_ERROR_CREATE_FROM_STATIC_STRING(desc)
size_t grpc_chttp2_stream_map_size(grpc_chttp2_stream_map *map)
@ GRPC_DTS_CLIENT_PREFIX_2
absl::Status RecvData(int64_t incoming_frame_size)
grpc_error_handle grpc_chttp2_rst_stream_parser_begin_frame(grpc_chttp2_rst_stream_parser *parser, uint32_t length, uint8_t flags)
#define GRPC_CHTTP2_REF_TRANSPORT(t, r)
@ GRPC_DTS_CLIENT_PREFIX_13
#define GRPC_CHTTP2_FRAME_SETTINGS
grpc_error_handle absl_status_to_grpc_error(absl::Status status)
#define GRPC_CHTTP2_NUM_SETTINGS
@ GRPC_DTS_CLIENT_PREFIX_14
#define GRPC_CHTTP2_IF_TRACING(stmt)
std::string grpc_error_std_string(grpc_error_handle error)
#define GRPC_CHTTP2_FLAG_HAS_PRIORITY
#define GRPC_CHTTP2_CLIENT_CONNECT_STRING
#define GRPC_CHTTP2_DATA_FLAG_END_STREAM
#define GRPC_CHTTP2_FRAME_DATA
#define GRPC_ERROR_CREATE_FROM_CPP_STRING(desc)
@ GRPC_DTS_CLIENT_PREFIX_15
static grpc_error_handle init_non_header_skip_frame_parser(grpc_chttp2_transport *t)
static grpc_error_handle init_data_frame_parser(grpc_chttp2_transport *t)
@ GRPC_DTS_CLIENT_PREFIX_17
@ GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE
ABSL_MUST_USE_RESULT bool ok() const
void grpc_chttp2_mark_stream_closed(grpc_chttp2_transport *t, grpc_chttp2_stream *s, int close_reads, int close_writes, grpc_error_handle error)
#define GRPC_ERROR_UNREF(err)
static HPackParser::Boundary hpack_boundary_type(grpc_chttp2_transport *t, bool is_eoh)
void grpc_chttp2_add_rst_stream_to_next_write(grpc_chttp2_transport *t, uint32_t id, uint32_t code, grpc_transport_one_way_stats *stats)
@ GRPC_CHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE
static grpc_error_handle parse_frame_slice(grpc_chttp2_transport *t, const grpc_slice &slice, int is_last)
static grpc_error_handle init_ping_parser(grpc_chttp2_transport *t)
@ GRPC_DTS_CLIENT_PREFIX_9
grpc_error_handle grpc_chttp2_perform_read(grpc_chttp2_transport *t, const grpc_slice &slice)
FlowControlAction MakeAction()
void AddIncomingBytes(int64_t num_bytes)
static HPackParser::LogInfo hpack_parser_log_info(grpc_chttp2_transport *t, HPackParser::LogInfo::Type type)
absl::Status grpc_chttp2_data_parser_begin_frame(uint8_t flags, uint32_t stream_id, grpc_chttp2_stream *s)
@ GRPC_DTS_CLIENT_PREFIX_1
grpc_error_handle grpc_chttp2_ping_parser_parse(void *parser, grpc_chttp2_transport *t, grpc_chttp2_stream *, const grpc_slice &slice, int is_last)
@ GRPC_HTTP2_PROTOCOL_ERROR
#define ABSL_FALLTHROUGH_INTENDED
@ GRPC_DTS_CLIENT_PREFIX_20
@ GRPC_DTS_CLIENT_PREFIX_21
#define GRPC_ERROR_IS_NONE(err)
@ GRPC_DTS_CLIENT_PREFIX_5
grpc_error_handle grpc_chttp2_header_parser_parse(void *hpack_parser, grpc_chttp2_transport *t, grpc_chttp2_stream *s, const grpc_slice &slice, int is_last)
grpc
Author(s): 
autogenerated on Fri May 16 2025 02:59:41