Add const to read-only nghttp2_frame* parameter in callbacks
This commit is contained in:
parent
a7bd4f33a3
commit
d960cf8953
|
@ -228,7 +228,7 @@ static ssize_t recv_callback(nghttp2_session *session,
|
||||||
* (nghttp2_submit_request).
|
* (nghttp2_submit_request).
|
||||||
*/
|
*/
|
||||||
static int before_frame_send_callback(nghttp2_session *session,
|
static int before_frame_send_callback(nghttp2_session *session,
|
||||||
nghttp2_frame *frame,
|
const nghttp2_frame *frame,
|
||||||
void *user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
if(frame->hd.type == NGHTTP2_HEADERS &&
|
if(frame->hd.type == NGHTTP2_HEADERS &&
|
||||||
|
@ -245,7 +245,7 @@ static int before_frame_send_callback(nghttp2_session *session,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int on_frame_send_callback(nghttp2_session *session,
|
static int on_frame_send_callback(nghttp2_session *session,
|
||||||
nghttp2_frame *frame, void *user_data)
|
const nghttp2_frame *frame, void *user_data)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
switch(frame->hd.type) {
|
switch(frame->hd.type) {
|
||||||
|
@ -272,7 +272,7 @@ static int on_frame_send_callback(nghttp2_session *session,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int on_frame_recv_callback(nghttp2_session *session,
|
static int on_frame_recv_callback(nghttp2_session *session,
|
||||||
nghttp2_frame *frame, void *user_data)
|
const nghttp2_frame *frame, void *user_data)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
switch(frame->hd.type) {
|
switch(frame->hd.type) {
|
||||||
|
@ -311,8 +311,8 @@ static int on_frame_recv_callback(nghttp2_session *session,
|
||||||
*/
|
*/
|
||||||
static int on_stream_close_callback(nghttp2_session *session,
|
static int on_stream_close_callback(nghttp2_session *session,
|
||||||
int32_t stream_id,
|
int32_t stream_id,
|
||||||
nghttp2_error_code error_code,
|
nghttp2_error_code error_code,
|
||||||
void *user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
struct Request *req;
|
struct Request *req;
|
||||||
req = nghttp2_session_get_stream_user_data(session, stream_id);
|
req = nghttp2_session_get_stream_user_data(session, stream_id);
|
||||||
|
|
|
@ -786,7 +786,7 @@ typedef ssize_t (*nghttp2_recv_callback)
|
||||||
* immediately return :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`.
|
* immediately return :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`.
|
||||||
*/
|
*/
|
||||||
typedef int (*nghttp2_on_frame_recv_callback)
|
typedef int (*nghttp2_on_frame_recv_callback)
|
||||||
(nghttp2_session *session, nghttp2_frame *frame, void *user_data);
|
(nghttp2_session *session, const nghttp2_frame *frame, void *user_data);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @functypedef
|
* @functypedef
|
||||||
|
@ -803,8 +803,8 @@ typedef int (*nghttp2_on_frame_recv_callback)
|
||||||
* immediately return :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`.
|
* immediately return :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`.
|
||||||
*/
|
*/
|
||||||
typedef int (*nghttp2_on_invalid_frame_recv_callback)
|
typedef int (*nghttp2_on_invalid_frame_recv_callback)
|
||||||
(nghttp2_session *session, nghttp2_frame *frame, nghttp2_error_code error_code,
|
(nghttp2_session *session, const nghttp2_frame *frame,
|
||||||
void *user_data);
|
nghttp2_error_code error_code, void *user_data);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @functypedef
|
* @functypedef
|
||||||
|
@ -857,7 +857,7 @@ typedef int (*nghttp2_on_data_recv_callback)
|
||||||
* immediately return :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`.
|
* immediately return :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`.
|
||||||
*/
|
*/
|
||||||
typedef int (*nghttp2_before_frame_send_callback)
|
typedef int (*nghttp2_before_frame_send_callback)
|
||||||
(nghttp2_session *session, nghttp2_frame *frame, void *user_data);
|
(nghttp2_session *session, const nghttp2_frame *frame, void *user_data);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @functypedef
|
* @functypedef
|
||||||
|
@ -870,7 +870,7 @@ typedef int (*nghttp2_before_frame_send_callback)
|
||||||
* immediately return :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`.
|
* immediately return :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`.
|
||||||
*/
|
*/
|
||||||
typedef int (*nghttp2_on_frame_send_callback)
|
typedef int (*nghttp2_on_frame_send_callback)
|
||||||
(nghttp2_session *session, nghttp2_frame *frame, void *user_data);
|
(nghttp2_session *session, const nghttp2_frame *frame, void *user_data);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @functypedef
|
* @functypedef
|
||||||
|
@ -886,7 +886,7 @@ typedef int (*nghttp2_on_frame_send_callback)
|
||||||
* immediately return :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`.
|
* immediately return :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`.
|
||||||
*/
|
*/
|
||||||
typedef int (*nghttp2_on_frame_not_send_callback)
|
typedef int (*nghttp2_on_frame_not_send_callback)
|
||||||
(nghttp2_session *session, nghttp2_frame *frame, int lib_error_code,
|
(nghttp2_session *session, const nghttp2_frame *frame, int lib_error_code,
|
||||||
void *user_data);
|
void *user_data);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -686,7 +686,7 @@ const char *REQUIRED_HEADERS[] = {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
int hd_on_frame_recv_callback
|
int hd_on_frame_recv_callback
|
||||||
(nghttp2_session *session, nghttp2_frame *frame, void *user_data)
|
(nghttp2_session *session, const nghttp2_frame *frame, void *user_data)
|
||||||
{
|
{
|
||||||
auto hd = reinterpret_cast<Http2Handler*>(user_data);
|
auto hd = reinterpret_cast<Http2Handler*>(user_data);
|
||||||
if(hd->get_config()->verbose) {
|
if(hd->get_config()->verbose) {
|
||||||
|
@ -741,7 +741,7 @@ int htdocs_on_request_recv_callback
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
int hd_on_frame_send_callback
|
int hd_on_frame_send_callback
|
||||||
(nghttp2_session *session, nghttp2_frame *frame,
|
(nghttp2_session *session, const nghttp2_frame *frame,
|
||||||
void *user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
auto hd = reinterpret_cast<Http2Handler*>(user_data);
|
auto hd = reinterpret_cast<Http2Handler*>(user_data);
|
||||||
|
|
|
@ -235,7 +235,7 @@ const char* frame_name_ansi_esc(print_type ptype)
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
void print_frame(print_type ptype, nghttp2_frame *frame)
|
void print_frame(print_type ptype, const nghttp2_frame *frame)
|
||||||
{
|
{
|
||||||
printf("%s%s%s frame ",
|
printf("%s%s%s frame ",
|
||||||
frame_name_ansi_esc(ptype),
|
frame_name_ansi_esc(ptype),
|
||||||
|
@ -324,7 +324,7 @@ void print_frame(print_type ptype, nghttp2_frame *frame)
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
int on_frame_recv_callback
|
int on_frame_recv_callback
|
||||||
(nghttp2_session *session, nghttp2_frame *frame, void *user_data)
|
(nghttp2_session *session, const nghttp2_frame *frame, void *user_data)
|
||||||
{
|
{
|
||||||
print_timer();
|
print_timer();
|
||||||
printf(" recv ");
|
printf(" recv ");
|
||||||
|
@ -334,7 +334,7 @@ int on_frame_recv_callback
|
||||||
}
|
}
|
||||||
|
|
||||||
int on_invalid_frame_recv_callback
|
int on_invalid_frame_recv_callback
|
||||||
(nghttp2_session *session, nghttp2_frame *frame,
|
(nghttp2_session *session, const nghttp2_frame *frame,
|
||||||
nghttp2_error_code error_code, void *user_data)
|
nghttp2_error_code error_code, void *user_data)
|
||||||
{
|
{
|
||||||
print_timer();
|
print_timer();
|
||||||
|
@ -392,7 +392,7 @@ int on_unknown_frame_recv_callback(nghttp2_session *session,
|
||||||
}
|
}
|
||||||
|
|
||||||
int on_frame_send_callback
|
int on_frame_send_callback
|
||||||
(nghttp2_session *session, nghttp2_frame *frame, void *user_data)
|
(nghttp2_session *session, const nghttp2_frame *frame, void *user_data)
|
||||||
{
|
{
|
||||||
print_timer();
|
print_timer();
|
||||||
printf(" send ");
|
printf(" send ");
|
||||||
|
|
|
@ -40,10 +40,10 @@ namespace nghttp2 {
|
||||||
void print_nv(char **nv);
|
void print_nv(char **nv);
|
||||||
|
|
||||||
int on_frame_recv_callback
|
int on_frame_recv_callback
|
||||||
(nghttp2_session *session, nghttp2_frame *frame, void *user_data);
|
(nghttp2_session *session, const nghttp2_frame *frame, void *user_data);
|
||||||
|
|
||||||
int on_invalid_frame_recv_callback
|
int on_invalid_frame_recv_callback
|
||||||
(nghttp2_session *session, nghttp2_frame *frame,
|
(nghttp2_session *session, const nghttp2_frame *frame,
|
||||||
nghttp2_error_code error_code, void *user_data);
|
nghttp2_error_code error_code, void *user_data);
|
||||||
|
|
||||||
int on_frame_recv_parse_error_callback(nghttp2_session *session,
|
int on_frame_recv_parse_error_callback(nghttp2_session *session,
|
||||||
|
@ -62,7 +62,7 @@ int on_unknown_frame_recv_callback(nghttp2_session *session,
|
||||||
void *user_data);
|
void *user_data);
|
||||||
|
|
||||||
int on_frame_send_callback
|
int on_frame_send_callback
|
||||||
(nghttp2_session *session, nghttp2_frame *frame, void *user_data);
|
(nghttp2_session *session, const nghttp2_frame *frame, void *user_data);
|
||||||
|
|
||||||
int on_data_recv_callback
|
int on_data_recv_callback
|
||||||
(nghttp2_session *session, uint16_t length, uint8_t flags, int32_t stream_id,
|
(nghttp2_session *session, uint16_t length, uint8_t flags, int32_t stream_id,
|
||||||
|
|
|
@ -979,7 +979,7 @@ void check_stream_id(nghttp2_session *session, int32_t stream_id,
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
int on_frame_send_callback2
|
int on_frame_send_callback2
|
||||||
(nghttp2_session *session, nghttp2_frame *frame, void *user_data)
|
(nghttp2_session *session, const nghttp2_frame *frame, void *user_data)
|
||||||
{
|
{
|
||||||
if(frame->hd.type == NGHTTP2_HEADERS &&
|
if(frame->hd.type == NGHTTP2_HEADERS &&
|
||||||
frame->headers.cat == NGHTTP2_HCAT_REQUEST) {
|
frame->headers.cat == NGHTTP2_HCAT_REQUEST) {
|
||||||
|
@ -992,7 +992,7 @@ int on_frame_send_callback2
|
||||||
}
|
}
|
||||||
|
|
||||||
void check_response_header
|
void check_response_header
|
||||||
(nghttp2_session *session, nghttp2_frame *frame, void *user_data)
|
(nghttp2_session *session, const nghttp2_frame *frame, void *user_data)
|
||||||
{
|
{
|
||||||
if(frame->hd.type != NGHTTP2_HEADERS ||
|
if(frame->hd.type != NGHTTP2_HEADERS ||
|
||||||
frame->headers.cat != NGHTTP2_HCAT_RESPONSE) {
|
frame->headers.cat != NGHTTP2_HCAT_RESPONSE) {
|
||||||
|
@ -1027,7 +1027,7 @@ void check_response_header
|
||||||
}
|
}
|
||||||
|
|
||||||
int on_frame_recv_callback2
|
int on_frame_recv_callback2
|
||||||
(nghttp2_session *session, nghttp2_frame *frame, void *user_data)
|
(nghttp2_session *session, const nghttp2_frame *frame, void *user_data)
|
||||||
{
|
{
|
||||||
if(frame->hd.type == NGHTTP2_HEADERS &&
|
if(frame->hd.type == NGHTTP2_HEADERS &&
|
||||||
frame->headers.cat == NGHTTP2_HCAT_RESPONSE) {
|
frame->headers.cat == NGHTTP2_HCAT_RESPONSE) {
|
||||||
|
|
|
@ -174,7 +174,7 @@ int Http2Upstream::upgrade_upstream(HttpsUpstream *http)
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
int on_frame_recv_callback
|
int on_frame_recv_callback
|
||||||
(nghttp2_session *session, nghttp2_frame *frame, void *user_data)
|
(nghttp2_session *session, const nghttp2_frame *frame, void *user_data)
|
||||||
{
|
{
|
||||||
auto upstream = reinterpret_cast<Http2Upstream*>(user_data);
|
auto upstream = reinterpret_cast<Http2Upstream*>(user_data);
|
||||||
switch(frame->hd.type) {
|
switch(frame->hd.type) {
|
||||||
|
@ -332,7 +332,7 @@ int on_data_chunk_recv_callback(nghttp2_session *session,
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
int on_frame_not_send_callback(nghttp2_session *session,
|
int on_frame_not_send_callback(nghttp2_session *session,
|
||||||
nghttp2_frame *frame,
|
const nghttp2_frame *frame,
|
||||||
int lib_error_code, void *user_data)
|
int lib_error_code, void *user_data)
|
||||||
{
|
{
|
||||||
auto upstream = reinterpret_cast<Http2Upstream*>(user_data);
|
auto upstream = reinterpret_cast<Http2Upstream*>(user_data);
|
||||||
|
|
|
@ -724,7 +724,7 @@ int on_stream_close_callback
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
int on_frame_recv_callback
|
int on_frame_recv_callback
|
||||||
(nghttp2_session *session, nghttp2_frame *frame, void *user_data)
|
(nghttp2_session *session, const nghttp2_frame *frame, void *user_data)
|
||||||
{
|
{
|
||||||
int rv;
|
int rv;
|
||||||
auto spdy = reinterpret_cast<SpdySession*>(user_data);
|
auto spdy = reinterpret_cast<SpdySession*>(user_data);
|
||||||
|
@ -947,7 +947,7 @@ int on_data_chunk_recv_callback(nghttp2_session *session,
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
int before_frame_send_callback(nghttp2_session *session,
|
int before_frame_send_callback(nghttp2_session *session,
|
||||||
nghttp2_frame *frame,
|
const nghttp2_frame *frame,
|
||||||
void *user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
if(frame->hd.type == NGHTTP2_HEADERS &&
|
if(frame->hd.type == NGHTTP2_HEADERS &&
|
||||||
|
@ -972,8 +972,8 @@ int before_frame_send_callback(nghttp2_session *session,
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
int on_frame_not_send_callback(nghttp2_session *session,
|
int on_frame_not_send_callback(nghttp2_session *session,
|
||||||
nghttp2_frame *frame,
|
const nghttp2_frame *frame,
|
||||||
int lib_error_code, void *user_data)
|
int lib_error_code, void *user_data)
|
||||||
{
|
{
|
||||||
auto spdy = reinterpret_cast<SpdySession*>(user_data);
|
auto spdy = reinterpret_cast<SpdySession*>(user_data);
|
||||||
SSLOG(WARNING, spdy) << "Failed to send control frame type="
|
SSLOG(WARNING, spdy) << "Failed to send control frame type="
|
||||||
|
|
|
@ -109,8 +109,8 @@ static ssize_t scripted_recv_callback(nghttp2_session *session,
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t eof_recv_callback(nghttp2_session *session,
|
static ssize_t eof_recv_callback(nghttp2_session *session,
|
||||||
uint8_t* data, size_t len, int flags,
|
uint8_t* data, size_t len, int flags,
|
||||||
void *user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
return NGHTTP2_ERR_EOF;
|
return NGHTTP2_ERR_EOF;
|
||||||
}
|
}
|
||||||
|
@ -127,7 +127,7 @@ static ssize_t accumulator_send_callback(nghttp2_session *session,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int on_frame_recv_callback(nghttp2_session *session,
|
static int on_frame_recv_callback(nghttp2_session *session,
|
||||||
nghttp2_frame *frame,
|
const nghttp2_frame *frame,
|
||||||
void *user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
my_user_data *ud = (my_user_data*)user_data;
|
my_user_data *ud = (my_user_data*)user_data;
|
||||||
|
@ -136,7 +136,7 @@ static int on_frame_recv_callback(nghttp2_session *session,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int on_invalid_frame_recv_callback(nghttp2_session *session,
|
static int on_invalid_frame_recv_callback(nghttp2_session *session,
|
||||||
nghttp2_frame *frame,
|
const nghttp2_frame *frame,
|
||||||
nghttp2_error_code error_code,
|
nghttp2_error_code error_code,
|
||||||
void *user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
|
@ -146,7 +146,7 @@ static int on_invalid_frame_recv_callback(nghttp2_session *session,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int on_frame_send_callback(nghttp2_session *session,
|
static int on_frame_send_callback(nghttp2_session *session,
|
||||||
nghttp2_frame *frame,
|
const nghttp2_frame *frame,
|
||||||
void *user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
my_user_data *ud = (my_user_data*)user_data;
|
my_user_data *ud = (my_user_data*)user_data;
|
||||||
|
@ -156,7 +156,7 @@ static int on_frame_send_callback(nghttp2_session *session,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int on_frame_not_send_callback(nghttp2_session *session,
|
static int on_frame_not_send_callback(nghttp2_session *session,
|
||||||
nghttp2_frame *frame,
|
const nghttp2_frame *frame,
|
||||||
int lib_error,
|
int lib_error,
|
||||||
void *user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue