Added function to pack and unpack WINDOW_UPDATE frame.

This commit is contained in:
Tatsuhiro Tsujikawa
2012-02-25 01:47:37 +09:00
parent 895562a15b
commit 4e62c75b02
6 changed files with 131 additions and 3 deletions

View File

@@ -145,6 +145,8 @@ int main(int argc, char* argv[])
test_spdylay_frame_pack_syn_reply) ||
!CU_add_test(pSuite, "frame_pack_headers",
test_spdylay_frame_pack_headers) ||
!CU_add_test(pSuite, "frame_pack_window_update",
test_spdylay_frame_pack_window_update) ||
!CU_add_test(pSuite, "frame_pack_settings",
test_spdylay_frame_pack_settings) ||
!CU_add_test(pSuite, "frame_nv_sort", test_spdylay_frame_nv_sort) ||

View File

@@ -384,6 +384,33 @@ void test_spdylay_frame_pack_headers()
test_spdylay_frame_pack_headers_with(SPDYLAY_PROTO_SPDY3);
}
void test_spdylay_frame_pack_window_update()
{
spdylay_frame frame, oframe;
uint8_t *buf = NULL;
size_t buflen = 0;
ssize_t framelen;
spdylay_frame_window_update_init(&frame.window_update, SPDYLAY_PROTO_SPDY3,
1000000007, 4096);
framelen = spdylay_frame_pack_window_update(&buf, &buflen,
&frame.window_update);
CU_ASSERT(0 == spdylay_frame_unpack_window_update
(&oframe.window_update,
&buf[0], SPDYLAY_FRAME_HEAD_LENGTH,
&buf[SPDYLAY_FRAME_HEAD_LENGTH],
framelen-SPDYLAY_FRAME_HEAD_LENGTH));
CU_ASSERT(1000000007 == oframe.window_update.stream_id);
CU_ASSERT(4096 == oframe.window_update.delta_window_size);
CU_ASSERT(SPDYLAY_PROTO_SPDY3 == oframe.headers.hd.version);
CU_ASSERT(SPDYLAY_WINDOW_UPDATE == oframe.headers.hd.type);
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_window_update_free(&oframe.window_update);
spdylay_frame_window_update_free(&frame.window_update);
}
void test_spdylay_frame_pack_settings()
{
spdylay_frame frame, oframe;

View File

@@ -34,6 +34,7 @@ void test_spdylay_frame_pack_goaway();
void test_spdylay_frame_pack_syn_stream();
void test_spdylay_frame_pack_syn_reply();
void test_spdylay_frame_pack_headers();
void test_spdylay_frame_pack_window_update();
void test_spdylay_frame_pack_settings();
void test_spdylay_frame_nv_sort();
void test_spdylay_frame_nv_downcase();