You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by bc...@apache.org on 2017/03/28 14:22:41 UTC

[trafficserver] branch master updated: Changed some of the HTTP/2 enums to enum classes and found a comparison bug in is_client_state_writeable()

This is an automated email from the ASF dual-hosted git repository.

bcall pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

The following commit(s) were added to refs/heads/master by this push:
       new  b2bddd3   Changed some of the HTTP/2 enums to enum classes and found a comparison bug in is_client_state_writeable()
b2bddd3 is described below

commit b2bddd32e555326fd4231881bde6c8d4da380965
Author: Bryan Call <bc...@apache.org>
AuthorDate: Fri Mar 24 09:41:12 2017 -0700

    Changed some of the HTTP/2 enums to enum classes and found a comparison bug
    in is_client_state_writeable()
---
 proxy/http2/HTTP2.cc                |  32 ++---
 proxy/http2/HTTP2.h                 |  14 +-
 proxy/http2/Http2ClientSession.cc   |  12 +-
 proxy/http2/Http2ConnectionState.cc | 259 ++++++++++++++++++++++--------------
 proxy/http2/Http2DebugNames.cc      |  30 ++---
 proxy/http2/Http2DebugNames.h       |   4 +-
 proxy/http2/Http2Stream.cc          |  48 +++----
 proxy/http2/Http2Stream.h           |   7 +-
 8 files changed, 231 insertions(+), 175 deletions(-)

diff --git a/proxy/http2/HTTP2.cc b/proxy/http2/HTTP2.cc
index 62df96b..1769950 100644
--- a/proxy/http2/HTTP2.cc
+++ b/proxy/http2/HTTP2.cc
@@ -311,7 +311,7 @@ http2_write_goaway(const Http2Goaway &goaway, IOVec iov)
   }
 
   write_and_advance(ptr, goaway.last_streamid);
-  write_and_advance(ptr, goaway.error_code);
+  write_and_advance(ptr, static_cast<uint32_t>(goaway.error_code));
 
   return true;
 }
@@ -405,7 +405,7 @@ http2_parse_goaway(IOVec iov, Http2Goaway &goaway)
   memcpy_and_advance(ec.bytes, ptr);
 
   goaway.last_streamid = ntohl(sid.value);
-  goaway.error_code    = ntohl(ec.value);
+  goaway.error_code    = static_cast<Http2ErrorCode>(ntohl(ec.value));
   return true;
 }
 
