mirror of
https://gitea.invidious.io/iv-org/litespeed-quic.git
synced 2024-08-15 00:53:43 +00:00
91 lines
3 KiB
C
91 lines
3 KiB
C
/* Copyright (c) 2017 LiteSpeed Technologies Inc. See LICENSE. */
|
|
#include <assert.h>
|
|
#include <errno.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <sys/queue.h>
|
|
#include <sys/types.h>
|
|
#include <sys/stat.h>
|
|
#ifndef WIN32
|
|
#include <unistd.h>
|
|
#endif
|
|
#include <fcntl.h>
|
|
|
|
#include <openssl/md5.h>
|
|
|
|
#include "lsquic.h"
|
|
|
|
#include "lsquic_int_types.h"
|
|
#include "lsquic_packet_common.h"
|
|
#include "lsquic_packet_out.h"
|
|
#include "lsquic_conn_flow.h"
|
|
#include "lsquic_sfcw.h"
|
|
#include "lsquic_stream.h"
|
|
#include "lsquic_types.h"
|
|
#include "lsquic_malo.h"
|
|
#include "lsquic_mm.h"
|
|
#include "lsquic_engine_public.h"
|
|
#include "lsquic_logger.h"
|
|
|
|
|
|
int
|
|
main (void)
|
|
{
|
|
struct lsquic_engine_public enpub;
|
|
struct packet_out_srec_iter posi;
|
|
lsquic_packet_out_t *packet_out;
|
|
struct lsquic_stream streams[6];
|
|
struct stream_rec *srec;
|
|
|
|
memset(&enpub, 0, sizeof(enpub));
|
|
memset(&streams, 0, sizeof(streams));
|
|
lsquic_mm_init(&enpub.enp_mm);
|
|
packet_out = lsquic_mm_get_packet_out(&enpub.enp_mm, NULL, QUIC_MAX_PAYLOAD_SZ);
|
|
|
|
lsquic_packet_out_add_stream(packet_out, &enpub.enp_mm, &streams[0], QUIC_FRAME_STREAM, 7, 1);
|
|
lsquic_packet_out_add_stream(packet_out, &enpub.enp_mm, &streams[1], QUIC_FRAME_STREAM, 8, 1);
|
|
lsquic_packet_out_add_stream(packet_out, &enpub.enp_mm, &streams[2], QUIC_FRAME_STREAM, 9, 1);
|
|
lsquic_packet_out_add_stream(packet_out, &enpub.enp_mm, &streams[1], QUIC_FRAME_RST_STREAM, 10, 0);
|
|
lsquic_packet_out_add_stream(packet_out, &enpub.enp_mm, &streams[3], QUIC_FRAME_STREAM, 11, 1);
|
|
lsquic_packet_out_add_stream(packet_out, &enpub.enp_mm, &streams[4], QUIC_FRAME_STREAM, 12, 1);
|
|
lsquic_packet_out_add_stream(packet_out, &enpub.enp_mm, &streams[5], QUIC_FRAME_STREAM, 13, 1);
|
|
|
|
srec = posi_first(&posi, packet_out);
|
|
assert(srec->sr_stream == &streams[0]);
|
|
assert(srec->sr_off == 7);
|
|
assert(srec->sr_frame_types == (1 << QUIC_FRAME_STREAM));
|
|
|
|
srec = posi_next(&posi);
|
|
assert(srec->sr_stream == &streams[1]);
|
|
assert(srec->sr_off == 8);
|
|
assert(srec->sr_frame_types == ((1 << QUIC_FRAME_STREAM)|(1 << QUIC_FRAME_RST_STREAM)));
|
|
|
|
srec = posi_next(&posi);
|
|
assert(srec->sr_stream == &streams[2]);
|
|
assert(srec->sr_off == 9);
|
|
assert(srec->sr_frame_types == (1 << QUIC_FRAME_STREAM));
|
|
|
|
srec = posi_next(&posi);
|
|
assert(srec->sr_stream == &streams[3]);
|
|
assert(srec->sr_off == 11);
|
|
assert(srec->sr_frame_types == (1 << QUIC_FRAME_STREAM));
|
|
|
|
srec = posi_next(&posi);
|
|
assert(srec->sr_stream == &streams[4]);
|
|
assert(srec->sr_off == 12);
|
|
assert(srec->sr_frame_types == (1 << QUIC_FRAME_STREAM));
|
|
|
|
srec = posi_next(&posi);
|
|
assert(srec->sr_stream == &streams[5]);
|
|
assert(srec->sr_off == 13);
|
|
assert(srec->sr_frame_types == (1 << QUIC_FRAME_STREAM));
|
|
|
|
assert((void *) 0 == posi_next(&posi));
|
|
|
|
lsquic_packet_out_destroy(packet_out, &enpub);
|
|
assert(!lsquic_malo_first(enpub.enp_mm.malo.stream_rec_arr));
|
|
|
|
lsquic_mm_cleanup(&enpub.enp_mm);
|
|
return 0;
|
|
}
|