Add spdylay_npn_get_proto_list() public API function.

spdylay_npn_get_proto_list() returns a pointer to the supported SPDY
version list. The element of the list is spdylay_npn_proto struct. It
contains all SPDY version information this library supports. The
application can use this information to configure NPN protocol
offerings/selection.
This commit is contained in:
Tatsuhiro Tsujikawa
2012-08-27 23:16:44 +09:00
parent cc15f4bd89
commit 4e5e741907
5 changed files with 62 additions and 9 deletions

View File

@@ -74,6 +74,8 @@ int main(int argc, char* argv[])
!CU_add_test(pSuite, "zlib_spdy2", test_spdylay_zlib_spdy2) ||
!CU_add_test(pSuite, "zlib_spdy3", test_spdylay_zlib_spdy3) ||
!CU_add_test(pSuite, "npn", test_spdylay_npn) ||
!CU_add_test(pSuite, "npn_get_proto_list",
test_spdylay_npn_get_proto_list) ||
!CU_add_test(pSuite, "session_recv", test_spdylay_session_recv) ||
!CU_add_test(pSuite, "session_recv_invalid_stream_id",
test_spdylay_session_recv_invalid_stream_id) ||

View File

@@ -79,3 +79,17 @@ void test_spdylay_npn(void)
http11();
no_overlap();
}
void test_spdylay_npn_get_proto_list(void)
{
size_t len;
const spdylay_npn_proto *list = spdylay_npn_get_proto_list(&len);
CU_ASSERT_EQUAL(2, len);
CU_ASSERT_STRING_EQUAL("spdy/3", list[0].proto);
CU_ASSERT_EQUAL(6, list[0].len);
CU_ASSERT_EQUAL(SPDYLAY_PROTO_SPDY3, list[0].version);
CU_ASSERT_STRING_EQUAL("spdy/2", list[1].proto);
CU_ASSERT_EQUAL(6, list[1].len);
CU_ASSERT_EQUAL(SPDYLAY_PROTO_SPDY2, list[1].version);
}

View File

@@ -26,5 +26,6 @@
#define SPDYLAY_NPN_TEST_H
void test_spdylay_npn(void);
void test_spdylay_npn_get_proto_list(void);
#endif /* SPDYLAY_NPN_TEST_H */