@@ -602,12 +602,12 @@ http2_encode_header_blocks(HTTPHdr *in, uint8_t *out, uint32_t out_len, uint32_t
   // TODO: It would be better to split Cookie header value
   int64_t result = hpack_encode_header_block(handle, out, out_len, in);
   if (result < 0) {
-    return HTTP2_ERROR_COMPRESSION_ERROR;
+    return Http2ErrorCode::HTTP2_ERROR_COMPRESSION_ERROR;
   }
   if (len_written) {
     *len_written = result;
   }
-  return HTTP2_ERROR_NO_ERROR;
+  return Http2ErrorCode::HTTP2_ERROR_NO_ERROR;
 }
 
 /*
@@ -625,12 +625,12 @@ http2_decode_header_blocks(HTTPHdr *hdr, const uint8_t *buf_start, const uint32_
 
   if (result < 0) {
     if (result == HPACK_ERROR_COMPRESSION_ERROR) {
-      return HTTP2_ERROR_COMPRESSION_ERROR;
+      return Http2ErrorCode::HTTP2_ERROR_COMPRESSION_ERROR;
     } else if (result == HPACK_ERROR_SIZE_EXCEEDED_ERROR) {
-      return HTTP2_ERROR_ENHANCE_YOUR_CALM;
+      return Http2ErrorCode::HTTP2_ERROR_ENHANCE_YOUR_CALM;
     }
 
-    return HTTP2_ERROR_PROTOCOL_ERROR;
+    return Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR;
   }
   if (len_read) {
     *len_read = result;
@@ -649,18 +649,18 @@ http2_decode_header_blocks(HTTPHdr *hdr, const uint8_t *buf_start, const uint32_
     if (len && value[0] == ':') {
       ++pseudo_header_count;
       if (pseudo_header_count > expected_pseudo_header_count) {
-        return HTTP2_ERROR_PROTOCOL_ERROR;
+        return Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR;
       }
     } else {
       if (pseudo_header_count != expected_pseudo_header_count) {
-        return HTTP2_ERROR_PROTOCOL_ERROR;
+        return Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR;
       }
     }
     // Check whether header field name is lower case
     // This check should be here but it will fail because WKSs in MIMEField is old fashioned.
     // for (uint32_t i = 0; i < len; ++i) {
     //   if (ParseRules::is_upalpha(value[i])) {
-    //     return HTTP2_ERROR_PROTOCOL_ERROR;
+    //     return Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR;
     //   }
     // }
   }
@@ -668,7 +668,7 @@ http2_decode_header_blocks(HTTPHdr *hdr, const uint8_t *buf_start, const uint32_
   // rfc7540,sec8.1.2.2: Any message containing connection-specific header
   // fields MUST be treated as malformed
   if (hdr->field_find(MIME_FIELD_CONNECTION, MIME_LEN_CONNECTION) != nullptr) {
-    return HTTP2_ERROR_PROTOCOL_ERROR;
+    return Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR;
   }
 
   // :path pseudo header MUST NOT empty for http or https URIs
@@ -676,7 +676,7 @@ http2_decode_header_blocks(HTTPHdr *hdr, const uint8_t *buf_start, const uint32_
   if (field) {
     field->value_get(&len);
     if (len == 0) {
-      return HTTP2_ERROR_PROTOCOL_ERROR;
+      return Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR;
     }
   }
 
@@ -693,7 +693,7 @@ http2_decode_header_blocks(HTTPHdr *hdr, const uint8_t *buf_start, const uint32_
   if (field) {
     value = field->value_get(&len);
     if (!(len == 8 && memcmp(value, "trailers", 8) == 0)) {
-      return HTTP2_ERROR_PROTOCOL_ERROR;
+      return Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR;
     }
   }
 
@@ -706,15 +706,15 @@ http2_decode_header_blocks(HTTPHdr *hdr, const uint8_t *buf_start, const uint32_
           hdr->field_find(HTTP2_VALUE_AUTHORITY, HTTP2_LEN_AUTHORITY) == nullptr ||
           hdr->field_find(HTTP2_VALUE_STATUS, HTTP2_LEN_STATUS) != nullptr) {
         // Decoded header field is invalid
-        return HTTP2_ERROR_PROTOCOL_ERROR;
+        return Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR;
       }
     } else {
       // Pseudo headers is insufficient
-      return HTTP2_ERROR_PROTOCOL_ERROR;
+      return Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR;
     }
   }
 
-  return HTTP2_ERROR_NO_ERROR;
+  return Http2ErrorCode::HTTP2_ERROR_NO_ERROR;
 }
 
 // Initialize this subsystem with librecords configs (for now)
diff --git a/proxy/http2/HTTP2.h b/proxy/http2/HTTP2.h
index 5c982c4..68a7729 100644
--- a/proxy/http2/HTTP2.h
+++ b/proxy/http2/HTTP2.h
@@ -96,14 +96,14 @@ extern RecRawStatBlock *http2_rsb; // Container for statistics.
 static const Http2WindowSize HTTP2_MAX_WINDOW_SIZE = 0x7FFFFFFF;
 
 // [RFC 7540] 5.4. Error Handling
-enum Http2ErrorClass {
+enum class Http2ErrorClass {
   HTTP2_ERROR_CLASS_NONE,
   HTTP2_ERROR_CLASS_CONNECTION,
   HTTP2_ERROR_CLASS_STREAM,
 };
 
 // [RFC 7540] 7. Error Codes
-enum Http2ErrorCode {
+enum class Http2ErrorCode {
   HTTP2_ERROR_NO_ERROR            = 0,
   HTTP2_ERROR_PROTOCOL_ERROR      = 1,
   HTTP2_ERROR_INTERNAL_ERROR      = 2,
@@ -123,7 +123,7 @@ enum Http2ErrorCode {
 };
 
 // [RFC 7540] 5.1. Stream States
-enum Http2StreamState {
+enum class Http2StreamState {
   HTTP2_STREAM_STATE_IDLE,
   HTTP2_STREAM_STATE_RESERVED_LOCAL,
   HTTP2_STREAM_STATE_RESERVED_REMOTE,
@@ -243,8 +243,8 @@ struct Http2FrameHeader {
 
 // [RFC 7540] 5.4. Error Handling
 struct Http2Error {
-  Http2Error(const Http2ErrorClass error_class = HTTP2_ERROR_CLASS_NONE, const Http2ErrorCode error_code = HTTP2_ERROR_NO_ERROR,
-             const char *err_msg = NULL)
+  Http2Error(const Http2ErrorClass error_class = Http2ErrorClass::HTTP2_ERROR_CLASS_NONE,
+             const Http2ErrorCode error_code = Http2ErrorCode::HTTP2_ERROR_NO_ERROR, const char *err_msg = NULL)
   {
     cls  = error_class;
     code = error_code;
@@ -283,9 +283,9 @@ struct Http2HeadersParameter {
 
 // [RFC 7540] 6.8 GOAWAY Format
 struct Http2Goaway {
-  Http2Goaway() : last_streamid(0), error_code(0) {}
+  Http2Goaway() : last_streamid(0), error_code(Http2ErrorCode::HTTP2_ERROR_NO_ERROR) {}
   Http2StreamId last_streamid;
-  uint32_t error_code;
+  Http2ErrorCode error_code;
 
   // NOTE: we don't (de)serialize the variable length debug data at this layer
   // because there's
diff --git a/proxy/http2/Http2ClientSession.cc b/proxy/http2/Http2ClientSession.cc
index d134048..74bfab8 100644
--- a/proxy/http2/Http2ClientSession.cc
+++ b/proxy/http2/Http2ClientSession.cc
@@ -401,7 +401,7 @@ Http2ClientSession::state_start_frame_read(int event, void *edata)
 int
 Http2ClientSession::do_start_frame_read(Http2ErrorCode &ret_error)
 {
-  ret_error = HTTP2_ERROR_NO_ERROR;
+  ret_error = Http2ErrorCode::HTTP2_ERROR_NO_ERROR;
   ink_release_assert(this->sm_reader->read_avail() >= (int64_t)HTTP2_FRAME_HEADER_LEN);
 
   uint8_t buf[HTTP2_FRAME_HEADER_LEN];
@@ -422,19 +422,19 @@ Http2ClientSession::do_start_frame_read(Http2ErrorCode &ret_error)
   this->sm_reader->consume(nbytes);
 
   if (!http2_frame_header_is_valid(this->current_hdr, this->connection_state.server_settings.get(HTTP2_SETTINGS_MAX_FRAME_SIZE))) {
-    ret_error = HTTP2_ERROR_PROTOCOL_ERROR;
+    ret_error = Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR;
     return -1;
   }
 
   // If we know up front that the payload is too long, nuke this connection.
   if (this->current_hdr.length > this->connection_state.server_settings.get(HTTP2_SETTINGS_MAX_FRAME_SIZE)) {
-    ret_error = HTTP2_ERROR_FRAME_SIZE_ERROR;
+    ret_error = Http2ErrorCode::HTTP2_ERROR_FRAME_SIZE_ERROR;
     return -1;
   }
 
   // Allow only stream id = 0 or streams started by client.
   if (this->current_hdr.streamid != 0 && !http2_is_client_streamid(this->current_hdr.streamid)) {
-    ret_error = HTTP2_ERROR_PROTOCOL_ERROR;
+    ret_error = Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR;
     return -1;
   }
 
@@ -443,7 +443,7 @@ Http2ClientSession::do_start_frame_read(Http2ErrorCode &ret_error)
 
   if (continued_stream_id != 0 &&
       (continued_stream_id != this->current_hdr.streamid || this->current_hdr.type != HTTP2_FRAME_TYPE_CONTINUATION)) {
-    ret_error = HTTP2_ERROR_PROTOCOL_ERROR;
+    ret_error = Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR;
     return -1;
   }
   return 0;
@@ -492,7 +492,7 @@ Http2ClientSession::state_process_frame_read(int event, VIO *vio, bool inside_fr
     Http2ErrorCode err;
     if (do_start_frame_read(err) < 0) {
       // send an error if specified.  Otherwise, just go away
-      if (err > HTTP2_ERROR_NO_ERROR) {
+      if (err > Http2ErrorCode::HTTP2_ERROR_NO_ERROR) {
         SCOPED_MUTEX_LOCK(lock, this->connection_state.mutex, this_ethread());
         if (!this->connection_state.is_state_closed()) {
           this->connection_state.send_goaway_frame(this->current_hdr.streamid, err);
diff --git a/proxy/http2/Http2ConnectionState.cc b/proxy/http2/Http2ConnectionState.cc
index f17ed3b..112bc2e 100644
--- a/proxy/http2/Http2ConnectionState.cc
+++ b/proxy/http2/Http2ConnectionState.cc
@@ -77,24 +77,28 @@ rcv_data_frame(Http2ConnectionState &cstate, const Http2Frame &frame)
   // recipient MUST
   // respond with a connection error of type PROTOCOL_ERROR.
   if (!http2_is_client_streamid(id)) {
-    return Http2Error(HTTP2_ERROR_CLASS_CONNECTION, HTTP2_ERROR_PROTOCOL_ERROR, "recv data bad frame client id");
+    return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR,
+                      "recv data bad frame client id");
   }
 
   Http2Stream *stream = cstate.find_stream(id);
   if (stream == nullptr) {
     if (cstate.is_valid_streamid(id)) {
       // This error occurs fairly often, and is probably innocuous (SM initiates the shutdown)
-      return Http2Error(HTTP2_ERROR_CLASS_STREAM, HTTP2_ERROR_STREAM_CLOSED, NULL);
+      return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_STREAM, Http2ErrorCode::HTTP2_ERROR_STREAM_CLOSED, NULL);
     } else {
-      return Http2Error(HTTP2_ERROR_CLASS_CONNECTION, HTTP2_ERROR_PROTOCOL_ERROR, "recv data stream freed with invalid id");
+      return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR,
+                        "recv data stream freed with invalid id");
     }
   }
 
   // If a DATA frame is received whose stream is not in "open" or "half closed
   // (local)" state,
   // the recipient MUST respond with a stream error of type STREAM_CLOSED.
-  if (stream->get_state() != HTTP2_STREAM_STATE_OPEN && stream->get_state() != HTTP2_STREAM_STATE_HALF_CLOSED_LOCAL) {
-    return Http2Error(HTTP2_ERROR_CLASS_STREAM, HTTP2_ERROR_STREAM_CLOSED, "recv data stream closed");
+  if (stream->get_state() != Http2StreamState::HTTP2_STREAM_STATE_OPEN &&
+      stream->get_state() != Http2StreamState::HTTP2_STREAM_STATE_HALF_CLOSED_LOCAL) {
+    return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_STREAM, Http2ErrorCode::HTTP2_ERROR_STREAM_CLOSED,
+                      "recv data stream closed");
   }
 
   if (frame.header().flags & HTTP2_FLAGS_DATA_PADDED) {
@@ -104,7 +108,8 @@ rcv_data_frame(Http2ConnectionState &cstate, const Http2Frame &frame)
       // If the length of the padding is the length of the
       // frame payload or greater, the recipient MUST treat this as a
       // connection error of type PROTOCOL_ERROR.
-      return Http2Error(HTTP2_ERROR_CLASS_CONNECTION, HTTP2_ERROR_PROTOCOL_ERROR, "recv data pad > payload");
+      return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR,
+                        "recv data pad > payload");
     }
   }
 
@@ -112,26 +117,28 @@ rcv_data_frame(Http2ConnectionState &cstate, const Http2Frame &frame)
   if (frame.header().flags & HTTP2_FLAGS_DATA_END_STREAM) {
     stream->recv_end_stream = true;
     if (!stream->change_state(frame.header().type, frame.header().flags)) {
-      cstate.send_rst_stream_frame(id, HTTP2_ERROR_STREAM_CLOSED);
-      return Http2Error(HTTP2_ERROR_CLASS_NONE);
+      cstate.send_rst_stream_frame(id, Http2ErrorCode::HTTP2_ERROR_STREAM_CLOSED);
+      return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_NONE);
     }
     if (!stream->payload_length_is_valid()) {
-      return Http2Error(HTTP2_ERROR_CLASS_CONNECTION, HTTP2_ERROR_PROTOCOL_ERROR, "recv data bad payload length");
+      return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR,
+                        "recv data bad payload length");
     }
   }
 
   // If Data length is 0, do nothing.
   if (payload_length == 0) {
-    return Http2Error(HTTP2_ERROR_CLASS_NONE);
+    return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_NONE);
   }
 
   // Check whether Window Size is acceptable
   if (cstate.server_rwnd < payload_length) {
-    return Http2Error(HTTP2_ERROR_CLASS_CONNECTION, HTTP2_ERROR_FLOW_CONTROL_ERROR,
+    return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, Http2ErrorCode::HTTP2_ERROR_FLOW_CONTROL_ERROR,
                       "recv data cstate.server_rwnd < payload_length");
   }
   if (stream->server_rwnd < payload_length) {
-    return Http2Error(HTTP2_ERROR_CLASS_STREAM, HTTP2_ERROR_FLOW_CONTROL_ERROR, "recv data stream->server_rwnd < payload_length");
+    return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_STREAM, Http2ErrorCode::HTTP2_ERROR_FLOW_CONTROL_ERROR,
+                      "recv data stream->server_rwnd < payload_length");
   }
 
   // Update Window size
@@ -170,7 +177,7 @@ rcv_data_frame(Http2ConnectionState &cstate, const Http2Frame &frame)
     cstate.send_window_update_frame(stream->get_id(), diff_size);
   }
 
-  return Http2Error(HTTP2_ERROR_CLASS_NONE);
+  return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_NONE);
 }
 
 /*
@@ -191,7 +198,8 @@ rcv_headers_frame(Http2ConnectionState &cstate, const Http2Frame &frame)
   DebugHttp2Stream(cstate.ua_session, stream_id, "Received HEADERS frame");
 
   if (!http2_is_client_streamid(stream_id)) {
-    return Http2Error(HTTP2_ERROR_CLASS_CONNECTION, HTTP2_ERROR_PROTOCOL_ERROR, "recv headers bad client id");
+    return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR,
+                      "recv headers bad client id");
   }
 
   Http2Stream *stream = nullptr;
@@ -200,11 +208,12 @@ rcv_headers_frame(Http2ConnectionState &cstate, const Http2Frame &frame)
   if (cstate.is_valid_streamid(stream_id)) {
     stream = cstate.find_stream(stream_id);
     if (stream == nullptr || !stream->has_trailing_header()) {
-      return Http2Error(HTTP2_ERROR_CLASS_CONNECTION, HTTP2_ERROR_STREAM_CLOSED, "recv headers cannot find existing stream_id");
+      return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, Http2ErrorCode::HTTP2_ERROR_STREAM_CLOSED,
+                        "recv headers cannot find existing stream_id");
     }
   } else {
     // Create new stream
-    Http2Error error(HTTP2_ERROR_CLASS_NONE);
+    Http2Error error(Http2ErrorClass::HTTP2_ERROR_CLASS_NONE);
     stream     = cstate.create_stream(stream_id, error);
     new_stream = true;
     if (!stream) {
@@ -215,7 +224,7 @@ rcv_headers_frame(Http2ConnectionState &cstate, const Http2Frame &frame)
   // keep track of how many bytes we get in the frame
   stream->request_header_length += payload_length;
   if (stream->request_header_length > Http2::max_request_header_size) {
-    return Http2Error(HTTP2_ERROR_CLASS_STREAM, HTTP2_ERROR_PROTOCOL_ERROR,
+    return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_STREAM, Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR,
                       "recv headers payload for headers greater than header length");
   }
 
@@ -233,11 +242,13 @@ rcv_headers_frame(Http2ConnectionState &cstate, const Http2Frame &frame)
     frame.reader()->memcpy(buf, HTTP2_HEADERS_PADLEN_LEN);
 
     if (!http2_parse_headers_parameter(make_iovec(buf, HTTP2_HEADERS_PADLEN_LEN), params)) {
-      return Http2Error(HTTP2_ERROR_CLASS_CONNECTION, HTTP2_ERROR_PROTOCOL_ERROR, "recv headers failed to parse");
+      return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR,
+                        "recv headers failed to parse");
     }
 
     if (params.pad_length > payload_length) {
-      return Http2Error(HTTP2_ERROR_CLASS_CONNECTION, HTTP2_ERROR_PROTOCOL_ERROR, "recv headers pad > payload length");
+      return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR,
+                        "recv headers pad > payload length");
     }
 
     header_block_fragment_offset += HTTP2_HEADERS_PADLEN_LEN;
@@ -250,11 +261,13 @@ rcv_headers_frame(Http2ConnectionState &cstate, const Http2Frame &frame)
 
     frame.reader()->memcpy(buf, HTTP2_PRIORITY_LEN, header_block_fragment_offset);
     if (!http2_parse_priority_parameter(make_iovec(buf, HTTP2_PRIORITY_LEN), params.priority)) {
-      return Http2Error(HTTP2_ERROR_CLASS_CONNECTION, HTTP2_ERROR_PROTOCOL_ERROR, "recv headers prioirity parameters failed parse");
+      return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR,
+                        "recv headers prioirity parameters failed parse");
     }
     // Protocol error if the stream depends on itself
     if (stream_id == params.priority.stream_dependency) {
-      return Http2Error(HTTP2_ERROR_CLASS_CONNECTION, HTTP2_ERROR_PROTOCOL_ERROR, "recv headers self dependency");
+      return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR,
+                        "recv headers self dependency");
     }
 
     header_block_fragment_offset += HTTP2_PRIORITY_LEN;
@@ -283,14 +296,15 @@ rcv_headers_frame(Http2ConnectionState &cstate, const Http2Frame &frame)
   if (frame.header().flags & HTTP2_FLAGS_HEADERS_END_HEADERS) {
     // NOTE: If there are END_HEADERS flag, decode stored Header Blocks.
     if (!stream->change_state(HTTP2_FRAME_TYPE_HEADERS, frame.header().flags) && stream->has_trailing_header() == false) {
-      return Http2Error(HTTP2_ERROR_CLASS_CONNECTION, HTTP2_ERROR_PROTOCOL_ERROR,
+      return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR,
                         "recv headers end headers and not trailing header");
     }
 
     bool empty_request = false;
     if (stream->has_trailing_header()) {
       if (!(frame.header().flags & HTTP2_FLAGS_HEADERS_END_STREAM)) {
-        return Http2Error(HTTP2_ERROR_CLASS_STREAM, HTTP2_ERROR_PROTOCOL_ERROR, "recv headers tailing header without endstream");
+        return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_STREAM, Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR,
+                          "recv headers tailing header without endstream");
       }
       // If the flag has already been set before decoding header blocks, this is the trailing header.
       // Set a flag to avoid initializing fetcher for now.
@@ -301,13 +315,16 @@ rcv_headers_frame(Http2ConnectionState &cstate, const Http2Frame &frame)
 
     Http2ErrorCode result = stream->decode_header_blocks(*cstate.local_hpack_handle);
 
-    if (result != HTTP2_ERROR_NO_ERROR) {
-      if (result == HTTP2_ERROR_COMPRESSION_ERROR) {
-        return Http2Error(HTTP2_ERROR_CLASS_CONNECTION, HTTP2_ERROR_COMPRESSION_ERROR, "recv headers compression error");
-      } else if (result == HTTP2_ERROR_ENHANCE_YOUR_CALM) {
-        return Http2Error(HTTP2_ERROR_CLASS_CONNECTION, HTTP2_ERROR_ENHANCE_YOUR_CALM, "recv headers enhance your calm");
+    if (result != Http2ErrorCode::HTTP2_ERROR_NO_ERROR) {
+      if (result == Http2ErrorCode::HTTP2_ERROR_COMPRESSION_ERROR) {
+        return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, Http2ErrorCode::HTTP2_ERROR_COMPRESSION_ERROR,
+                          "recv headers compression error");
+      } else if (result == Http2ErrorCode::HTTP2_ERROR_ENHANCE_YOUR_CALM) {
+        return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, Http2ErrorCode::HTTP2_ERROR_ENHANCE_YOUR_CALM,
+                          "recv headers enhance your calm");
       } else {
-        return Http2Error(HTTP2_ERROR_CLASS_STREAM, HTTP2_ERROR_PROTOCOL_ERROR, "recv headers malformed request");
+        return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_STREAM, Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR,
+                          "recv headers malformed request");
       }
     }
 
@@ -324,7 +341,7 @@ rcv_headers_frame(Http2ConnectionState &cstate, const Http2Frame &frame)
     cstate.set_continued_stream_id(stream_id);
   }
 
-  return Http2Error(HTTP2_ERROR_CLASS_NONE);
+  return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_NONE);
 }
 
 /*
@@ -342,17 +359,19 @@ rcv_priority_frame(Http2ConnectionState &cstate, const Http2Frame &frame)
   // If a PRIORITY frame is received with a stream identifier of 0x0, the
   // recipient MUST respond with a connection error of type PROTOCOL_ERROR.
   if (stream_id == 0) {
-    return Http2Error(HTTP2_ERROR_CLASS_CONNECTION, HTTP2_ERROR_PROTOCOL_ERROR, "priority 0 stream_id");
+    return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR,
+                      "priority 0 stream_id");
   }
 
   // A PRIORITY frame with a length other than 5 octets MUST be treated as
   // a stream error (Section 5.4.2) of type FRAME_SIZE_ERROR.
   if (payload_length != HTTP2_PRIORITY_LEN) {
-    return Http2Error(HTTP2_ERROR_CLASS_STREAM, HTTP2_ERROR_FRAME_SIZE_ERROR, "priority bad length");
+    return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_STREAM, Http2ErrorCode::HTTP2_ERROR_FRAME_SIZE_ERROR,
+                      "priority bad length");
   }
 
   if (!Http2::stream_priority_enabled) {
-    return Http2Error(HTTP2_ERROR_CLASS_NONE);
+    return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_NONE);
   }
 
   uint8_t buf[HTTP2_PRIORITY_LEN] = {0};
@@ -360,7 +379,8 @@ rcv_priority_frame(Http2ConnectionState &cstate, const Http2Frame &frame)
 
   Http2Priority priority;
   if (!http2_parse_priority_parameter(make_iovec(buf, HTTP2_PRIORITY_LEN), priority)) {
-    return Http2Error(HTTP2_ERROR_CLASS_CONNECTION, HTTP2_ERROR_PROTOCOL_ERROR, "priority parse error");
+    return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR,
+                      "priority parse error");
   }
 
   DebugHttp2Stream(cstate.ua_session, stream_id, "PRIORITY - dep: %d, weight: %d, excl: %d, tree size: %d",
@@ -382,7 +402,7 @@ rcv_priority_frame(Http2ConnectionState &cstate, const Http2Frame &frame)
     }
   }
 
-  return Http2Error(HTTP2_ERROR_CLASS_NONE);
+  return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_NONE);
 }
 
 static Http2Error
@@ -400,34 +420,39 @@ rcv_rst_stream_frame(Http2ConnectionState &cstate, const Http2Frame &frame)
   // treat this as a connection error (Section 5.4.1) of type
   // PROTOCOL_ERROR.
   if (!http2_is_client_streamid(stream_id)) {
-    return Http2Error(HTTP2_ERROR_CLASS_CONNECTION, HTTP2_ERROR_PROTOCOL_ERROR, "reset access stream with invalid id");
+    return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR,
+                      "reset access stream with invalid id");
   }
 
   Http2Stream *stream = cstate.find_stream(stream_id);
   if (stream == nullptr) {
     if (cstate.is_valid_streamid(stream_id)) {
-      return Http2Error(HTTP2_ERROR_CLASS_NONE);
+      return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_NONE);
     } else {
-      return Http2Error(HTTP2_ERROR_CLASS_CONNECTION, HTTP2_ERROR_PROTOCOL_ERROR, "reset frame bad id stream not found");
+      return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR,
+                        "reset frame bad id stream not found");
     }
   }
 
   // A RST_STREAM frame with a length other than 4 octets MUST be treated
   // as a connection error (Section 5.4.1) of type FRAME_SIZE_ERROR.
   if (frame.header().length != HTTP2_RST_STREAM_LEN) {
-    return Http2Error(HTTP2_ERROR_CLASS_CONNECTION, HTTP2_ERROR_FRAME_SIZE_ERROR, "reset frame wrong length");
+    return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, Http2ErrorCode::HTTP2_ERROR_FRAME_SIZE_ERROR,
+                      "reset frame wrong length");
   }
 
   if (stream == nullptr || !stream->change_state(frame.header().type, frame.header().flags)) {
     // If a RST_STREAM frame identifying an idle stream is received, the
     // recipient MUST treat this as a connection error of type PROTOCOL_ERROR.
-    return Http2Error(HTTP2_ERROR_CLASS_CONNECTION, HTTP2_ERROR_PROTOCOL_ERROR, "reset missing stream or bad stream state");
+    return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR,
+                      "reset missing stream or bad stream state");
   }
 
   end = frame.reader()->memcpy(buf, sizeof(buf), 0);
 
   if (!http2_parse_rst_stream(make_iovec(buf, end - buf), rst_stream)) {
-    return Http2Error(HTTP2_ERROR_CLASS_CONNECTION, HTTP2_ERROR_PROTOCOL_ERROR, "reset failed to parse");
+    return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR,
+                      "reset failed to parse");
   }
 
   if (stream != nullptr) {
@@ -436,7 +461,7 @@ rcv_rst_stream_frame(Http2ConnectionState &cstate, const Http2Frame &frame)
     cstate.delete_stream(stream);
   }
 
-  return Http2Error(HTTP2_ERROR_CLASS_NONE);
+  return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_NONE);
 }
 
 static Http2Error
@@ -454,7 +479,8 @@ rcv_settings_frame(Http2ConnectionState &cstate, const Http2Frame &frame)
   // anything other than 0x0, the endpoint MUST respond with a connection
   // error (Section 5.4.1) of type PROTOCOL_ERROR.
   if (stream_id != 0) {
-    return Http2Error(HTTP2_ERROR_CLASS_CONNECTION, HTTP2_ERROR_PROTOCOL_ERROR, "recv settings stream not 0");
+    return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR,
+                      "recv settings stream not 0");
   }
 
   // [RFC 7540] 6.5. Receipt of a SETTINGS frame with the ACK flag set and a
@@ -462,9 +488,10 @@ rcv_settings_frame(Http2ConnectionState &cstate, const Http2Frame &frame)
   // error of type FRAME_SIZE_ERROR.
   if (frame.header().flags & HTTP2_FLAGS_SETTINGS_ACK) {
     if (frame.header().length == 0) {
-      return Http2Error(HTTP2_ERROR_CLASS_NONE);
+      return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_NONE);
     } else {
-      return Http2Error(HTTP2_ERROR_CLASS_CONNECTION, HTTP2_ERROR_FRAME_SIZE_ERROR, "recv settings ACK header length not 0");
+      return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, Http2ErrorCode::HTTP2_ERROR_FRAME_SIZE_ERROR,
+                        "recv settings ACK header length not 0");
     }
   }
 
@@ -472,21 +499,25 @@ rcv_settings_frame(Http2ConnectionState &cstate, const Http2Frame &frame)
   // be treated as a connection error (Section 5.4.1) of type
   // FRAME_SIZE_ERROR.
   if (frame.header().length % 6 != 0) {
-    return Http2Error(HTTP2_ERROR_CLASS_CONNECTION, HTTP2_ERROR_FRAME_SIZE_ERROR, "recv settings header wrong length");
+    return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, Http2ErrorCode::HTTP2_ERROR_FRAME_SIZE_ERROR,
+                      "recv settings header wrong length");
   }
 
   while (nbytes < frame.header().length) {
     unsigned read_bytes = read_rcv_buffer(buf, sizeof(buf), nbytes, frame);
 
     if (!http2_parse_settings_parameter(make_iovec(buf, read_bytes), param)) {
-      return Http2Error(HTTP2_ERROR_CLASS_CONNECTION, HTTP2_ERROR_PROTOCOL_ERROR, "recv settings parse failed");
+      return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR,
+                        "recv settings parse failed");
     }
 
     if (!http2_settings_parameter_is_valid(param)) {
       if (param.id == HTTP2_SETTINGS_INITIAL_WINDOW_SIZE) {
-        return Http2Error(HTTP2_ERROR_CLASS_CONNECTION, HTTP2_ERROR_FLOW_CONTROL_ERROR, "recv settings bad initial window size");
+        return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, Http2ErrorCode::HTTP2_ERROR_FLOW_CONTROL_ERROR,
+                          "recv settings bad initial window size");
       } else {
-        return Http2Error(HTTP2_ERROR_CLASS_CONNECTION, HTTP2_ERROR_PROTOCOL_ERROR, "recv settings bad param");
+        return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR,
+                          "recv settings bad param");
       }
     }
 
@@ -508,7 +539,7 @@ rcv_settings_frame(Http2ConnectionState &cstate, const Http2Frame &frame)
   Http2Frame ackFrame(HTTP2_FRAME_TYPE_SETTINGS, 0, HTTP2_FLAGS_SETTINGS_ACK);
   cstate.ua_session->handleEvent(HTTP2_SESSION_EVENT_XMIT, &ackFrame);
 
-  return Http2Error(HTTP2_ERROR_CLASS_NONE);
+  return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_NONE);
 }
 
 static Http2Error
@@ -518,7 +549,8 @@ rcv_push_promise_frame(Http2ConnectionState &cstate, const Http2Frame &frame)
 
   // [RFC 7540] 8.2. A client cannot push. Thus, servers MUST treat the receipt of a
   // PUSH_PROMISE frame as a connection error of type PROTOCOL_ERROR.
-  return Http2Error(HTTP2_ERROR_CLASS_CONNECTION, HTTP2_ERROR_PROTOCOL_ERROR, "promise not allowed");
+  return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR,
+                    "promise not allowed");
 }
 
 static Http2Error
@@ -533,18 +565,19 @@ rcv_ping_frame(Http2ConnectionState &cstate, const Http2Frame &frame)
   //  than 0x0, the recipient MUST respond with a connection error of type
   //  PROTOCOL_ERROR.
   if (stream_id != 0x0) {
-    return Http2Error(HTTP2_ERROR_CLASS_CONNECTION, HTTP2_ERROR_PROTOCOL_ERROR, "ping id not 0");
+    return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR, "ping id not 0");
   }
 
   // Receipt of a PING frame with a length field value other than 8 MUST
   // be treated as a connection error (Section 5.4.1) of type FRAME_SIZE_ERROR.
   if (frame.header().length != HTTP2_PING_LEN) {
-    return Http2Error(HTTP2_ERROR_CLASS_CONNECTION, HTTP2_ERROR_FRAME_SIZE_ERROR, "ping bad length");
+    return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, Http2ErrorCode::HTTP2_ERROR_FRAME_SIZE_ERROR,
+                      "ping bad length");
   }
 
   // An endpoint MUST NOT respond to PING frames containing this flag.
   if (frame.header().flags & HTTP2_FLAGS_PING_ACK) {
-    return Http2Error(HTTP2_ERROR_CLASS_NONE);
+    return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_NONE);
   }
 
   frame.reader()->memcpy(opaque_data, HTTP2_PING_LEN, 0);
@@ -552,7 +585,7 @@ rcv_ping_frame(Http2ConnectionState &cstate, const Http2Frame &frame)
   // ACK (0x1): An endpoint MUST set this flag in PING responses.
   cstate.send_ping_frame(stream_id, HTTP2_FLAGS_PING_ACK, opaque_data);
 
-  return Http2Error(HTTP2_ERROR_CLASS_NONE);
+  return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_NONE);
 }
 
 static Http2Error
@@ -568,14 +601,16 @@ rcv_goaway_frame(Http2ConnectionState &cstate, const Http2Frame &frame)
   // An endpoint MUST treat a GOAWAY frame with a stream identifier other
   // than 0x0 as a connection error of type PROTOCOL_ERROR.
   if (stream_id != 0x0) {
-    return Http2Error(HTTP2_ERROR_CLASS_CONNECTION, HTTP2_ERROR_PROTOCOL_ERROR, "goaway id non-zero");
+    return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR,
+                      "goaway id non-zero");
   }
 
   while (nbytes < frame.header().length) {
     unsigned read_bytes = read_rcv_buffer(buf, sizeof(buf), nbytes, frame);
 
     if (!http2_parse_goaway(make_iovec(buf, read_bytes), goaway)) {
-      return Http2Error(HTTP2_ERROR_CLASS_CONNECTION, HTTP2_ERROR_PROTOCOL_ERROR, "goaway failed parse");
+      return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR,
+                        "goaway failed parse");
     }
   }
 
@@ -585,7 +620,7 @@ rcv_goaway_frame(Http2ConnectionState &cstate, const Http2Frame &frame)
   cstate.handleEvent(HTTP2_SESSION_EVENT_FINI, nullptr);
   // eventProcessor.schedule_imm(&cs, ET_NET, VC_EVENT_ERROR);
 
-  return Http2Error(HTTP2_ERROR_CLASS_NONE);
+  return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_NONE);
 }
 
 static Http2Error
@@ -599,7 +634,8 @@ rcv_window_update_frame(Http2ConnectionState &cstate, const Http2Frame &frame)
   //  treated as a connection error of type FRAME_SIZE_ERROR.
   if (frame.header().length != HTTP2_WINDOW_UPDATE_LEN) {
     DebugHttp2Stream(cstate.ua_session, stream_id, "Received WINDOW_UPDATE frame - length incorrect");
-    return Http2Error(HTTP2_ERROR_CLASS_CONNECTION, HTTP2_ERROR_FRAME_SIZE_ERROR, "window update bad length");
+    return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, Http2ErrorCode::HTTP2_ERROR_FRAME_SIZE_ERROR,
+                      "window update bad length");
   }
 
   frame.reader()->memcpy(buf, sizeof(buf), 0);
@@ -609,9 +645,11 @@ rcv_window_update_frame(Http2ConnectionState &cstate, const Http2Frame &frame)
   // control window increment of 0 as a connection error of type PROTOCOL_ERROR;
   if (size == 0) {
     if (stream_id == 0) {
-      return Http2Error(HTTP2_ERROR_CLASS_CONNECTION, HTTP2_ERROR_PROTOCOL_ERROR, "window update length=0 and id=0");
+      return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR,
+                        "window update length=0 and id=0");
     } else {
-      return Http2Error(HTTP2_ERROR_CLASS_STREAM, HTTP2_ERROR_PROTOCOL_ERROR, "window update length=0");
+      return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_STREAM, Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR,
+                        "window update length=0");
     }
   }
 
@@ -628,7 +666,8 @@ rcv_window_update_frame(Http2ConnectionState &cstate, const Http2Frame &frame)
     // connection, a GOAWAY frame with an error code of FLOW_CONTROL_ERROR
     // is sent.
     if (size > HTTP2_MAX_WINDOW_SIZE - cstate.client_rwnd) {
-      return Http2Error(HTTP2_ERROR_CLASS_CONNECTION, HTTP2_ERROR_FLOW_CONTROL_ERROR, "window update too big");
+      return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, Http2ErrorCode::HTTP2_ERROR_FLOW_CONTROL_ERROR,
+                        "window update too big");
     }
 
     cstate.client_rwnd += size;
@@ -639,9 +678,10 @@ rcv_window_update_frame(Http2ConnectionState &cstate, const Http2Frame &frame)
 
     if (stream == nullptr) {
       if (cstate.is_valid_streamid(stream_id)) {
-        return Http2Error(HTTP2_ERROR_CLASS_NONE);
+        return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_NONE);
       } else {
-        return Http2Error(HTTP2_ERROR_CLASS_CONNECTION, HTTP2_ERROR_PROTOCOL_ERROR, "window update stream invalid id");
+        return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR,
+                          "window update stream invalid id");
       }
     }
 
@@ -656,18 +696,19 @@ rcv_window_update_frame(Http2ConnectionState &cstate, const Http2Frame &frame)
     // connection, a GOAWAY frame with an error code of FLOW_CONTROL_ERROR
     // is sent.
     if (size > HTTP2_MAX_WINDOW_SIZE - stream->client_rwnd) {
-      return Http2Error(HTTP2_ERROR_CLASS_STREAM, HTTP2_ERROR_FLOW_CONTROL_ERROR, "window update too big 2");
+      return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_STREAM, Http2ErrorCode::HTTP2_ERROR_FLOW_CONTROL_ERROR,
+                        "window update too big 2");
     }
 
     stream->client_rwnd += size;
     ssize_t wnd = min(cstate.client_rwnd, stream->client_rwnd);
 
-    if (!stream->is_closed() && stream->get_state() == HTTP2_STREAM_STATE_HALF_CLOSED_REMOTE && wnd > 0) {
+    if (!stream->is_closed() && stream->get_state() == Http2StreamState::HTTP2_STREAM_STATE_HALF_CLOSED_REMOTE && wnd > 0) {
       stream->send_response_body();
     }
   }
 
-  return Http2Error(HTTP2_ERROR_CLASS_NONE);
+  return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_NONE);
 }
 
 /*
@@ -686,7 +727,8 @@ rcv_continuation_frame(Http2ConnectionState &cstate, const Http2Frame &frame)
   DebugHttp2Stream(cstate.ua_session, stream_id, "Received CONTINUATION frame");
 
   if (!http2_is_client_streamid(stream_id)) {
-    return Http2Error(HTTP2_ERROR_CLASS_CONNECTION, HTTP2_ERROR_PROTOCOL_ERROR, "continuation bad client id");
+    return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR,
+                      "continuation bad client id");
   }
 
   // Find opened stream
@@ -697,25 +739,30 @@ rcv_continuation_frame(Http2ConnectionState &cstate, const Http2Frame &frame)
   Http2Stream *stream = cstate.find_stream(stream_id);
   if (stream == nullptr) {
     if (cstate.is_valid_streamid(stream_id)) {
-      return Http2Error(HTTP2_ERROR_CLASS_CONNECTION, HTTP2_ERROR_STREAM_CLOSED, "continuation stream freed with valid id");
+      return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, Http2ErrorCode::HTTP2_ERROR_STREAM_CLOSED,
+                        "continuation stream freed with valid id");
     } else {
-      return Http2Error(HTTP2_ERROR_CLASS_CONNECTION, HTTP2_ERROR_PROTOCOL_ERROR, "continuation stream freed with invalid id");
+      return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR,
+                        "continuation stream freed with invalid id");
     }
   } else {
     switch (stream->get_state()) {
-    case HTTP2_STREAM_STATE_HALF_CLOSED_REMOTE:
-      return Http2Error(HTTP2_ERROR_CLASS_CONNECTION, HTTP2_ERROR_STREAM_CLOSED, "continuation half close remote");
-    case HTTP2_STREAM_STATE_IDLE:
+    case Http2StreamState::HTTP2_STREAM_STATE_HALF_CLOSED_REMOTE:
+      return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, Http2ErrorCode::HTTP2_ERROR_STREAM_CLOSED,
+                        "continuation half close remote");
+    case Http2StreamState::HTTP2_STREAM_STATE_IDLE:
       break;
     default:
-      return Http2Error(HTTP2_ERROR_CLASS_CONNECTION, HTTP2_ERROR_PROTOCOL_ERROR, "continuation bad state");
+      return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR,
+                        "continuation bad state");
     }
   }
 
   // keep track of how many bytes we get in the frame
   stream->request_header_length += payload_length;
   if (stream->request_header_length > Http2::max_request_header_size) {
-    return Http2Error(HTTP2_ERROR_CLASS_CONNECTION, HTTP2_ERROR_PROTOCOL_ERROR, "continuation payload for headers exceeded");
+    return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR,
+                      "continuation payload for headers exceeded");
   }
 
   uint32_t header_blocks_offset = stream->header_blocks_length;
@@ -729,18 +776,22 @@ rcv_continuation_frame(Http2ConnectionState &cstate, const Http2Frame &frame)
     cstate.clear_continued_stream_id();
 
     if (!stream->change_state(HTTP2_FRAME_TYPE_CONTINUATION, frame.header().flags)) {
-      return Http2Error(HTTP2_ERROR_CLASS_CONNECTION, HTTP2_ERROR_PROTOCOL_ERROR, "continuation no state change");
+      return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR,
+                        "continuation no state change");
     }
 
     Http2ErrorCode result = stream->decode_header_blocks(*cstate.local_hpack_handle);
 
-    if (result != HTTP2_ERROR_NO_ERROR) {
-      if (result == HTTP2_ERROR_COMPRESSION_ERROR) {
-        return Http2Error(HTTP2_ERROR_CLASS_CONNECTION, HTTP2_ERROR_COMPRESSION_ERROR, "continuation compression error");
-      } else if (result == HTTP2_ERROR_ENHANCE_YOUR_CALM) {
-        return Http2Error(HTTP2_ERROR_CLASS_CONNECTION, HTTP2_ERROR_ENHANCE_YOUR_CALM, "continuation enhance your calm");
+    if (result != Http2ErrorCode::HTTP2_ERROR_NO_ERROR) {
+      if (result == Http2ErrorCode::HTTP2_ERROR_COMPRESSION_ERROR) {
+        return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, Http2ErrorCode::HTTP2_ERROR_COMPRESSION_ERROR,
+                          "continuation compression error");
+      } else if (result == Http2ErrorCode::HTTP2_ERROR_ENHANCE_YOUR_CALM) {
+        return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, Http2ErrorCode::HTTP2_ERROR_ENHANCE_YOUR_CALM,
+                          "continuation enhance your calm");
       } else {
-        return Http2Error(HTTP2_ERROR_CLASS_CONNECTION, HTTP2_ERROR_PROTOCOL_ERROR, "continuation malformed request");
+        return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR,
+                          "continuation malformed request");
       }
     }
 
@@ -753,7 +804,7 @@ rcv_continuation_frame(Http2ConnectionState &cstate, const Http2Frame &frame)
     DebugHttp2Stream(cstate.ua_session, stream_id, "No END_HEADERS flag, expecting CONTINUATION frame");
   }
 
-  return Http2Error(HTTP2_ERROR_CLASS_NONE);
+  return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_NONE);
 }
 
 static const http2_frame_dispatch frame_handlers[HTTP2_FRAME_TYPE_MAX] = {
@@ -831,13 +882,13 @@ Http2ConnectionState::main_event_handler(int event, void *edata)
     if (frame_handlers[frame->header().type]) {
       error = frame_handlers[frame->header().type](*this, *frame);
     } else {
-      error = Http2Error(HTTP2_ERROR_CLASS_CONNECTION, HTTP2_ERROR_INTERNAL_ERROR, "no handler");
+      error = Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, Http2ErrorCode::HTTP2_ERROR_INTERNAL_ERROR, "no handler");
     }
 
-    if (error.cls != HTTP2_ERROR_CLASS_NONE) {
+    if (error.cls != Http2ErrorClass::HTTP2_ERROR_CLASS_NONE) {
       ip_port_text_buffer ipb;
       const char *client_ip = ats_ip_ntop(ua_session->get_client_addr(), ipb, sizeof(ipb));
-      if (error.cls == HTTP2_ERROR_CLASS_CONNECTION) {
+      if (error.cls == Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION) {
         if (error.msg) {
           Error("HTTP/2 connection error client_ip=%s session_id=%" PRId64 " %s", client_ip, ua_session->connection_id(),
                 error.msg);
@@ -854,7 +905,7 @@ Http2ConnectionState::main_event_handler(int event, void *edata)
         // implementing the
         // half-closed state ...
         SET_HANDLER(&Http2ConnectionState::state_closed);
-      } else if (error.cls == HTTP2_ERROR_CLASS_STREAM) {
+      } else if (error.cls == Http2ErrorClass::HTTP2_ERROR_CLASS_STREAM) {
         if (error.msg) {
           Error("HTTP/2 stream error client_ip=%s session_id=%" PRId64 " %s", client_ip, ua_session->connection_id(), error.msg);
         }
@@ -902,13 +953,13 @@ Http2ConnectionState::create_stream(Http2StreamId new_id, Http2Error &error)
   // connection error (Section 5.4.1) of type PROTOCOL_ERROR.
   if (client_streamid) {
     if (new_id <= latest_streamid_in) {
-      error = Http2Error(HTTP2_ERROR_CLASS_CONNECTION, HTTP2_ERROR_PROTOCOL_ERROR,
+      error = Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR,
                          "recv headers new client id less than latest stream id");
       return nullptr;
     }
   } else {
     if (new_id <= latest_streamid_out) {
-      error = Http2Error(HTTP2_ERROR_CLASS_CONNECTION, HTTP2_ERROR_PROTOCOL_ERROR,
+      error = Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR,
                          "recv headers new server id less than latest stream id");
       return nullptr;
     }
@@ -919,13 +970,13 @@ Http2ConnectionState::create_stream(Http2StreamId new_id, Http2Error &error)
   // stream limit to be exceeded MUST treat this as a stream error.
   if (client_streamid) {
     if (client_streams_in_count >= server_settings.get(HTTP2_SETTINGS_MAX_CONCURRENT_STREAMS)) {
-      error = Http2Error(HTTP2_ERROR_CLASS_STREAM, HTTP2_ERROR_REFUSED_STREAM,
+      error = Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_STREAM, Http2ErrorCode::HTTP2_ERROR_REFUSED_STREAM,
                          "recv headers creating inbound stream beyond max_concurrent limit");
       return nullptr;
     }
   } else {
     if (client_streams_out_count >= client_settings.get(HTTP2_SETTINGS_MAX_CONCURRENT_STREAMS)) {
-      error = Http2Error(HTTP2_ERROR_CLASS_STREAM, HTTP2_ERROR_REFUSED_STREAM,
+      error = Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_STREAM, Http2ErrorCode::HTTP2_ERROR_REFUSED_STREAM,
                          "recv headers creating outbound stream beyond max_concurrent limit");
       return nullptr;
     }
@@ -979,7 +1030,8 @@ Http2ConnectionState::restart_streams()
 
   while (s) {
     Http2Stream *next = s->link.next;
-    if (!s->is_closed() && s->get_state() == HTTP2_STREAM_STATE_HALF_CLOSED_REMOTE && min(this->client_rwnd, s->client_rwnd) > 0) {
+    if (!s->is_closed() && s->get_state() == Http2StreamState::HTTP2_STREAM_STATE_HALF_CLOSED_REMOTE &&
+        min(this->client_rwnd, s->client_rwnd) > 0) {
       s->send_response_body();
     }
     ink_assert(s != next);
@@ -1028,8 +1080,8 @@ Http2ConnectionState::delete_stream(Http2Stream *stream)
     }
   }
 
-  if (stream->get_state() == HTTP2_STREAM_STATE_HALF_CLOSED_LOCAL) {
-    send_rst_stream_frame(stream->get_id(), HTTP2_ERROR_NO_ERROR);
+  if (stream->get_state() == Http2StreamState::HTTP2_STREAM_STATE_HALF_CLOSED_LOCAL) {
+    send_rst_stream_frame(stream->get_id(), Http2ErrorCode::HTTP2_ERROR_NO_ERROR);
   }
 
   stream_list.remove(stream);
@@ -1218,7 +1270,8 @@ Http2ConnectionState::send_data_frames(Http2Stream *stream)
 {
   // To follow RFC 7540 must not send more frames other than priority on
   // a closed stream.  So we return without sending
-  if (stream->get_state() == HTTP2_STREAM_STATE_HALF_CLOSED_LOCAL || stream->get_state() == HTTP2_STREAM_STATE_CLOSED) {
+  if (stream->get_state() == Http2StreamState::HTTP2_STREAM_STATE_HALF_CLOSED_LOCAL ||
+      stream->get_state() == Http2StreamState::HTTP2_STREAM_STATE_CLOSED) {
     DebugSsn(this->ua_session, "http2_cs", "Shutdown half closed local stream %d", stream->get_id());
     this->delete_stream(stream);
     return;
@@ -1268,7 +1321,7 @@ Http2ConnectionState::send_headers_frame(Http2Stream *stream)
     return;
   }
   Http2ErrorCode result = http2_encode_header_blocks(&h2_hdr, buf, buf_len, &header_blocks_size, *(this->remote_hpack_handle));
-  if (result != HTTP2_ERROR_NO_ERROR) {
+  if (result != Http2ErrorCode::HTTP2_ERROR_NO_ERROR) {
     h2_hdr.destroy();
     ats_free(buf);
     return;
@@ -1292,7 +1345,7 @@ Http2ConnectionState::send_headers_frame(Http2Stream *stream)
 
   // Change stream state
   if (!stream->change_state(HTTP2_FRAME_TYPE_HEADERS, flags)) {
-    this->send_goaway_frame(stream->get_id(), HTTP2_ERROR_PROTOCOL_ERROR);
+    this->send_goaway_frame(stream->get_id(), Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR);
     h2_hdr.destroy();
     ats_free(buf);
     return;
@@ -1357,7 +1410,7 @@ Http2ConnectionState::send_push_promise_frame(Http2Stream *stream, URL &url)
     return;
   }
   Http2ErrorCode result = http2_encode_header_blocks(&h2_hdr, buf, buf_len, &header_blocks_size, *(this->remote_hpack_handle));
-  if (result != HTTP2_ERROR_NO_ERROR) {
+  if (result != Http2ErrorCode::HTTP2_ERROR_NO_ERROR) {
     h2_hdr.destroy();
     ats_free(buf);
     return;
@@ -1404,7 +1457,7 @@ Http2ConnectionState::send_push_promise_frame(Http2Stream *stream, URL &url)
   }
   ats_free(buf);
 
-  Http2Error error(HTTP2_ERROR_CLASS_NONE);
+  Http2Error error(Http2ErrorClass::HTTP2_ERROR_CLASS_NONE);
   stream = this->create_stream(id, error);
   if (!stream) {
     return;
@@ -1435,7 +1488,7 @@ Http2ConnectionState::send_rst_stream_frame(Http2StreamId id, Http2ErrorCode ec)
 {
   DebugHttp2Stream(ua_session, id, "Send RST_STREAM frame");
 
-  if (ec != HTTP2_ERROR_NO_ERROR) {
+  if (ec != Http2ErrorCode::HTTP2_ERROR_NO_ERROR) {
     HTTP2_INCREMENT_THREAD_DYN_STAT(HTTP2_STAT_STREAM_ERRORS_COUNT, this_ethread());
   }
 
@@ -1449,7 +1502,7 @@ Http2ConnectionState::send_rst_stream_frame(Http2StreamId id, Http2ErrorCode ec)
   Http2Stream *stream = find_stream(id);
   if (stream != nullptr) {
     if (!stream->change_state(HTTP2_FRAME_TYPE_RST_STREAM, 0)) {
-      this->send_goaway_frame(stream->get_id(), HTTP2_ERROR_PROTOCOL_ERROR);
+      this->send_goaway_frame(stream->get_id(), Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR);
       return;
     }
   }
@@ -1482,7 +1535,7 @@ Http2ConnectionState::send_settings_frame(const Http2ConnectionSettings &new_set
 
       // Write settings to send buffer
       if (!http2_write_settings(param, iov)) {
-        send_goaway_frame(0, HTTP2_ERROR_INTERNAL_ERROR);
+        send_goaway_frame(0, Http2ErrorCode::HTTP2_ERROR_INTERNAL_ERROR);
         return;
       }
       iov.iov_base = reinterpret_cast<uint8_t *>(iov.iov_base) + HTTP2_SETTINGS_PARAMETER_LEN;
@@ -1522,7 +1575,7 @@ Http2ConnectionState::send_goaway_frame(Http2StreamId id, Http2ErrorCode ec)
 {
   DebugHttp2Stream(ua_session, id, "Send GOAWAY frame");
 
-  if (ec != HTTP2_ERROR_NO_ERROR) {
+  if (ec != Http2ErrorCode::HTTP2_ERROR_NO_ERROR) {
     HTTP2_INCREMENT_THREAD_DYN_STAT(HTTP2_STAT_CONNECTION_ERRORS_COUNT, this_ethread());
   }
 
diff --git a/proxy/http2/Http2DebugNames.cc b/proxy/http2/Http2DebugNames.cc
index 8009cfd..fb776bd 100644
--- a/proxy/http2/Http2DebugNames.cc
+++ b/proxy/http2/Http2DebugNames.cc
@@ -47,23 +47,23 @@ Http2DebugNames::get_settings_param_name(uint16_t id)
 }
 
 const char *
-Http2DebugNames::get_state_name(uint16_t id)
+Http2DebugNames::get_state_name(Http2StreamState id)
 {
   switch (id) {
-  case HTTP2_STREAM_STATE_IDLE:
-    return "HTTP2_STREAM_STATE_IDLE";
-  case HTTP2_STREAM_STATE_RESERVED_LOCAL:
-    return "HTTP2_STREAM_STATE_RESERVED_LOCAL";
-  case HTTP2_STREAM_STATE_RESERVED_REMOTE:
-    return "HTTP2_STREAM_STATE_RESERVED_REMOTE";
-  case HTTP2_STREAM_STATE_OPEN:
-    return "HTTP2_STREAM_STATE_OPEN";
-  case HTTP2_STREAM_STATE_HALF_CLOSED_LOCAL:
-    return "HTTP2_STREAM_STATE_HALF_CLOSED_LOCAL";
-  case HTTP2_STREAM_STATE_HALF_CLOSED_REMOTE:
-    return "HTTP2_STREAM_STATE_HALF_CLOSED_REMOTE";
-  case HTTP2_STREAM_STATE_CLOSED:
-    return "HTTP2_STREAM_STATE_CLOSED";
+  case Http2StreamState::HTTP2_STREAM_STATE_IDLE:
+    return "Http2StreamState::HTTP2_STREAM_STATE_IDLE";
+  case Http2StreamState::HTTP2_STREAM_STATE_RESERVED_LOCAL:
+    return "Http2StreamState::HTTP2_STREAM_STATE_RESERVED_LOCAL";
+  case Http2StreamState::HTTP2_STREAM_STATE_RESERVED_REMOTE:
+    return "Http2StreamState::HTTP2_STREAM_STATE_RESERVED_REMOTE";
+  case Http2StreamState::HTTP2_STREAM_STATE_OPEN:
+    return "Http2StreamState::HTTP2_STREAM_STATE_OPEN";
+  case Http2StreamState::HTTP2_STREAM_STATE_HALF_CLOSED_LOCAL:
+    return "Http2StreamState::HTTP2_STREAM_STATE_HALF_CLOSED_LOCAL";
+  case Http2StreamState::HTTP2_STREAM_STATE_HALF_CLOSED_REMOTE:
+    return "Http2StreamState::HTTP2_STREAM_STATE_HALF_CLOSED_REMOTE";
+  case Http2StreamState::HTTP2_STREAM_STATE_CLOSED:
+    return "Http2StreamState::HTTP2_STREAM_STATE_CLOSED";
   }
 
   return "UNKNOWN";
diff --git a/proxy/http2/Http2DebugNames.h b/proxy/http2/Http2DebugNames.h
index b836477..c9160bf 100644
--- a/proxy/http2/Http2DebugNames.h
+++ b/proxy/http2/Http2DebugNames.h
@@ -26,11 +26,13 @@
 
 #include "ts/ink_defs.h"
 
+enum class Http2StreamState;
+
 class Http2DebugNames
 {
 public:
   static const char *get_settings_param_name(uint16_t id);
-  static const char *get_state_name(uint16_t id);
+  static const char *get_state_name(Http2StreamState id);
 };
 
 #endif // __HTTP2_DEBUG_NAMES_H__
diff --git a/proxy/http2/Http2Stream.cc b/proxy/http2/Http2Stream.cc
index a570266..d95f3b2 100644
--- a/proxy/http2/Http2Stream.cc
+++ b/proxy/http2/Http2Stream.cc
@@ -178,38 +178,38 @@ bool
 Http2Stream::change_state(uint8_t type, uint8_t flags)
 {
   switch (_state) {
-  case HTTP2_STREAM_STATE_IDLE:
+  case Http2StreamState::HTTP2_STREAM_STATE_IDLE:
     if (type == HTTP2_FRAME_TYPE_HEADERS) {
       if (recv_end_stream) {
-        _state = HTTP2_STREAM_STATE_HALF_CLOSED_REMOTE;
+        _state = Http2StreamState::HTTP2_STREAM_STATE_HALF_CLOSED_REMOTE;
       } else if (send_end_stream) {
-        _state = HTTP2_STREAM_STATE_HALF_CLOSED_LOCAL;
+        _state = Http2StreamState::HTTP2_STREAM_STATE_HALF_CLOSED_LOCAL;
       } else {
-        _state = HTTP2_STREAM_STATE_OPEN;
+        _state = Http2StreamState::HTTP2_STREAM_STATE_OPEN;
       }
     } else if (type == HTTP2_FRAME_TYPE_CONTINUATION) {
       if (recv_end_stream) {
-        _state = HTTP2_STREAM_STATE_HALF_CLOSED_REMOTE;
+        _state = Http2StreamState::HTTP2_STREAM_STATE_HALF_CLOSED_REMOTE;
       } else if (send_end_stream) {
-        _state = HTTP2_STREAM_STATE_HALF_CLOSED_LOCAL;
+        _state = Http2StreamState::HTTP2_STREAM_STATE_HALF_CLOSED_LOCAL;
       } else {
-        _state = HTTP2_STREAM_STATE_OPEN;
+        _state = Http2StreamState::HTTP2_STREAM_STATE_OPEN;
       }
     } else if (type == HTTP2_FRAME_TYPE_PUSH_PROMISE) {
-      _state = HTTP2_STREAM_STATE_RESERVED_LOCAL;
+      _state = Http2StreamState::HTTP2_STREAM_STATE_RESERVED_LOCAL;
     } else {
       return false;
     }
     break;
 
-  case HTTP2_STREAM_STATE_OPEN:
+  case Http2StreamState::HTTP2_STREAM_STATE_OPEN:
     if (type == HTTP2_FRAME_TYPE_RST_STREAM) {
-      _state = HTTP2_STREAM_STATE_CLOSED;
+      _state = Http2StreamState::HTTP2_STREAM_STATE_CLOSED;
     } else if (type == HTTP2_FRAME_TYPE_DATA) {
       if (recv_end_stream) {
-        _state = HTTP2_STREAM_STATE_HALF_CLOSED_REMOTE;
+        _state = Http2StreamState::HTTP2_STREAM_STATE_HALF_CLOSED_REMOTE;
       } else if (send_end_stream) {
-        _state = HTTP2_STREAM_STATE_HALF_CLOSED_LOCAL;
+        _state = Http2StreamState::HTTP2_STREAM_STATE_HALF_CLOSED_LOCAL;
       } else {
         // Do not change state
       }
@@ -219,48 +219,48 @@ Http2Stream::change_state(uint8_t type, uint8_t flags)
     }
     break;
 
-  case HTTP2_STREAM_STATE_RESERVED_LOCAL:
+  case Http2StreamState::HTTP2_STREAM_STATE_RESERVED_LOCAL:
     if (type == HTTP2_FRAME_TYPE_HEADERS) {
       if (flags & HTTP2_FLAGS_HEADERS_END_HEADERS) {
-        _state = HTTP2_STREAM_STATE_HALF_CLOSED_REMOTE;
+        _state = Http2StreamState::HTTP2_STREAM_STATE_HALF_CLOSED_REMOTE;
       }
     } else if (type == HTTP2_FRAME_TYPE_CONTINUATION) {
       if (flags & HTTP2_FLAGS_CONTINUATION_END_HEADERS) {
-        _state = HTTP2_STREAM_STATE_HALF_CLOSED_REMOTE;
+        _state = Http2StreamState::HTTP2_STREAM_STATE_HALF_CLOSED_REMOTE;
       }
     } else {
       return false;
     }
     break;
 
-  case HTTP2_STREAM_STATE_RESERVED_REMOTE:
+  case Http2StreamState::HTTP2_STREAM_STATE_RESERVED_REMOTE:
     // Currently ATS supports only HTTP/2 server features
     return false;
 
-  case HTTP2_STREAM_STATE_HALF_CLOSED_LOCAL:
+  case Http2StreamState::HTTP2_STREAM_STATE_HALF_CLOSED_LOCAL:
     if (type == HTTP2_FRAME_TYPE_RST_STREAM || recv_end_stream) {
-      _state = HTTP2_STREAM_STATE_CLOSED;
+      _state = Http2StreamState::HTTP2_STREAM_STATE_CLOSED;
     } else {
       // Error, set state closed
-      _state = HTTP2_STREAM_STATE_CLOSED;
+      _state = Http2StreamState::HTTP2_STREAM_STATE_CLOSED;
       return false;
     }
     break;
 
-  case HTTP2_STREAM_STATE_HALF_CLOSED_REMOTE:
+  case Http2StreamState::HTTP2_STREAM_STATE_HALF_CLOSED_REMOTE:
     if (type == HTTP2_FRAME_TYPE_RST_STREAM || send_end_stream) {
-      _state = HTTP2_STREAM_STATE_CLOSED;
+      _state = Http2StreamState::HTTP2_STREAM_STATE_CLOSED;
     } else if (type == HTTP2_FRAME_TYPE_HEADERS) { // w/o END_STREAM flag
       // No state change here. Expect a following DATA frame with END_STREAM flag.
       return true;
     } else {
       // Error, set state closed
-      _state = HTTP2_STREAM_STATE_CLOSED;
+      _state = Http2StreamState::HTTP2_STREAM_STATE_CLOSED;
       return false;
     }
     break;
 
-  case HTTP2_STREAM_STATE_CLOSED:
+  case Http2StreamState::HTTP2_STREAM_STATE_CLOSED:
     // No state changing
     return true;
 
@@ -380,7 +380,7 @@ Http2Stream::initiating_close()
     // Set the state of the connection to closed
     // TODO - these states should be combined
     closed = true;
-    _state = HTTP2_STREAM_STATE_CLOSED;
+    _state = Http2StreamState::HTTP2_STREAM_STATE_CLOSED;
 
     // leaving the reference to the SM, so we can detach from the SM when we actually destroy
     // current_reader = NULL;
diff --git a/proxy/http2/Http2Stream.h b/proxy/http2/Http2Stream.h
index 78f8da8..79cbebd 100644
--- a/proxy/http2/Http2Stream.h
+++ b/proxy/http2/Http2Stream.h
@@ -58,7 +58,7 @@ public:
       _start_time(0),
       _thread(NULL),
       _id(sid),
-      _state(HTTP2_STREAM_STATE_IDLE),
+      _state(Http2StreamState::HTTP2_STREAM_STATE_IDLE),
       trailing_header(false),
       body_done(false),
       closed(false),
@@ -238,8 +238,9 @@ public:
   bool
   is_client_state_writeable() const
   {
-    return _state == HTTP2_STREAM_STATE_OPEN || _state == HTTP2_STREAM_STATE_HALF_CLOSED_REMOTE ||
-           HTTP2_STREAM_STATE_RESERVED_LOCAL;
+    return _state == Http2StreamState::HTTP2_STREAM_STATE_OPEN ||
+           _state == Http2StreamState::HTTP2_STREAM_STATE_HALF_CLOSED_REMOTE ||
+           _state == Http2StreamState::HTTP2_STREAM_STATE_RESERVED_LOCAL;
   }
 
   bool

-- 
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>'].