diff options
author | Hugo Landau <hlandau@openssl.org> | 2024-01-22 15:08:37 +0100 |
---|---|---|
committer | Hugo Landau <hlandau@openssl.org> | 2024-02-08 17:50:00 +0100 |
commit | 7048339158a9ccfbbbeaa4d88baf74f06d41392e (patch) | |
tree | 4d0c93d48d874b4b7f9ba0ef9d8a701716679b91 /test/quic_multistream_test.c | |
parent | QUIC MULTISTREAM TEST: Test idle timeout configuration (diff) | |
download | openssl-7048339158a9ccfbbbeaa4d88baf74f06d41392e.tar.xz openssl-7048339158a9ccfbbbeaa4d88baf74f06d41392e.zip |
QUIC MULTISTREAM TEST: Test available stream count API
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23360)
Diffstat (limited to 'test/quic_multistream_test.c')
-rw-r--r-- | test/quic_multistream_test.c | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/test/quic_multistream_test.c b/test/quic_multistream_test.c index e5ae060dff..aeb4ca4d7e 100644 --- a/test/quic_multistream_test.c +++ b/test/quic_multistream_test.c @@ -5342,6 +5342,83 @@ static const struct script_op script_83[] = { OP_END }; +/* 82. Test query of available streams */ +static int check_avail_streams(struct helper *h, struct helper_local *hl) +{ + uint64_t v = 0; + + switch (hl->check_op->arg1) { + case 0: + if (!TEST_true(SSL_get_quic_stream_bidi_local_avail(h->c_conn, &v))) + return 0; + break; + case 1: + if (!TEST_true(SSL_get_quic_stream_bidi_remote_avail(h->c_conn, &v))) + return 0; + break; + case 2: + if (!TEST_true(SSL_get_quic_stream_uni_local_avail(h->c_conn, &v))) + return 0; + break; + case 3: + if (!TEST_true(SSL_get_quic_stream_uni_remote_avail(h->c_conn, &v))) + return 0; + break; + default: + return 0; + } + + if (!TEST_uint64_t_eq(v, hl->check_op->arg2)) + return 0; + + return 1; +} + +static const struct script_op script_82[] = { + OP_C_SET_ALPN ("ossltest") + OP_C_CONNECT_WAIT () + + OP_C_SET_DEFAULT_STREAM_MODE(SSL_DEFAULT_STREAM_MODE_NONE) + + OP_CHECK2 (check_avail_streams, 0, 100) + OP_CHECK2 (check_avail_streams, 1, 100) + OP_CHECK2 (check_avail_streams, 2, 100) + OP_CHECK2 (check_avail_streams, 3, 100) + + OP_C_NEW_STREAM_BIDI (a, C_BIDI_ID(0)) + + OP_CHECK2 (check_avail_streams, 0, 99) + OP_CHECK2 (check_avail_streams, 1, 100) + OP_CHECK2 (check_avail_streams, 2, 100) + OP_CHECK2 (check_avail_streams, 3, 100) + + OP_C_NEW_STREAM_UNI (b, C_UNI_ID(0)) + + OP_CHECK2 (check_avail_streams, 0, 99) + OP_CHECK2 (check_avail_streams, 1, 100) + OP_CHECK2 (check_avail_streams, 2, 99) + OP_CHECK2 (check_avail_streams, 3, 100) + + OP_S_NEW_STREAM_BIDI (a, S_BIDI_ID(0)) + OP_S_WRITE (a, "x", 1) + + OP_CHECK2 (check_avail_streams, 0, 99) + OP_CHECK2 (check_avail_streams, 1, 99) + OP_CHECK2 (check_avail_streams, 2, 99) + OP_CHECK2 (check_avail_streams, 3, 100) + + OP_S_NEW_STREAM_UNI (b, S_UNI_ID(0)) + OP_S_WRITE (b, "x", 1) + + OP_CHECK2 (check_avail_streams, 0, 99) + OP_CHECK2 (check_avail_streams, 1, 99) + OP_CHECK2 (check_avail_streams, 2, 99) + OP_CHECK2 (check_avail_streams, 3, 99) + + OP_END +}; + + static const struct script_op *const scripts[] = { script_1, script_2, |