vlc | branch: master | Rémi Denis-Courmont <[email protected]> | Sat Nov 21 19:09:46 2015 +0200| [a64f235daefbb66f488d21f50643ca959d12bff6] | committer: Rémi Denis-Courmont
HTTP/2 debug helpers > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a64f235daefbb66f488d21f50643ca959d12bff6 --- modules/access/http/h2frame.c | 41 +++++++++++++++++++++++++++++++++++++++++ modules/access/http/h2frame.h | 4 ++++ 2 files changed, 45 insertions(+) diff --git a/modules/access/http/h2frame.c b/modules/access/http/h2frame.c index a342d03..7b80f6b 100644 --- a/modules/access/http/h2frame.c +++ b/modules/access/http/h2frame.c @@ -260,6 +260,23 @@ struct vlc_h2_frame *vlc_h2_frame_settings_ack(void) 0); } +const char *vlc_h2_setting_name(uint_fast16_t id) +{ + static const char names[][20] = { + [0] = "Unknown setting", + [VLC_H2_SETTING_HEADER_TABLE_SIZE] = "Header table size", + [VLC_H2_SETTING_ENABLE_PUSH] = "Enable push", + [VLC_H2_SETTING_MAX_CONCURRENT_STREAMS] = "Concurrent streams", + [VLC_H2_SETTING_INITIAL_WINDOW_SIZE] = "Initial window size", + [VLC_H2_SETTING_MAX_FRAME_SIZE] = "Frame size", + [VLC_H2_SETTING_MAX_HEADER_LIST_SIZE] = "Header list size", + }; + + if (id >= sizeof (names) / sizeof (names[0]) || names[id][0] == '\0') + id = 0; + return names[id]; +} + struct vlc_h2_frame *vlc_h2_frame_ping(uint64_t opaque) { struct vlc_h2_frame *f = vlc_h2_frame_alloc(VLC_H2_FRAME_PING, 0, 0, 8); @@ -306,3 +323,27 @@ vlc_h2_frame_window_update(uint_fast32_t stream_id, uint_fast32_t credit) } return f; } + +const char *vlc_h2_strerror(uint_fast32_t code) +{ + static const char names[][20] = { + [VLC_H2_NO_ERROR] = "No error", + [VLC_H2_PROTOCOL_ERROR] = "Protocol error", + [VLC_H2_INTERNAL_ERROR] = "Internal error", + [VLC_H2_FLOW_CONTROL_ERROR] = "Flow control error", + [VLC_H2_SETTINGS_TIMEOUT] = "Settings time-out", + [VLC_H2_STREAM_CLOSED] = "Stream closed", + [VLC_H2_FRAME_SIZE_ERROR] = "Frame size error", + [VLC_H2_REFUSED_STREAM] = "Refused stream", + [VLC_H2_CANCEL] = "Cancellation", + [VLC_H2_COMPRESSION_ERROR] = "Compression error", + [VLC_H2_CONNECT_ERROR] = "CONNECT error", + [VLC_H2_ENHANCE_YOUR_CALM] = "Excessive load", + [VLC_H2_INADEQUATE_SECURITY] = "Inadequate security", + [VLC_H2_HTTP_1_1_REQUIRED] = "Required HTTP/1.1", + }; + + if (code >= sizeof (names) / sizeof (names[0]) || names[code][0] == '\0') + return "Unknown error"; + return names[code]; +} diff --git a/modules/access/http/h2frame.h b/modules/access/http/h2frame.h index 1079f1f..6673c79 100644 --- a/modules/access/http/h2frame.h +++ b/modules/access/http/h2frame.h @@ -61,6 +61,8 @@ enum vlc_h2_error { VLC_H2_HTTP_1_1_REQUIRED, }; +const char *vlc_h2_strerror(uint_fast32_t); + enum vlc_h2_setting { VLC_H2_SETTING_HEADER_TABLE_SIZE = 0x0001, VLC_H2_SETTING_ENABLE_PUSH, @@ -70,6 +72,8 @@ enum vlc_h2_setting { VLC_H2_SETTING_MAX_HEADER_LIST_SIZE, }; +const char *vlc_h2_setting_name(uint_fast16_t); + /* Our settings */ #define VLC_H2_MAX_HEADER_TABLE 4096 /* Header (compression) table size */ #define VLC_H2_MAX_STREAMS 0 /* Concurrent peer-initiated streams */ _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
