Path: blob/master/Utilities/cmnghttp2/lib/nghttp2_callbacks.h
3153 views
/*1* nghttp2 - HTTP/2 C Library2*3* Copyright (c) 2014 Tatsuhiro Tsujikawa4*5* Permission is hereby granted, free of charge, to any person obtaining6* a copy of this software and associated documentation files (the7* "Software"), to deal in the Software without restriction, including8* without limitation the rights to use, copy, modify, merge, publish,9* distribute, sublicense, and/or sell copies of the Software, and to10* permit persons to whom the Software is furnished to do so, subject to11* the following conditions:12*13* The above copyright notice and this permission notice shall be14* included in all copies or substantial portions of the Software.15*16* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,17* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF18* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND19* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE20* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION21* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION22* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.23*/24#ifndef NGHTTP2_CALLBACKS_H25#define NGHTTP2_CALLBACKS_H2627#ifdef HAVE_CONFIG_H28# include <config.h>29#endif /* HAVE_CONFIG_H */3031#include <nghttp2/nghttp2.h>3233/*34* Callback functions.35*/36struct nghttp2_session_callbacks {37/**38* Callback function invoked when the session wants to send data to39* the remote peer. This callback is not necessary if the40* application uses solely `nghttp2_session_mem_send()` to serialize41* data to transmit.42*/43nghttp2_send_callback send_callback;44/**45* Callback function invoked when the session wants to receive data46* from the remote peer. This callback is not necessary if the47* application uses solely `nghttp2_session_mem_recv()` to process48* received data.49*/50nghttp2_recv_callback recv_callback;51/**52* Callback function invoked by `nghttp2_session_recv()` when a53* frame is received.54*/55nghttp2_on_frame_recv_callback on_frame_recv_callback;56/**57* Callback function invoked by `nghttp2_session_recv()` when an58* invalid non-DATA frame is received.59*/60nghttp2_on_invalid_frame_recv_callback on_invalid_frame_recv_callback;61/**62* Callback function invoked when a chunk of data in DATA frame is63* received.64*/65nghttp2_on_data_chunk_recv_callback on_data_chunk_recv_callback;66/**67* Callback function invoked before a non-DATA frame is sent.68*/69nghttp2_before_frame_send_callback before_frame_send_callback;70/**71* Callback function invoked after a frame is sent.72*/73nghttp2_on_frame_send_callback on_frame_send_callback;74/**75* The callback function invoked when a non-DATA frame is not sent76* because of an error.77*/78nghttp2_on_frame_not_send_callback on_frame_not_send_callback;79/**80* Callback function invoked when the stream is closed.81*/82nghttp2_on_stream_close_callback on_stream_close_callback;83/**84* Callback function invoked when the reception of header block in85* HEADERS or PUSH_PROMISE is started.86*/87nghttp2_on_begin_headers_callback on_begin_headers_callback;88/**89* Callback function invoked when a header name/value pair is90* received.91*/92nghttp2_on_header_callback on_header_callback;93nghttp2_on_header_callback2 on_header_callback2;94/**95* Callback function invoked when a invalid header name/value pair96* is received which is silently ignored if these callbacks are not97* set.98*/99nghttp2_on_invalid_header_callback on_invalid_header_callback;100nghttp2_on_invalid_header_callback2 on_invalid_header_callback2;101/**102* Callback function invoked when the library asks application how103* many padding bytes are required for the transmission of the given104* frame.105*/106nghttp2_select_padding_callback select_padding_callback;107/**108* The callback function used to determine the length allowed in109* `nghttp2_data_source_read_callback()`110*/111nghttp2_data_source_read_length_callback read_length_callback;112/**113* Sets callback function invoked when a frame header is received.114*/115nghttp2_on_begin_frame_callback on_begin_frame_callback;116nghttp2_send_data_callback send_data_callback;117nghttp2_pack_extension_callback pack_extension_callback;118nghttp2_unpack_extension_callback unpack_extension_callback;119nghttp2_on_extension_chunk_recv_callback on_extension_chunk_recv_callback;120nghttp2_error_callback error_callback;121nghttp2_error_callback2 error_callback2;122};123124#endif /* NGHTTP2_CALLBACKS_H */125126127