Commit 827abb57 authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa

Simplified bitfield calculation of extension frame

parent 9aee43f7
...@@ -70,6 +70,6 @@ void nghttp2_option_set_user_recv_extension_type(nghttp2_option *option, ...@@ -70,6 +70,6 @@ void nghttp2_option_set_user_recv_extension_type(nghttp2_option *option,
} }
option->opt_set_mask |= NGHTTP2_OPT_USER_RECV_EXT_TYPES; option->opt_set_mask |= NGHTTP2_OPT_USER_RECV_EXT_TYPES;
option->user_recv_ext_types[type / 8] = (uint8_t)( option->user_recv_ext_types[type / 8] =
option->user_recv_ext_types[type / 8] | (1 << (7 - (type & 0x7)))); (uint8_t)(option->user_recv_ext_types[type / 8] | (1 << (type & 0x7)));
} }
...@@ -5345,7 +5345,7 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in, ...@@ -5345,7 +5345,7 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in,
if (!session->callbacks.unpack_extension_callback || if (!session->callbacks.unpack_extension_callback ||
(session->user_recv_ext_types[iframe->frame.hd.type / 8] & (session->user_recv_ext_types[iframe->frame.hd.type / 8] &
(1 << (7 - (iframe->frame.hd.type & 0x7)))) == 0) { (1 << (iframe->frame.hd.type & 0x7))) == 0) {
/* Silently ignore unknown frame type. */ /* Silently ignore unknown frame type. */
busy = 1; busy = 1;
......
...@@ -306,10 +306,11 @@ struct nghttp2_session { ...@@ -306,10 +306,11 @@ struct nghttp2_session {
WINDOW_UPDATE is not queued. */ WINDOW_UPDATE is not queued. */
uint8_t window_update_queued; uint8_t window_update_queued;
/* Bitfield of extension frame types that application is willing to /* Bitfield of extension frame types that application is willing to
receive. First most significant 10 bits are standard frame types receive. To designate the bit of given frame type i, use
and not used. If bit is set, it indicates that incoming frame user_recv_ext_types[i / 8] & (1 << (i & 0x7)). First 10 frame
with that type is passed to user defined callbacks, otherwise types are standard frame types and not used in this bitfield. If
they are ignored. */ bit is set, it indicates that incoming frame with that type is
passed to user defined callbacks, otherwise they are ignored. */
uint8_t user_recv_ext_types[32]; uint8_t user_recv_ext_types[32];
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment