Add const to read-only nghttp2_frame* parameter in callbacks

This commit is contained in:
Tatsuhiro Tsujikawa 2013-09-03 21:24:14 +09:00
parent a7bd4f33a3
commit d960cf8953
9 changed files with 35 additions and 35 deletions

View File

@ -228,7 +228,7 @@ static ssize_t recv_callback(nghttp2_session *session,
* (nghttp2_submit_request).
*/
static int before_frame_send_callback(nghttp2_session *session,
nghttp2_frame *frame,
const nghttp2_frame *frame,
void *user_data)
{
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,
nghttp2_frame *frame, void *user_data)
const nghttp2_frame *frame, void *user_data)
{
size_t i;
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,
nghttp2_frame *frame, void *user_data)
const nghttp2_frame *frame, void *user_data)
{
size_t i;
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,
int32_t stream_id,
nghttp2_error_code error_code,
void *user_data)
nghttp2_error_code error_code,
void *user_data)
{
struct Request *req;
req = nghttp2_session_get_stream_user_data(session, stream_id);

View File

@ -786,7 +786,7 @@ typedef ssize_t (*nghttp2_recv_callback)
* immediately return :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`.
*/
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
@ -803,8 +803,8 @@ typedef int (*nghttp2_on_frame_recv_callback)
* immediately return :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`.
*/
typedef int (*nghttp2_on_invalid_frame_recv_callback)
(nghttp2_session *session, nghttp2_frame *frame, nghttp2_error_code error_code,
void *user_data);
(nghttp2_session *session, const nghttp2_frame *frame,
nghttp2_error_code error_code, void *user_data);
/**
* @functypedef
@ -857,7 +857,7 @@ typedef int (*nghttp2_on_data_recv_callback)
* immediately return :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`.
*/
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
@ -870,7 +870,7 @@ typedef int (*nghttp2_before_frame_send_callback)
* immediately return :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`.
*/
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
@ -886,7 +886,7 @@ typedef int (*nghttp2_on_frame_send_callback)
* immediately return :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`.
*/
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);
/**

View File

@ -686,7 +686,7 @@ const char *REQUIRED_HEADERS[] = {
namespace {
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);
if(hd->get_config()->verbose) {
@ -741,7 +741,7 @@ int htdocs_on_request_recv_callback
namespace {
int hd_on_frame_send_callback
(nghttp2_session *session, nghttp2_frame *frame,
(nghttp2_session *session, const nghttp2_frame *frame,
void *user_data)
{
auto hd = reinterpret_cast<Http2Handler*>(user_data);

View File

@ -235,7 +235,7 @@ const char* frame_name_ansi_esc(print_type ptype)
} // 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 ",
frame_name_ansi_esc(ptype),
@ -324,7 +324,7 @@ void print_frame(print_type ptype, nghttp2_frame *frame)
} // namespace
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();
printf(" recv ");
@ -334,7 +334,7 @@ int on_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)
{
print_timer();
@ -392,7 +392,7 @@ int on_unknown_frame_recv_callback(nghttp2_session *session,
}
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();
printf(" send ");

View File

@ -40,10 +40,10 @@ namespace nghttp2 {
void print_nv(char **nv);
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
(nghttp2_session *session, nghttp2_frame *frame,
(nghttp2_session *session, const nghttp2_frame *frame,
nghttp2_error_code error_code, void *user_data);
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);
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
(nghttp2_session *session, uint16_t length, uint8_t flags, int32_t stream_id,

View File

@ -979,7 +979,7 @@ void check_stream_id(nghttp2_session *session, int32_t stream_id,
} // namespace
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 &&
frame->headers.cat == NGHTTP2_HCAT_REQUEST) {
@ -992,7 +992,7 @@ int on_frame_send_callback2
}
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 ||
frame->headers.cat != NGHTTP2_HCAT_RESPONSE) {
@ -1027,7 +1027,7 @@ void check_response_header
}
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 &&
frame->headers.cat == NGHTTP2_HCAT_RESPONSE) {

View File

@ -174,7 +174,7 @@ int Http2Upstream::upgrade_upstream(HttpsUpstream *http)
namespace {
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);
switch(frame->hd.type) {
@ -332,7 +332,7 @@ int on_data_chunk_recv_callback(nghttp2_session *session,
namespace {
int on_frame_not_send_callback(nghttp2_session *session,
nghttp2_frame *frame,
const nghttp2_frame *frame,
int lib_error_code, void *user_data)
{
auto upstream = reinterpret_cast<Http2Upstream*>(user_data);

View File

@ -724,7 +724,7 @@ int on_stream_close_callback
namespace {
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;
auto spdy = reinterpret_cast<SpdySession*>(user_data);
@ -947,7 +947,7 @@ int on_data_chunk_recv_callback(nghttp2_session *session,
namespace {
int before_frame_send_callback(nghttp2_session *session,
nghttp2_frame *frame,
const nghttp2_frame *frame,
void *user_data)
{
if(frame->hd.type == NGHTTP2_HEADERS &&
@ -972,8 +972,8 @@ int before_frame_send_callback(nghttp2_session *session,
namespace {
int on_frame_not_send_callback(nghttp2_session *session,
nghttp2_frame *frame,
int lib_error_code, void *user_data)
const nghttp2_frame *frame,
int lib_error_code, void *user_data)
{
auto spdy = reinterpret_cast<SpdySession*>(user_data);
SSLOG(WARNING, spdy) << "Failed to send control frame type="

View File

@ -109,8 +109,8 @@ static ssize_t scripted_recv_callback(nghttp2_session *session,
}
static ssize_t eof_recv_callback(nghttp2_session *session,
uint8_t* data, size_t len, int flags,
void *user_data)
uint8_t* data, size_t len, int flags,
void *user_data)
{
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,
nghttp2_frame *frame,
const nghttp2_frame *frame,
void *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,
nghttp2_frame *frame,
const nghttp2_frame *frame,
nghttp2_error_code error_code,
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,
nghttp2_frame *frame,
const nghttp2_frame *frame,
void *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,
nghttp2_frame *frame,
const nghttp2_frame *frame,
int lib_error,
void *user_data)
{