Use hex in nghttp2_error_code and nghttp2_settings_id

This commit is contained in:
Tatsuhiro Tsujikawa 2014-06-18 10:48:31 +09:00
parent a5af621947
commit 174e410b93
2 changed files with 21 additions and 20 deletions

View File

@ -506,19 +506,19 @@ typedef enum {
/**
* SETTINGS_HEADER_TABLE_SIZE
*/
NGHTTP2_SETTINGS_HEADER_TABLE_SIZE = 1,
NGHTTP2_SETTINGS_HEADER_TABLE_SIZE = 0x01,
/**
* SETTINGS_ENABLE_PUSH
*/
NGHTTP2_SETTINGS_ENABLE_PUSH = 2,
NGHTTP2_SETTINGS_ENABLE_PUSH = 0x02,
/**
* SETTINGS_MAX_CONCURRENT_STREAMS
*/
NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS = 3,
NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS = 0x03,
/**
* SETTINGS_INITIAL_WINDOW_SIZE
*/
NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE = 4,
NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE = 0x04
} nghttp2_settings_id;
/**
@ -535,55 +535,55 @@ typedef enum {
/**
* No errors.
*/
NGHTTP2_NO_ERROR = 0,
NGHTTP2_NO_ERROR = 0x00,
/**
* PROTOCOL_ERROR
*/
NGHTTP2_PROTOCOL_ERROR = 1,
NGHTTP2_PROTOCOL_ERROR = 0x01,
/**
* INTERNAL_ERROR
*/
NGHTTP2_INTERNAL_ERROR = 2,
NGHTTP2_INTERNAL_ERROR = 0x02,
/**
* FLOW_CONTROL_ERROR
*/
NGHTTP2_FLOW_CONTROL_ERROR = 3,
NGHTTP2_FLOW_CONTROL_ERROR = 0x03,
/**
* SETTINGS_TIMEOUT
*/
NGHTTP2_SETTINGS_TIMEOUT = 4,
NGHTTP2_SETTINGS_TIMEOUT = 0x04,
/**
* STREAM_CLOSED
*/
NGHTTP2_STREAM_CLOSED = 5,
NGHTTP2_STREAM_CLOSED = 0x05,
/**
* FRAME_SIZE_ERROR
*/
NGHTTP2_FRAME_SIZE_ERROR = 6,
NGHTTP2_FRAME_SIZE_ERROR = 0x06,
/**
* REFUSED_STREAM
*/
NGHTTP2_REFUSED_STREAM = 7,
NGHTTP2_REFUSED_STREAM = 0x07,
/**
* CANCEL
*/
NGHTTP2_CANCEL = 8,
NGHTTP2_CANCEL = 0x08,
/**
* COMPRESSION_ERROR
*/
NGHTTP2_COMPRESSION_ERROR = 9,
NGHTTP2_COMPRESSION_ERROR = 0x09,
/**
* CONNECT_ERROR
*/
NGHTTP2_CONNECT_ERROR = 10,
NGHTTP2_CONNECT_ERROR = 0x0a,
/**
* ENHANCE_YOUR_CALM
*/
NGHTTP2_ENHANCE_YOUR_CALM = 11,
NGHTTP2_ENHANCE_YOUR_CALM = 0x0b,
/**
* INADEQUATE_SECURITY
*/
NGHTTP2_INADEQUATE_SECURITY = 12
NGHTTP2_INADEQUATE_SECURITY = 0x0c
} nghttp2_error_code;
/**

View File

@ -383,7 +383,7 @@ void print_frame(print_type ptype, const nghttp2_frame *frame)
break;
case NGHTTP2_RST_STREAM:
print_frame_attr_indent();
fprintf(outfile, "(error_code=%s(%u))\n",
fprintf(outfile, "(error_code=%s(0x%02x))\n",
strstatus(frame->rst_stream.error_code),
frame->rst_stream.error_code);
break;
@ -393,7 +393,7 @@ void print_frame(print_type ptype, const nghttp2_frame *frame)
static_cast<unsigned long>(frame->settings.niv));
for(size_t i = 0; i < frame->settings.niv; ++i) {
print_frame_attr_indent();
fprintf(outfile, "[%s(%d):%u]\n",
fprintf(outfile, "[%s(0x%02x):%u]\n",
strsettingsid(frame->settings.iv[i].settings_id),
frame->settings.iv[i].settings_id,
frame->settings.iv[i].value);
@ -414,7 +414,8 @@ void print_frame(print_type ptype, const nghttp2_frame *frame)
case NGHTTP2_GOAWAY:
print_frame_attr_indent();
fprintf(outfile,
"(last_stream_id=%d, error_code=%s(%u), opaque_data(%u)=[%s])\n",
"(last_stream_id=%d, error_code=%s(0x%02x), "
"opaque_data(%u)=[%s])\n",
frame->goaway.last_stream_id,
strstatus(frame->goaway.error_code),
frame->goaway.error_code,