[MISC] replace TAB with 4 spaces.

This commit is contained in:
George Wang 2021-12-16 21:54:52 -05:00
parent f07b3eae43
commit 6ff1e9b834
7 changed files with 870 additions and 871 deletions

View File

@ -100,41 +100,41 @@ run_test (const struct test *const test)
int
main (void)
{
const struct test tests[] = {
const struct test tests[] = {
{ .lineno = __LINE__,
.pf = select_pf_by_ver(LSQVER_ID27),
.offset = 0,
.data_sz = 10,
.data = "0123456789",
.avail = 0x100,
.out =
{ /* Type */ 0x06,
/* Offset */ 0x00,
/* Size */ 0x0A,
/* Data */ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
},
.len = 1 + 1 + 1 + 10,
.min_sz = 1 + 1 + 1 + 1,
},
{ .lineno = __LINE__,
.pf = select_pf_by_ver(LSQVER_ID27),
.offset = 0,
.data_sz = 10,
.data = "0123456789",
.avail = 0x100,
.out =
{ /* Type */ 0x06,
/* Offset */ 0x00,
/* Size */ 0x0A,
/* Data */ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
},
.len = 1 + 1 + 1 + 10,
.min_sz = 1 + 1 + 1 + 1,
},
{ .lineno = __LINE__,
.pf = select_pf_by_ver(LSQVER_ID27),
.offset = 500,
.data_sz = 10,
.data = "0123456789",
.avail = 0x100,
.out =
{ /* Type */ 0x06,
/* Offset */ 0x41, 0xF4,
/* Size */ 0x0A,
/* Data */ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
},
.len = 1 + 2 + 1 + 10,
.min_sz = 1 + 2 + 1 + 1,
},
{ .lineno = __LINE__,
.pf = select_pf_by_ver(LSQVER_ID27),
.offset = 500,
.data_sz = 10,
.data = "0123456789",
.avail = 0x100,
.out =
{ /* Type */ 0x06,
/* Offset */ 0x41, 0xF4,
/* Size */ 0x0A,
/* Data */ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
},
.len = 1 + 2 + 1 + 10,
.min_sz = 1 + 2 + 1 + 1,
},
};
};
unsigned i;
for (i = 0; i < sizeof(tests) / sizeof(tests[0]); ++i)

View File

@ -771,7 +771,7 @@ main (int argc, char **argv)
#ifndef _MSC_VER
LSQ_INFO("testing version %s", lsquic_ver2str[version]);
#else
LSQ_INFO("testing version %d", version);
LSQ_INFO("testing version %d", version);
#endif
for (spec = test_specs; spec < test_specs + sizeof(test_specs) / sizeof(test_specs[0]); ++spec)
run_test(spec, version);

View File

@ -41,7 +41,6 @@ struct test {
};
static void
run_test (const struct test *const test)
{
@ -80,156 +79,156 @@ run_test (const struct test *const test)
int
main (void)
{
const struct test tests[] = {
{
.pf = select_pf_by_ver(LSQVER_043),
.bufsz = GQUIC_MAX_PUBHDR_SZ,
.cid = 0x0102030405060708UL,
.nonce = NULL,
.packno = 0x01020304,
.bits = GQUIC_PACKNO_LEN_4,
.len = 1 + 8 + 0 + 4,
.out = { (0 << 2) /* Nonce present */
| 0x08 /* Connection ID present */
| 0x20 /* Packet number length */
,
0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, /* Connection ID */
0x01, 0x02, 0x03, 0x04, /* Packet number */
},
},
const struct test tests[] = {
{
.pf = select_pf_by_ver(LSQVER_043),
.bufsz = GQUIC_MAX_PUBHDR_SZ,
.cid = 0x0102030405060708UL,
.nonce = NULL,
.packno = 0x01020304,
.bits = GQUIC_PACKNO_LEN_4,
.len = 1 + 8 + 0 + 4,
.out = { (0 << 2) /* Nonce present */
| 0x08 /* Connection ID present */
| 0x20 /* Packet number length */
,
0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, /* Connection ID */
0x01, 0x02, 0x03, 0x04, /* Packet number */
},
},
{
.pf = select_pf_by_ver(LSQVER_043),
.bufsz = GQUIC_MAX_PUBHDR_SZ,
.cid = 0x0102030405060708UL,
.nonce = NULL,
.packno = 0x00,
.bits = GQUIC_PACKNO_LEN_1,
.len = 1 + 8 + 0 + 1,
.out = { (0 << 2) /* Nonce present */
| 0x08 /* Connection ID present */
| 0x00 /* Packet number length */
,
0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, /* Connection ID */
0x00, /* Packet number */
},
},
{
.pf = select_pf_by_ver(LSQVER_043),
.bufsz = GQUIC_MAX_PUBHDR_SZ,
.cid = 0x0102030405060708UL,
.nonce = NULL,
.packno = 0x00,
.bits = GQUIC_PACKNO_LEN_1,
.len = 1 + 8 + 0 + 1,
.out = { (0 << 2) /* Nonce present */
| 0x08 /* Connection ID present */
| 0x00 /* Packet number length */
,
0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, /* Connection ID */
0x00, /* Packet number */
},
},
{
.pf = select_pf_by_ver(LSQVER_043),
.bufsz = GQUIC_MAX_PUBHDR_SZ,
.cid = 0x0102030405060708UL,
.nonce = NULL,
.packno = 0x09,
.bits = GQUIC_PACKNO_LEN_1,
.ver.buf= { 'Q', '0', '4', '3', },
.len = 1 + 8 + 4 + 0 + 1,
.out = { (0 << 2) /* Nonce present */
| 0x01 /* Version present */
| 0x08 /* Connection ID present */
| 0x00 /* Packet number length */
,
0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, /* Connection ID */
'Q', '0', '4', '3',
0x09, /* Packet number */
},
},
{
.pf = select_pf_by_ver(LSQVER_043),
.bufsz = GQUIC_MAX_PUBHDR_SZ,
.cid = 0x0102030405060708UL,
.nonce = NULL,
.packno = 0x09,
.bits = GQUIC_PACKNO_LEN_1,
.ver.buf= { 'Q', '0', '4', '3', },
.len = 1 + 8 + 4 + 0 + 1,
.out = { (0 << 2) /* Nonce present */
| 0x01 /* Version present */
| 0x08 /* Connection ID present */
| 0x00 /* Packet number length */
,
0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, /* Connection ID */
'Q', '0', '4', '3',
0x09, /* Packet number */
},
},
#define NONCENSE "0123456789abcdefghijklmnopqrstuv"
#define NONCENSE_BYTES '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v'
#define NONCENSE "0123456789abcdefghijklmnopqrstuv"
#define NONCENSE_BYTES '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v'
{
.pf = select_pf_by_ver(LSQVER_043),
.bufsz = GQUIC_MAX_PUBHDR_SZ,
.cid = 0x0102030405060708UL,
.nonce = NONCENSE,
.packno = 0x00,
.bits = GQUIC_PACKNO_LEN_1,
.len = 1 + 8 + 32 + 1,
.out = { (1 << 2) /* Nonce present */
| 0x08 /* Connection ID present */
| 0x00 /* Packet number length */
,
0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, /* Connection ID */
NONCENSE_BYTES,
0x00, /* Packet number */
},
},
{
.pf = select_pf_by_ver(LSQVER_043),
.bufsz = GQUIC_MAX_PUBHDR_SZ,
.cid = 0x0102030405060708UL,
.nonce = NONCENSE,
.packno = 0x00,
.bits = GQUIC_PACKNO_LEN_1,
.len = 1 + 8 + 32 + 1,
.out = { (1 << 2) /* Nonce present */
| 0x08 /* Connection ID present */
| 0x00 /* Packet number length */
,
0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, /* Connection ID */
NONCENSE_BYTES,
0x00, /* Packet number */
},
},
{
.pf = select_pf_by_ver(LSQVER_043),
.bufsz = GQUIC_MAX_PUBHDR_SZ,
.cid = 0, /* Do not set connection ID */
.nonce = NONCENSE,
.packno = 0x00,
.bits = GQUIC_PACKNO_LEN_1,
.len = 1 + 0 + 32 + 1,
.out = { (1 << 2) /* Nonce present */
| 0x00 /* Packet number length */
,
NONCENSE_BYTES,
0x00, /* Packet number */
},
},
{
.pf = select_pf_by_ver(LSQVER_043),
.bufsz = GQUIC_MAX_PUBHDR_SZ,
.cid = 0, /* Do not set connection ID */
.nonce = NONCENSE,
.packno = 0x00,
.bits = GQUIC_PACKNO_LEN_1,
.len = 1 + 0 + 32 + 1,
.out = { (1 << 2) /* Nonce present */
| 0x00 /* Packet number length */
,
NONCENSE_BYTES,
0x00, /* Packet number */
},
},
{
.pf = select_pf_by_ver(LSQVER_043),
.bufsz = GQUIC_MAX_PUBHDR_SZ,
.cid = 0x0102030405060708UL,
.nonce = NONCENSE,
.packno = 0x00,
.bits = GQUIC_PACKNO_LEN_1,
.ver.buf= { 'Q', '0', '4', '3', },
.len = 1 + 8 + 4 + 32 + 1,
.out = { (1 << 2) /* Nonce present */
| 0x01 /* Version present */
| 0x08 /* Connection ID present */
| 0x00 /* Packet number length */
,
0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, /* Connection ID */
'Q', '0', '4', '3',
NONCENSE_BYTES,
0x00, /* Packet number */
},
},
{
.pf = select_pf_by_ver(LSQVER_043),
.bufsz = GQUIC_MAX_PUBHDR_SZ,
.cid = 0x0102030405060708UL,
.nonce = NONCENSE,
.packno = 0x00,
.bits = GQUIC_PACKNO_LEN_1,
.ver.buf= { 'Q', '0', '4', '3', },
.len = 1 + 8 + 4 + 32 + 1,
.out = { (1 << 2) /* Nonce present */
| 0x01 /* Version present */
| 0x08 /* Connection ID present */
| 0x00 /* Packet number length */
,
0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, /* Connection ID */
'Q', '0', '4', '3',
NONCENSE_BYTES,
0x00, /* Packet number */
},
},
{
.pf = select_pf_by_ver(LSQVER_043),
.bufsz = GQUIC_MAX_PUBHDR_SZ,
.cid = 0x0102030405060708UL,
.nonce = NONCENSE,
.packno = 0xA0A1A2A3A4A5A6A7UL,
.bits = GQUIC_PACKNO_LEN_6,
.len = 1 + 8 + 32 + 6,
.out = { (1 << 2) /* Nonce present */
| 0x08 /* Connection ID present */
| 0x30 /* Packet number length */
,
0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, /* Connection ID */
NONCENSE_BYTES,
0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7,
},
},
{
.pf = select_pf_by_ver(LSQVER_043),
.bufsz = GQUIC_MAX_PUBHDR_SZ,
.cid = 0x0102030405060708UL,
.nonce = NONCENSE,
.packno = 0xA0A1A2A3A4A5A6A7UL,
.bits = GQUIC_PACKNO_LEN_6,
.len = 1 + 8 + 32 + 6,
.out = { (1 << 2) /* Nonce present */
| 0x08 /* Connection ID present */
| 0x30 /* Packet number length */
,
0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, /* Connection ID */
NONCENSE_BYTES,
0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7,
},
},
{
.pf = select_pf_by_ver(LSQVER_043),
.bufsz = GQUIC_MAX_PUBHDR_SZ,
.cid = 0x0102030405060708UL,
.nonce = NONCENSE,
.packno = 0xA0A1A2A3A4A5A6A7UL,
.bits = GQUIC_PACKNO_LEN_6,
.len = 1 + 8 + 32 + 6,
.out = { (1 << 2) /* Nonce present */
| 0x08 /* Connection ID present */
| 0x30 /* Packet number length */
,
0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, /* Connection ID */
NONCENSE_BYTES,
0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7,
},
},
{
.pf = select_pf_by_ver(LSQVER_043),
.bufsz = GQUIC_MAX_PUBHDR_SZ,
.cid = 0x0102030405060708UL,
.nonce = NONCENSE,
.packno = 0xA0A1A2A3A4A5A6A7UL,
.bits = GQUIC_PACKNO_LEN_6,
.len = 1 + 8 + 32 + 6,
.out = { (1 << 2) /* Nonce present */
| 0x08 /* Connection ID present */
| 0x30 /* Packet number length */
,
0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, /* Connection ID */
NONCENSE_BYTES,
0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7,
},
},
};
};
unsigned i;
for (i = 0; i < sizeof(tests) / sizeof(tests[0]); ++i)

View File

@ -3680,7 +3680,7 @@ main (int argc, char **argv)
{
g_pf = select_pf_by_ver(LSQVER_043);
int opt;
int opt;
lsquic_global_init(LSQUIC_GLOBAL_SERVER);

View File

@ -134,357 +134,357 @@ int
main (void)
{
const struct test tests[] = {
/*
* Big-endian:
*/
{ .lineno = __LINE__,
.pf = select_pf_by_ver(LSQVER_043),
.fin = { 0, 1, },
.offset = 0x0807060504030201UL,
.stream_id = 0x210,
.data_sz = 10,
.data = "0123456789",
.avail = 0x100,
.out =
/* 1 f d ooo ss 1fdoooss */
/* TYPE FIN DLEN OLEN SLEN */
{ 0x80 | 0x40 | 0x20 | 0x1C | 0x01,
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,
},
/*
* Big-endian:
*/
{ .lineno = __LINE__,
.pf = select_pf_by_ver(LSQVER_043),
.fin = { 0, 1, },
.offset = 0x0807060504030201UL,
.stream_id = 0x210,
.data_sz = 10,
.data = "0123456789",
.avail = 0x100,
.out =
/* 1 f d ooo ss 1fdoooss */
/* TYPE FIN DLEN OLEN SLEN */
{ 0x80 | 0x40 | 0x20 | 0x1C | 0x01,
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_043),
.fin = { 0, 0, },
.offset = 0x0807060504030201UL,
.stream_id = 0x210,
.data_sz = 10,
.data = "0123456789",
.avail = 0x100,
.out =
/* 1 f d ooo ss 1fdoooss */
/* TYPE FIN DLEN OLEN SLEN */
{ 0x80 | 0x00 | 0x20 | 0x1C | 0x01,
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_043),
.fin = { 0, 0, },
.offset = 0x0807060504030201UL,
.stream_id = 0x210,
.data_sz = 10,
.data = "0123456789",
.avail = 0x100,
.out =
/* 1 f d ooo ss 1fdoooss */
/* TYPE FIN DLEN OLEN SLEN */
{ 0x80 | 0x00 | 0x20 | 0x1C | 0x01,
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_043),
.fin = { 1, 0, },
.offset = 0x0807060504030201UL,
.stream_id = 0x210,
.data_sz = 10,
.data = "0123456789",
.avail = 0x100,
.out =
/* 1 f d ooo ss 1fdoooss */
/* TYPE FIN DLEN OLEN SLEN */
{ 0x80 | 0x40 | 0x20 | 0x1C | 0x01,
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_043),
.fin = { 1, 0, },
.offset = 0x0807060504030201UL,
.stream_id = 0x210,
.data_sz = 10,
.data = "0123456789",
.avail = 0x100,
.out =
/* 1 f d ooo ss 1fdoooss */
/* TYPE FIN DLEN OLEN SLEN */
{ 0x80 | 0x40 | 0x20 | 0x1C | 0x01,
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_043),
.fin = { 1, 0, },
.offset = 0x0807060504030201UL,
.stream_id = 0x21,
.data_sz = 10,
.data = "0123456789",
.avail = 0x100,
.out =
/* 1 f d ooo ss 1fdoooss */
/* TYPE FIN DLEN OLEN SLEN */
{ 0x80 | 0x40 | 0x20 | 0x1C | 0x00,
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_043),
.fin = { 1, 0, },
.offset = 0x0807060504030201UL,
.stream_id = 0x21,
.data_sz = 10,
.data = "0123456789",
.avail = 0x100,
.out =
/* 1 f d ooo ss 1fdoooss */
/* TYPE FIN DLEN OLEN SLEN */
{ 0x80 | 0x40 | 0x20 | 0x1C | 0x00,
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_043),
.fin = { 0, 0, },
.offset = 0x77,
.stream_id = 0x210,
.data_sz = 10,
.data = "0123456789",
.avail = 0x100,
.out =
/* 1 f d ooo ss 1fdoooss */
/* TYPE FIN DLEN OLEN SLEN */
{ 0x80 | 0x00 | 0x20 | 0x04 | 0x01,
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_043),
.fin = { 0, 0, },
.offset = 0x77,
.stream_id = 0x210,
.data_sz = 10,
.data = "0123456789",
.avail = 0x100,
.out =
/* 1 f d ooo ss 1fdoooss */
/* TYPE FIN DLEN OLEN SLEN */
{ 0x80 | 0x00 | 0x20 | 0x04 | 0x01,
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_043),
.fin = { 0, 0, },
.offset = 0x0,
.stream_id = 0x210,
.data_sz = 10,
.data = "0123456789",
.avail = 0x100,
.out =
/* 1 f d ooo ss 1fdoooss */
/* TYPE FIN DLEN OLEN SLEN */
{ 0x80 | 0x00 | 0x20 | 0x00 | 0x01,
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_043),
.fin = { 0, 0, },
.offset = 0x0,
.stream_id = 0x210,
.data_sz = 10,
.data = "0123456789",
.avail = 0x100,
.out =
/* 1 f d ooo ss 1fdoooss */
/* TYPE FIN DLEN OLEN SLEN */
{ 0x80 | 0x00 | 0x20 | 0x00 | 0x01,
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_043),
.fin = { 0, 1, },
.offset = 0x0,
.stream_id = 0x210,
.data_sz = 1,
.data = "0123456789",
.avail = 0x100,
.out =
/* 1 f d ooo ss 1fdoooss */
/* TYPE FIN DLEN OLEN SLEN */
{ 0x80 | 0x40 | 0x20 | 0x00 | 0x01,
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_043),
.fin = { 0, 1, },
.offset = 0x0,
.stream_id = 0x210,
.data_sz = 1,
.data = "0123456789",
.avail = 0x100,
.out =
/* 1 f d ooo ss 1fdoooss */
/* TYPE FIN DLEN OLEN SLEN */
{ 0x80 | 0x40 | 0x20 | 0x00 | 0x01,
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_043),
.fin = { 0, 0, },
.offset = 0xFFFFFF,
.stream_id = 0x210,
.data_sz = 10,
.data = "0123456789",
.avail = 0x100,
.out =
/* 1 f d ooo ss 1fdoooss */
/* TYPE FIN DLEN OLEN SLEN */
{ 0x80 | 0x00 | 0x20 | 0x08 | 0x01,
0x02, 0x10, /* Stream ID */
0xFF, 0xFF, 0xFF, /* Offset */
0x00, 0x0A, /* Data length */
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
},
.len = 1 + 2 + 3 + 2 + 10,
.min_sz = 1 + 2 + 3 + 0 + 1,
},
{ .lineno = __LINE__,
.pf = select_pf_by_ver(LSQVER_043),
.fin = { 0, 0, },
.offset = 0xFFFFFF,
.stream_id = 0x210,
.data_sz = 10,
.data = "0123456789",
.avail = 0x100,
.out =
/* 1 f d ooo ss 1fdoooss */
/* TYPE FIN DLEN OLEN SLEN */
{ 0x80 | 0x00 | 0x20 | 0x08 | 0x01,
0x02, 0x10, /* Stream ID */
0xFF, 0xFF, 0xFF, /* Offset */
0x00, 0x0A, /* Data length */
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
},
.len = 1 + 2 + 3 + 2 + 10,
.min_sz = 1 + 2 + 3 + 0 + 1,
},
{ .lineno = __LINE__,
.pf = select_pf_by_ver(LSQVER_043),
.fin = { 0, 0, },
.offset = 0xFFFFFF + 1,
.stream_id = 0x210,
.data_sz = 10,
.data = "0123456789",
.avail = 0x100,
.out =
/* 1 f d ooo ss 1fdoooss */
/* TYPE FIN DLEN OLEN SLEN */
{ 0x80 | 0x00 | 0x20 | 0x0C | 0x01,
0x02, 0x10, /* Stream ID */
0x01, 0x00, 0x00, 0x00, /* 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_043),
.fin = { 0, 0, },
.offset = 0xFFFFFF + 1,
.stream_id = 0x210,
.data_sz = 10,
.data = "0123456789",
.avail = 0x100,
.out =
/* 1 f d ooo ss 1fdoooss */
/* TYPE FIN DLEN OLEN SLEN */
{ 0x80 | 0x00 | 0x20 | 0x0C | 0x01,
0x02, 0x10, /* Stream ID */
0x01, 0x00, 0x00, 0x00, /* 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_043),
.fin = { 0, 0, },
.offset = 0xFFFFFF + 1,
.stream_id = 0x210,
.data_sz = 10,
.data = "0123456789",
.avail = 10,
.out =
/* 1 f d ooo ss 1fdoooss */
/* TYPE FIN DLEN OLEN SLEN */
{ 0x80 | 0x00 | 0x00 | 0x0C | 0x01,
0x02, 0x10, /* Stream ID */
0x01, 0x00, 0x00, 0x00, /* Offset */
'0', '1', '2',
},
.len = 1 + 2 + 4 + 0 + 3,
.min_sz = 1 + 2 + 4 + 0 + 1,
},
{ .lineno = __LINE__,
.pf = select_pf_by_ver(LSQVER_043),
.fin = { 0, 0, },
.offset = 0xFFFFFF + 1,
.stream_id = 0x210,
.data_sz = 10,
.data = "0123456789",
.avail = 10,
.out =
/* 1 f d ooo ss 1fdoooss */
/* TYPE FIN DLEN OLEN SLEN */
{ 0x80 | 0x00 | 0x00 | 0x0C | 0x01,
0x02, 0x10, /* Stream ID */
0x01, 0x00, 0x00, 0x00, /* Offset */
'0', '1', '2',
},
.len = 1 + 2 + 4 + 0 + 3,
.min_sz = 1 + 2 + 4 + 0 + 1,
},
{ .lineno = __LINE__,
.pf = select_pf_by_ver(LSQVER_043),
.fin = { 1, 0, },
.offset = 0xB4,
.stream_id = 0x01,
.data_sz = 0,
.data = "0123456789",
.avail = 0x100,
.out =
/* 1 f d ooo ss 1fdoooss */
/* TYPE FIN DLEN OLEN SLEN */
{ 0x80 | 0x40 | 0x20 | 0x04 | 0x00,
0x01, /* Stream ID */
0x00, 0xB4, /* Offset */
0x00, 0x00, /* Data length */
},
.len = 6,
.min_sz = 6,
},
{ .lineno = __LINE__,
.pf = select_pf_by_ver(LSQVER_043),
.fin = { 1, 0, },
.offset = 0xB4,
.stream_id = 0x01,
.data_sz = 0,
.data = "0123456789",
.avail = 0x100,
.out =
/* 1 f d ooo ss 1fdoooss */
/* TYPE FIN DLEN OLEN SLEN */
{ 0x80 | 0x40 | 0x20 | 0x04 | 0x00,
0x01, /* Stream ID */
0x00, 0xB4, /* Offset */
0x00, 0x00, /* Data length */
},
.len = 6,
.min_sz = 6,
},
/*
* IETF QUIC Internet-Draft 17:
*/
/*
* IETF QUIC Internet-Draft 17:
*/
{ .lineno = __LINE__,
.pf = select_pf_by_ver(LSQVER_ID27),
.fin = { 0, 1, },
.offset = 0x0807060504030201UL,
.stream_id = 0x210,
.data_sz = 10,
.data = "0123456789",
.avail = 0x100,
.out =
/* TYPE OFF DLEN FIN */
{ 0x08 | 1<<2 | 1<<1 | 1<<0,
0x42, 0x10, /* Stream ID */
0xC8, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, /* Offset */
0x0A, /* Data length */
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
},
.len = 1 + 2 + 8 + 1 + 10,
.min_sz = 1 + 2 + 8 + 0 + 1,
},
{ .lineno = __LINE__,
.pf = select_pf_by_ver(LSQVER_ID27),
.fin = { 0, 1, },
.offset = 0x0807060504030201UL,
.stream_id = 0x210,
.data_sz = 10,
.data = "0123456789",
.avail = 0x100,
.out =
/* TYPE OFF DLEN FIN */
{ 0x08 | 1<<2 | 1<<1 | 1<<0,
0x42, 0x10, /* Stream ID */
0xC8, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, /* Offset */
0x0A, /* Data length */
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
},
.len = 1 + 2 + 8 + 1 + 10,
.min_sz = 1 + 2 + 8 + 0 + 1,
},
{ .lineno = __LINE__,
.pf = select_pf_by_ver(LSQVER_ID27),
.fin = { 0, 0, },
.offset = 0,
.stream_id = 0x210,
.data_sz = 10,
.data = "0123456789",
.avail = 0x100,
.out =
/* TYPE OFF DLEN FIN */
{ 0x08 | 0<<2 | 1<<1 | 0<<0,
0x42, 0x10, /* Stream ID */
0x0A, /* Data length */
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
},
.len = 1 + 2 + 0 + 1 + 10,
.min_sz = 1 + 2 + 0 + 0 + 1,
},
{ .lineno = __LINE__,
.pf = select_pf_by_ver(LSQVER_ID27),
.fin = { 0, 0, },
.offset = 0,
.stream_id = 0x210,
.data_sz = 10,
.data = "0123456789",
.avail = 0x100,
.out =
/* TYPE OFF DLEN FIN */
{ 0x08 | 0<<2 | 1<<1 | 0<<0,
0x42, 0x10, /* Stream ID */
0x0A, /* Data length */
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
},
.len = 1 + 2 + 0 + 1 + 10,
.min_sz = 1 + 2 + 0 + 0 + 1,
},
{ .lineno = __LINE__,
.pf = select_pf_by_ver(LSQVER_ID27),
.fin = { 0, 0, },
.offset = 0,
.stream_id = 0x21,
.data_sz = 10,
.data = "0123456789",
.avail = 12,
.out =
/* TYPE OFF DLEN FIN */
{ 0x08 | 0<<2 | 0<<1 | 0<<0,
0x21, /* Stream ID */
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
},
.len = 1 + 1 + 0 + 0 + 10,
.min_sz = 1 + 1 + 0 + 0 + 1,
},
{ .lineno = __LINE__,
.pf = select_pf_by_ver(LSQVER_ID27),
.fin = { 0, 0, },
.offset = 0,
.stream_id = 0x21,
.data_sz = 10,
.data = "0123456789",
.avail = 12,
.out =
/* TYPE OFF DLEN FIN */
{ 0x08 | 0<<2 | 0<<1 | 0<<0,
0x21, /* Stream ID */
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
},
.len = 1 + 1 + 0 + 0 + 10,
.min_sz = 1 + 1 + 0 + 0 + 1,
},
{ .lineno = __LINE__,
.pf = select_pf_by_ver(LSQVER_ID27),
.fin = { 0, 0, },
.offset = 0x0807060504030201UL,
.stream_id = 0x210,
.data_sz = 10,
.data = "0123456789",
.avail = 0x100,
.out =
/* TYPE OFF DLEN FIN */
{ 0x08 | 1<<2 | 1<<1 | 0<<0,
0x42, 0x10, /* Stream ID */
0xC8, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, /* Offset */
0x0A, /* Data length */
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
},
.len = 1 + 2 + 8 + 1 + 10,
.min_sz = 1 + 2 + 8 + 0 + 1,
},
{ .lineno = __LINE__,
.pf = select_pf_by_ver(LSQVER_ID27),
.fin = { 0, 0, },
.offset = 0x0807060504030201UL,
.stream_id = 0x210,
.data_sz = 10,
.data = "0123456789",
.avail = 0x100,
.out =
/* TYPE OFF DLEN FIN */
{ 0x08 | 1<<2 | 1<<1 | 0<<0,
0x42, 0x10, /* Stream ID */
0xC8, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, /* Offset */
0x0A, /* Data length */
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
},
.len = 1 + 2 + 8 + 1 + 10,
.min_sz = 1 + 2 + 8 + 0 + 1,
},
{ .lineno = __LINE__,
.pf = select_pf_by_ver(LSQVER_ID27),
.fin = { 1, 0, },
.offset = 0x0807060504030201UL,
.stream_id = 0x210,
.data_sz = 0,
.data = "0123456789",
.avail = 11,
.out =
/* TYPE OFF DLEN FIN */
{ 0x08 | 1<<2 | 0<<1 | 1<<0,
0x42, 0x10, /* Stream ID */
0xC8, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, /* Offset */
},
.len = 1 + 2 + 8,
.min_sz = 1 + 2 + 8,
},
{ .lineno = __LINE__,
.pf = select_pf_by_ver(LSQVER_ID27),
.fin = { 1, 0, },
.offset = 0x0807060504030201UL,
.stream_id = 0x210,
.data_sz = 0,
.data = "0123456789",
.avail = 11,
.out =
/* TYPE OFF DLEN FIN */
{ 0x08 | 1<<2 | 0<<1 | 1<<0,
0x42, 0x10, /* Stream ID */
0xC8, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, /* Offset */
},
.len = 1 + 2 + 8,
.min_sz = 1 + 2 + 8,
},
{ .lineno = __LINE__,
.pf = select_pf_by_ver(LSQVER_ID27),
.fin = { 1, 0, },
.offset = 0x0807060504030201UL,
.stream_id = 0x210,
.data_sz = 0,
.data = "0123456789",
.avail = 0x100,
.out =
/* TYPE OFF DLEN FIN */
{ 0x08 | 1<<2 | 1<<1 | 1<<0,
0x42, 0x10, /* Stream ID */
0xC8, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, /* Offset */
0x00, /* Data length */
},
.len = 1 + 2 + 8 + 1,
.min_sz = 1 + 2 + 8,
},
{ .lineno = __LINE__,
.pf = select_pf_by_ver(LSQVER_ID27),
.fin = { 1, 0, },
.offset = 0x0807060504030201UL,
.stream_id = 0x210,
.data_sz = 0,
.data = "0123456789",
.avail = 0x100,
.out =
/* TYPE OFF DLEN FIN */
{ 0x08 | 1<<2 | 1<<1 | 1<<0,
0x42, 0x10, /* Stream ID */
0xC8, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, /* Offset */
0x00, /* Data length */
},
.len = 1 + 2 + 8 + 1,
.min_sz = 1 + 2 + 8,
},
};
};
unsigned i;
for (i = 0; i < sizeof(tests) / sizeof(tests[0]); ++i)

View File

@ -61,387 +61,387 @@ int
main (void)
{
const struct test tests[] = {
const struct test tests[] = {
/*
* Big-endian tests
*/
{ "Balls to the wall: every possible bit is set",
__LINE__,
select_pf_by_ver(LSQVER_043),
/* 1 f d ooo ss 1fdoooss */
/* TYPE FIN DLEN OLEN SLEN */
{ 0x80 | 0x40 | 0x20 | 0x1C | 0x3,
0x00, 0x00, 0x02, 0x10, /* Stream ID */
0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, /* Offset */
0x01, 0xC4, /* Data length */
},
1 + 2 + 8 + 4,
0x200,
{ .data_frame.df_offset = 0x0807060504030201UL,
.stream_id = 0x210,
.data_frame.df_size = 0x1C4,
.data_frame.df_fin = 1,
},
1,
},
/*
* Big-endian tests
*/
{ "Balls to the wall: every possible bit is set",
__LINE__,
select_pf_by_ver(LSQVER_043),
/* 1 f d ooo ss 1fdoooss */
/* TYPE FIN DLEN OLEN SLEN */
{ 0x80 | 0x40 | 0x20 | 0x1C | 0x3,
0x00, 0x00, 0x02, 0x10, /* Stream ID */
0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, /* Offset */
0x01, 0xC4, /* Data length */
},
1 + 2 + 8 + 4,
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_043),
/* 1 f d ooo ss 1fdoooss */
/* TYPE FIN DLEN OLEN SLEN */
{ 0x80 | 0x00 | 0x20 | 0x1C | 0x3,
0x00, 0x00, 0x02, 0x10, /* Stream ID */
0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, /* Offset */
0x01, 0xC4, /* Data length */
},
1 + 2 + 8 + 4,
0x200,
{ .data_frame.df_offset = 0x0807060504030201UL,
.stream_id = 0x210,
.data_frame.df_size = 0x1C4,
.data_frame.df_fin = 0,
},
1,
},
{ "Balls to the wall #2: every possible bit is set, except FIN",
__LINE__,
select_pf_by_ver(LSQVER_043),
/* 1 f d ooo ss 1fdoooss */
/* TYPE FIN DLEN OLEN SLEN */
{ 0x80 | 0x00 | 0x20 | 0x1C | 0x3,
0x00, 0x00, 0x02, 0x10, /* Stream ID */
0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, /* Offset */
0x01, 0xC4, /* Data length */
},
1 + 2 + 8 + 4,
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_043),
/* 1 f d ooo ss 1fdoooss */
/* TYPE FIN DLEN OLEN SLEN */
{ 0x80 | 0x40 | 0x00 | 0x1C | 0x3,
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 + 0 + 8 + 4,
0x200,
{ .data_frame.df_offset = 0x0807060504030201UL,
.stream_id = 0x210,
.data_frame.df_size = 0x200 - (1 + 8 + 4),
.data_frame.df_fin = 1,
},
1,
},
{ "Data length is zero",
__LINE__,
select_pf_by_ver(LSQVER_043),
/* 1 f d ooo ss 1fdoooss */
/* TYPE FIN DLEN OLEN SLEN */
{ 0x80 | 0x40 | 0x00 | 0x1C | 0x3,
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 + 0 + 8 + 4,
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_043),
/* 1 f d ooo ss 1fdoooss */
/* TYPE FIN DLEN OLEN SLEN */
{ 0x80 | 0x40 | 0x20 | 0x1C | 0x0,
0xF0, /* Stream ID */
0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, /* Offset */
0x01, 0xC4, /* Data length */
},
1 + 2 + 8 + 1,
0x200,
{ .data_frame.df_offset = 0x0807060504030201UL,
.stream_id = 0xF0,
.data_frame.df_size = 0x1C4,
.data_frame.df_fin = 1,
},
1,
},
{ "Stream ID length is 1",
__LINE__,
select_pf_by_ver(LSQVER_043),
/* 1 f d ooo ss 1fdoooss */
/* TYPE FIN DLEN OLEN SLEN */
{ 0x80 | 0x40 | 0x20 | 0x1C | 0x0,
0xF0, /* Stream ID */
0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, /* Offset */
0x01, 0xC4, /* Data length */
},
1 + 2 + 8 + 1,
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_043),
/* 1 f d ooo ss 1fdoooss */
/* TYPE FIN DLEN OLEN SLEN */
{ 0x80 | 0x00 | 0x00 | 0x04 | 0x0,
0xF0, /* Stream ID */
0x02, 0x55, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, /* Offset */
0xC4, 0x01, /* Data length */
},
1 + 0 + 2 + 1,
0x200,
{ .data_frame.df_offset = 0x255,
.stream_id = 0xF0,
.data_frame.df_size = 0x200 - 4,
.data_frame.df_fin = 0,
},
1,
},
{ "All bits are zero save offset length",
__LINE__,
select_pf_by_ver(LSQVER_043),
/* 1 f d ooo ss 1fdoooss */
/* TYPE FIN DLEN OLEN SLEN */
{ 0x80 | 0x00 | 0x00 | 0x04 | 0x0,
0xF0, /* Stream ID */
0x02, 0x55, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, /* Offset */
0xC4, 0x01, /* Data length */
},
1 + 0 + 2 + 1,
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_043),
/* 1 f d ooo ss 1fdoooss */
/* TYPE FIN DLEN OLEN SLEN */
{ 0x80 | 0x00 | 0x00 | 0x04 | 0x0,
0xF0, /* Stream ID */
0x02, 0x55, /* Offset */
},
1 + 0 + 2 + 1,
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 #1",
__LINE__,
select_pf_by_ver(LSQVER_043),
/* 1 f d ooo ss 1fdoooss */
/* TYPE FIN DLEN OLEN SLEN */
{ 0x80 | 0x00 | 0x00 | 0x04 | 0x0,
0xF0, /* Stream ID */
0x02, 0x55, /* Offset */
},
1 + 0 + 2 + 1,
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_043),
/* 1 f d ooo ss 1fdoooss */
/* TYPE FIN DLEN OLEN SLEN */
{ 0x80 | 0x00 | 0x20 | 0x04 | 0x0,
0xF0, /* Stream ID */
0x02, 0x55, /* Offset */
0x00, 0x00,
},
1 + 2 + 2 + 1,
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 #2",
__LINE__,
select_pf_by_ver(LSQVER_043),
/* 1 f d ooo ss 1fdoooss */
/* TYPE FIN DLEN OLEN SLEN */
{ 0x80 | 0x00 | 0x20 | 0x04 | 0x0,
0xF0, /* Stream ID */
0x02, 0x55, /* Offset */
0x00, 0x00,
},
1 + 2 + 2 + 1,
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_043),
/* 1 f d ooo ss 1fdoooss */
/* TYPE FIN DLEN OLEN SLEN */
{ 0x80 | 0x40 | 0x20 | 0x04 | 0x0,
0xF0, /* Stream ID */
0x02, 0x55, /* Offset */
0x00, 0x00,
},
1 + 2 + 2 + 1,
200,
{ .data_frame.df_offset = 0x255,
.stream_id = 0xF0,
.data_frame.df_size = 0x0,
.data_frame.df_fin = 1,
},
1,
},
{ "Sanity check: either FIN must be set or data length is not zero #3",
__LINE__,
select_pf_by_ver(LSQVER_043),
/* 1 f d ooo ss 1fdoooss */
/* TYPE FIN DLEN OLEN SLEN */
{ 0x80 | 0x40 | 0x20 | 0x04 | 0x0,
0xF0, /* Stream ID */
0x02, 0x55, /* Offset */
0x00, 0x00,
},
1 + 2 + 2 + 1,
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_043),
/* 1 f d ooo ss 1fdoooss */
/* TYPE FIN DLEN OLEN SLEN */
{ 0x80 | 0x00 | 0x20 | 0x04 | 0x0,
0xF0, /* Stream ID */
0x02, 0x55, /* Offset */
0x01, 0xFA, /* Data length */
},
1 + 2 + 2 + 1,
0x200,
{ .data_frame.df_offset = 0x255,
.stream_id = 0xF0,
.data_frame.df_size = 0x1FA,
.data_frame.df_fin = 0,
},
1,
},
{ "Check data bounds #1",
__LINE__,
select_pf_by_ver(LSQVER_043),
/* 1 f d ooo ss 1fdoooss */
/* TYPE FIN DLEN OLEN SLEN */
{ 0x80 | 0x00 | 0x20 | 0x04 | 0x0,
0xF0, /* Stream ID */
0x02, 0x55, /* Offset */
0x01, 0xFA, /* Data length */
},
1 + 2 + 2 + 1,
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_043),
/* 1 f d ooo ss 1fdoooss */
/* TYPE FIN DLEN OLEN SLEN */
{ 0x80 | 0x00 | 0x20 | 0x04 | 0x0,
0xF0, /* Stream ID */
0x02, 0x55, /* Offset */
0x01, 0xFB, /* <--- One byte too many */
},
1 + 2 + 2 + 1,
0x200,
{ .data_frame.df_offset = 0x255,
.stream_id = 0xF0,
.data_frame.df_size = 0x1FA,
.data_frame.df_fin = 0,
},
0,
},
{ "Check data bounds #2",
__LINE__,
select_pf_by_ver(LSQVER_043),
/* 1 f d ooo ss 1fdoooss */
/* TYPE FIN DLEN OLEN SLEN */
{ 0x80 | 0x00 | 0x20 | 0x04 | 0x0,
0xF0, /* Stream ID */
0x02, 0x55, /* Offset */
0x01, 0xFB, /* <--- One byte too many */
},
1 + 2 + 2 + 1,
0x200,
{ .data_frame.df_offset = 0x255,
.stream_id = 0xF0,
.data_frame.df_size = 0x1FA,
.data_frame.df_fin = 0,
},
0,
},
/*
* IETF QUIC Internet-Draft 14 Tests.
*/
/*
* IETF QUIC Internet-Draft 14 Tests.
*/
{ "Balls to the wall: every possible bit is set",
__LINE__,
select_pf_by_ver(LSQVER_ID27),
/* TYPE OFF DLEN FIN */
{ 0x10 | 1<<2 | 1<<1 | 1<<0,
0x41, 0x23, /* Stream ID */
0x08, /* Offset */
0x41, 0xC4, /* Data length */
},
1 + 2 + 1 + 2,
0x200,
{ .data_frame.df_offset = 0x08,
.stream_id = 0x123,
.data_frame.df_size = 0x1C4,
.data_frame.df_fin = 1,
},
1,
},
{ "Balls to the wall: every possible bit is set",
__LINE__,
select_pf_by_ver(LSQVER_ID27),
/* TYPE OFF DLEN FIN */
{ 0x10 | 1<<2 | 1<<1 | 1<<0,
0x41, 0x23, /* Stream ID */
0x08, /* Offset */
0x41, 0xC4, /* Data length */
},
1 + 2 + 1 + 2,
0x200,
{ .data_frame.df_offset = 0x08,
.stream_id = 0x123,
.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_ID27),
/* TYPE OFF DLEN FIN */
{ 0x10 | 1<<2 | 1<<1 | 0<<0,
0x81, 0x23, 0x00, 0xE4, /* Stream ID */
0xF0, 0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, /* Offset */
0x41, 0xC4, /* Data length */
},
1 + 4 + 8 + 2,
0x200,
{ .data_frame.df_offset = 0x301234567890ABCDull,
.stream_id = 0x12300E4,
.data_frame.df_size = 0x1C4,
.data_frame.df_fin = 0,
},
1,
},
{ "Balls to the wall #2: every possible bit is set except FIN",
__LINE__,
select_pf_by_ver(LSQVER_ID27),
/* TYPE OFF DLEN FIN */
{ 0x10 | 1<<2 | 1<<1 | 0<<0,
0x81, 0x23, 0x00, 0xE4, /* Stream ID */
0xF0, 0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, /* Offset */
0x41, 0xC4, /* Data length */
},
1 + 4 + 8 + 2,
0x200,
{ .data_frame.df_offset = 0x301234567890ABCDull,
.stream_id = 0x12300E4,
.data_frame.df_size = 0x1C4,
.data_frame.df_fin = 0,
},
1,
},
{ "Data length is zero",
__LINE__,
select_pf_by_ver(LSQVER_ID27),
/* TYPE OFF DLEN FIN */
{ 0x10 | 1<<2 | 0<<1 | 0<<0,
0x81, 0x23, 0x00, 0xE4, /* Stream ID */
0xF0, 0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, /* Offset */
},
1 + 4 + 8 + 0,
0x200,
{ .data_frame.df_offset = 0x301234567890ABCDull,
.stream_id = 0x12300E4,
.data_frame.df_size = 0x200 - 1 - 4 - 8,
.data_frame.df_fin = 0,
},
1,
},
{ "Data length is zero",
__LINE__,
select_pf_by_ver(LSQVER_ID27),
/* TYPE OFF DLEN FIN */
{ 0x10 | 1<<2 | 0<<1 | 0<<0,
0x81, 0x23, 0x00, 0xE4, /* Stream ID */
0xF0, 0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, /* Offset */
},
1 + 4 + 8 + 0,
0x200,
{ .data_frame.df_offset = 0x301234567890ABCDull,
.stream_id = 0x12300E4,
.data_frame.df_size = 0x200 - 1 - 4 - 8,
.data_frame.df_fin = 0,
},
1,
},
{ "Sanity check: what happens when data length is zero #1",
__LINE__,
select_pf_by_ver(LSQVER_ID27),
/* TYPE OFF DLEN FIN */
{ 0x10 | 1<<2 | 1<<1 | 0<<0,
0x81, 0x23, 0x00, 0xE4, /* Stream ID */
0xF0, 0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, /* Offset */
0x40, 0x00, /* Data length */
},
1 + 4 + 8 + 2,
0x200,
{ .data_frame.df_offset = 0x301234567890ABCDull,
.stream_id = 0x12300E4,
.data_frame.df_size = 0,
.data_frame.df_fin = 0,
},
1,
},
{ "Sanity check: what happens when data length is zero #1",
__LINE__,
select_pf_by_ver(LSQVER_ID27),
/* TYPE OFF DLEN FIN */
{ 0x10 | 1<<2 | 1<<1 | 0<<0,
0x81, 0x23, 0x00, 0xE4, /* Stream ID */
0xF0, 0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, /* Offset */
0x40, 0x00, /* Data length */
},
1 + 4 + 8 + 2,
0x200,
{ .data_frame.df_offset = 0x301234567890ABCDull,
.stream_id = 0x12300E4,
.data_frame.df_size = 0,
.data_frame.df_fin = 0,
},
1,
},
{ "Sanity check: what happens when data length is zero #2",
__LINE__,
select_pf_by_ver(LSQVER_ID27),
/* TYPE OFF DLEN FIN */
{ 0x10 | 1<<2 | 1<<1 | 0<<0,
0x81, 0x23, 0x00, 0xE4, /* Stream ID */
0x00, /* Offset */
0x40, 0x00, /* Data length */
},
1 + 4 + 1 + 2,
0x200,
{ .data_frame.df_offset = 0,
.stream_id = 0x12300E4,
.data_frame.df_size = 0,
.data_frame.df_fin = 0,
},
1,
},
{ "Sanity check: what happens when data length is zero #2",
__LINE__,
select_pf_by_ver(LSQVER_ID27),
/* TYPE OFF DLEN FIN */
{ 0x10 | 1<<2 | 1<<1 | 0<<0,
0x81, 0x23, 0x00, 0xE4, /* Stream ID */
0x00, /* Offset */
0x40, 0x00, /* Data length */
},
1 + 4 + 1 + 2,
0x200,
{ .data_frame.df_offset = 0,
.stream_id = 0x12300E4,
.data_frame.df_size = 0,
.data_frame.df_fin = 0,
},
1,
},
{ "Sanity check: what happens when data length is zero #3",
__LINE__,
select_pf_by_ver(LSQVER_ID27),
/* TYPE OFF DLEN FIN */
{ 0x10 | 0<<2 | 1<<1 | 0<<0,
0x81, 0x23, 0x00, 0xE4, /* Stream ID */
0x40, 0x00, /* Data length */
},
1 + 4 + 0 + 2,
0x200,
{ .data_frame.df_offset = 0,
.stream_id = 0x12300E4,
.data_frame.df_size = 0,
.data_frame.df_fin = 0,
},
1,
},
{ "Sanity check: what happens when data length is zero #3",
__LINE__,
select_pf_by_ver(LSQVER_ID27),
/* TYPE OFF DLEN FIN */
{ 0x10 | 0<<2 | 1<<1 | 0<<0,
0x81, 0x23, 0x00, 0xE4, /* Stream ID */
0x40, 0x00, /* Data length */
},
1 + 4 + 0 + 2,
0x200,
{ .data_frame.df_offset = 0,
.stream_id = 0x12300E4,
.data_frame.df_size = 0,
.data_frame.df_fin = 0,
},
1,
},
{ "Sanity check: what happens when data length is zero #3",
__LINE__,
select_pf_by_ver(LSQVER_ID27),
/* TYPE OFF DLEN FIN */
{ 0x10 | 1<<2 | 1<<1 | 1<<0,
0x81, 0x23, 0x00, 0xE4, /* Stream ID */
0x12, /* Offset */
0x00, /* Data length */
},
1 + 4 + 1 + 1,
0x200,
{ .data_frame.df_offset = 0x12,
.stream_id = 0x12300E4,
.data_frame.df_size = 0,
.data_frame.df_fin = 1,
},
1,
},
{ "Sanity check: what happens when data length is zero #3",
__LINE__,
select_pf_by_ver(LSQVER_ID27),
/* TYPE OFF DLEN FIN */
{ 0x10 | 1<<2 | 1<<1 | 1<<0,
0x81, 0x23, 0x00, 0xE4, /* Stream ID */
0x12, /* Offset */
0x00, /* Data length */
},
1 + 4 + 1 + 1,
0x200,
{ .data_frame.df_offset = 0x12,
.stream_id = 0x12300E4,
.data_frame.df_size = 0,
.data_frame.df_fin = 1,
},
1,
},
{ "Check data bounds #1",
__LINE__,
select_pf_by_ver(LSQVER_ID27),
/* TYPE OFF DLEN FIN */
{ 0x10 | 1<<2 | 1<<1 | 1<<0,
0x81, 0x23, 0x00, 0xE4, /* Stream ID */
0x12, /* Offset */
0x41, 0xF8, /* Data length */
},
1 + 4 + 1 + 2,
0x200,
{ .data_frame.df_offset = 0x12,
.stream_id = 0x12300E4,
.data_frame.df_size = 0x200 - 1 - 4 - 1 - 2,
.data_frame.df_fin = 1,
},
1,
},
{ "Check data bounds #1",
__LINE__,
select_pf_by_ver(LSQVER_ID27),
/* TYPE OFF DLEN FIN */
{ 0x10 | 1<<2 | 1<<1 | 1<<0,
0x81, 0x23, 0x00, 0xE4, /* Stream ID */
0x12, /* Offset */
0x41, 0xF8, /* Data length */
},
1 + 4 + 1 + 2,
0x200,
{ .data_frame.df_offset = 0x12,
.stream_id = 0x12300E4,
.data_frame.df_size = 0x200 - 1 - 4 - 1 - 2,
.data_frame.df_fin = 1,
},
1,
},
{ "Check data bounds #2",
__LINE__,
select_pf_by_ver(LSQVER_ID27),
/* TYPE OFF DLEN FIN */
{ 0x10 | 1<<2 | 1<<1 | 1<<0,
0x81, 0x23, 0x00, 0xE4, /* Stream ID */
0x12, /* Offset */
0x41, 0xF9, /* Data length */
},
1 + 4 + 1 + 2,
0x200,
{ .data_frame.df_offset = 0x12,
.stream_id = 0x12300E4,
.data_frame.df_size = 0x200 - 1 - 4 - 1 - 2,
.data_frame.df_fin = 1,
},
0,
},
{ "Check data bounds #2",
__LINE__,
select_pf_by_ver(LSQVER_ID27),
/* TYPE OFF DLEN FIN */
{ 0x10 | 1<<2 | 1<<1 | 1<<0,
0x81, 0x23, 0x00, 0xE4, /* Stream ID */
0x12, /* Offset */
0x41, 0xF9, /* Data length */
},
1 + 4 + 1 + 2,
0x200,
{ .data_frame.df_offset = 0x12,
.stream_id = 0x12300E4,
.data_frame.df_size = 0x200 - 1 - 4 - 1 - 2,
.data_frame.df_fin = 1,
},
0,
},
};
};
unsigned i;
for (i = 0; i < sizeof(tests) / sizeof(tests[0]); ++i)

View File

@ -19,8 +19,8 @@ struct iovec {
4018:signed/unsigned mismatch
4100:unreferenced formal parameter,
4127: conditional expression is constant
4152: nonstandard extension, function/data pointer conversion in expression
4189:local variable is initialized but not referenced
4152: nonstandard extension, function/data pointer conversion in expression
4189:local variable is initialized but not referenced
4200:zero-sized-array in struct,
4204: nonstandard extension used: non-constant aggregate initializer,
4221: nonstandard extension used:xx cannot be initialized using address of automatic variable y,