From baa0f60dc8c3201ebdbbfc03551d40e2704f2608 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Fri, 26 Aug 2016 23:02:51 +0900 Subject: [PATCH] Add API to get current HPACK dynamic table size --- doc/Makefile.am | 2 ++ lib/includes/nghttp2/nghttp2.h | 18 ++++++++++++++++++ lib/nghttp2_session.c | 10 ++++++++++ 3 files changed, 30 insertions(+) diff --git a/doc/Makefile.am b/doc/Makefile.am index 534484be..f52d7483 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -108,6 +108,8 @@ APIDOCS= \ nghttp2_session_find_stream.rst \ nghttp2_session_get_effective_local_window_size.rst \ nghttp2_session_get_effective_recv_data_length.rst \ + nghttp2_session_get_hd_deflate_dynamic_table_size.rst \ + nghttp2_session_get_hd_inflate_dynamic_table_size.rst \ nghttp2_session_get_last_proc_stream_id.rst \ nghttp2_session_get_local_settings.rst \ nghttp2_session_get_local_window_size.rst \ diff --git a/lib/includes/nghttp2/nghttp2.h b/lib/includes/nghttp2/nghttp2.h index 9620ae01..bc35e40a 100644 --- a/lib/includes/nghttp2/nghttp2.h +++ b/lib/includes/nghttp2/nghttp2.h @@ -3135,6 +3135,24 @@ NGHTTP2_EXTERN int nghttp2_session_get_stream_remote_close(nghttp2_session *session, int32_t stream_id); +/** + * @function + * + * Returns the current dynamic table size of HPACK inflater, including + * the overhead 32 bytes per entry described in RFC 7541. + */ +NGHTTP2_EXTERN size_t +nghttp2_session_get_hd_inflate_dynamic_table_size(nghttp2_session *session); + +/** + * @function + * + * Returns the current dynamic table size of HPACK deflater including + * the overhead 32 bytes per entry described in RFC 7541. + */ +NGHTTP2_EXTERN size_t +nghttp2_session_get_hd_deflate_dynamic_table_size(nghttp2_session *session); + /** * @function * diff --git a/lib/nghttp2_session.c b/lib/nghttp2_session.c index a85f5915..2442db39 100644 --- a/lib/nghttp2_session.c +++ b/lib/nghttp2_session.c @@ -7588,3 +7588,13 @@ int nghttp2_session_create_idle_stream(nghttp2_session *session, called. */ return 0; } + +size_t +nghttp2_session_get_hd_inflate_dynamic_table_size(nghttp2_session *session) { + return nghttp2_hd_inflate_get_dynamic_table_size(&session->hd_inflater); +} + +size_t +nghttp2_session_get_hd_deflate_dynamic_table_size(nghttp2_session *session) { + return nghttp2_hd_deflate_get_dynamic_table_size(&session->hd_deflater); +}