@@ -387,6 +387,11 @@ typedef enum {
387387 * Indicates that a processing was canceled.
388388 */
389389 NGHTTP2_ERR_CANCEL = -535 ,
390+ /**
391+ * When a local endpoint expects to receive SETTINGS frame, it
392+ * receives an other type of frame.
393+ */
394+ NGHTTP2_ERR_SETTINGS_EXPECTED = -536 ,
390395 /**
391396 * The errors < :enum:`NGHTTP2_ERR_FATAL` mean that the library is
392397 * under unexpected condition and processing was terminated (e.g.,
@@ -1987,6 +1992,9 @@ typedef ssize_t (*nghttp2_pack_extension_callback)(nghttp2_session *session,
19871992 * of length |len|. |len| does not include the sentinel NULL
19881993 * character.
19891994 *
1995+ * This function is deprecated. The new application should use
1996+ * :type:`nghttp2_error_callback2`.
1997+ *
19901998 * The format of error message may change between nghttp2 library
19911999 * versions. The application should not depend on the particular
19922000 * format.
@@ -2003,6 +2011,33 @@ typedef ssize_t (*nghttp2_pack_extension_callback)(nghttp2_session *session,
20032011typedef int (* nghttp2_error_callback )(nghttp2_session * session , const char * msg ,
20042012 size_t len , void * user_data );
20052013
2014+ /**
2015+ * @functypedef
2016+ *
2017+ * Callback function invoked when library provides the error code, and
2018+ * message. This callback is solely for debugging purpose.
2019+ * |lib_error_code| is one of error code defined in
2020+ * :enum:`nghttp2_error`. The |msg| is typically NULL-terminated
2021+ * string of length |len|, and intended for human consumption. |len|
2022+ * does not include the sentinel NULL character.
2023+ *
2024+ * The format of error message may change between nghttp2 library
2025+ * versions. The application should not depend on the particular
2026+ * format.
2027+ *
2028+ * Normally, application should return 0 from this callback. If fatal
2029+ * error occurred while doing something in this callback, application
2030+ * should return :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`. In this case,
2031+ * library will return immediately with return value
2032+ * :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`. Currently, if nonzero value
2033+ * is returned from this callback, they are treated as
2034+ * :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`, but application should not
2035+ * rely on this details.
2036+ */
2037+ typedef int (* nghttp2_error_callback2 )(nghttp2_session * session ,
2038+ int lib_error_code , const char * msg ,
2039+ size_t len , void * user_data );
2040+
20062041struct nghttp2_session_callbacks ;
20072042
20082043/**
@@ -2267,10 +2302,30 @@ nghttp2_session_callbacks_set_on_extension_chunk_recv_callback(
22672302 *
22682303 * Sets callback function invoked when library tells error message to
22692304 * the application.
2305+ *
2306+ * This function is deprecated. The new application should use
2307+ * `nghttp2_session_callbacks_set_error_callback2()`.
2308+ *
2309+ * If both :type:`nghttp2_error_callback` and
2310+ * :type:`nghttp2_error_callback2` are set, the latter takes
2311+ * precedence.
22702312 */
22712313NGHTTP2_EXTERN void nghttp2_session_callbacks_set_error_callback (
22722314 nghttp2_session_callbacks * cbs , nghttp2_error_callback error_callback );
22732315
2316+ /**
2317+ * @function
2318+ *
2319+ * Sets callback function invoked when library tells error code, and
2320+ * message to the application.
2321+ *
2322+ * If both :type:`nghttp2_error_callback` and
2323+ * :type:`nghttp2_error_callback2` are set, the latter takes
2324+ * precedence.
2325+ */
2326+ NGHTTP2_EXTERN void nghttp2_session_callbacks_set_error_callback2 (
2327+ nghttp2_session_callbacks * cbs , nghttp2_error_callback2 error_callback2 );
2328+
22742329/**
22752330 * @functypedef
22762331 *
@@ -4702,8 +4757,8 @@ nghttp2_hd_deflate_change_table_size(nghttp2_hd_deflater *deflater,
47024757 *
47034758 * After this function returns, it is safe to delete the |nva|.
47044759 *
4705- * This function returns 0 if it succeeds, or one of the following
4706- * negative error codes:
4760+ * This function returns the number of bytes written to |buf| if it
4761+ * succeeds, or one of the following negative error codes:
47074762 *
47084763 * :enum:`NGHTTP2_ERR_NOMEM`
47094764 * Out of memory.
@@ -4734,8 +4789,8 @@ NGHTTP2_EXTERN ssize_t nghttp2_hd_deflate_hd(nghttp2_hd_deflater *deflater,
47344789 *
47354790 * After this function returns, it is safe to delete the |nva|.
47364791 *
4737- * This function returns 0 if it succeeds, or one of the following
4738- * negative error codes:
4792+ * This function returns the number of bytes written to |vec| if it
4793+ * succeeds, or one of the following negative error codes:
47394794 *
47404795 * :enum:`NGHTTP2_ERR_NOMEM`
47414796 * Out of memory.
0 commit comments