Drop support for Q041
This commit is contained in:
parent
052a1c28ad
commit
97028223ac
|
@ -1,9 +1,7 @@
|
|||
2018-05-09
|
||||
|
||||
- [FEATURE] Add support for Q043.
|
||||
- Support for versions Q037, Q038, and Q042 has been removed.
|
||||
- Q041 is marked deprecated. It is still fully usable, but not
|
||||
enabled by default.
|
||||
- Support for versions Q037, Q038, Q041, and Q042 has been removed.
|
||||
- Fix typo in debug message.
|
||||
- Fix code indentation.
|
||||
- Add /* fallthru */ comment to stop newer gcc from complaining.
|
||||
|
|
|
@ -13,10 +13,10 @@ our own products: LiteSpeed Web Server and ADC. We think it is free of
|
|||
major problems. Nevertheless, do not hesitate to report bugs back to us.
|
||||
Even better, send us fixes and improvements!
|
||||
|
||||
Currently supported QUIC versions are Q035, Q039, Q041, and Q043.
|
||||
Support for newer versions will be added soon after they are released.
|
||||
The version(s) specified by IETF QUIC WG will be added once the IETF
|
||||
version of the protocol settles down a little.
|
||||
Currently supported QUIC versions are Q035, Q039, and Q043. Support for
|
||||
newer versions will be added soon after they are released. The version(s)
|
||||
specified by IETF QUIC WG will be added once the IETF version of the
|
||||
protocol settles down a little.
|
||||
|
||||
Documentation
|
||||
-------------
|
||||
|
|
|
@ -75,10 +75,12 @@ enum lsquic_version
|
|||
*/
|
||||
LSQVER_039,
|
||||
|
||||
/**
|
||||
/*
|
||||
* Q041. RST_STREAM, ACK and STREAM frames match IETF format.
|
||||
*/
|
||||
LSQVER_041,
|
||||
/* Support for this version has been removed. The comment remains to
|
||||
* document the changes.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Q042. Receiving overlapping stream data is allowed.
|
||||
|
@ -98,14 +100,14 @@ enum lsquic_version
|
|||
};
|
||||
|
||||
/**
|
||||
* We currently support versions 35, 37, 38, 39, 41, 42, and 43.
|
||||
* We currently support versions 35, 39, and 43.
|
||||
* @see lsquic_version
|
||||
*/
|
||||
#define LSQUIC_SUPPORTED_VERSIONS ((1 << N_LSQVER) - 1)
|
||||
|
||||
#define LSQUIC_EXPERIMENTAL_VERSIONS 0
|
||||
|
||||
#define LSQUIC_DEPRECATED_VERSIONS (1 << LSQVER_041)
|
||||
#define LSQUIC_DEPRECATED_VERSIONS 0
|
||||
|
||||
/**
|
||||
* @struct lsquic_stream_if
|
||||
|
|
|
@ -8,7 +8,6 @@ SET(lsquic_STAT_SRCS
|
|||
lsquic_parse_gquic_common.c
|
||||
lsquic_parse_gquic_le.c
|
||||
lsquic_parse_gquic_be.c
|
||||
lsquic_parse_gquic_Q041.c
|
||||
lsquic_packet_in.c
|
||||
lsquic_packet_out.c
|
||||
lsquic_crypto.c
|
||||
|
|
|
@ -165,9 +165,7 @@ extern const struct parse_funcs lsquic_parse_funcs_gquic_Q041;
|
|||
|
||||
#define select_pf_by_ver(ver) ( \
|
||||
((1 << (ver)) & (1 << LSQVER_035)) \
|
||||
? &lsquic_parse_funcs_gquic_le : \
|
||||
((1 << (ver)) & (1 << LSQVER_041)) \
|
||||
? &lsquic_parse_funcs_gquic_Q041 \
|
||||
? &lsquic_parse_funcs_gquic_le \
|
||||
: &lsquic_parse_funcs_gquic_Q039)
|
||||
|
||||
/* This function is QUIC-version independent */
|
||||
|
|
|
@ -394,267 +394,6 @@ static const enum QUIC_FRAME_TYPE byte2frame_type_Q035_thru_Q039[0x100] =
|
|||
};
|
||||
|
||||
|
||||
static const enum QUIC_FRAME_TYPE byte2frame_type_Q041[0x100] =
|
||||
{
|
||||
[0x00] = QUIC_FRAME_PADDING,
|
||||
[0x01] = QUIC_FRAME_RST_STREAM,
|
||||
[0x02] = QUIC_FRAME_CONNECTION_CLOSE,
|
||||
[0x03] = QUIC_FRAME_GOAWAY,
|
||||
[0x04] = QUIC_FRAME_WINDOW_UPDATE,
|
||||
[0x05] = QUIC_FRAME_BLOCKED,
|
||||
[0x06] = QUIC_FRAME_STOP_WAITING,
|
||||
[0x07] = QUIC_FRAME_PING,
|
||||
[0x08] = QUIC_FRAME_INVALID,
|
||||
[0x09] = QUIC_FRAME_INVALID,
|
||||
[0x0A] = QUIC_FRAME_INVALID,
|
||||
[0x0B] = QUIC_FRAME_INVALID,
|
||||
[0x0C] = QUIC_FRAME_INVALID,
|
||||
[0x0D] = QUIC_FRAME_INVALID,
|
||||
[0x0E] = QUIC_FRAME_INVALID,
|
||||
[0x0F] = QUIC_FRAME_INVALID,
|
||||
[0x10] = QUIC_FRAME_INVALID,
|
||||
[0x11] = QUIC_FRAME_INVALID,
|
||||
[0x12] = QUIC_FRAME_INVALID,
|
||||
[0x13] = QUIC_FRAME_INVALID,
|
||||
[0x14] = QUIC_FRAME_INVALID,
|
||||
[0x15] = QUIC_FRAME_INVALID,
|
||||
[0x16] = QUIC_FRAME_INVALID,
|
||||
[0x17] = QUIC_FRAME_INVALID,
|
||||
[0x18] = QUIC_FRAME_INVALID,
|
||||
[0x19] = QUIC_FRAME_INVALID,
|
||||
[0x1A] = QUIC_FRAME_INVALID,
|
||||
[0x1B] = QUIC_FRAME_INVALID,
|
||||
[0x1C] = QUIC_FRAME_INVALID,
|
||||
[0x1D] = QUIC_FRAME_INVALID,
|
||||
[0x1E] = QUIC_FRAME_INVALID,
|
||||
[0x1F] = QUIC_FRAME_INVALID,
|
||||
[0x20] = QUIC_FRAME_INVALID,
|
||||
[0x21] = QUIC_FRAME_INVALID,
|
||||
[0x22] = QUIC_FRAME_INVALID,
|
||||
[0x23] = QUIC_FRAME_INVALID,
|
||||
[0x24] = QUIC_FRAME_INVALID,
|
||||
[0x25] = QUIC_FRAME_INVALID,
|
||||
[0x26] = QUIC_FRAME_INVALID,
|
||||
[0x27] = QUIC_FRAME_INVALID,
|
||||
[0x28] = QUIC_FRAME_INVALID,
|
||||
[0x29] = QUIC_FRAME_INVALID,
|
||||
[0x2A] = QUIC_FRAME_INVALID,
|
||||
[0x2B] = QUIC_FRAME_INVALID,
|
||||
[0x2C] = QUIC_FRAME_INVALID,
|
||||
[0x2D] = QUIC_FRAME_INVALID,
|
||||
[0x2E] = QUIC_FRAME_INVALID,
|
||||
[0x2F] = QUIC_FRAME_INVALID,
|
||||
[0x30] = QUIC_FRAME_INVALID,
|
||||
[0x31] = QUIC_FRAME_INVALID,
|
||||
[0x32] = QUIC_FRAME_INVALID,
|
||||
[0x33] = QUIC_FRAME_INVALID,
|
||||
[0x34] = QUIC_FRAME_INVALID,
|
||||
[0x35] = QUIC_FRAME_INVALID,
|
||||
[0x36] = QUIC_FRAME_INVALID,
|
||||
[0x37] = QUIC_FRAME_INVALID,
|
||||
[0x38] = QUIC_FRAME_INVALID,
|
||||
[0x39] = QUIC_FRAME_INVALID,
|
||||
[0x3A] = QUIC_FRAME_INVALID,
|
||||
[0x3B] = QUIC_FRAME_INVALID,
|
||||
[0x3C] = QUIC_FRAME_INVALID,
|
||||
[0x3D] = QUIC_FRAME_INVALID,
|
||||
[0x3E] = QUIC_FRAME_INVALID,
|
||||
[0x3F] = QUIC_FRAME_INVALID,
|
||||
[0x40] = QUIC_FRAME_INVALID,
|
||||
[0x41] = QUIC_FRAME_INVALID,
|
||||
[0x42] = QUIC_FRAME_INVALID,
|
||||
[0x43] = QUIC_FRAME_INVALID,
|
||||
[0x44] = QUIC_FRAME_INVALID,
|
||||
[0x45] = QUIC_FRAME_INVALID,
|
||||
[0x46] = QUIC_FRAME_INVALID,
|
||||
[0x47] = QUIC_FRAME_INVALID,
|
||||
[0x48] = QUIC_FRAME_INVALID,
|
||||
[0x49] = QUIC_FRAME_INVALID,
|
||||
[0x4A] = QUIC_FRAME_INVALID,
|
||||
[0x4B] = QUIC_FRAME_INVALID,
|
||||
[0x4C] = QUIC_FRAME_INVALID,
|
||||
[0x4D] = QUIC_FRAME_INVALID,
|
||||
[0x4E] = QUIC_FRAME_INVALID,
|
||||
[0x4F] = QUIC_FRAME_INVALID,
|
||||
[0x50] = QUIC_FRAME_INVALID,
|
||||
[0x51] = QUIC_FRAME_INVALID,
|
||||
[0x52] = QUIC_FRAME_INVALID,
|
||||
[0x53] = QUIC_FRAME_INVALID,
|
||||
[0x54] = QUIC_FRAME_INVALID,
|
||||
[0x55] = QUIC_FRAME_INVALID,
|
||||
[0x56] = QUIC_FRAME_INVALID,
|
||||
[0x57] = QUIC_FRAME_INVALID,
|
||||
[0x58] = QUIC_FRAME_INVALID,
|
||||
[0x59] = QUIC_FRAME_INVALID,
|
||||
[0x5A] = QUIC_FRAME_INVALID,
|
||||
[0x5B] = QUIC_FRAME_INVALID,
|
||||
[0x5C] = QUIC_FRAME_INVALID,
|
||||
[0x5D] = QUIC_FRAME_INVALID,
|
||||
[0x5E] = QUIC_FRAME_INVALID,
|
||||
[0x5F] = QUIC_FRAME_INVALID,
|
||||
[0x60] = QUIC_FRAME_INVALID,
|
||||
[0x61] = QUIC_FRAME_INVALID,
|
||||
[0x62] = QUIC_FRAME_INVALID,
|
||||
[0x63] = QUIC_FRAME_INVALID,
|
||||
[0x64] = QUIC_FRAME_INVALID,
|
||||
[0x65] = QUIC_FRAME_INVALID,
|
||||
[0x66] = QUIC_FRAME_INVALID,
|
||||
[0x67] = QUIC_FRAME_INVALID,
|
||||
[0x68] = QUIC_FRAME_INVALID,
|
||||
[0x69] = QUIC_FRAME_INVALID,
|
||||
[0x6A] = QUIC_FRAME_INVALID,
|
||||
[0x6B] = QUIC_FRAME_INVALID,
|
||||
[0x6C] = QUIC_FRAME_INVALID,
|
||||
[0x6D] = QUIC_FRAME_INVALID,
|
||||
[0x6E] = QUIC_FRAME_INVALID,
|
||||
[0x6F] = QUIC_FRAME_INVALID,
|
||||
[0x70] = QUIC_FRAME_INVALID,
|
||||
[0x71] = QUIC_FRAME_INVALID,
|
||||
[0x72] = QUIC_FRAME_INVALID,
|
||||
[0x73] = QUIC_FRAME_INVALID,
|
||||
[0x74] = QUIC_FRAME_INVALID,
|
||||
[0x75] = QUIC_FRAME_INVALID,
|
||||
[0x76] = QUIC_FRAME_INVALID,
|
||||
[0x77] = QUIC_FRAME_INVALID,
|
||||
[0x78] = QUIC_FRAME_INVALID,
|
||||
[0x79] = QUIC_FRAME_INVALID,
|
||||
[0x7A] = QUIC_FRAME_INVALID,
|
||||
[0x7B] = QUIC_FRAME_INVALID,
|
||||
[0x7C] = QUIC_FRAME_INVALID,
|
||||
[0x7D] = QUIC_FRAME_INVALID,
|
||||
[0x7E] = QUIC_FRAME_INVALID,
|
||||
[0x7F] = QUIC_FRAME_INVALID,
|
||||
[0x80] = QUIC_FRAME_INVALID,
|
||||
[0x81] = QUIC_FRAME_INVALID,
|
||||
[0x82] = QUIC_FRAME_INVALID,
|
||||
[0x83] = QUIC_FRAME_INVALID,
|
||||
[0x84] = QUIC_FRAME_INVALID,
|
||||
[0x85] = QUIC_FRAME_INVALID,
|
||||
[0x86] = QUIC_FRAME_INVALID,
|
||||
[0x87] = QUIC_FRAME_INVALID,
|
||||
[0x88] = QUIC_FRAME_INVALID,
|
||||
[0x89] = QUIC_FRAME_INVALID,
|
||||
[0x8A] = QUIC_FRAME_INVALID,
|
||||
[0x8B] = QUIC_FRAME_INVALID,
|
||||
[0x8C] = QUIC_FRAME_INVALID,
|
||||
[0x8D] = QUIC_FRAME_INVALID,
|
||||
[0x8E] = QUIC_FRAME_INVALID,
|
||||
[0x8F] = QUIC_FRAME_INVALID,
|
||||
[0x90] = QUIC_FRAME_INVALID,
|
||||
[0x91] = QUIC_FRAME_INVALID,
|
||||
[0x92] = QUIC_FRAME_INVALID,
|
||||
[0x93] = QUIC_FRAME_INVALID,
|
||||
[0x94] = QUIC_FRAME_INVALID,
|
||||
[0x95] = QUIC_FRAME_INVALID,
|
||||
[0x96] = QUIC_FRAME_INVALID,
|
||||
[0x97] = QUIC_FRAME_INVALID,
|
||||
[0x98] = QUIC_FRAME_INVALID,
|
||||
[0x99] = QUIC_FRAME_INVALID,
|
||||
[0x9A] = QUIC_FRAME_INVALID,
|
||||
[0x9B] = QUIC_FRAME_INVALID,
|
||||
[0x9C] = QUIC_FRAME_INVALID,
|
||||
[0x9D] = QUIC_FRAME_INVALID,
|
||||
[0x9E] = QUIC_FRAME_INVALID,
|
||||
[0x9F] = QUIC_FRAME_INVALID,
|
||||
[0xA0] = QUIC_FRAME_ACK,
|
||||
[0xA1] = QUIC_FRAME_ACK,
|
||||
[0xA2] = QUIC_FRAME_ACK,
|
||||
[0xA3] = QUIC_FRAME_ACK,
|
||||
[0xA4] = QUIC_FRAME_ACK,
|
||||
[0xA5] = QUIC_FRAME_ACK,
|
||||
[0xA6] = QUIC_FRAME_ACK,
|
||||
[0xA7] = QUIC_FRAME_ACK,
|
||||
[0xA8] = QUIC_FRAME_ACK,
|
||||
[0xA9] = QUIC_FRAME_ACK,
|
||||
[0xAA] = QUIC_FRAME_ACK,
|
||||
[0xAB] = QUIC_FRAME_ACK,
|
||||
[0xAC] = QUIC_FRAME_ACK,
|
||||
[0xAD] = QUIC_FRAME_ACK,
|
||||
[0xAE] = QUIC_FRAME_ACK,
|
||||
[0xAF] = QUIC_FRAME_ACK,
|
||||
[0xB0] = QUIC_FRAME_ACK,
|
||||
[0xB1] = QUIC_FRAME_ACK,
|
||||
[0xB2] = QUIC_FRAME_ACK,
|
||||
[0xB3] = QUIC_FRAME_ACK,
|
||||
[0xB4] = QUIC_FRAME_ACK,
|
||||
[0xB5] = QUIC_FRAME_ACK,
|
||||
[0xB6] = QUIC_FRAME_ACK,
|
||||
[0xB7] = QUIC_FRAME_ACK,
|
||||
[0xB8] = QUIC_FRAME_ACK,
|
||||
[0xB9] = QUIC_FRAME_ACK,
|
||||
[0xBA] = QUIC_FRAME_ACK,
|
||||
[0xBB] = QUIC_FRAME_ACK,
|
||||
[0xBC] = QUIC_FRAME_ACK,
|
||||
[0xBD] = QUIC_FRAME_ACK,
|
||||
[0xBE] = QUIC_FRAME_ACK,
|
||||
[0xBF] = QUIC_FRAME_ACK,
|
||||
[0xC0] = QUIC_FRAME_STREAM,
|
||||
[0xC1] = QUIC_FRAME_STREAM,
|
||||
[0xC2] = QUIC_FRAME_STREAM,
|
||||
[0xC3] = QUIC_FRAME_STREAM,
|
||||
[0xC4] = QUIC_FRAME_STREAM,
|
||||
[0xC5] = QUIC_FRAME_STREAM,
|
||||
[0xC6] = QUIC_FRAME_STREAM,
|
||||
[0xC7] = QUIC_FRAME_STREAM,
|
||||
[0xC8] = QUIC_FRAME_STREAM,
|
||||
[0xC9] = QUIC_FRAME_STREAM,
|
||||
[0xCA] = QUIC_FRAME_STREAM,
|
||||
[0xCB] = QUIC_FRAME_STREAM,
|
||||
[0xCC] = QUIC_FRAME_STREAM,
|
||||
[0xCD] = QUIC_FRAME_STREAM,
|
||||
[0xCE] = QUIC_FRAME_STREAM,
|
||||
[0xCF] = QUIC_FRAME_STREAM,
|
||||
[0xD0] = QUIC_FRAME_STREAM,
|
||||
[0xD1] = QUIC_FRAME_STREAM,
|
||||
[0xD2] = QUIC_FRAME_STREAM,
|
||||
[0xD3] = QUIC_FRAME_STREAM,
|
||||
[0xD4] = QUIC_FRAME_STREAM,
|
||||
[0xD5] = QUIC_FRAME_STREAM,
|
||||
[0xD6] = QUIC_FRAME_STREAM,
|
||||
[0xD7] = QUIC_FRAME_STREAM,
|
||||
[0xD8] = QUIC_FRAME_STREAM,
|
||||
[0xD9] = QUIC_FRAME_STREAM,
|
||||
[0xDA] = QUIC_FRAME_STREAM,
|
||||
[0xDB] = QUIC_FRAME_STREAM,
|
||||
[0xDC] = QUIC_FRAME_STREAM,
|
||||
[0xDD] = QUIC_FRAME_STREAM,
|
||||
[0xDE] = QUIC_FRAME_STREAM,
|
||||
[0xDF] = QUIC_FRAME_STREAM,
|
||||
[0xE0] = QUIC_FRAME_STREAM,
|
||||
[0xE1] = QUIC_FRAME_STREAM,
|
||||
[0xE2] = QUIC_FRAME_STREAM,
|
||||
[0xE3] = QUIC_FRAME_STREAM,
|
||||
[0xE4] = QUIC_FRAME_STREAM,
|
||||
[0xE5] = QUIC_FRAME_STREAM,
|
||||
[0xE6] = QUIC_FRAME_STREAM,
|
||||
[0xE7] = QUIC_FRAME_STREAM,
|
||||
[0xE8] = QUIC_FRAME_STREAM,
|
||||
[0xE9] = QUIC_FRAME_STREAM,
|
||||
[0xEA] = QUIC_FRAME_STREAM,
|
||||
[0xEB] = QUIC_FRAME_STREAM,
|
||||
[0xEC] = QUIC_FRAME_STREAM,
|
||||
[0xED] = QUIC_FRAME_STREAM,
|
||||
[0xEE] = QUIC_FRAME_STREAM,
|
||||
[0xEF] = QUIC_FRAME_STREAM,
|
||||
[0xF0] = QUIC_FRAME_STREAM,
|
||||
[0xF1] = QUIC_FRAME_STREAM,
|
||||
[0xF2] = QUIC_FRAME_STREAM,
|
||||
[0xF3] = QUIC_FRAME_STREAM,
|
||||
[0xF4] = QUIC_FRAME_STREAM,
|
||||
[0xF5] = QUIC_FRAME_STREAM,
|
||||
[0xF6] = QUIC_FRAME_STREAM,
|
||||
[0xF7] = QUIC_FRAME_STREAM,
|
||||
[0xF8] = QUIC_FRAME_STREAM,
|
||||
[0xF9] = QUIC_FRAME_STREAM,
|
||||
[0xFA] = QUIC_FRAME_STREAM,
|
||||
[0xFB] = QUIC_FRAME_STREAM,
|
||||
[0xFC] = QUIC_FRAME_STREAM,
|
||||
[0xFD] = QUIC_FRAME_STREAM,
|
||||
[0xFE] = QUIC_FRAME_STREAM,
|
||||
[0xFF] = QUIC_FRAME_STREAM,
|
||||
};
|
||||
|
||||
|
||||
enum QUIC_FRAME_TYPE
|
||||
parse_frame_type_gquic_Q035_thru_Q039 (unsigned char b)
|
||||
{
|
||||
|
@ -662,13 +401,6 @@ parse_frame_type_gquic_Q035_thru_Q039 (unsigned char b)
|
|||
}
|
||||
|
||||
|
||||
enum QUIC_FRAME_TYPE
|
||||
parse_frame_type_gquic_Q041 (unsigned char b)
|
||||
{
|
||||
return byte2frame_type_Q041[b];
|
||||
}
|
||||
|
||||
|
||||
unsigned
|
||||
parse_stream_frame_header_sz_gquic (unsigned char type)
|
||||
{
|
||||
|
|
|
@ -10,7 +10,6 @@ static const unsigned char version_tags[N_LSQVER][4] =
|
|||
{
|
||||
[LSQVER_035] = { 'Q', '0', '3', '5', },
|
||||
[LSQVER_039] = { 'Q', '0', '3', '9', },
|
||||
[LSQVER_041] = { 'Q', '0', '4', '1', },
|
||||
[LSQVER_043] = { 'Q', '0', '4', '3', },
|
||||
};
|
||||
|
||||
|
@ -58,7 +57,6 @@ lsquic_str2ver (const char *str, size_t len)
|
|||
const char *const lsquic_ver2str[N_LSQVER] = {
|
||||
[LSQVER_035] = "Q035",
|
||||
[LSQVER_039] = "Q039",
|
||||
[LSQVER_041] = "Q041",
|
||||
[LSQVER_043] = "Q043",
|
||||
};
|
||||
|
||||
|
|
|
@ -71,10 +71,6 @@ add_executable(test_rst_stream_gquic_be test_rst_stream_gquic_be.c)
|
|||
target_link_libraries(test_rst_stream_gquic_be lsquic pthread libssl.a libcrypto.a z m ${FIULIB})
|
||||
add_test(rst_stream_gquic_be test_rst_stream_gquic_be)
|
||||
|
||||
add_executable(test_rst_stream_ietf test_rst_stream_ietf.c)
|
||||
target_link_libraries(test_rst_stream_ietf lsquic pthread libssl.a libcrypto.a z m ${FIULIB})
|
||||
add_test(rst_stream_ietf test_rst_stream_ietf)
|
||||
|
||||
add_executable(test_conn_close_gquic_le test_conn_close_gquic_le.c)
|
||||
target_link_libraries(test_conn_close_gquic_le lsquic pthread libssl.a libcrypto.a z m ${FIULIB})
|
||||
add_test(conn_close_gquic_le test_conn_close_gquic_le)
|
||||
|
@ -107,10 +103,6 @@ add_executable(test_ackparse_gquic_be test_ackparse_gquic_be.c)
|
|||
target_link_libraries(test_ackparse_gquic_be lsquic pthread libssl.a libcrypto.a z m ${FIULIB})
|
||||
add_test(ackparse_gquic_be test_ackparse_gquic_be)
|
||||
|
||||
add_executable(test_ackparse_gquic_ietf test_ackparse_gquic_ietf.c)
|
||||
target_link_libraries(test_ackparse_gquic_ietf lsquic pthread libssl.a libcrypto.a z m ${FIULIB})
|
||||
add_test(ackparse_gquic_ietf test_ackparse_gquic_ietf)
|
||||
|
||||
add_executable(test_ackgen_gquic_le test_ackgen_gquic_le.c)
|
||||
target_link_libraries(test_ackgen_gquic_le lsquic pthread libssl.a libcrypto.a z m ${FIULIB})
|
||||
add_test(ackgen_gquic_le test_ackgen_gquic_le)
|
||||
|
@ -119,10 +111,6 @@ add_executable(test_ackgen_gquic_be test_ackgen_gquic_be.c)
|
|||
target_link_libraries(test_ackgen_gquic_be lsquic pthread libssl.a libcrypto.a z m ${FIULIB})
|
||||
add_test(ackgen_gquic_be test_ackgen_gquic_be)
|
||||
|
||||
add_executable(test_ackgen_gquic_ietf test_ackgen_gquic_ietf.c)
|
||||
target_link_libraries(test_ackgen_gquic_ietf lsquic pthread libssl.a libcrypto.a z m ${FIULIB})
|
||||
add_test(ackgen_gquic_ietf test_ackgen_gquic_ietf)
|
||||
|
||||
add_executable(test_sfcw test_sfcw.c)
|
||||
target_link_libraries(test_sfcw lsquic pthread libssl.a libcrypto.a z m ${FIULIB})
|
||||
add_test(sfcw test_sfcw)
|
||||
|
@ -306,10 +294,6 @@ add_executable(test_rst_stream_gquic_be test_rst_stream_gquic_be.c)
|
|||
target_link_libraries(test_rst_stream_gquic_be lsquic ${LIBS_LIST})
|
||||
add_test(rst_stream_gquic_be test_rst_stream_gquic_be)
|
||||
|
||||
add_executable(test_rst_stream_ietf test_rst_stream_ietf.c)
|
||||
target_link_libraries(test_rst_stream_ietf lsquic ${LIBS_LIST})
|
||||
add_test(rst_stream_ietf test_rst_stream_ietf)
|
||||
|
||||
add_executable(test_conn_close_gquic_le test_conn_close_gquic_le.c)
|
||||
target_link_libraries(test_conn_close_gquic_le lsquic ${LIBS_LIST})
|
||||
add_test(conn_close_gquic_le test_conn_close_gquic_le)
|
||||
|
@ -342,10 +326,6 @@ add_executable(test_ackparse_gquic_be test_ackparse_gquic_be.c)
|
|||
target_link_libraries(test_ackparse_gquic_be lsquic ${LIBS_LIST})
|
||||
add_test(ackparse_gquic_be test_ackparse_gquic_be)
|
||||
|
||||
add_executable(test_ackparse_gquic_ietf test_ackparse_gquic_ietf.c)
|
||||
target_link_libraries(test_ackparse_gquic_ietf lsquic ${LIBS_LIST})
|
||||
add_test(ackparse_gquic_ietf test_ackparse_gquic_ietf)
|
||||
|
||||
add_executable(test_ackgen_gquic_le test_ackgen_gquic_le.c)
|
||||
target_link_libraries(test_ackgen_gquic_le lsquic ${LIBS_LIST})
|
||||
add_test(ackgen_gquic_le test_ackgen_gquic_le)
|
||||
|
@ -354,10 +334,6 @@ add_executable(test_ackgen_gquic_be test_ackgen_gquic_be.c)
|
|||
target_link_libraries(test_ackgen_gquic_be lsquic ${LIBS_LIST})
|
||||
add_test(ackgen_gquic_be test_ackgen_gquic_be)
|
||||
|
||||
add_executable(test_ackgen_gquic_ietf test_ackgen_gquic_ietf.c)
|
||||
target_link_libraries(test_ackgen_gquic_ietf lsquic ${LIBS_LIST})
|
||||
add_test(ackgen_gquic_ietf test_ackgen_gquic_ietf)
|
||||
|
||||
add_executable(test_sfcw test_sfcw.c)
|
||||
target_link_libraries(test_sfcw lsquic ${LIBS_LIST})
|
||||
add_test(sfcw test_sfcw)
|
||||
|
|
|
@ -1,359 +0,0 @@
|
|||
/* Copyright (c) 2017 - 2018 LiteSpeed Technologies Inc. See LICENSE. */
|
||||
/*
|
||||
* Test how ACK frame is encoded. Receive history module is tested by a
|
||||
* separate unit test.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "lsquic_types.h"
|
||||
#include "lsquic_int_types.h"
|
||||
#include "lsquic_rechist.h"
|
||||
#include "lsquic_parse.h"
|
||||
#include "lsquic_util.h"
|
||||
#include "lsquic_logger.h"
|
||||
#include "lsquic.h"
|
||||
|
||||
static const struct parse_funcs *const pf = select_pf_by_ver(LSQVER_041);
|
||||
|
||||
static void
|
||||
test1 (void) /* Inverse of quic_framer_test.cc -- NewAckFrameOneAckBlock */
|
||||
{
|
||||
lsquic_rechist_t rechist;
|
||||
lsquic_time_t now = lsquic_time_now();
|
||||
lsquic_packno_t largest = 0;
|
||||
|
||||
lsquic_rechist_init(&rechist, 0);
|
||||
|
||||
unsigned i;
|
||||
for (i = 1; i <= 0x1234; ++i)
|
||||
(void) lsquic_rechist_received(&rechist, i, now);
|
||||
|
||||
const unsigned char expected_ack_frame[] = {
|
||||
/* TYPE N LL MM */
|
||||
0xA0 | 0 << 4 | 1 << 2 | 1,
|
||||
0x00, /* Number of timestamps */
|
||||
0x12, 0x34, /* Largest acked */
|
||||
0x87, 0xFF, /* Zero delta time */
|
||||
0x12, 0x34, /* first ack block length */
|
||||
};
|
||||
unsigned char outbuf[0x100];
|
||||
|
||||
int has_missing = -1;
|
||||
int w = pf->pf_gen_ack_frame(outbuf, sizeof(outbuf),
|
||||
(gaf_rechist_first_f) lsquic_rechist_first,
|
||||
(gaf_rechist_next_f) lsquic_rechist_next,
|
||||
(gaf_rechist_largest_recv_f) lsquic_rechist_largest_recv,
|
||||
&rechist, now + 0x7FF8000, &has_missing, &largest);
|
||||
assert(("ACK frame generation successful", w > 0));
|
||||
assert(("ACK frame length is correct", w == sizeof(expected_ack_frame)));
|
||||
assert(("ACK frame contents are as expected",
|
||||
0 == memcmp(outbuf, expected_ack_frame, sizeof(expected_ack_frame))));
|
||||
assert(("ACK frame has no missing packets", has_missing == 0));
|
||||
assert(largest == 0x1234);
|
||||
|
||||
lsquic_rechist_cleanup(&rechist);
|
||||
}
|
||||
|
||||
static void
|
||||
test2 (void) /* Inverse of quic_framer_test.cc -- NewAckFrameOneAckBlock, minus
|
||||
* delta times.
|
||||
*/
|
||||
{
|
||||
lsquic_rechist_t rechist;
|
||||
lsquic_time_t now = lsquic_time_now();
|
||||
|
||||
lsquic_rechist_init(&rechist, 0);
|
||||
|
||||
/* Encode the following ranges:
|
||||
* high low
|
||||
* 0x1234 0x1234
|
||||
* 0x1232 0x384
|
||||
* 0x1F3 0xA
|
||||
* 0x4 0x1
|
||||
*/
|
||||
unsigned i;
|
||||
for (i = 4; i >= 1; --i)
|
||||
(void) lsquic_rechist_received(&rechist, i, now);
|
||||
(void) lsquic_rechist_received(&rechist, 0x1234, now);
|
||||
for (i = 0xA; i <= 0x1F3; ++i)
|
||||
(void) lsquic_rechist_received(&rechist, i, now);
|
||||
for (i = 0x1232; i >= 0x384; --i)
|
||||
(void) lsquic_rechist_received(&rechist, i, now);
|
||||
|
||||
const unsigned char expected_ack_frame[] = {
|
||||
/* TYPE N LL MM */
|
||||
0xA0 | 1 << 4 | 1 << 2 | 1,
|
||||
0x04, /* Num ack blocks ranges. */
|
||||
0x00, /* Number of timestamps. */
|
||||
0x12, 0x34, /* Largest acked */
|
||||
0x00, 0x00, /* Zero delta time. */
|
||||
0x00, 0x01, /* First ack block length. */
|
||||
0x01, /* Gap to next block. */
|
||||
0x0e, 0xaf, /* Ack block length. */
|
||||
0xff, /* Gap to next block. */
|
||||
0x00, 0x00, /* Ack block length. */
|
||||
0x91, /* Gap to next block. */
|
||||
0x01, 0xea, /* Ack block length. */
|
||||
0x05, /* Gap to next block. */
|
||||
0x00, 0x04, /* Ack block length. */
|
||||
};
|
||||
unsigned char outbuf[0x100];
|
||||
|
||||
int has_missing = -1;
|
||||
lsquic_packno_t largest = 0;
|
||||
int w = pf->pf_gen_ack_frame(outbuf, sizeof(outbuf),
|
||||
(gaf_rechist_first_f) lsquic_rechist_first,
|
||||
(gaf_rechist_next_f) lsquic_rechist_next,
|
||||
(gaf_rechist_largest_recv_f) lsquic_rechist_largest_recv,
|
||||
&rechist, now, &has_missing, &largest);
|
||||
assert(("ACK frame generation successful", w > 0));
|
||||
assert(("ACK frame length is correct", w == sizeof(expected_ack_frame)));
|
||||
assert(("ACK frame contents are as expected",
|
||||
0 == memcmp(outbuf, expected_ack_frame, sizeof(expected_ack_frame))));
|
||||
assert(("ACK frame has missing packets", has_missing > 0));
|
||||
assert(largest == 0x1234);
|
||||
|
||||
lsquic_rechist_cleanup(&rechist);
|
||||
}
|
||||
|
||||
static void
|
||||
test3 (void)
|
||||
{
|
||||
lsquic_rechist_t rechist;
|
||||
lsquic_time_t now = lsquic_time_now();
|
||||
|
||||
lsquic_rechist_init(&rechist, 0);
|
||||
|
||||
/* Encode the following ranges:
|
||||
* high low
|
||||
* 3 3
|
||||
* 1 1
|
||||
*/
|
||||
(void) lsquic_rechist_received(&rechist, 1, now);
|
||||
(void) lsquic_rechist_received(&rechist, 3, now);
|
||||
|
||||
const unsigned char expected_ack_frame[] = {
|
||||
/* TYPE N LL MM */
|
||||
0xA0 | 1 << 4 | 0 << 2 | 0,
|
||||
0x01, /* Num ack blocks ranges. */
|
||||
0x00, /* Number of timestamps. */
|
||||
0x03,
|
||||
0x00, 0x00, /* Zero delta time. */
|
||||
0x01, /* First ack block length. */
|
||||
0x01, /* Gap to next block. */
|
||||
0x01, /* Ack block length. */
|
||||
};
|
||||
unsigned char outbuf[0x100];
|
||||
|
||||
int has_missing = -1;
|
||||
lsquic_packno_t largest = 0;
|
||||
int w = pf->pf_gen_ack_frame(outbuf, sizeof(outbuf),
|
||||
(gaf_rechist_first_f) lsquic_rechist_first,
|
||||
(gaf_rechist_next_f) lsquic_rechist_next,
|
||||
(gaf_rechist_largest_recv_f) lsquic_rechist_largest_recv,
|
||||
&rechist, now, &has_missing, &largest);
|
||||
assert(("ACK frame generation successful", w > 0));
|
||||
assert(("ACK frame length is correct", w == sizeof(expected_ack_frame)));
|
||||
assert(("ACK frame contents are as expected",
|
||||
0 == memcmp(outbuf, expected_ack_frame, sizeof(expected_ack_frame))));
|
||||
assert(("ACK frame has missing packets", has_missing > 0));
|
||||
assert(largest == 0x03);
|
||||
|
||||
lsquic_rechist_cleanup(&rechist);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
test4 (void)
|
||||
{
|
||||
lsquic_rechist_t rechist;
|
||||
int i;
|
||||
|
||||
lsquic_rechist_init(&rechist, 0);
|
||||
|
||||
lsquic_time_t now = lsquic_time_now();
|
||||
lsquic_rechist_received(&rechist, 1, now);
|
||||
|
||||
{
|
||||
const unsigned char expected_ack_frame[] = {
|
||||
/* TYPE N LL MM */
|
||||
0xA0 | 0 << 4 | 0 << 2 | 0,
|
||||
0x00, /* Number of timestamps */
|
||||
0x01, /* Largest acked */
|
||||
0x00, 0x00, /* Delta time */
|
||||
0x01, /* Block length */
|
||||
};
|
||||
unsigned char outbuf[0x100];
|
||||
int has_missing = -1;
|
||||
lsquic_packno_t largest = 0;
|
||||
int w = pf->pf_gen_ack_frame(outbuf, sizeof(outbuf),
|
||||
(gaf_rechist_first_f) lsquic_rechist_first,
|
||||
(gaf_rechist_next_f) lsquic_rechist_next,
|
||||
(gaf_rechist_largest_recv_f) lsquic_rechist_largest_recv,
|
||||
&rechist, now, &has_missing, &largest);
|
||||
assert(("ACK frame generation successful", w > 0));
|
||||
assert(("ACK frame length is correct", w == sizeof(expected_ack_frame)));
|
||||
assert(("ACK frame contents are as expected",
|
||||
0 == memcmp(outbuf, expected_ack_frame, sizeof(expected_ack_frame))));
|
||||
assert(("ACK frame has no missing packets", has_missing == 0));
|
||||
assert(largest == 1);
|
||||
}
|
||||
|
||||
for (i = 3; i <= 5; ++i)
|
||||
lsquic_rechist_received(&rechist, i, now);
|
||||
|
||||
{
|
||||
const unsigned char expected_ack_frame[] = {
|
||||
/* TYPE N LL MM */
|
||||
0xA0 | 1 << 4 | 0 << 2 | 0,
|
||||
0x01, /* Num ack blocks */
|
||||
0x00, /* Number of timestamps */
|
||||
0x05, /* Largest acked */
|
||||
0x00, 0x00, /* Delta time */
|
||||
0x03, /* First block length [3, 5] */
|
||||
0x01, /* Gap to next block */
|
||||
0x01, /* Second block length [1, 1] */
|
||||
};
|
||||
unsigned char outbuf[0x100];
|
||||
int has_missing = -1;
|
||||
lsquic_packno_t largest = 0;
|
||||
int w = pf->pf_gen_ack_frame(outbuf, sizeof(outbuf),
|
||||
(gaf_rechist_first_f) lsquic_rechist_first,
|
||||
(gaf_rechist_next_f) lsquic_rechist_next,
|
||||
(gaf_rechist_largest_recv_f) lsquic_rechist_largest_recv,
|
||||
&rechist, now, &has_missing, &largest);
|
||||
assert(("ACK frame generation successful", w > 0));
|
||||
assert(("ACK frame length is correct", w == sizeof(expected_ack_frame)));
|
||||
assert(("ACK frame contents are as expected",
|
||||
0 == memcmp(outbuf, expected_ack_frame, sizeof(expected_ack_frame))));
|
||||
assert(("ACK frame has missing packets", has_missing > 0));
|
||||
assert(largest == 5);
|
||||
}
|
||||
|
||||
lsquic_rechist_cleanup(&rechist);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
test_4byte_packnos (void)
|
||||
{
|
||||
lsquic_packno_t packno;
|
||||
lsquic_rechist_t rechist;
|
||||
struct packet_interval *pint;
|
||||
lsquic_time_t now = lsquic_time_now();
|
||||
|
||||
lsquic_rechist_init(&rechist, 0);
|
||||
|
||||
packno = 0x23456789;
|
||||
(void) lsquic_rechist_received(&rechist, packno - 33, now);
|
||||
pint = TAILQ_FIRST(&rechist.rh_pints.pk_intervals);
|
||||
(void) lsquic_rechist_received(&rechist, packno, now);
|
||||
|
||||
/* Adjust: */
|
||||
pint->range.low = 1;
|
||||
|
||||
const unsigned char expected_ack_frame[] = {
|
||||
/* TYPE N LL MM */
|
||||
0xA0 | 1 << 4 | 2 << 2 | 2,
|
||||
0x01, /* Num ack blocks ranges. */
|
||||
0x00, /* Number of timestamps. */
|
||||
0x23, 0x45, 0x67, 0x89,
|
||||
0x00, 0x00, /* Zero delta time. */
|
||||
0x00, 0x00, 0x00, 0x01, /* First ack block length. */
|
||||
33 - 1, /* Gap to next block. */
|
||||
0x23, 0x45, 0x67, 0x68, /* Ack block length. */
|
||||
};
|
||||
unsigned char outbuf[0x100];
|
||||
|
||||
int has_missing = -1;
|
||||
lsquic_packno_t largest = 0;
|
||||
int w = pf->pf_gen_ack_frame(outbuf, sizeof(outbuf),
|
||||
(gaf_rechist_first_f) lsquic_rechist_first,
|
||||
(gaf_rechist_next_f) lsquic_rechist_next,
|
||||
(gaf_rechist_largest_recv_f) lsquic_rechist_largest_recv,
|
||||
&rechist, now, &has_missing, &largest);
|
||||
assert(("ACK frame generation successful", w > 0));
|
||||
assert(("ACK frame length is correct", w == sizeof(expected_ack_frame)));
|
||||
assert(("ACK frame contents are as expected",
|
||||
0 == memcmp(outbuf, expected_ack_frame, sizeof(expected_ack_frame))));
|
||||
assert(("ACK frame has missing packets", has_missing > 0));
|
||||
assert(largest == 0x23456789);
|
||||
|
||||
lsquic_rechist_cleanup(&rechist);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
test_8byte_packnos (void)
|
||||
{
|
||||
lsquic_packno_t packno;
|
||||
lsquic_rechist_t rechist;
|
||||
struct packet_interval *pint;
|
||||
lsquic_time_t now = lsquic_time_now();
|
||||
|
||||
lsquic_rechist_init(&rechist, 0);
|
||||
|
||||
packno = 0xABCD23456789;
|
||||
(void) lsquic_rechist_received(&rechist, packno - 33, now);
|
||||
pint = TAILQ_FIRST(&rechist.rh_pints.pk_intervals);
|
||||
(void) lsquic_rechist_received(&rechist, packno, now);
|
||||
|
||||
/* Adjust: */
|
||||
pint->range.low = 1;
|
||||
|
||||
const unsigned char expected_ack_frame[] = {
|
||||
/* TYPE N LL MM */
|
||||
0xA0 | 1 << 4 | 3 << 2 | 3,
|
||||
0x01, /* Num ack blocks ranges. */
|
||||
0x00, /* Number of timestamps. */
|
||||
0x00, 0x00, 0xAB, 0xCD, 0x23, 0x45, 0x67, 0x89,
|
||||
0x00, 0x00, /* Zero delta time. */
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, /* First ack block length. */
|
||||
33 - 1, /* Gap to next block. */
|
||||
0x00, 0x00, 0xAB, 0xCD, 0x23, 0x45, 0x67, 0x68, /* Ack block length. */
|
||||
};
|
||||
unsigned char outbuf[0x100];
|
||||
|
||||
int has_missing = -1;
|
||||
lsquic_packno_t largest = 0;
|
||||
int w = pf->pf_gen_ack_frame(outbuf, sizeof(outbuf),
|
||||
(gaf_rechist_first_f) lsquic_rechist_first,
|
||||
(gaf_rechist_next_f) lsquic_rechist_next,
|
||||
(gaf_rechist_largest_recv_f) lsquic_rechist_largest_recv,
|
||||
&rechist, now, &has_missing, &largest);
|
||||
assert(("ACK frame generation successful", w > 0));
|
||||
assert(("ACK frame length is correct", w == sizeof(expected_ack_frame)));
|
||||
assert(("ACK frame contents are as expected",
|
||||
0 == memcmp(outbuf, expected_ack_frame, sizeof(expected_ack_frame))));
|
||||
assert(("ACK frame has missing packets", has_missing > 0));
|
||||
assert(largest == 0xABCD23456789ULL);
|
||||
|
||||
lsquic_rechist_cleanup(&rechist);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
lsquic_global_init(LSQUIC_GLOBAL_SERVER);
|
||||
lsquic_log_to_fstream(stderr, 0);
|
||||
lsq_log_levels[LSQLM_PARSE] = LSQ_LOG_DEBUG;
|
||||
|
||||
test1();
|
||||
|
||||
test2();
|
||||
|
||||
test3();
|
||||
|
||||
test4();
|
||||
|
||||
test_4byte_packnos();
|
||||
|
||||
test_8byte_packnos();
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -1,453 +0,0 @@
|
|||
/* Copyright (c) 2017 - 2018 LiteSpeed Technologies Inc. See LICENSE. */
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#ifndef WIN32
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#include "lsquic_types.h"
|
||||
#include "lsquic_parse.h"
|
||||
#include "lsquic_rechist.h"
|
||||
#include "lsquic_util.h"
|
||||
#include "lsquic.h"
|
||||
|
||||
static const struct parse_funcs *const pf = select_pf_by_ver(LSQVER_041);
|
||||
|
||||
|
||||
static lsquic_packno_t
|
||||
n_acked (const ack_info_t *acki)
|
||||
{
|
||||
lsquic_packno_t n = 0;
|
||||
unsigned i;
|
||||
for (i = 0; i < acki->n_ranges; ++i)
|
||||
n += acki->ranges[i].high - acki->ranges[i].low + 1;
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
test1 (void)
|
||||
{
|
||||
/* Test taken from quic_framer_test.cc -- NewAckFrameOneAckBlock */
|
||||
unsigned char ack_buf[] = {
|
||||
/* TYPE N LL MM */
|
||||
0xA0 | 0 << 4 | 1 << 2 | 1,
|
||||
0x00, /* Number of timestamps */
|
||||
0x12, 0x34, /* Largest acked */
|
||||
0x00, 0x00, /* Zero delta time */
|
||||
0x12, 0x34, /* first ack block length */
|
||||
};
|
||||
|
||||
ack_info_t acki;
|
||||
memset(&acki, 0xF1, sizeof(acki));
|
||||
|
||||
int len = pf->pf_parse_ack_frame(ack_buf, sizeof(ack_buf), &acki);
|
||||
assert(("Parsed length is correct (8)", len == sizeof(ack_buf)));
|
||||
assert(("Number of ranges is 1", acki.n_ranges == 1));
|
||||
assert(("Largest acked is 0x1234", acki.ranges[0].high == 0x1234));
|
||||
assert(("Lowest acked is 1", acki.ranges[0].low == 1));
|
||||
assert(("Number of timestamps is 0", acki.n_timestamps == 0));
|
||||
unsigned n = n_acked(&acki);
|
||||
assert(("Number of acked packets is 0x1234", n == 0x1234));
|
||||
|
||||
{
|
||||
size_t sz;
|
||||
for (sz = 1; sz < sizeof(ack_buf); ++sz)
|
||||
{
|
||||
len = pf->pf_parse_ack_frame(ack_buf, sz, &acki);
|
||||
assert(("Parsing truncated frame failed", len < 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
test2 (void)
|
||||
{
|
||||
/* Test taken from quic_framer_test.cc -- NewAckFrameOneAckBlock */
|
||||
unsigned char ack_buf[] = {
|
||||
/* TYPE N LL MM */
|
||||
0xA0 | 1 << 4 | 1 << 2 | 1,
|
||||
0x04, /* Num Blocks */
|
||||
0x02, /* Num TS */
|
||||
0x12, 0x34, /* Largest acked */
|
||||
0x00, 0x00, /* Zero delta time. */
|
||||
0x00, 0x01, /* First ack block length. */
|
||||
0x01, /* Gap to next block. */
|
||||
0x0e, 0xaf, /* Ack block length. */
|
||||
0xff, /* Gap to next block. */
|
||||
0x00, 0x00, /* Ack block length. */
|
||||
0x91, /* Gap to next block. */
|
||||
0x01, 0xea, /* Ack block length. */
|
||||
0x05, /* Gap to next block. */
|
||||
0x00, 0x04, /* Ack block length. */
|
||||
0x01, /* Delta from largest observed. */
|
||||
0x10, 0x32, 0x54, 0x76, /* Delta time. */ /* XXX do we use this at all? */
|
||||
0x02, /* Delta from largest observed. */
|
||||
0x10, 0x32, /* Delta time. */
|
||||
};
|
||||
|
||||
/* We should get the following array of ranges:
|
||||
* high low
|
||||
* 0x1234 0x1234
|
||||
* 0x1232 0x384
|
||||
* 0x1F3 0xA
|
||||
* 0x4 0x1
|
||||
*/
|
||||
static const struct { unsigned high, low; } ranges[] = {
|
||||
{ 0x1234, 0x1234 },
|
||||
{ 0x1232, 0x384 },
|
||||
{ 0x1F3, 0xA },
|
||||
{ 0x4, 0x1 },
|
||||
};
|
||||
|
||||
ack_info_t acki;
|
||||
memset(&acki, 0xF1, sizeof(acki));
|
||||
|
||||
int len = pf->pf_parse_ack_frame(ack_buf, sizeof(ack_buf), &acki);
|
||||
assert(("Parsed length is correct (29)", len == sizeof(ack_buf)));
|
||||
assert(("Number of ranges is 4", acki.n_ranges == 4));
|
||||
assert(("Largest acked is 0x1234", acki.ranges[0].high == 0x1234));
|
||||
assert(("Number of timestamps is 2", acki.n_timestamps == 2));
|
||||
unsigned n = n_acked(&acki);
|
||||
assert(("Number of acked packets is 4254", n == 4254));
|
||||
|
||||
for (n = 0; n < 4; ++n)
|
||||
assert(("Range checks out", ranges[n].high == acki.ranges[n].high
|
||||
&& ranges[n].low == acki.ranges[n].low));
|
||||
|
||||
{
|
||||
size_t sz;
|
||||
for (sz = 1; sz < sizeof(ack_buf); ++sz)
|
||||
{
|
||||
len = pf->pf_parse_ack_frame(ack_buf, sz, &acki);
|
||||
assert(("Parsing truncated frame failed", len < 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
test3 (void)
|
||||
{
|
||||
/* Generated by our own code, but failed to parse... */
|
||||
unsigned char ack_buf[] = {
|
||||
/* TYPE N LL MM */
|
||||
0xA0 | 1 << 4 | 0 << 2 | 0,
|
||||
0x01, /* Num ACK block ranges */
|
||||
0x00, /* Number of timestamps */
|
||||
0x06, /* Largest ACKed */
|
||||
0x00, 0x00, /* Delta time */
|
||||
0x01, /* First ACK block length */
|
||||
0x02, /* Gap to next block */
|
||||
0x03, /* Ack block length */
|
||||
};
|
||||
|
||||
/* We should get the following array of ranges:
|
||||
* high low
|
||||
* 6 6
|
||||
* 3 1
|
||||
*/
|
||||
static const struct { unsigned high, low; } ranges[] = {
|
||||
{ 6, 6, },
|
||||
{ 3, 1, },
|
||||
};
|
||||
|
||||
ack_info_t acki;
|
||||
memset(&acki, 0xF1, sizeof(acki));
|
||||
|
||||
int len = pf->pf_parse_ack_frame(ack_buf, sizeof(ack_buf), &acki);
|
||||
assert(("Parsed length is correct (9)", len == sizeof(ack_buf)));
|
||||
assert(("Number of ranges is 2", acki.n_ranges == 2));
|
||||
assert(("Largest acked is 6", acki.ranges[0].high == 6));
|
||||
assert(("Number of timestamps is 0", acki.n_timestamps == 0));
|
||||
unsigned n = n_acked(&acki);
|
||||
assert(("Number of acked packets is 4", n == 4));
|
||||
|
||||
for (n = 0; n < 2; ++n)
|
||||
assert(("Range checks out", ranges[n].high == acki.ranges[n].high
|
||||
&& ranges[n].low == acki.ranges[n].low));
|
||||
|
||||
{
|
||||
size_t sz;
|
||||
for (sz = 1; sz < sizeof(ack_buf); ++sz)
|
||||
{
|
||||
len = pf->pf_parse_ack_frame(ack_buf, sz, &acki);
|
||||
assert(("Parsing truncated frame failed", len < 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
test4 (void)
|
||||
{
|
||||
unsigned char ack_buf[] = {
|
||||
/* TYPE N LL MM */
|
||||
0xA0 | 1 << 4 | 0 << 2 | 0,
|
||||
0x01, /* Num ACK block ranges */
|
||||
0x00, /* Number of timestamps */
|
||||
0x03, /* Largest ACKed */
|
||||
0x23, 0x00, /* Delta time */
|
||||
0x01, /* First ack block length */
|
||||
0x01, /* Gap */
|
||||
0x01, /* Ack block length */
|
||||
};
|
||||
|
||||
/* We should get the following array of ranges:
|
||||
* high low
|
||||
* 6 6
|
||||
* 3 1
|
||||
*/
|
||||
static const struct { unsigned high, low; } ranges[] = {
|
||||
{ 3, 3, },
|
||||
{ 1, 1, },
|
||||
};
|
||||
|
||||
ack_info_t acki;
|
||||
memset(&acki, 0xF1, sizeof(acki));
|
||||
|
||||
int len = pf->pf_parse_ack_frame(ack_buf, sizeof(ack_buf), &acki);
|
||||
assert(("Parsed length is correct (9)", len == sizeof(ack_buf)));
|
||||
assert(("Number of ranges is 2", acki.n_ranges == 2));
|
||||
assert(("Largest acked is 3", acki.ranges[0].high == 3));
|
||||
assert(("Number of timestamps is 0", acki.n_timestamps == 0));
|
||||
unsigned n = n_acked(&acki);
|
||||
assert(("Number of acked packets is 2", n == 2));
|
||||
|
||||
for (n = 0; n < 2; ++n)
|
||||
assert(("Range checks out", ranges[n].high == acki.ranges[n].high
|
||||
&& ranges[n].low == acki.ranges[n].low));
|
||||
|
||||
{
|
||||
size_t sz;
|
||||
for (sz = 1; sz < sizeof(ack_buf); ++sz)
|
||||
{
|
||||
len = pf->pf_parse_ack_frame(ack_buf, sz, &acki);
|
||||
assert(("Parsing truncated frame failed", len < 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Four-byte packet numbers */
|
||||
static void
|
||||
test5 (void)
|
||||
{
|
||||
unsigned char ack_buf[] = {
|
||||
/* TYPE N LL MM */
|
||||
0xA0 | 1 << 4 | 2 << 2 | 2,
|
||||
0x01, /* Num ack blocks ranges. */
|
||||
0x00, /* Number of timestamps. */
|
||||
0x23, 0x45, 0x67, 0x89,
|
||||
0x00, 0x00, /* Zero delta time. */
|
||||
0x00, 0x00, 0x00, 0x01, /* First ack block length. */
|
||||
33 - 1, /* Gap to next block. */
|
||||
0x23, 0x45, 0x67, 0x68, /* Ack block length. */
|
||||
};
|
||||
|
||||
/* We should get the following array of ranges:
|
||||
* high low
|
||||
* 6 6
|
||||
* 3 1
|
||||
*/
|
||||
static const struct { unsigned high, low; } ranges[] = {
|
||||
{ 0x23456789, 0x23456789, },
|
||||
{ 0x23456768, 1, },
|
||||
};
|
||||
|
||||
ack_info_t acki;
|
||||
memset(&acki, 0xF1, sizeof(acki));
|
||||
|
||||
int len = pf->pf_parse_ack_frame(ack_buf, sizeof(ack_buf), &acki);
|
||||
assert(("Parsed length is correct (9)", len == sizeof(ack_buf)));
|
||||
assert(("Number of ranges is 2", acki.n_ranges == 2));
|
||||
assert(("Largest acked is 0x23456789", acki.ranges[0].high == 0x23456789));
|
||||
assert(("Number of timestamps is 0", acki.n_timestamps == 0));
|
||||
lsquic_packno_t n = n_acked(&acki);
|
||||
assert(("Number of acked packets is correct", n == 0x23456768 + 1));
|
||||
|
||||
for (n = 0; n < 2; ++n)
|
||||
assert(("Range checks out", ranges[n].high == acki.ranges[n].high
|
||||
&& ranges[n].low == acki.ranges[n].low));
|
||||
|
||||
{
|
||||
size_t sz;
|
||||
for (sz = 1; sz < sizeof(ack_buf); ++sz)
|
||||
{
|
||||
len = pf->pf_parse_ack_frame(ack_buf, sz, &acki);
|
||||
assert(("Parsing truncated frame failed", len < 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Six-byte packet numbers */
|
||||
static void
|
||||
test6 (void)
|
||||
{
|
||||
unsigned char ack_buf[] = {
|
||||
/* TYPE N LL MM */
|
||||
0xA0 | 1 << 4 | 3 << 2 | 3,
|
||||
0x01, /* Num ack blocks ranges. */
|
||||
0x00, /* Number of timestamps. */
|
||||
0x00, 0x00, 0xAB, 0xCD, 0x23, 0x45, 0x67, 0x89,
|
||||
0x00, 0x00, /* Zero delta time. */
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, /* First ack block length. */
|
||||
33 - 1, /* Gap to next block. */
|
||||
0x00, 0x00, 0xAB, 0xCD, 0x23, 0x45, 0x67, 0x68, /* Ack block length. */
|
||||
};
|
||||
|
||||
static const struct { lsquic_packno_t high, low; } ranges[] = {
|
||||
{ 0xABCD23456789, 0xABCD23456789, },
|
||||
{ 0xABCD23456768, 1, },
|
||||
};
|
||||
|
||||
ack_info_t acki;
|
||||
memset(&acki, 0xF1, sizeof(acki));
|
||||
|
||||
int len = pf->pf_parse_ack_frame(ack_buf, sizeof(ack_buf), &acki);
|
||||
assert(("Parsed length is correct", len == sizeof(ack_buf)));
|
||||
assert(("Number of ranges is 2", acki.n_ranges == 2));
|
||||
assert(("Largest acked is 0xABCD23456789", acki.ranges[0].high == 0xABCD23456789));
|
||||
assert(("Number of timestamps is 0", acki.n_timestamps == 0));
|
||||
lsquic_packno_t n = n_acked(&acki);
|
||||
assert(("Number of acked packets is correct", n == 0xABCD23456768 + 1));
|
||||
|
||||
for (n = 0; n < 2; ++n)
|
||||
assert(("Range checks out", ranges[n].high == acki.ranges[n].high
|
||||
&& ranges[n].low == acki.ranges[n].low));
|
||||
|
||||
{
|
||||
size_t sz;
|
||||
for (sz = 1; sz < sizeof(ack_buf); ++sz)
|
||||
{
|
||||
len = pf->pf_parse_ack_frame(ack_buf, sz, &acki);
|
||||
assert(("Parsing truncated frame failed", len < 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
test_max_ack (void)
|
||||
{
|
||||
lsquic_rechist_t rechist;
|
||||
lsquic_time_t now;
|
||||
unsigned i;
|
||||
int has_missing, sz[2];
|
||||
const struct lsquic_packno_range *range;
|
||||
unsigned char buf[1500];
|
||||
struct ack_info acki;
|
||||
|
||||
lsquic_rechist_init(&rechist, 12345);
|
||||
now = lsquic_time_now();
|
||||
|
||||
for (i = 1; i <= 300; ++i)
|
||||
{
|
||||
lsquic_rechist_received(&rechist, i * 10, now);
|
||||
now += i * 1000;
|
||||
}
|
||||
|
||||
memset(buf, 0xAA, sizeof(buf));
|
||||
|
||||
lsquic_packno_t largest = 0;
|
||||
sz[0] = pf->pf_gen_ack_frame(buf, sizeof(buf),
|
||||
(gaf_rechist_first_f) lsquic_rechist_first,
|
||||
(gaf_rechist_next_f) lsquic_rechist_next,
|
||||
(gaf_rechist_largest_recv_f) lsquic_rechist_largest_recv,
|
||||
&rechist, now, &has_missing, &largest);
|
||||
assert(sz[0] > 0);
|
||||
assert(sz[0] <= (int) sizeof(buf));
|
||||
assert(has_missing);
|
||||
|
||||
assert(0 == buf[ 2 ]); /* Number of timestamps */
|
||||
assert(0xAA == buf[ sz[0] ]);
|
||||
|
||||
sz[1] = pf->pf_parse_ack_frame(buf, sizeof(buf), &acki);
|
||||
assert(sz[1] == sz[0]);
|
||||
assert(256 == acki.n_ranges);
|
||||
|
||||
for (range = lsquic_rechist_first(&rechist), i = 0;
|
||||
range && i < acki.n_ranges;
|
||||
range = lsquic_rechist_next(&rechist), ++i)
|
||||
{
|
||||
assert(range->high == acki.ranges[i].high);
|
||||
assert(range->low == acki.ranges[i].low);
|
||||
}
|
||||
assert(i == 256);
|
||||
|
||||
lsquic_rechist_cleanup(&rechist);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
test_ack_truncation (void)
|
||||
{
|
||||
lsquic_rechist_t rechist;
|
||||
lsquic_time_t now;
|
||||
unsigned i;
|
||||
int has_missing, sz[2];
|
||||
const struct lsquic_packno_range *range;
|
||||
unsigned char buf[1500];
|
||||
struct ack_info acki;
|
||||
size_t bufsz;
|
||||
|
||||
lsquic_rechist_init(&rechist, 12345);
|
||||
now = lsquic_time_now();
|
||||
|
||||
for (i = 1; i <= 300; ++i)
|
||||
{
|
||||
lsquic_rechist_received(&rechist, i * 10, now);
|
||||
now += i * 1000;
|
||||
}
|
||||
|
||||
for (bufsz = 200; bufsz < 210; ++bufsz)
|
||||
{
|
||||
memset(buf, 0xAA, sizeof(buf));
|
||||
lsquic_packno_t largest = 0;
|
||||
sz[0] = pf->pf_gen_ack_frame(buf, bufsz,
|
||||
(gaf_rechist_first_f) lsquic_rechist_first,
|
||||
(gaf_rechist_next_f) lsquic_rechist_next,
|
||||
(gaf_rechist_largest_recv_f) lsquic_rechist_largest_recv,
|
||||
&rechist, now, &has_missing, &largest);
|
||||
assert(sz[0] > 0);
|
||||
assert(sz[0] <= (int) bufsz);
|
||||
assert(has_missing);
|
||||
|
||||
assert(0 == buf[ 2 ]); /* Number of timestamps */
|
||||
assert(0xAA == buf[ sz[0] ]);
|
||||
|
||||
sz[1] = pf->pf_parse_ack_frame(buf, sizeof(buf), &acki);
|
||||
assert(sz[1] == sz[0]);
|
||||
assert(acki.n_ranges < 256);
|
||||
|
||||
for (range = lsquic_rechist_first(&rechist), i = 0;
|
||||
range && i < acki.n_ranges;
|
||||
range = lsquic_rechist_next(&rechist), ++i)
|
||||
{
|
||||
assert(range->high == acki.ranges[i].high);
|
||||
assert(range->low == acki.ranges[i].low);
|
||||
}
|
||||
}
|
||||
|
||||
lsquic_rechist_cleanup(&rechist);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
lsquic_global_init(LSQUIC_GLOBAL_SERVER);
|
||||
test1();
|
||||
test2();
|
||||
test3();
|
||||
test4();
|
||||
test5();
|
||||
test6();
|
||||
test_max_ack();
|
||||
test_ack_truncation();
|
||||
return 0;
|
||||
}
|
|
@ -1,82 +0,0 @@
|
|||
/* Copyright (c) 2017 - 2018 LiteSpeed Technologies Inc. See LICENSE. */
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#ifndef WIN32
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#include "lsquic.h"
|
||||
#include "lsquic_types.h"
|
||||
#include "lsquic_alarmset.h"
|
||||
#include "lsquic_parse.h"
|
||||
|
||||
static const struct parse_funcs *const pf = select_pf_by_ver(LSQVER_041);
|
||||
|
||||
|
||||
/* The test is both for generation and parsing: */
|
||||
struct rst_stream_test {
|
||||
unsigned char buf[0x20];
|
||||
size_t buf_len;
|
||||
uint32_t stream_id;
|
||||
uint64_t offset;
|
||||
uint32_t error_code;
|
||||
};
|
||||
|
||||
static const struct rst_stream_test rst_stream_tests[] = {
|
||||
{
|
||||
.buf = { 0x01,
|
||||
0x00, 0x67, 0x45, 0x34,
|
||||
0x00, 0x00, 0x00, 0x03,
|
||||
0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
|
||||
},
|
||||
.buf_len = QUIC_RST_STREAM_SZ,
|
||||
.stream_id = 0x674534,
|
||||
.offset = 0x0102030405,
|
||||
.error_code = 0x03,
|
||||
},
|
||||
|
||||
{ .buf = { 0 }, }
|
||||
};
|
||||
|
||||
|
||||
static void
|
||||
run_parse_tests (void)
|
||||
{
|
||||
const struct rst_stream_test *test;
|
||||
for (test = rst_stream_tests; test->buf[0]; ++test)
|
||||
{
|
||||
uint32_t stream_id = ~0;
|
||||
uint64_t offset = ~0;
|
||||
uint32_t error_code = ~0;
|
||||
int sz = pf->pf_parse_rst_frame(test->buf, test->buf_len, &stream_id, &offset, &error_code);
|
||||
assert(sz == QUIC_RST_STREAM_SZ);
|
||||
assert(stream_id == test->stream_id);
|
||||
assert(offset == test->offset);
|
||||
assert(error_code == test->error_code);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
run_gen_tests (void)
|
||||
{
|
||||
const struct rst_stream_test *test;
|
||||
for (test = rst_stream_tests; test->buf[0]; ++test)
|
||||
{
|
||||
unsigned char buf[0x100];
|
||||
int sz = pf->pf_gen_rst_frame(buf, test->buf_len, test->stream_id, test->offset, test->error_code);
|
||||
assert(sz == QUIC_RST_STREAM_SZ);
|
||||
assert(0 == memcmp(buf, test->buf, sz));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
run_parse_tests();
|
||||
run_gen_tests();
|
||||
return 0;
|
||||
}
|
|
@ -504,238 +504,6 @@ static const struct test tests[] = {
|
|||
.min_sz = 6,
|
||||
},
|
||||
|
||||
/*
|
||||
* IETF:
|
||||
*/
|
||||
{ .lineno = __LINE__,
|
||||
.pf = select_pf_by_ver(LSQVER_041),
|
||||
.fin = { 0, 1, },
|
||||
.offset = 0x0807060504030201UL,
|
||||
.stream_id = 0x210,
|
||||
.data_sz = 10,
|
||||
.data = "0123456789",
|
||||
.avail = 0x100,
|
||||
.out =
|
||||
/* 11 F SS OO D 11FSSOOD */
|
||||
/* TYPE FIN SLEN OLEN DLEN */
|
||||
{ 0xC0 | 1 << 5 | 1 << 3 | 3 << 1 | 1,
|
||||
0x02, 0x10, /* Stream ID */
|
||||
0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, /* Offset */
|
||||
0x00, 0x0A, /* Data length */
|
||||
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
|
||||
},
|
||||
.len = 1 + 2 + 8 + 2 + 10,
|
||||
.min_sz = 1 + 2 + 8 + 0 + 1,
|
||||
},
|
||||
|
||||
{ .lineno = __LINE__,
|
||||
.pf = select_pf_by_ver(LSQVER_041),
|
||||
.fin = { 0, 0, },
|
||||
.offset = 0x0807060504030201UL,
|
||||
.stream_id = 0x210,
|
||||
.data_sz = 10,
|
||||
.data = "0123456789",
|
||||
.avail = 0x100,
|
||||
.out =
|
||||
/* 11 F SS OO D 11FSSOOD */
|
||||
/* TYPE FIN SLEN OLEN DLEN */
|
||||
{ 0xC0 | 0 << 5 | 1 << 3 | 3 << 1 | 1,
|
||||
0x02, 0x10, /* Stream ID */
|
||||
0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, /* Offset */
|
||||
0x00, 0x0A, /* Data length */
|
||||
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
|
||||
},
|
||||
.len = 1 + 2 + 8 + 2 + 10,
|
||||
.min_sz = 1 + 2 + 8 + 0 + 1,
|
||||
},
|
||||
|
||||
{ .lineno = __LINE__,
|
||||
.pf = select_pf_by_ver(LSQVER_041),
|
||||
.fin = { 1, 0, },
|
||||
.offset = 0x0807060504030201UL,
|
||||
.stream_id = 0x210,
|
||||
.data_sz = 10,
|
||||
.data = "0123456789",
|
||||
.avail = 0x100,
|
||||
.out =
|
||||
/* 11 F SS OO D 11FSSOOD */
|
||||
/* TYPE FIN SLEN OLEN DLEN */
|
||||
{ 0xC0 | 1 << 5 | 1 << 3 | 3 << 1 | 1,
|
||||
0x02, 0x10, /* Stream ID */
|
||||
0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, /* Offset */
|
||||
0x00, 0x00, /* Data length */
|
||||
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
|
||||
},
|
||||
.len = 1 + 2 + 8 + 2,
|
||||
.min_sz = 1 + 2 + 8 + 2,
|
||||
},
|
||||
|
||||
{ .lineno = __LINE__,
|
||||
.pf = select_pf_by_ver(LSQVER_041),
|
||||
.fin = { 1, 0, },
|
||||
.offset = 0x0807060504030201UL,
|
||||
.stream_id = 0x21,
|
||||
.data_sz = 10,
|
||||
.data = "0123456789",
|
||||
.avail = 0x100,
|
||||
.out =
|
||||
/* 11 F SS OO D 11FSSOOD */
|
||||
/* TYPE FIN SLEN OLEN DLEN */
|
||||
{ 0xC0 | 1 << 5 | 0 << 3 | 3 << 1 | 1,
|
||||
0x21, /* Stream ID */
|
||||
0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, /* Offset */
|
||||
0x00, 0x00, /* Data length */
|
||||
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
|
||||
},
|
||||
.len = 1 + 1 + 8 + 2,
|
||||
.min_sz = 1 + 1 + 8 + 2,
|
||||
},
|
||||
|
||||
{ .lineno = __LINE__,
|
||||
.pf = select_pf_by_ver(LSQVER_041),
|
||||
.fin = { 0, 0, },
|
||||
.offset = 0x77,
|
||||
.stream_id = 0x210,
|
||||
.data_sz = 10,
|
||||
.data = "0123456789",
|
||||
.avail = 0x100,
|
||||
.out =
|
||||
/* 11 F SS OO D 11FSSOOD */
|
||||
/* TYPE FIN SLEN OLEN DLEN */
|
||||
{ 0xC0 | 0 << 5 | 1 << 3 | 1 << 1 | 1,
|
||||
0x02, 0x10, /* Stream ID */
|
||||
0x00, 0x77, /* Offset */
|
||||
0x00, 0x0A, /* Data length */
|
||||
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
|
||||
},
|
||||
.len = 1 + 2 + 2 + 2 + 10,
|
||||
.min_sz = 1 + 2 + 2 + 0 + 1,
|
||||
},
|
||||
|
||||
{ .lineno = __LINE__,
|
||||
.pf = select_pf_by_ver(LSQVER_041),
|
||||
.fin = { 0, 0, },
|
||||
.offset = 0x0,
|
||||
.stream_id = 0x210,
|
||||
.data_sz = 10,
|
||||
.data = "0123456789",
|
||||
.avail = 0x100,
|
||||
.out =
|
||||
/* 11 F SS OO D 11FSSOOD */
|
||||
/* TYPE FIN SLEN OLEN DLEN */
|
||||
{ 0xC0 | 0 << 5 | 1 << 3 | 0 << 1 | 1,
|
||||
0x02, 0x10, /* Stream ID */
|
||||
/* Offset */
|
||||
0x00, 0x0A, /* Data length */
|
||||
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
|
||||
},
|
||||
.len = 1 + 2 + 0 + 2 + 10,
|
||||
.min_sz = 1 + 2 + 0 + 0 + 1,
|
||||
},
|
||||
|
||||
{ .lineno = __LINE__,
|
||||
.pf = select_pf_by_ver(LSQVER_041),
|
||||
.fin = { 0, 1, },
|
||||
.offset = 0x0,
|
||||
.stream_id = 0x210,
|
||||
.data_sz = 1,
|
||||
.data = "0123456789",
|
||||
.avail = 0x100,
|
||||
.out =
|
||||
/* 11 F SS OO D 11FSSOOD */
|
||||
/* TYPE FIN SLEN OLEN DLEN */
|
||||
{ 0xC0 | 1 << 5 | 1 << 3 | 0 << 1 | 1,
|
||||
0x02, 0x10, /* Stream ID */
|
||||
/* Offset */
|
||||
0x00, 0x01, /* Data length */
|
||||
'0',
|
||||
},
|
||||
.len = 1 + 2 + 0 + 2 + 1,
|
||||
.min_sz = 1 + 2 + 0 + 0 + 1,
|
||||
},
|
||||
|
||||
{ .lineno = __LINE__,
|
||||
.pf = select_pf_by_ver(LSQVER_041),
|
||||
.fin = { 0, 0, },
|
||||
.offset = 0xFFFFFF,
|
||||
.stream_id = 0x210,
|
||||
.data_sz = 10,
|
||||
.data = "0123456789",
|
||||
.avail = 0x100,
|
||||
.out =
|
||||
/* 11 F SS OO D 11FSSOOD */
|
||||
/* TYPE FIN SLEN OLEN DLEN */
|
||||
{ 0xC0 | 0 << 5 | 1 << 3 | 2 << 1 | 1,
|
||||
0x02, 0x10, /* Stream ID */
|
||||
0x00, 0xFF, 0xFF, 0xFF, /* Offset */
|
||||
0x00, 0x0A, /* Data length */
|
||||
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
|
||||
},
|
||||
.len = 1 + 2 + 4 + 2 + 10,
|
||||
.min_sz = 1 + 2 + 4 + 0 + 1,
|
||||
},
|
||||
|
||||
{ .lineno = __LINE__,
|
||||
.pf = select_pf_by_ver(LSQVER_041),
|
||||
.fin = { 0, 0, },
|
||||
.offset = 0xFFFFFFFFULL + 1,
|
||||
.stream_id = 0x210,
|
||||
.data_sz = 10,
|
||||
.data = "0123456789",
|
||||
.avail = 0x100,
|
||||
.out =
|
||||
/* 11 F SS OO D 11FSSOOD */
|
||||
/* TYPE FIN SLEN OLEN DLEN */
|
||||
{ 0xC0 | 0 << 5 | 1 << 3 | 3 << 1 | 1,
|
||||
0x02, 0x10, /* Stream ID */
|
||||
0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, /* Offset */
|
||||
0x00, 0x0A, /* Data length */
|
||||
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
|
||||
},
|
||||
.len = 1 + 2 + 8 + 2 + 10,
|
||||
.min_sz = 1 + 2 + 8 + 0 + 1,
|
||||
},
|
||||
|
||||
{ .lineno = __LINE__,
|
||||
.pf = select_pf_by_ver(LSQVER_041),
|
||||
.fin = { 0, 0, },
|
||||
.offset = 0xFFFFFFFFULL + 1,
|
||||
.stream_id = 0x210,
|
||||
.data_sz = 10,
|
||||
.data = "0123456789",
|
||||
.avail = 14,
|
||||
.out =
|
||||
/* 11 F SS OO D 11FSSOOD */
|
||||
/* TYPE FIN SLEN OLEN DLEN */
|
||||
{ 0xC0 | 0 << 5 | 1 << 3 | 3 << 1 | 0,
|
||||
0x02, 0x10, /* Stream ID */
|
||||
0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, /* Offset */
|
||||
'0', '1', '2',
|
||||
},
|
||||
.len = 1 + 2 + 8 + 0 + 3,
|
||||
.min_sz = 1 + 2 + 8 + 0 + 1,
|
||||
},
|
||||
|
||||
{ .lineno = __LINE__,
|
||||
.pf = select_pf_by_ver(LSQVER_041),
|
||||
.fin = { 1, 0, },
|
||||
.offset = 0xB4,
|
||||
.stream_id = 0x01,
|
||||
.data_sz = 0,
|
||||
.data = "0123456789",
|
||||
.avail = 0x100,
|
||||
.out =
|
||||
/* 11 F SS OO D 11FSSOOD */
|
||||
/* TYPE FIN SLEN OLEN DLEN */
|
||||
{ 0xC0 | 1 << 5 | 0 << 3 | 1 << 1 | 1,
|
||||
0x01, /* Stream ID */
|
||||
0x00, 0xB4, /* Offset */
|
||||
0x00, 0x00, /* Data length */
|
||||
},
|
||||
.len = 6,
|
||||
.min_sz = 6,
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -443,211 +443,6 @@ static const struct test tests[] = {
|
|||
0,
|
||||
},
|
||||
|
||||
/*
|
||||
* GQUIC IETF tests
|
||||
*/
|
||||
{ "Balls to the wall: every possible bit is set",
|
||||
__LINE__,
|
||||
select_pf_by_ver(LSQVER_041),
|
||||
/* 11 F SS OO D 11FSSOOD */
|
||||
/* TYPE FIN SLEN OLEN DLEN */
|
||||
{ 0xC0 | 1 << 5 | 3 << 3 | 3 << 1 | 1,
|
||||
0x00, 0x00, 0x02, 0x10, /* Stream ID */
|
||||
0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, /* Offset */
|
||||
0x01, 0xC4, /* Data length */
|
||||
},
|
||||
1 + 4 + 8 + 2,
|
||||
0x200,
|
||||
{ .data_frame.df_offset = 0x0807060504030201UL,
|
||||
.stream_id = 0x210,
|
||||
.data_frame.df_size = 0x1C4,
|
||||
.data_frame.df_fin = 1,
|
||||
},
|
||||
1,
|
||||
},
|
||||
|
||||
{ "Balls to the wall #2: every possible bit is set, except FIN",
|
||||
__LINE__,
|
||||
select_pf_by_ver(LSQVER_041),
|
||||
/* 11 F SS OO D 11FSSOOD */
|
||||
/* TYPE FIN SLEN OLEN DLEN */
|
||||
{ 0xC0 | 0 << 5 | 3 << 3 | 3 << 1 | 1,
|
||||
0x00, 0x00, 0x02, 0x10, /* Stream ID */
|
||||
0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, /* Offset */
|
||||
0x01, 0xC4, /* Data length */
|
||||
},
|
||||
1 + 4 + 8 + 2,
|
||||
0x200,
|
||||
{ .data_frame.df_offset = 0x0807060504030201UL,
|
||||
.stream_id = 0x210,
|
||||
.data_frame.df_size = 0x1C4,
|
||||
.data_frame.df_fin = 0,
|
||||
},
|
||||
1,
|
||||
},
|
||||
|
||||
{ "Data length is zero",
|
||||
__LINE__,
|
||||
select_pf_by_ver(LSQVER_041),
|
||||
/* 11 F SS OO D 11FSSOOD */
|
||||
/* TYPE FIN SLEN OLEN DLEN */
|
||||
{ 0xC0 | 1 << 5 | 3 << 3 | 3 << 1 | 0,
|
||||
0x00, 0x00, 0x02, 0x10, /* Stream ID */
|
||||
0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, /* Offset */
|
||||
0xC4, 0x01, /* Data length: note this does not matter */
|
||||
},
|
||||
1 + 4 + 8 + 0,
|
||||
0x200,
|
||||
{ .data_frame.df_offset = 0x0807060504030201UL,
|
||||
.stream_id = 0x210,
|
||||
.data_frame.df_size = 0x200 - (1 + 8 + 4),
|
||||
.data_frame.df_fin = 1,
|
||||
},
|
||||
1,
|
||||
},
|
||||
|
||||
{ "Stream ID length is 1",
|
||||
__LINE__,
|
||||
select_pf_by_ver(LSQVER_041),
|
||||
/* 11 F SS OO D 11FSSOOD */
|
||||
/* TYPE FIN SLEN OLEN DLEN */
|
||||
{ 0xC0 | 1 << 5 | 0 << 3 | 3 << 1 | 1,
|
||||
0xF0, /* Stream ID */
|
||||
0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, /* Offset */
|
||||
0x01, 0xC4, /* Data length */
|
||||
},
|
||||
1 + 1 + 8 + 2,
|
||||
0x200,
|
||||
{ .data_frame.df_offset = 0x0807060504030201UL,
|
||||
.stream_id = 0xF0,
|
||||
.data_frame.df_size = 0x1C4,
|
||||
.data_frame.df_fin = 1,
|
||||
},
|
||||
1,
|
||||
},
|
||||
|
||||
{ "All bits are zero save offset length",
|
||||
__LINE__,
|
||||
select_pf_by_ver(LSQVER_041),
|
||||
/* 11 F SS OO D 11FSSOOD */
|
||||
/* TYPE FIN SLEN OLEN DLEN */
|
||||
{ 0xC0 | 0 << 5 | 0 << 3 | 1 << 1 | 0,
|
||||
0xF0, /* Stream ID */
|
||||
0x02, 0x55, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, /* Offset */
|
||||
0xC4, 0x01, /* Data length */
|
||||
},
|
||||
1 + 1 + 2 + 0,
|
||||
0x200,
|
||||
{ .data_frame.df_offset = 0x255,
|
||||
.stream_id = 0xF0,
|
||||
.data_frame.df_size = 0x200 - 4,
|
||||
.data_frame.df_fin = 0,
|
||||
},
|
||||
1,
|
||||
},
|
||||
|
||||
{ "Sanity check: either FIN must be set or data length is not zero #1",
|
||||
__LINE__,
|
||||
select_pf_by_ver(LSQVER_041),
|
||||
/* 11 F SS OO D 11FSSOOD */
|
||||
/* TYPE FIN SLEN OLEN DLEN */
|
||||
{ 0xC0 | 0 << 5 | 0 << 3 | 1 << 1 | 0,
|
||||
0xF0, /* Stream ID */
|
||||
0x02, 0x55, /* Offset */
|
||||
},
|
||||
1 + 1 + 2 + 0,
|
||||
4, /* Same as buffer size: in the absense of explicit data
|
||||
* length in the header, this would mean that data
|
||||
* length is zero.
|
||||
*/
|
||||
{ .data_frame.df_offset = 0x255,
|
||||
.stream_id = 0xF0,
|
||||
.data_frame.df_size = 0x200 - 4,
|
||||
.data_frame.df_fin = 0,
|
||||
},
|
||||
0,
|
||||
},
|
||||
|
||||
{ "Sanity check: either FIN must be set or data length is not zero #2",
|
||||
__LINE__,
|
||||
select_pf_by_ver(LSQVER_041),
|
||||
/* 11 F SS OO D 11FSSOOD */
|
||||
/* TYPE FIN SLEN OLEN DLEN */
|
||||
{ 0xC0 | 0 << 5 | 0 << 3 | 1 << 1 | 1,
|
||||
0xF0, /* Stream ID */
|
||||
0x02, 0x55, /* Offset */
|
||||
0x00, 0x00,
|
||||
},
|
||||
1 + 1 + 2 + 2,
|
||||
200,
|
||||
{ .data_frame.df_offset = 0x255,
|
||||
.stream_id = 0xF0,
|
||||
.data_frame.df_size = 0x200 - 4,
|
||||
.data_frame.df_fin = 0,
|
||||
},
|
||||
0,
|
||||
},
|
||||
|
||||
{ "Sanity check: either FIN must be set or data length is not zero #3",
|
||||
__LINE__,
|
||||
select_pf_by_ver(LSQVER_041),
|
||||
/* 11 F SS OO D 11FSSOOD */
|
||||
/* TYPE FIN SLEN OLEN DLEN */
|
||||
{ 0xC0 | 1 << 5 | 0 << 3 | 1 << 1 | 1,
|
||||
0xF0, /* Stream ID */
|
||||
0x02, 0x55, /* Offset */
|
||||
0x00, 0x00,
|
||||
},
|
||||
1 + 1 + 2 + 2,
|
||||
200,
|
||||
{ .data_frame.df_offset = 0x255,
|
||||
.stream_id = 0xF0,
|
||||
.data_frame.df_size = 0x0,
|
||||
.data_frame.df_fin = 1,
|
||||
},
|
||||
1,
|
||||
},
|
||||
|
||||
{ "Check data bounds #1",
|
||||
__LINE__,
|
||||
select_pf_by_ver(LSQVER_041),
|
||||
/* 11 F SS OO D 11FSSOOD */
|
||||
/* TYPE FIN SLEN OLEN DLEN */
|
||||
{ 0xC0 | 0 << 5 | 0 << 3 | 1 << 1 | 1,
|
||||
0xF0, /* Stream ID */
|
||||
0x02, 0x55, /* Offset */
|
||||
0x01, 0xFA, /* Data length */
|
||||
},
|
||||
1 + 1 + 2 + 2,
|
||||
0x200,
|
||||
{ .data_frame.df_offset = 0x255,
|
||||
.stream_id = 0xF0,
|
||||
.data_frame.df_size = 0x1FA,
|
||||
.data_frame.df_fin = 0,
|
||||
},
|
||||
1,
|
||||
},
|
||||
|
||||
{ "Check data bounds #2",
|
||||
__LINE__,
|
||||
select_pf_by_ver(LSQVER_041),
|
||||
/* 11 F SS OO D 11FSSOOD */
|
||||
/* TYPE FIN SLEN OLEN DLEN */
|
||||
{ 0xC0 | 0 << 5 | 0 << 3 | 1 << 1 | 1,
|
||||
0xF0, /* Stream ID */
|
||||
0x02, 0x55, /* Offset */
|
||||
0x01, 0xFB, /* <--- One byte too many */
|
||||
},
|
||||
1 + 1 + 2 + 2,
|
||||
0x200,
|
||||
{ .data_frame.df_offset = 0x255,
|
||||
.stream_id = 0xF0,
|
||||
.data_frame.df_size = 0x1FA,
|
||||
.data_frame.df_fin = 0,
|
||||
},
|
||||
0,
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue