[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 int
main (void) main (void)
{ {
const struct test tests[] = { const struct test tests[] = {
{ .lineno = __LINE__, { .lineno = __LINE__,
.pf = select_pf_by_ver(LSQVER_ID27), .pf = select_pf_by_ver(LSQVER_ID27),
.offset = 0, .offset = 0,
.data_sz = 10, .data_sz = 10,
.data = "0123456789", .data = "0123456789",
.avail = 0x100, .avail = 0x100,
.out = .out =
{ /* Type */ 0x06, { /* Type */ 0x06,
/* Offset */ 0x00, /* Offset */ 0x00,
/* Size */ 0x0A, /* Size */ 0x0A,
/* Data */ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', /* Data */ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
}, },
.len = 1 + 1 + 1 + 10, .len = 1 + 1 + 1 + 10,
.min_sz = 1 + 1 + 1 + 1, .min_sz = 1 + 1 + 1 + 1,
}, },
{ .lineno = __LINE__, { .lineno = __LINE__,
.pf = select_pf_by_ver(LSQVER_ID27), .pf = select_pf_by_ver(LSQVER_ID27),
.offset = 500, .offset = 500,
.data_sz = 10, .data_sz = 10,
.data = "0123456789", .data = "0123456789",
.avail = 0x100, .avail = 0x100,
.out = .out =
{ /* Type */ 0x06, { /* Type */ 0x06,
/* Offset */ 0x41, 0xF4, /* Offset */ 0x41, 0xF4,
/* Size */ 0x0A, /* Size */ 0x0A,
/* Data */ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', /* Data */ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
}, },
.len = 1 + 2 + 1 + 10, .len = 1 + 2 + 1 + 10,
.min_sz = 1 + 2 + 1 + 1, .min_sz = 1 + 2 + 1 + 1,
}, },
}; };
unsigned i; unsigned i;
for (i = 0; i < sizeof(tests) / sizeof(tests[0]); ++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 #ifndef _MSC_VER
LSQ_INFO("testing version %s", lsquic_ver2str[version]); LSQ_INFO("testing version %s", lsquic_ver2str[version]);
#else #else
LSQ_INFO("testing version %d", version); LSQ_INFO("testing version %d", version);
#endif #endif
for (spec = test_specs; spec < test_specs + sizeof(test_specs) / sizeof(test_specs[0]); ++spec) for (spec = test_specs; spec < test_specs + sizeof(test_specs) / sizeof(test_specs[0]); ++spec)
run_test(spec, version); run_test(spec, version);

View file

@ -41,7 +41,6 @@ struct test {
}; };
static void static void
run_test (const struct test *const test) run_test (const struct test *const test)
{ {
@ -80,156 +79,156 @@ run_test (const struct test *const test)
int int
main (void) main (void)
{ {
const struct test tests[] = { const struct test tests[] = {
{ {
.pf = select_pf_by_ver(LSQVER_043), .pf = select_pf_by_ver(LSQVER_043),
.bufsz = GQUIC_MAX_PUBHDR_SZ, .bufsz = GQUIC_MAX_PUBHDR_SZ,
.cid = 0x0102030405060708UL, .cid = 0x0102030405060708UL,
.nonce = NULL, .nonce = NULL,
.packno = 0x01020304, .packno = 0x01020304,
.bits = GQUIC_PACKNO_LEN_4, .bits = GQUIC_PACKNO_LEN_4,
.len = 1 + 8 + 0 + 4, .len = 1 + 8 + 0 + 4,
.out = { (0 << 2) /* Nonce present */ .out = { (0 << 2) /* Nonce present */
| 0x08 /* Connection ID present */ | 0x08 /* Connection ID present */
| 0x20 /* Packet number length */ | 0x20 /* Packet number length */
, ,
0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, /* Connection ID */ 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, /* Connection ID */
0x01, 0x02, 0x03, 0x04, /* Packet number */ 0x01, 0x02, 0x03, 0x04, /* Packet number */
}, },
}, },
{ {
.pf = select_pf_by_ver(LSQVER_043), .pf = select_pf_by_ver(LSQVER_043),
.bufsz = GQUIC_MAX_PUBHDR_SZ, .bufsz = GQUIC_MAX_PUBHDR_SZ,
.cid = 0x0102030405060708UL, .cid = 0x0102030405060708UL,
.nonce = NULL, .nonce = NULL,
.packno = 0x00, .packno = 0x00,
.bits = GQUIC_PACKNO_LEN_1, .bits = GQUIC_PACKNO_LEN_1,
.len = 1 + 8 + 0 + 1, .len = 1 + 8 + 0 + 1,
.out = { (0 << 2) /* Nonce present */ .out = { (0 << 2) /* Nonce present */
| 0x08 /* Connection ID present */ | 0x08 /* Connection ID present */
| 0x00 /* Packet number length */ | 0x00 /* Packet number length */
, ,
0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, /* Connection ID */ 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, /* Connection ID */
0x00, /* Packet number */ 0x00, /* Packet number */
}, },
}, },
{ {
.pf = select_pf_by_ver(LSQVER_043), .pf = select_pf_by_ver(LSQVER_043),
.bufsz = GQUIC_MAX_PUBHDR_SZ, .bufsz = GQUIC_MAX_PUBHDR_SZ,
.cid = 0x0102030405060708UL, .cid = 0x0102030405060708UL,
.nonce = NULL, .nonce = NULL,
.packno = 0x09, .packno = 0x09,
.bits = GQUIC_PACKNO_LEN_1, .bits = GQUIC_PACKNO_LEN_1,
.ver.buf= { 'Q', '0', '4', '3', }, .ver.buf= { 'Q', '0', '4', '3', },
.len = 1 + 8 + 4 + 0 + 1, .len = 1 + 8 + 4 + 0 + 1,
.out = { (0 << 2) /* Nonce present */ .out = { (0 << 2) /* Nonce present */
| 0x01 /* Version present */ | 0x01 /* Version present */
| 0x08 /* Connection ID present */ | 0x08 /* Connection ID present */
| 0x00 /* Packet number length */ | 0x00 /* Packet number length */
, ,
0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, /* Connection ID */ 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, /* Connection ID */
'Q', '0', '4', '3', 'Q', '0', '4', '3',
0x09, /* Packet number */ 0x09, /* Packet number */
}, },
}, },
#define NONCENSE "0123456789abcdefghijklmnopqrstuv" #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_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), .pf = select_pf_by_ver(LSQVER_043),
.bufsz = GQUIC_MAX_PUBHDR_SZ, .bufsz = GQUIC_MAX_PUBHDR_SZ,
.cid = 0x0102030405060708UL, .cid = 0x0102030405060708UL,
.nonce = NONCENSE, .nonce = NONCENSE,
.packno = 0x00, .packno = 0x00,
.bits = GQUIC_PACKNO_LEN_1, .bits = GQUIC_PACKNO_LEN_1,
.len = 1 + 8 + 32 + 1, .len = 1 + 8 + 32 + 1,
.out = { (1 << 2) /* Nonce present */ .out = { (1 << 2) /* Nonce present */
| 0x08 /* Connection ID present */ | 0x08 /* Connection ID present */
| 0x00 /* Packet number length */ | 0x00 /* Packet number length */
, ,
0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, /* Connection ID */ 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, /* Connection ID */
NONCENSE_BYTES, NONCENSE_BYTES,
0x00, /* Packet number */ 0x00, /* Packet number */
}, },
}, },
{ {
.pf = select_pf_by_ver(LSQVER_043), .pf = select_pf_by_ver(LSQVER_043),
.bufsz = GQUIC_MAX_PUBHDR_SZ, .bufsz = GQUIC_MAX_PUBHDR_SZ,
.cid = 0, /* Do not set connection ID */ .cid = 0, /* Do not set connection ID */
.nonce = NONCENSE, .nonce = NONCENSE,
.packno = 0x00, .packno = 0x00,
.bits = GQUIC_PACKNO_LEN_1, .bits = GQUIC_PACKNO_LEN_1,
.len = 1 + 0 + 32 + 1, .len = 1 + 0 + 32 + 1,
.out = { (1 << 2) /* Nonce present */ .out = { (1 << 2) /* Nonce present */
| 0x00 /* Packet number length */ | 0x00 /* Packet number length */
, ,
NONCENSE_BYTES, NONCENSE_BYTES,
0x00, /* Packet number */ 0x00, /* Packet number */
}, },
}, },
{ {
.pf = select_pf_by_ver(LSQVER_043), .pf = select_pf_by_ver(LSQVER_043),
.bufsz = GQUIC_MAX_PUBHDR_SZ, .bufsz = GQUIC_MAX_PUBHDR_SZ,
.cid = 0x0102030405060708UL, .cid = 0x0102030405060708UL,
.nonce = NONCENSE, .nonce = NONCENSE,
.packno = 0x00, .packno = 0x00,
.bits = GQUIC_PACKNO_LEN_1, .bits = GQUIC_PACKNO_LEN_1,
.ver.buf= { 'Q', '0', '4', '3', }, .ver.buf= { 'Q', '0', '4', '3', },
.len = 1 + 8 + 4 + 32 + 1, .len = 1 + 8 + 4 + 32 + 1,
.out = { (1 << 2) /* Nonce present */ .out = { (1 << 2) /* Nonce present */
| 0x01 /* Version present */ | 0x01 /* Version present */
| 0x08 /* Connection ID present */ | 0x08 /* Connection ID present */
| 0x00 /* Packet number length */ | 0x00 /* Packet number length */
, ,
0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, /* Connection ID */ 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, /* Connection ID */
'Q', '0', '4', '3', 'Q', '0', '4', '3',
NONCENSE_BYTES, NONCENSE_BYTES,
0x00, /* Packet number */ 0x00, /* Packet number */
}, },
}, },
{ {
.pf = select_pf_by_ver(LSQVER_043), .pf = select_pf_by_ver(LSQVER_043),
.bufsz = GQUIC_MAX_PUBHDR_SZ, .bufsz = GQUIC_MAX_PUBHDR_SZ,
.cid = 0x0102030405060708UL, .cid = 0x0102030405060708UL,
.nonce = NONCENSE, .nonce = NONCENSE,
.packno = 0xA0A1A2A3A4A5A6A7UL, .packno = 0xA0A1A2A3A4A5A6A7UL,
.bits = GQUIC_PACKNO_LEN_6, .bits = GQUIC_PACKNO_LEN_6,
.len = 1 + 8 + 32 + 6, .len = 1 + 8 + 32 + 6,
.out = { (1 << 2) /* Nonce present */ .out = { (1 << 2) /* Nonce present */
| 0x08 /* Connection ID present */ | 0x08 /* Connection ID present */
| 0x30 /* Packet number length */ | 0x30 /* Packet number length */
, ,
0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, /* Connection ID */ 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, /* Connection ID */
NONCENSE_BYTES, NONCENSE_BYTES,
0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7,
}, },
}, },
{ {
.pf = select_pf_by_ver(LSQVER_043), .pf = select_pf_by_ver(LSQVER_043),
.bufsz = GQUIC_MAX_PUBHDR_SZ, .bufsz = GQUIC_MAX_PUBHDR_SZ,
.cid = 0x0102030405060708UL, .cid = 0x0102030405060708UL,
.nonce = NONCENSE, .nonce = NONCENSE,
.packno = 0xA0A1A2A3A4A5A6A7UL, .packno = 0xA0A1A2A3A4A5A6A7UL,
.bits = GQUIC_PACKNO_LEN_6, .bits = GQUIC_PACKNO_LEN_6,
.len = 1 + 8 + 32 + 6, .len = 1 + 8 + 32 + 6,
.out = { (1 << 2) /* Nonce present */ .out = { (1 << 2) /* Nonce present */
| 0x08 /* Connection ID present */ | 0x08 /* Connection ID present */
| 0x30 /* Packet number length */ | 0x30 /* Packet number length */
, ,
0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, /* Connection ID */ 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, /* Connection ID */
NONCENSE_BYTES, NONCENSE_BYTES,
0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7,
}, },
}, },
}; };
unsigned i; unsigned i;
for (i = 0; i < sizeof(tests) / sizeof(tests[0]); ++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); g_pf = select_pf_by_ver(LSQVER_043);
int opt; int opt;
lsquic_global_init(LSQUIC_GLOBAL_SERVER); lsquic_global_init(LSQUIC_GLOBAL_SERVER);

View file

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

View file

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

View file

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