From cf7da38598bd3937380ed5f0d848fd443fcdc6d4 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Fri, 24 Feb 2012 21:40:13 +0900 Subject: [PATCH] Define flags separately for control and data frames. --- lib/includes/spdylay/spdylay.h | 34 ++++--- lib/spdylay_frame.c | 2 +- lib/spdylay_session.c | 47 +++++----- lib/spdylay_session.h | 17 ++-- lib/spdylay_submit.c | 20 ++--- tests/spdylay_frame_test.c | 6 +- tests/spdylay_session_test.c | 158 +++++++++++++++++---------------- tests/spdylay_stream_test.c | 4 +- 8 files changed, 152 insertions(+), 136 deletions(-) diff --git a/lib/includes/spdylay/spdylay.h b/lib/includes/spdylay/spdylay.h index 19a25a18..74af18e3 100644 --- a/lib/includes/spdylay/spdylay.h +++ b/lib/includes/spdylay/spdylay.h @@ -74,10 +74,15 @@ typedef enum { } spdylay_frame_type; typedef enum { - SPDYLAY_FLAG_NONE = 0, - SPDYLAY_FLAG_FIN = 1, - SPDYLAY_FLAG_UNIDIRECTIONAL = 2 -} spdylay_flag; + SPDYLAY_CTRL_FLAG_NONE = 0, + SPDYLAY_CTRL_FLAG_FIN = 0x1, + SPDYLAY_CTRL_FLAG_UNIDIRECTIONAL = 0x2 +} spdylay_ctrl_flag; + +typedef enum { + SPDYLAY_DATA_FLAG_NONE = 0, + SPDYLAY_DATA_FLAG_FIN = 0x1 +} spdylay_data_flag; typedef enum { SPDYLAY_FLAG_SETTINGS_NONE = 0, @@ -271,10 +276,9 @@ typedef void (*spdylay_on_invalid_ctrl_recv_callback) * Callback function invoked when data chunk of DATA frame is * received. |stream_id| is the stream ID of this DATA frame belongs * to. |flags| is the flags of DATA frame which this data chunk is - * contained. flags & SPDYLAY_FLAG_FIN does not necessarily mean this - * chunk of data is the last one in the stream. You should use - * spdylay_on_data_recv_callback to know all data frame is received - * whose flags contains SPDYLAY_FLAG_FIN. + * contained. flags & SPDYLAY_DATA_FLAG_FIN does not necessarily mean + * this chunk of data is the last one in the stream. You should use + * spdylay_on_data_recv_callback to know all data frames are received. */ typedef void (*spdylay_on_data_chunk_recv_callback) (spdylay_session *session, uint8_t flags, int32_t stream_id, @@ -515,10 +519,11 @@ int spdylay_submit_response(spdylay_session *session, * Submits SYN_STREAM frame. The |flags| is bitwise OR of the * following values: * - * SPDYLAY_FLAG_FIN - * SPDYLAY_FLAG_UNIDIRECTIONAL + * SPDYLAY_CTRL_FLAG_FIN + * SPDYLAY_CTRL_FLAG_UNIDIRECTIONAL * - * If |flags| includes SPDYLAY_FLAG_FIN, this frame has FIN flag set. + * If |flags| includes SPDYLAY_CTRL_FLAG_FIN, this frame has FIN flag + * set. * * The |assoc_stream_id| is used for server-push. If |session| is * initialized for client use, |assoc_stream_id| is ignored. The |pri| @@ -547,9 +552,10 @@ int spdylay_submit_syn_stream(spdylay_session *session, uint8_t flags, * Submits HEADERS frame. The |flags| is bitwise OR of the following * values: * - * SPDYLAY_FLAG_FIN + * SPDYLAY_CTRL_FLAG_FIN * - * If |flags| includes SPDYLAY_FLAG_FIN, this frame has FIN flag set. + * If |flags| includes SPDYLAY_CTRL_FLAG_FIN, this frame has FIN flag + * set. * * The stream this frame belongs to is given in |stream_id|. The |nv| * is the name/value pairs in this frame. @@ -567,7 +573,7 @@ int spdylay_submit_headers(spdylay_session *session, uint8_t flags, * Submits 1 or more DATA frames to the stream |stream_id|. The data * to be sent are provided by |data_prd|. Depending on the length of * data, 1 or more DATA frames will be sent. If |flags| contains - * SPDYLAY_FLAG_FIN, the last DATA frame has FLAG_FIN set. + * SPDYLAY_DATA_FLAG_FIN, the last DATA frame has FLAG_FIN set. * * This function returns 0 if it succeeds, or one of the following * negative error codes: diff --git a/lib/spdylay_frame.c b/lib/spdylay_frame.c index 23d7d2a1..0da8178a 100644 --- a/lib/spdylay_frame.c +++ b/lib/spdylay_frame.c @@ -408,7 +408,7 @@ void spdylay_frame_ping_init(spdylay_ping *frame, uint32_t unique_id) memset(frame, 0, sizeof(spdylay_ping)); frame->hd.version = SPDYLAY_PROTO_VERSION; frame->hd.type = SPDYLAY_PING; - frame->hd.flags = SPDYLAY_FLAG_NONE; + frame->hd.flags = SPDYLAY_CTRL_FLAG_NONE; frame->hd.length = 4; frame->unique_id = unique_id; } diff --git a/lib/spdylay_session.c b/lib/spdylay_session.c index d818d152..41988f26 100644 --- a/lib/spdylay_session.c +++ b/lib/spdylay_session.c @@ -715,7 +715,7 @@ static int spdylay_session_after_frame_sent(spdylay_session *session) session->callbacks.on_data_send_callback (session, frame->data.eof ? frame->data.flags : - (frame->data.flags & (~SPDYLAY_FLAG_FIN)), + (frame->data.flags & (~SPDYLAY_DATA_FLAG_FIN)), frame->data.stream_id, session->aob.framebuflen-SPDYLAY_HEAD_LEN, session->user_data); } @@ -732,10 +732,10 @@ static int spdylay_session_after_frame_sent(spdylay_session *session) if(stream) { spdylay_syn_stream_aux_data *aux_data; stream->state = SPDYLAY_STREAM_OPENING; - if(frame->syn_stream.hd.flags & SPDYLAY_FLAG_FIN) { + if(frame->syn_stream.hd.flags & SPDYLAY_CTRL_FLAG_FIN) { spdylay_stream_shutdown(stream, SPDYLAY_SHUT_WR); } - if(frame->syn_stream.hd.flags & SPDYLAY_FLAG_UNIDIRECTIONAL) { + if(frame->syn_stream.hd.flags & SPDYLAY_CTRL_FLAG_UNIDIRECTIONAL) { spdylay_stream_shutdown(stream, SPDYLAY_SHUT_RD); } spdylay_session_close_stream_if_shut_rdwr(session, stream); @@ -745,7 +745,7 @@ static int spdylay_session_after_frame_sent(spdylay_session *session) int r; /* spdylay_submit_data() makes a copy of aux_data->data_prd */ r = spdylay_submit_data(session, frame->syn_stream.stream_id, - SPDYLAY_FLAG_FIN, aux_data->data_prd); + SPDYLAY_DATA_FLAG_FIN, aux_data->data_prd); if(r != 0) { /* FATAL error */ assert(r < SPDYLAY_ERR_FATAL); @@ -761,7 +761,7 @@ static int spdylay_session_after_frame_sent(spdylay_session *session) spdylay_session_get_stream(session, frame->syn_reply.stream_id); if(stream) { stream->state = SPDYLAY_STREAM_OPENED; - if(frame->syn_reply.hd.flags & SPDYLAY_FLAG_FIN) { + if(frame->syn_reply.hd.flags & SPDYLAY_CTRL_FLAG_FIN) { spdylay_stream_shutdown(stream, SPDYLAY_SHUT_WR); } spdylay_session_close_stream_if_shut_rdwr(session, stream); @@ -771,7 +771,7 @@ static int spdylay_session_after_frame_sent(spdylay_session *session) (spdylay_data_provider*)item->aux_data; int r; r = spdylay_submit_data(session, frame->syn_reply.stream_id, - SPDYLAY_FLAG_FIN, data_prd); + SPDYLAY_DATA_FLAG_FIN, data_prd); if(r != 0) { /* FATAL error */ assert(r < SPDYLAY_ERR_FATAL); @@ -811,7 +811,7 @@ static int spdylay_session_after_frame_sent(spdylay_session *session) spdylay_stream *stream = spdylay_session_get_stream(session, frame->headers.stream_id); if(stream) { - if(frame->headers.hd.flags & SPDYLAY_FLAG_FIN) { + if(frame->headers.hd.flags & SPDYLAY_CTRL_FLAG_FIN) { spdylay_stream_shutdown(stream, SPDYLAY_SHUT_WR); } spdylay_session_close_stream_if_shut_rdwr(session, stream); @@ -819,7 +819,7 @@ static int spdylay_session_after_frame_sent(spdylay_session *session) break; } case SPDYLAY_DATA: - if(frame->data.eof && (frame->data.flags & SPDYLAY_FLAG_FIN)) { + if(frame->data.eof && (frame->data.flags & SPDYLAY_DATA_FLAG_FIN)) { spdylay_stream *stream = spdylay_session_get_stream(session, frame->data.stream_id); if(stream) { @@ -1078,7 +1078,7 @@ static int spdylay_session_validate_syn_stream(spdylay_session *session, a RST_STREAM with error code INVALID_STREAM. */ return SPDYLAY_INVALID_STREAM; } - if((frame->hd.flags & SPDYLAY_FLAG_UNIDIRECTIONAL) == 0 || + if((frame->hd.flags & SPDYLAY_CTRL_FLAG_UNIDIRECTIONAL) == 0 || frame->assoc_stream_id % 2 == 0 || spdylay_session_get_stream(session, frame->assoc_stream_id) == NULL) { /* It seems spdy/2 spec does not say which status code should be @@ -1133,7 +1133,8 @@ int spdylay_session_on_syn_stream_received(spdylay_session *session, &frame->syn_stream); if(status_code == 0) { uint8_t flags = frame->syn_stream.hd.flags; - if((flags & SPDYLAY_FLAG_FIN) && (flags & SPDYLAY_FLAG_UNIDIRECTIONAL)) { + if((flags & SPDYLAY_CTRL_FLAG_FIN) && + (flags & SPDYLAY_CTRL_FLAG_UNIDIRECTIONAL)) { /* If the stream is UNIDIRECTIONAL and FIN bit set, we can close stream upon receiving SYN_STREAM. So, the stream needs not to be opened. */ @@ -1145,24 +1146,24 @@ int spdylay_session_on_syn_stream_received(spdylay_session *session, SPDYLAY_STREAM_OPENING, NULL); if(stream) { - if(flags & SPDYLAY_FLAG_FIN) { + if(flags & SPDYLAY_CTRL_FLAG_FIN) { spdylay_stream_shutdown(stream, SPDYLAY_SHUT_RD); } - if(flags & SPDYLAY_FLAG_UNIDIRECTIONAL) { + if(flags & SPDYLAY_CTRL_FLAG_UNIDIRECTIONAL) { spdylay_stream_shutdown(stream, SPDYLAY_SHUT_WR); } /* We don't call spdylay_session_close_stream_if_shut_rdwr() - here because either SPDYLAY_FLAG_FIN or - SPDYLAY_FLAG_UNIDIRECTIONAL is not set here. */ + here because either SPDYLAY_CTRL_FLAG_FIN or + SPDYLAY_CTRL_FLAG_UNIDIRECTIONAL is not set here. */ } } session->last_recv_stream_id = frame->syn_stream.stream_id; spdylay_session_call_on_ctrl_frame_received(session, SPDYLAY_SYN_STREAM, frame); - if(flags & SPDYLAY_FLAG_FIN) { + if(flags & SPDYLAY_CTRL_FLAG_FIN) { spdylay_session_call_on_request_recv(session, frame->syn_stream.stream_id); - if(flags & SPDYLAY_FLAG_UNIDIRECTIONAL) { + if(flags & SPDYLAY_CTRL_FLAG_UNIDIRECTIONAL) { /* Note that we call on_stream_close_callback without opening stream. */ if(session->callbacks.on_stream_close_callback) { @@ -1199,7 +1200,7 @@ int spdylay_session_on_syn_reply_received(spdylay_session *session, stream->state = SPDYLAY_STREAM_OPENED; spdylay_session_call_on_ctrl_frame_received(session, SPDYLAY_SYN_REPLY, frame); - if(frame->syn_reply.hd.flags & SPDYLAY_FLAG_FIN) { + if(frame->syn_reply.hd.flags & SPDYLAY_CTRL_FLAG_FIN) { /* This is the last frame of this stream, so disallow further receptions. */ spdylay_stream_shutdown(stream, SPDYLAY_SHUT_RD); @@ -1303,7 +1304,7 @@ int spdylay_session_on_headers_received(spdylay_session *session, valid = 1; spdylay_session_call_on_ctrl_frame_received(session, SPDYLAY_HEADERS, frame); - if(frame->headers.hd.flags & SPDYLAY_FLAG_FIN) { + if(frame->headers.hd.flags & SPDYLAY_CTRL_FLAG_FIN) { spdylay_stream_shutdown(stream, SPDYLAY_SHUT_RD); spdylay_session_close_stream_if_shut_rdwr(session, stream); } @@ -1322,7 +1323,7 @@ int spdylay_session_on_headers_received(spdylay_session *session, if(stream->state != SPDYLAY_STREAM_CLOSING) { spdylay_session_call_on_ctrl_frame_received(session, SPDYLAY_HEADERS, frame); - if(frame->headers.hd.flags & SPDYLAY_FLAG_FIN) { + if(frame->headers.hd.flags & SPDYLAY_CTRL_FLAG_FIN) { spdylay_session_call_on_request_recv(session, frame->headers.stream_id); spdylay_stream_shutdown(stream, SPDYLAY_SHUT_RD); @@ -1516,12 +1517,12 @@ int spdylay_session_on_data_received(spdylay_session *session, session->callbacks.on_data_recv_callback (session, flags, stream_id, length, session->user_data); } - if(flags & SPDYLAY_FLAG_FIN) { + if(flags & SPDYLAY_DATA_FLAG_FIN) { spdylay_session_call_on_request_recv(session, stream_id); } } if(valid) { - if(flags & SPDYLAY_FLAG_FIN) { + if(flags & SPDYLAY_DATA_FLAG_FIN) { spdylay_stream_shutdown(stream, SPDYLAY_SHUT_RD); spdylay_session_close_stream_if_shut_rdwr(session, stream); } @@ -1754,8 +1755,8 @@ ssize_t spdylay_session_pack_data(spdylay_session *session, flags = 0; if(eof) { frame->eof = 1; - if(frame->flags & SPDYLAY_FLAG_FIN) { - flags |= SPDYLAY_FLAG_FIN; + if(frame->flags & SPDYLAY_DATA_FLAG_FIN) { + flags |= SPDYLAY_DATA_FLAG_FIN; } } (*buf_ptr)[4] = flags; diff --git a/lib/spdylay_session.h b/lib/spdylay_session.h index 725f1b23..8609c51a 100644 --- a/lib/spdylay_session.h +++ b/lib/spdylay_session.h @@ -224,14 +224,15 @@ int spdylay_session_add_goaway(spdylay_session *session, /* * Creates new stream in |session| with stream ID |stream_id|, - * priority |pri| and flags |flags|. SPDYLAY_FLAG_UNIDIRECTIONAL flag - * is set in |flags|, this stream is unidirectional. SPDYLAY_FLAG_FIN - * flag is set in |flags|, the sender of SYN_STREAM will not send any - * further data in this stream. Since this function is called when - * SYN_STREAM is sent or received, these flags are taken from - * SYN_STREAM. The state of stream is set to |initial_state|. - * |stream_user_data| is a pointer to the arbitrary user supplied data - * to be associated to this stream. + * priority |pri| and flags |flags|. SPDYLAY_CTRL_FLAG_UNIDIRECTIONAL + * flag is set in |flags|, this stream is + * unidirectional. SPDYLAY_CTRL_FLAG_FIN flag is set in |flags|, the + * sender of SYN_STREAM will not send any further data in this + * stream. Since this function is called when SYN_STREAM is sent or + * received, these flags are taken from SYN_STREAM. The state of + * stream is set to |initial_state|. |stream_user_data| is a pointer + * to the arbitrary user supplied data to be associated to this + * stream. * * This function returns a pointer to created new stream object, or * NULL. diff --git a/lib/spdylay_submit.c b/lib/spdylay_submit.c index b20239e7..6aeed7e7 100644 --- a/lib/spdylay_submit.c +++ b/lib/spdylay_submit.c @@ -79,11 +79,11 @@ static int spdylay_submit_syn_stream_shared spdylay_frame_nv_downcase(nv_copy); spdylay_frame_nv_sort(nv_copy); flags_copy = 0; - if(flags & SPDYLAY_FLAG_FIN) { - flags_copy |= SPDYLAY_FLAG_FIN; + if(flags & SPDYLAY_CTRL_FLAG_FIN) { + flags_copy |= SPDYLAY_CTRL_FLAG_FIN; } - if(flags & SPDYLAY_FLAG_UNIDIRECTIONAL) { - flags_copy |= SPDYLAY_FLAG_UNIDIRECTIONAL; + if(flags & SPDYLAY_CTRL_FLAG_UNIDIRECTIONAL) { + flags_copy |= SPDYLAY_CTRL_FLAG_UNIDIRECTIONAL; } spdylay_frame_syn_stream_init(&frame->syn_stream, flags_copy, 0, assoc_stream_id, pri, nv_copy); @@ -125,8 +125,8 @@ int spdylay_submit_headers(spdylay_session *session, uint8_t flags, spdylay_frame_nv_downcase(nv_copy); spdylay_frame_nv_sort(nv_copy); flags_copy = 0; - if(flags & SPDYLAY_FLAG_FIN) { - flags_copy |= SPDYLAY_FLAG_FIN; + if(flags & SPDYLAY_CTRL_FLAG_FIN) { + flags_copy |= SPDYLAY_CTRL_FLAG_FIN; } spdylay_frame_headers_init(&frame->headers, flags_copy, stream_id, nv_copy); r = spdylay_session_add_frame(session, SPDYLAY_HEADERS, frame, NULL); @@ -162,7 +162,7 @@ int spdylay_submit_request(spdylay_session *session, uint8_t pri, int flags; flags = 0; if(data_prd == NULL || data_prd->read_callback == NULL) { - flags |= SPDYLAY_FLAG_FIN; + flags |= SPDYLAY_CTRL_FLAG_FIN; } return spdylay_submit_syn_stream_shared(session, flags, 0, pri, nv, data_prd, stream_user_data); @@ -198,7 +198,7 @@ int spdylay_submit_response(spdylay_session *session, spdylay_frame_nv_downcase(nv_copy); spdylay_frame_nv_sort(nv_copy); if(data_prd_copy == NULL) { - flags |= SPDYLAY_FLAG_FIN; + flags |= SPDYLAY_CTRL_FLAG_FIN; } spdylay_frame_syn_reply_init(&frame->syn_reply, flags, stream_id, nv_copy); @@ -223,8 +223,8 @@ int spdylay_submit_data(spdylay_session *session, int32_t stream_id, if(frame == NULL) { return SPDYLAY_ERR_NOMEM; } - if(flags & SPDYLAY_FLAG_FIN) { - nflags |= SPDYLAY_FLAG_FIN; + if(flags & SPDYLAY_DATA_FLAG_FIN) { + nflags |= SPDYLAY_DATA_FLAG_FIN; } spdylay_frame_data_init(&frame->data, stream_id, nflags, data_prd); r = spdylay_session_add_frame(session, SPDYLAY_DATA, frame, NULL); diff --git a/tests/spdylay_frame_test.c b/tests/spdylay_frame_test.c index 2a999a10..21891e65 100644 --- a/tests/spdylay_frame_test.c +++ b/tests/spdylay_frame_test.c @@ -218,7 +218,7 @@ void test_spdylay_frame_pack_goaway() CU_ASSERT(1000000007 == oframe.goaway.last_good_stream_id); CU_ASSERT(SPDYLAY_PROTO_VERSION == oframe.headers.hd.version); CU_ASSERT(SPDYLAY_GOAWAY == oframe.headers.hd.type); - CU_ASSERT(SPDYLAY_FLAG_NONE == oframe.headers.hd.flags); + CU_ASSERT(SPDYLAY_CTRL_FLAG_NONE == oframe.headers.hd.flags); CU_ASSERT(framelen-SPDYLAY_FRAME_HEAD_LENGTH == oframe.ping.hd.length); free(buf); spdylay_frame_goaway_free(&oframe.goaway); @@ -236,7 +236,7 @@ void test_spdylay_frame_pack_headers() spdylay_buffer_init(&inflatebuf, 4096); spdylay_zlib_deflate_hd_init(&deflater); spdylay_zlib_inflate_hd_init(&inflater); - spdylay_frame_headers_init(&frame.headers, SPDYLAY_FLAG_FIN, 3, + spdylay_frame_headers_init(&frame.headers, SPDYLAY_CTRL_FLAG_FIN, 3, spdylay_frame_nv_copy(headers)); framelen = spdylay_frame_pack_headers(&buf, &buflen, &nvbuf, &nvbuflen, @@ -252,7 +252,7 @@ void test_spdylay_frame_pack_headers() CU_ASSERT(3 == oframe.headers.stream_id); CU_ASSERT(SPDYLAY_PROTO_VERSION == oframe.headers.hd.version); CU_ASSERT(SPDYLAY_HEADERS == oframe.headers.hd.type); - CU_ASSERT(SPDYLAY_FLAG_FIN == oframe.headers.hd.flags); + CU_ASSERT(SPDYLAY_CTRL_FLAG_FIN == oframe.headers.hd.flags); CU_ASSERT(framelen-SPDYLAY_FRAME_HEAD_LENGTH == oframe.ping.hd.length); CU_ASSERT(strcmp("method", oframe.headers.nv[0]) == 0); CU_ASSERT(strcmp("GET", oframe.headers.nv[1]) == 0); diff --git a/tests/spdylay_session_test.c b/tests/spdylay_session_test.c index b0762b49..6a140c1f 100644 --- a/tests/spdylay_session_test.c +++ b/tests/spdylay_session_test.c @@ -199,8 +199,8 @@ void test_spdylay_session_recv() callbacks.on_ctrl_recv_callback = on_ctrl_recv_callback; user_data.df = &df; spdylay_session_server_new(&session, &callbacks, &user_data); - spdylay_frame_syn_stream_init(&frame.syn_stream, SPDYLAY_FLAG_NONE, 1, 0, 3, - dup_nv(nv)); + spdylay_frame_syn_stream_init(&frame.syn_stream, SPDYLAY_CTRL_FLAG_NONE, + 1, 0, 3, dup_nv(nv)); framelen = spdylay_frame_pack_syn_stream(&framedata, &framedatalen, &nvbuf, &nvbuflen, &frame.syn_stream, @@ -251,8 +251,8 @@ void test_spdylay_session_add_frame() CU_ASSERT(0 == spdylay_session_client_new(&session, &callbacks, &user_data)); frame = malloc(sizeof(spdylay_frame)); - spdylay_frame_syn_stream_init(&frame->syn_stream, SPDYLAY_FLAG_NONE, 0, 0, 3, - dup_nv(nv)); + spdylay_frame_syn_stream_init(&frame->syn_stream, SPDYLAY_CTRL_FLAG_NONE, + 0, 0, 3, dup_nv(nv)); CU_ASSERT(0 == spdylay_session_add_frame(session, SPDYLAY_SYN_STREAM, frame, aux_data)); @@ -294,8 +294,8 @@ void test_spdylay_session_recv_invalid_stream_id() user_data.df = &df; user_data.invalid_ctrl_recv_cb_called = 0; spdylay_session_client_new(&session, &callbacks, &user_data); - spdylay_frame_syn_stream_init(&frame.syn_stream, SPDYLAY_FLAG_NONE, 1, 0, 3, - dup_nv(nv)); + spdylay_frame_syn_stream_init(&frame.syn_stream, SPDYLAY_CTRL_FLAG_NONE, + 1, 0, 3, dup_nv(nv)); framelen = spdylay_frame_pack_syn_stream(&framedata, &framedatalen, &nvbuf, &nvbuflen, &frame.syn_stream, @@ -306,8 +306,8 @@ void test_spdylay_session_recv_invalid_stream_id() CU_ASSERT(0 == spdylay_session_recv(session)); CU_ASSERT(1 == user_data.invalid_ctrl_recv_cb_called); - spdylay_frame_syn_reply_init(&frame.syn_reply, SPDYLAY_FLAG_NONE, 100, - dup_nv(nv)); + spdylay_frame_syn_reply_init(&frame.syn_reply, SPDYLAY_CTRL_FLAG_NONE, + 100, dup_nv(nv)); framelen = spdylay_frame_pack_syn_reply(&framedata, &framedatalen, &nvbuf, &nvbuflen, &frame.syn_reply, @@ -341,7 +341,7 @@ void test_spdylay_session_on_syn_stream_received() user_data.invalid_ctrl_recv_cb_called = 0; spdylay_session_server_new(&session, &callbacks, &user_data); - spdylay_frame_syn_stream_init(&frame.syn_stream, SPDYLAY_FLAG_NONE, + spdylay_frame_syn_stream_init(&frame.syn_stream, SPDYLAY_CTRL_FLAG_NONE, stream_id, 0, pri, dup_nv(nv)); CU_ASSERT(0 == spdylay_session_on_syn_stream_received(session, &frame)); @@ -364,8 +364,8 @@ void test_spdylay_session_on_syn_stream_received() spdylay_frame_syn_stream_free(&frame.syn_stream); /* Upper cased name/value pairs */ - spdylay_frame_syn_stream_init(&frame.syn_stream, SPDYLAY_FLAG_NONE, 3, 0, 3, - dup_nv(upcase_nv)); + spdylay_frame_syn_stream_init(&frame.syn_stream, SPDYLAY_CTRL_FLAG_NONE, + 3, 0, 3, dup_nv(upcase_nv)); CU_ASSERT(0 == spdylay_session_on_syn_stream_received(session, &frame)); CU_ASSERT(3 == user_data.invalid_ctrl_recv_cb_called); @@ -391,10 +391,10 @@ void test_spdylay_session_on_syn_stream_received_with_push() user_data.invalid_ctrl_recv_cb_called = 0; spdylay_session_client_new(&session, &callbacks, &user_data); - spdylay_session_open_stream(session, assoc_stream_id, SPDYLAY_FLAG_NONE, + spdylay_session_open_stream(session, assoc_stream_id, SPDYLAY_CTRL_FLAG_NONE, pri, SPDYLAY_STREAM_OPENED, NULL); spdylay_frame_syn_stream_init(&frame.syn_stream, - SPDYLAY_FLAG_UNIDIRECTIONAL, + SPDYLAY_CTRL_FLAG_UNIDIRECTIONAL, stream_id, assoc_stream_id, pri, dup_nv(nv)); CU_ASSERT(0 == spdylay_session_on_syn_stream_received(session, &frame)); @@ -408,17 +408,17 @@ void test_spdylay_session_on_syn_stream_received_with_push() CU_ASSERT(0 == spdylay_session_on_syn_stream_received(session, &frame)); CU_ASSERT(1 == user_data.invalid_ctrl_recv_cb_called); - /* Push without SPDYLAY_FLAG_UNIDIRECTIONAL is invalid */ + /* Push without SPDYLAY_CTRL_FLAG_UNIDIRECTIONAL is invalid */ frame.syn_stream.stream_id = 6; frame.syn_stream.assoc_stream_id = 1; - frame.syn_stream.hd.flags = SPDYLAY_FLAG_FIN; + frame.syn_stream.hd.flags = SPDYLAY_CTRL_FLAG_FIN; CU_ASSERT(0 == spdylay_session_on_syn_stream_received(session, &frame)); CU_ASSERT(2 == user_data.invalid_ctrl_recv_cb_called); /* Push to non-existent stream is invalid */ frame.syn_stream.stream_id = 8; frame.syn_stream.assoc_stream_id = 3; - frame.syn_stream.hd.flags = SPDYLAY_FLAG_UNIDIRECTIONAL; + frame.syn_stream.hd.flags = SPDYLAY_CTRL_FLAG_UNIDIRECTIONAL; CU_ASSERT(0 == spdylay_session_on_syn_stream_received(session, &frame)); CU_ASSERT(3 == user_data.invalid_ctrl_recv_cb_called); @@ -444,9 +444,9 @@ void test_spdylay_session_on_syn_reply_received() user_data.invalid_ctrl_recv_cb_called = 0; spdylay_session_client_new(&session, &callbacks, &user_data); - spdylay_session_open_stream(session, 1, SPDYLAY_FLAG_NONE, 0, + spdylay_session_open_stream(session, 1, SPDYLAY_CTRL_FLAG_NONE, 0, SPDYLAY_STREAM_OPENING, NULL); - spdylay_frame_syn_reply_init(&frame.syn_reply, SPDYLAY_FLAG_NONE, 1, + spdylay_frame_syn_reply_init(&frame.syn_reply, SPDYLAY_CTRL_FLAG_NONE, 1, dup_nv(nv)); CU_ASSERT(0 == spdylay_session_on_syn_reply_received(session, &frame)); @@ -461,7 +461,7 @@ void test_spdylay_session_on_syn_reply_received() /* Check the situation when SYN_REPLY is received after peer sends FIN */ - stream = spdylay_session_open_stream(session, 3, SPDYLAY_FLAG_NONE, 0, + stream = spdylay_session_open_stream(session, 3, SPDYLAY_CTRL_FLAG_NONE, 0, SPDYLAY_STREAM_OPENED, NULL); spdylay_stream_shutdown(stream, SPDYLAY_SHUT_RD); frame.syn_reply.stream_id = 3; @@ -472,9 +472,9 @@ void test_spdylay_session_on_syn_reply_received() spdylay_frame_syn_reply_free(&frame.syn_reply); /* Upper cased name/value pairs */ - spdylay_session_open_stream(session, 5, SPDYLAY_FLAG_NONE, 0, + spdylay_session_open_stream(session, 5, SPDYLAY_CTRL_FLAG_NONE, 0, SPDYLAY_STREAM_OPENING, NULL); - spdylay_frame_syn_reply_init(&frame.syn_reply, SPDYLAY_FLAG_NONE, 5, + spdylay_frame_syn_reply_init(&frame.syn_reply, SPDYLAY_CTRL_FLAG_NONE, 5, dup_nv(upcase_nv)); CU_ASSERT(0 == spdylay_session_on_syn_reply_received(session, &frame)); CU_ASSERT(3 == user_data.invalid_ctrl_recv_cb_called); @@ -501,7 +501,7 @@ void test_spdylay_session_send_syn_stream() memset(aux_data, 0, sizeof(spdylay_syn_stream_aux_data)); spdylay_session_client_new(&session, &callbacks, NULL); - spdylay_frame_syn_stream_init(&frame->syn_stream, SPDYLAY_FLAG_NONE, + spdylay_frame_syn_stream_init(&frame->syn_stream, SPDYLAY_CTRL_FLAG_NONE, 0, 0, 3, dup_nv(nv)); spdylay_session_add_frame(session, SPDYLAY_SYN_STREAM, frame, aux_data); CU_ASSERT(0 == spdylay_session_send(session)); @@ -525,9 +525,9 @@ void test_spdylay_session_send_syn_reply() spdylay_stream *stream; CU_ASSERT(0 == spdylay_session_client_new(&session, &callbacks, NULL)); - spdylay_session_open_stream(session, 2, SPDYLAY_FLAG_NONE, 3, + spdylay_session_open_stream(session, 2, SPDYLAY_CTRL_FLAG_NONE, 3, SPDYLAY_STREAM_OPENING, NULL); - spdylay_frame_syn_reply_init(&frame->syn_reply, SPDYLAY_FLAG_NONE, + spdylay_frame_syn_reply_init(&frame->syn_reply, SPDYLAY_CTRL_FLAG_NONE, 2, dup_nv(nv)); spdylay_session_add_frame(session, SPDYLAY_SYN_REPLY, frame, NULL); CU_ASSERT(0 == spdylay_session_send(session)); @@ -555,7 +555,7 @@ void test_spdylay_submit_response() data_prd.read_callback = fixed_length_data_source_read_callback; ud.data_source_length = 64*1024; CU_ASSERT(0 == spdylay_session_client_new(&session, &callbacks, &ud)); - spdylay_session_open_stream(session, stream_id, SPDYLAY_FLAG_NONE, 3, + spdylay_session_open_stream(session, stream_id, SPDYLAY_CTRL_FLAG_NONE, 3, SPDYLAY_STREAM_OPENING, NULL); CU_ASSERT(0 == spdylay_submit_response(session, stream_id, nv, &data_prd)); item = spdylay_session_get_next_ob_item(session); @@ -575,12 +575,12 @@ void test_spdylay_submit_response_with_null_data_read_callback() memset(&callbacks, 0, sizeof(callbacks)); callbacks.send_callback = null_send_callback; CU_ASSERT(0 == spdylay_session_server_new(&session, &callbacks, NULL)); - spdylay_session_open_stream(session, 1, SPDYLAY_FLAG_FIN, 3, + spdylay_session_open_stream(session, 1, SPDYLAY_CTRL_FLAG_FIN, 3, SPDYLAY_STREAM_OPENING, NULL); CU_ASSERT(0 == spdylay_submit_response(session, 1, nv, &data_prd)); item = spdylay_session_get_next_ob_item(session); CU_ASSERT(0 == strcmp("version", item->frame->syn_reply.nv[0])); - CU_ASSERT(item->frame->syn_reply.hd.flags & SPDYLAY_FLAG_FIN); + CU_ASSERT(item->frame->syn_reply.hd.flags & SPDYLAY_CTRL_FLAG_FIN); spdylay_session_del(session); } @@ -628,7 +628,7 @@ void test_spdylay_submit_request_with_null_data_read_callback() CU_ASSERT(0 == spdylay_submit_request(session, 3, nv, &data_prd, NULL)); item = spdylay_session_get_next_ob_item(session); CU_ASSERT(0 == strcmp("version", item->frame->syn_stream.nv[0])); - CU_ASSERT(item->frame->syn_stream.hd.flags & SPDYLAY_FLAG_FIN); + CU_ASSERT(item->frame->syn_stream.hd.flags & SPDYLAY_CTRL_FLAG_FIN); spdylay_session_del(session); } @@ -642,11 +642,11 @@ void test_spdylay_submit_syn_stream() memset(&callbacks, 0, sizeof(spdylay_session_callbacks)); CU_ASSERT(0 == spdylay_session_client_new(&session, &callbacks, NULL)); - CU_ASSERT(0 == spdylay_submit_syn_stream(session, SPDYLAY_FLAG_FIN, 1, 3, + CU_ASSERT(0 == spdylay_submit_syn_stream(session, SPDYLAY_CTRL_FLAG_FIN, 1, 3, nv, NULL)); item = spdylay_session_get_next_ob_item(session); CU_ASSERT(0 == strcmp("version", item->frame->syn_stream.nv[0])); - CU_ASSERT(SPDYLAY_FLAG_FIN == item->frame->syn_stream.hd.flags); + CU_ASSERT(SPDYLAY_CTRL_FLAG_FIN == item->frame->syn_stream.hd.flags); /* See assoc-stream-ID is ignored */ CU_ASSERT(0 == item->frame->syn_stream.assoc_stream_id); CU_ASSERT(3 == item->frame->syn_stream.pri); @@ -654,11 +654,11 @@ void test_spdylay_submit_syn_stream() spdylay_session_del(session); CU_ASSERT(0 == spdylay_session_server_new(&session, &callbacks, NULL)); - CU_ASSERT(0 == spdylay_submit_syn_stream(session, SPDYLAY_FLAG_FIN, 1, 3, + CU_ASSERT(0 == spdylay_submit_syn_stream(session, SPDYLAY_CTRL_FLAG_FIN, 1, 3, nv, NULL)); item = spdylay_session_get_next_ob_item(session); CU_ASSERT(0 == strcmp("version", item->frame->syn_stream.nv[0])); - CU_ASSERT(SPDYLAY_FLAG_FIN == item->frame->syn_stream.hd.flags); + CU_ASSERT(SPDYLAY_CTRL_FLAG_FIN == item->frame->syn_stream.hd.flags); CU_ASSERT(1 == item->frame->syn_stream.assoc_stream_id); CU_ASSERT(3 == item->frame->syn_stream.pri); @@ -679,20 +679,20 @@ void test_spdylay_submit_headers() callbacks.on_ctrl_send_callback = on_ctrl_send_callback; CU_ASSERT(0 == spdylay_session_client_new(&session, &callbacks, &ud)); - CU_ASSERT(0 == spdylay_submit_headers(session, SPDYLAY_FLAG_FIN, 1, nv)); + CU_ASSERT(0 == spdylay_submit_headers(session, SPDYLAY_CTRL_FLAG_FIN, 1, nv)); item = spdylay_session_get_next_ob_item(session); CU_ASSERT(0 == strcmp("version", item->frame->headers.nv[0])); - CU_ASSERT(SPDYLAY_FLAG_FIN == item->frame->headers.hd.flags); + CU_ASSERT(SPDYLAY_CTRL_FLAG_FIN == item->frame->headers.hd.flags); ud.ctrl_send_cb_called = 0; ud.sent_frame_type = 0; CU_ASSERT(0 == spdylay_session_send(session)); CU_ASSERT(0 == ud.ctrl_send_cb_called); - stream = spdylay_session_open_stream(session, 1, SPDYLAY_FLAG_NONE, 3, + stream = spdylay_session_open_stream(session, 1, SPDYLAY_CTRL_FLAG_NONE, 3, SPDYLAY_STREAM_OPENING, NULL); - CU_ASSERT(0 == spdylay_submit_headers(session, SPDYLAY_FLAG_FIN, 1, nv)); + CU_ASSERT(0 == spdylay_submit_headers(session, SPDYLAY_CTRL_FLAG_FIN, 1, nv)); CU_ASSERT(0 == spdylay_session_send(session)); CU_ASSERT(1 == ud.ctrl_send_cb_called); CU_ASSERT(SPDYLAY_HEADERS == ud.sent_frame_type); @@ -738,11 +738,11 @@ void test_spdylay_session_on_headers_received() user_data.invalid_ctrl_recv_cb_called = 0; spdylay_session_client_new(&session, &callbacks, &user_data); - spdylay_session_open_stream(session, 1, SPDYLAY_FLAG_NONE, 0, + spdylay_session_open_stream(session, 1, SPDYLAY_CTRL_FLAG_NONE, 0, SPDYLAY_STREAM_OPENED, NULL); spdylay_stream_shutdown(spdylay_session_get_stream(session, 1), SPDYLAY_SHUT_WR); - spdylay_frame_headers_init(&frame.headers, SPDYLAY_FLAG_NONE, 1, + spdylay_frame_headers_init(&frame.headers, SPDYLAY_CTRL_FLAG_NONE, 1, dup_nv(nv)); CU_ASSERT(0 == spdylay_session_on_headers_received(session, &frame)); @@ -750,7 +750,7 @@ void test_spdylay_session_on_headers_received() CU_ASSERT(SPDYLAY_STREAM_OPENED == spdylay_session_get_stream(session, 1)->state); - frame.headers.hd.flags |= SPDYLAY_FLAG_FIN; + frame.headers.hd.flags |= SPDYLAY_CTRL_FLAG_FIN; CU_ASSERT(0 == spdylay_session_on_headers_received(session, &frame)); CU_ASSERT(2 == user_data.ctrl_recv_cb_called); @@ -761,19 +761,19 @@ void test_spdylay_session_on_headers_received() /* Check to see when SPDYLAY_STREAM_CLOSING, incoming HEADERS is discarded. */ - spdylay_session_open_stream(session, 3, SPDYLAY_FLAG_NONE, 0, + spdylay_session_open_stream(session, 3, SPDYLAY_CTRL_FLAG_NONE, 0, SPDYLAY_STREAM_CLOSING, NULL); frame.headers.stream_id = 3; - frame.headers.hd.flags = SPDYLAY_FLAG_NONE; + frame.headers.hd.flags = SPDYLAY_CTRL_FLAG_NONE; CU_ASSERT(0 == spdylay_session_on_headers_received(session, &frame)); CU_ASSERT(2 == user_data.ctrl_recv_cb_called); CU_ASSERT(1 == user_data.invalid_ctrl_recv_cb_called); /* Server initiated stream */ - spdylay_session_open_stream(session, 2, SPDYLAY_FLAG_NONE, 0, + spdylay_session_open_stream(session, 2, SPDYLAY_CTRL_FLAG_NONE, 0, SPDYLAY_STREAM_OPENING, NULL); - frame.headers.hd.flags = SPDYLAY_FLAG_FIN; + frame.headers.hd.flags = SPDYLAY_CTRL_FLAG_FIN; frame.headers.stream_id = 2; CU_ASSERT(0 == spdylay_session_on_headers_received(session, &frame)); @@ -789,9 +789,9 @@ void test_spdylay_session_on_headers_received() spdylay_frame_headers_free(&frame.headers); /* Upper cased name/value pairs */ - spdylay_session_open_stream(session, 5, SPDYLAY_FLAG_NONE, 0, + spdylay_session_open_stream(session, 5, SPDYLAY_CTRL_FLAG_NONE, 0, SPDYLAY_STREAM_OPENED, NULL); - spdylay_frame_headers_init(&frame.headers, SPDYLAY_FLAG_NONE, 5, + spdylay_frame_headers_init(&frame.headers, SPDYLAY_CTRL_FLAG_NONE, 5, dup_nv(upcase_nv)); CU_ASSERT(0 == spdylay_session_on_headers_received(session, &frame)); @@ -875,22 +875,26 @@ void test_spdylay_session_on_data_received() spdylay_stream *stream; spdylay_session_client_new(&session, &callbacks, &user_data); - stream = spdylay_session_open_stream(session, stream_id, SPDYLAY_FLAG_NONE, + stream = spdylay_session_open_stream(session, stream_id, + SPDYLAY_CTRL_FLAG_NONE, 3, SPDYLAY_STREAM_OPENING, NULL); - CU_ASSERT(0 == spdylay_session_on_data_received(session, SPDYLAY_FLAG_NONE, + CU_ASSERT(0 == spdylay_session_on_data_received(session, + SPDYLAY_DATA_FLAG_NONE, 4096, stream_id)); CU_ASSERT(0 == stream->shut_flags); - CU_ASSERT(0 == spdylay_session_on_data_received(session, SPDYLAY_FLAG_FIN, + CU_ASSERT(0 == spdylay_session_on_data_received(session, + SPDYLAY_DATA_FLAG_FIN, 4096, stream_id)); CU_ASSERT(SPDYLAY_SHUT_RD == stream->shut_flags); /* If SPDYLAY_STREAM_CLOSING state, DATA frame is discarded. */ stream_id = 4; - spdylay_session_open_stream(session, stream_id, SPDYLAY_FLAG_NONE, + spdylay_session_open_stream(session, stream_id, SPDYLAY_CTRL_FLAG_NONE, 3, SPDYLAY_STREAM_CLOSING, NULL); - CU_ASSERT(0 == spdylay_session_on_data_received(session, SPDYLAY_FLAG_NONE, + CU_ASSERT(0 == spdylay_session_on_data_received(session, + SPDYLAY_DATA_FLAG_NONE, 4096, stream_id)); CU_ASSERT(NULL == spdylay_session_get_ob_pq_top(session)); @@ -898,7 +902,8 @@ void test_spdylay_session_on_data_received() not exist. */ stream_id = 6; - CU_ASSERT(0 == spdylay_session_on_data_received(session, SPDYLAY_FLAG_NONE, + CU_ASSERT(0 == spdylay_session_on_data_received(session, + SPDYLAY_DATA_FLAG_NONE, 4096, stream_id)); top = spdylay_session_get_ob_pq_top(session); CU_ASSERT(SPDYLAY_RST_STREAM == top->frame_type); @@ -938,13 +943,13 @@ void test_spdylay_session_on_rst_received() spdylay_frame frame; memset(&callbacks, 0, sizeof(spdylay_session_callbacks)); spdylay_session_server_new(&session, &callbacks, &user_data); - stream = spdylay_session_open_stream(session, 1, SPDYLAY_FLAG_NONE, + stream = spdylay_session_open_stream(session, 1, SPDYLAY_CTRL_FLAG_NONE, 3, SPDYLAY_STREAM_OPENING, NULL); /* server push */ - spdylay_session_open_stream(session, 2, SPDYLAY_FLAG_NONE, + spdylay_session_open_stream(session, 2, SPDYLAY_CTRL_FLAG_NONE, 3, SPDYLAY_STREAM_OPENING, NULL); spdylay_stream_add_pushed_stream(stream, 2); - spdylay_session_open_stream(session, 4, SPDYLAY_FLAG_NONE, + spdylay_session_open_stream(session, 4, SPDYLAY_CTRL_FLAG_NONE, 3, SPDYLAY_STREAM_OPENING, NULL); spdylay_stream_add_pushed_stream(stream, 4); @@ -970,13 +975,13 @@ void test_spdylay_session_send_rst_stream() memset(&callbacks, 0, sizeof(spdylay_session_callbacks)); callbacks.send_callback = null_send_callback; spdylay_session_client_new(&session, &callbacks, &user_data); - stream = spdylay_session_open_stream(session, 1, SPDYLAY_FLAG_NONE, + stream = spdylay_session_open_stream(session, 1, SPDYLAY_CTRL_FLAG_NONE, 3, SPDYLAY_STREAM_OPENING, NULL); /* server push */ - spdylay_session_open_stream(session, 2, SPDYLAY_FLAG_NONE, + spdylay_session_open_stream(session, 2, SPDYLAY_CTRL_FLAG_NONE, 3, SPDYLAY_STREAM_OPENING, NULL); spdylay_stream_add_pushed_stream(stream, 2); - spdylay_session_open_stream(session, 4, SPDYLAY_FLAG_NONE, + spdylay_session_open_stream(session, 4, SPDYLAY_CTRL_FLAG_NONE, 3, SPDYLAY_STREAM_OPENING, NULL); spdylay_stream_add_pushed_stream(stream, 4); @@ -1015,7 +1020,7 @@ void test_spdylay_session_get_next_ob_item() CU_ASSERT(0 == spdylay_session_send(session)); CU_ASSERT(NULL == spdylay_session_get_next_ob_item(session)); - spdylay_session_open_stream(session, 1, SPDYLAY_FLAG_NONE, + spdylay_session_open_stream(session, 1, SPDYLAY_CTRL_FLAG_NONE, 3, SPDYLAY_STREAM_OPENING, NULL); spdylay_submit_request(session, 0, nv, NULL, NULL); @@ -1061,7 +1066,7 @@ void test_spdylay_session_pop_next_ob_item() CU_ASSERT(NULL == spdylay_session_pop_next_ob_item(session)); - spdylay_session_open_stream(session, 1, SPDYLAY_FLAG_NONE, + spdylay_session_open_stream(session, 1, SPDYLAY_CTRL_FLAG_NONE, 3, SPDYLAY_STREAM_OPENING, NULL); spdylay_submit_request(session, 0, nv, NULL, NULL); @@ -1097,13 +1102,13 @@ void test_spdylay_session_on_request_recv_callback() user_data.stream_id = 0; spdylay_session_server_new(&session, &callbacks, &user_data); - spdylay_frame_syn_stream_init(&frame.syn_stream, SPDYLAY_FLAG_NONE, 1, 0, 3, - dup_nv(nv)); + spdylay_frame_syn_stream_init(&frame.syn_stream, SPDYLAY_CTRL_FLAG_NONE, + 1, 0, 3, dup_nv(nv)); CU_ASSERT(0 == spdylay_session_on_syn_stream_received(session, &frame)); CU_ASSERT(0 == user_data.stream_id); frame.syn_stream.stream_id = 3; - frame.syn_stream.hd.flags |= SPDYLAY_FLAG_FIN; + frame.syn_stream.hd.flags |= SPDYLAY_CTRL_FLAG_FIN; CU_ASSERT(0 == spdylay_session_on_syn_stream_received(session, &frame)); CU_ASSERT(3 == user_data.stream_id); @@ -1119,14 +1124,15 @@ void test_spdylay_session_on_request_recv_callback() user_data.stream_id = 0; - spdylay_session_open_stream(session, 5, SPDYLAY_FLAG_NONE, 0, + spdylay_session_open_stream(session, 5, SPDYLAY_CTRL_FLAG_NONE, 0, SPDYLAY_STREAM_OPENING, NULL); - spdylay_frame_headers_init(&frame.headers, SPDYLAY_FLAG_NONE, 5, dup_nv(nv)); + spdylay_frame_headers_init(&frame.headers, SPDYLAY_CTRL_FLAG_NONE, + 5, dup_nv(nv)); CU_ASSERT(0 == spdylay_session_on_headers_received(session, &frame)); CU_ASSERT(0 == user_data.stream_id); - frame.headers.hd.flags |= SPDYLAY_FLAG_FIN; + frame.headers.hd.flags |= SPDYLAY_CTRL_FLAG_FIN; CU_ASSERT(0 == spdylay_session_on_headers_received(session, &frame)); CU_ASSERT(5 == user_data.stream_id); @@ -1164,7 +1170,8 @@ void test_spdylay_session_on_stream_close() user_data.stream_close_cb_called = 0; CU_ASSERT(spdylay_session_client_new(&session, &callbacks, &user_data) == 0); - stream = spdylay_session_open_stream(session, stream_id, SPDYLAY_FLAG_NONE, + stream = spdylay_session_open_stream(session, stream_id, + SPDYLAY_CTRL_FLAG_NONE, pri, SPDYLAY_STREAM_OPENED, &user_data); CU_ASSERT(stream != NULL); CU_ASSERT(spdylay_session_close_stream(session, stream_id, SPDYLAY_OK) == 0); @@ -1182,9 +1189,9 @@ void test_spdylay_session_max_concurrent_streams() memset(&callbacks, 0, sizeof(spdylay_session_callbacks)); spdylay_session_server_new(&session, &callbacks, NULL); - spdylay_session_open_stream(session, 1, SPDYLAY_FLAG_NONE, 3, + spdylay_session_open_stream(session, 1, SPDYLAY_CTRL_FLAG_NONE, 3, SPDYLAY_STREAM_OPENED, NULL); - spdylay_frame_syn_stream_init(&frame.syn_stream, SPDYLAY_FLAG_NONE, + spdylay_frame_syn_stream_init(&frame.syn_stream, SPDYLAY_CTRL_FLAG_NONE, 3, 0, 3, dup_nv(nv)); session->settings[SPDYLAY_SETTINGS_MAX_CONCURRENT_STREAMS] = 1; @@ -1278,7 +1285,7 @@ void test_spdylay_session_stop_data_with_rst_stream() ud.data_source_length = 16*1024; spdylay_session_server_new(&session, &callbacks, &ud); - spdylay_session_open_stream(session, 1, SPDYLAY_FLAG_NONE, 3, + spdylay_session_open_stream(session, 1, SPDYLAY_CTRL_FLAG_NONE, 3, SPDYLAY_STREAM_OPENING, NULL); spdylay_submit_response(session, 1, nv, &data_prd); @@ -1308,7 +1315,7 @@ void test_spdylay_session_stop_data_with_rst_stream() /* * Check that on_stream_close_callback is called when server pushed - * SYN_STREAM have SPDYLAY_FLAG_FIN. + * SYN_STREAM have SPDYLAY_CTRL_FLAG_FIN. */ void test_spdylay_session_stream_close_on_syn_stream() { @@ -1324,10 +1331,11 @@ void test_spdylay_session_stream_close_on_syn_stream() ud.stream_close_cb_called = 0; spdylay_session_client_new(&session, &callbacks, &ud); - spdylay_session_open_stream(session, 1, SPDYLAY_FLAG_NONE, 3, + spdylay_session_open_stream(session, 1, SPDYLAY_CTRL_FLAG_NONE, 3, SPDYLAY_STREAM_OPENING, NULL); spdylay_frame_syn_stream_init(&frame.syn_stream, - SPDYLAY_FLAG_FIN | SPDYLAY_FLAG_UNIDIRECTIONAL, + SPDYLAY_CTRL_FLAG_FIN | + SPDYLAY_CTRL_FLAG_UNIDIRECTIONAL, 2, 1, 3, dup_nv(nv)); CU_ASSERT(0 == spdylay_session_on_syn_stream_received(session, &frame)); @@ -1358,8 +1366,8 @@ void test_spdylay_session_recv_invalid_frame() user_data.df = &df; user_data.ctrl_send_cb_called = 0; spdylay_session_server_new(&session, &callbacks, &user_data); - spdylay_frame_syn_stream_init(&frame.syn_stream, SPDYLAY_FLAG_NONE, 1, 0, 3, - dup_nv(nv)); + spdylay_frame_syn_stream_init(&frame.syn_stream, + SPDYLAY_CTRL_FLAG_NONE, 1, 0, 3, dup_nv(nv)); framelen = spdylay_frame_pack_syn_stream(&framedata, &framedatalen, &nvbuf, &nvbuflen, &frame.syn_stream, @@ -1411,7 +1419,7 @@ void test_spdylay_session_defer_data() ud.data_source_length = 16*1024; spdylay_session_server_new(&session, &callbacks, &ud); - spdylay_session_open_stream(session, 1, SPDYLAY_FLAG_NONE, 3, + spdylay_session_open_stream(session, 1, SPDYLAY_CTRL_FLAG_NONE, 3, SPDYLAY_STREAM_OPENING, NULL); spdylay_submit_response(session, 1, nv, &data_prd); diff --git a/tests/spdylay_stream_test.c b/tests/spdylay_stream_test.c index 821ecc00..b02937cf 100644 --- a/tests/spdylay_stream_test.c +++ b/tests/spdylay_stream_test.c @@ -32,8 +32,8 @@ void test_spdylay_stream_add_pushed_stream() { spdylay_stream stream; int i, n; - spdylay_stream_init(&stream, 1, SPDYLAY_FLAG_NONE, 3, SPDYLAY_STREAM_OPENING, - NULL); + spdylay_stream_init(&stream, 1, SPDYLAY_CTRL_FLAG_NONE, 3, + SPDYLAY_STREAM_OPENING, NULL); n = 26; for(i = 2; i < n; i += 2) { CU_ASSERT(0 == spdylay_stream_add_pushed_stream(&stream, i));