1 /** @file
2 
3   Http2DebugNames
4 
5   @section license License
6 
7   Licensed to the Apache Software Foundation (ASF) under one
8   or more contributor license agreements.  See the NOTICE file
9   distributed with this work for additional information
10   regarding copyright ownership.  The ASF licenses this file
11   to you under the Apache License, Version 2.0 (the
12   "License"); you may not use this file except in compliance
13   with the License.  You may obtain a copy of the License at
14 
15       http://www.apache.org/licenses/LICENSE-2.0
16 
17   Unless required by applicable law or agreed to in writing, software
18   distributed under the License is distributed on an "AS IS" BASIS,
19   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20   See the License for the specific language governing permissions and
21   limitations under the License.
22  */
23 
24 #include "Http2DebugNames.h"
25 
26 #include "HTTP2.h"
27 
28 const char *
get_settings_param_name(uint16_t id)29 Http2DebugNames::get_settings_param_name(uint16_t id)
30 {
31   switch (id) {
32   case HTTP2_SETTINGS_HEADER_TABLE_SIZE:
33     return "HEADER_TABLE_SIZE";
34   case HTTP2_SETTINGS_ENABLE_PUSH:
35     return "ENABLE_PUSH";
36   case HTTP2_SETTINGS_MAX_CONCURRENT_STREAMS:
37     return "MAX_CONCURRENT_STREAMS";
38   case HTTP2_SETTINGS_INITIAL_WINDOW_SIZE:
39     return "INITIAL_WINDOW_SIZE";
40   case HTTP2_SETTINGS_MAX_FRAME_SIZE:
41     return "MAX_FRAME_SIZE";
42   case HTTP2_SETTINGS_MAX_HEADER_LIST_SIZE:
43     return "MAX_HEADER_LIST_SIZE";
44   }
45 
46   return "UNKNOWN";
47 }
48 
49 const char *
get_state_name(Http2StreamState id)50 Http2DebugNames::get_state_name(Http2StreamState id)
51 {
52   switch (id) {
53   case Http2StreamState::HTTP2_STREAM_STATE_IDLE:
54     return "Http2StreamState::HTTP2_STREAM_STATE_IDLE";
55   case Http2StreamState::HTTP2_STREAM_STATE_RESERVED_LOCAL:
56     return "Http2StreamState::HTTP2_STREAM_STATE_RESERVED_LOCAL";
57   case Http2StreamState::HTTP2_STREAM_STATE_RESERVED_REMOTE:
58     return "Http2StreamState::HTTP2_STREAM_STATE_RESERVED_REMOTE";
59   case Http2StreamState::HTTP2_STREAM_STATE_OPEN:
60     return "Http2StreamState::HTTP2_STREAM_STATE_OPEN";
61   case Http2StreamState::HTTP2_STREAM_STATE_HALF_CLOSED_LOCAL:
62     return "Http2StreamState::HTTP2_STREAM_STATE_HALF_CLOSED_LOCAL";
63   case Http2StreamState::HTTP2_STREAM_STATE_HALF_CLOSED_REMOTE:
64     return "Http2StreamState::HTTP2_STREAM_STATE_HALF_CLOSED_REMOTE";
65   case Http2StreamState::HTTP2_STREAM_STATE_CLOSED:
66     return "Http2StreamState::HTTP2_STREAM_STATE_CLOSED";
67   }
68 
69   return "UNKNOWN";
70 }
71