@@ -387,6 +387,11 @@ typedef enum { |
387 | 387 | * Indicates that a processing was canceled. |
388 | 388 | */ |
389 | 389 | 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, |
390 | 395 | /** |
391 | 396 | * The errors < :enum:`NGHTTP2_ERR_FATAL` mean that the library is |
392 | 397 | * under unexpected condition and processing was terminated (e.g., |
@@ -1987,6 +1992,9 @@ typedef ssize_t (*nghttp2_pack_extension_callback)(nghttp2_session *session, |
1987 | 1992 | * of length |len|. |len| does not include the sentinel NULL |
1988 | 1993 | * character. |
1989 | 1994 | * |
| 1995 | + * This function is deprecated. The new application should use |
| 1996 | + * :type:`nghttp2_error_callback2`. |
| 1997 | + * |
1990 | 1998 | * The format of error message may change between nghttp2 library |
1991 | 1999 | * versions. The application should not depend on the particular |
1992 | 2000 | * format. |
@@ -2003,6 +2011,33 @@ typedef ssize_t (*nghttp2_pack_extension_callback)(nghttp2_session *session, |
2003 | 2011 | typedef int (*nghttp2_error_callback)(nghttp2_session *session, const char *msg, |
2004 | 2012 | size_t len, void *user_data); |
2005 | 2013 |
|
| 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 | + |
2006 | 2041 | struct nghttp2_session_callbacks; |
2007 | 2042 |
|
2008 | 2043 | /** |
@@ -2267,10 +2302,30 @@ nghttp2_session_callbacks_set_on_extension_chunk_recv_callback( |
2267 | 2302 | * |
2268 | 2303 | * Sets callback function invoked when library tells error message to |
2269 | 2304 | * 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. |
2270 | 2312 | */ |
2271 | 2313 | NGHTTP2_EXTERN void nghttp2_session_callbacks_set_error_callback( |
2272 | 2314 | nghttp2_session_callbacks *cbs, nghttp2_error_callback error_callback); |
2273 | 2315 |
|
| 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 | + |
2274 | 2329 | /** |
2275 | 2330 | * @functypedef |
2276 | 2331 | * |
@@ -4702,8 +4757,8 @@ nghttp2_hd_deflate_change_table_size(nghttp2_hd_deflater *deflater, |
4702 | 4757 | * |
4703 | 4758 | * After this function returns, it is safe to delete the |nva|. |
4704 | 4759 | * |
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: |
4707 | 4762 | * |
4708 | 4763 | * :enum:`NGHTTP2_ERR_NOMEM` |
4709 | 4764 | * Out of memory. |
@@ -4734,8 +4789,8 @@ NGHTTP2_EXTERN ssize_t nghttp2_hd_deflate_hd(nghttp2_hd_deflater *deflater, |
4734 | 4789 | * |
4735 | 4790 | * After this function returns, it is safe to delete the |nva|. |
4736 | 4791 | * |
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: |
4739 | 4794 | * |
4740 | 4795 | * :enum:`NGHTTP2_ERR_NOMEM` |
4741 | 4796 | * Out of memory. |
|