test/unittests/test_stream.c
/* Create a new stream frame.  Each stream frame has a real packet_in to
 * back it up, just like in real code.  The contents of the packet do
 * not matter.
 */
Create a new stream frame.  Each stream frame has a real packet_in to
back it up, just like in real code.  The contents of the packet do
not matter.
Create a new stream frame . Each stream frame has a real packet_in to back it up just like in real code . The contents of the packet do not matter .
static stream_frame_t *
new_frame_in_ext (struct test_objs *tobjs, size_t off, size_t sz, int fin,
                                                            const void *data)
{
    lsquic_packet_in_t *packet_in;
    stream_frame_t *frame;
    assert(sz <= 1370);
    packet_in = lsquic_mm_get_packet_in(&tobjs->eng_pub.enp_mm);
    if (data)
        packet_in->pi_data = (void *) data;
    else
    {
        packet_in->pi_data = lsquic_mm_get_packet_in_buf(&tobjs->eng_pub.enp_mm, 1370);
        packet_in->pi_flags |= PI_OWN_DATA;
        memset(packet_in->pi_data, 'A', sz);
    }
    packet_in->pi_data_sz = sz;
    packet_in->pi_refcnt = 1;
    frame = lsquic_malo_get(tobjs->eng_pub.enp_mm.malo.stream_frame);
    memset(frame, 0, sizeof(*frame));
    frame->packet_in = packet_in;
    frame->data_frame.df_offset = off;
    frame->data_frame.df_size = sz;
    frame->data_frame.df_data = &packet_in->pi_data[0];
    frame->data_frame.df_fin  = fin;
    return frame;
}
static stream_frame_t * new_frame_in_ext ( struct test_objs * tobjs , size_t off , size_t sz , int fin , const void * data ) { lsquic_packet_in_t * packet_in ; stream_frame_t * frame ; assert ( sz <= 1370 ) ; packet_in = lsquic_mm_get_packet_in ( & tobjs -> eng_pub . enp_mm ) ; if ( data ) packet_in -> pi_data = ( void * ) data ; else { packet_in -> pi_data = lsquic_mm_get_packet_in_buf ( & tobjs -> eng_pub . enp_mm , 1370 ) ; packet_in -> pi_flags |= PI_OWN_DATA ; memset ( packet_in -> pi_data , ' ' , sz ) ; } packet_in -> pi_data_sz = sz ; packet_in -> pi_refcnt = 1 ; frame = lsquic_malo_get ( tobjs -> eng_pub . enp_mm . malo . stream_frame ) ; memset ( frame , 0 , sizeof ( * frame ) ) ; frame -> packet_in = packet_in ; frame -> data_frame . df_offset = off ; frame -> data_frame . df_size = sz ; frame -> data_frame . df_data = & packet_in -> pi_data [ 0 ] ; frame -> data_frame . df_fin = fin ; return frame ; }
Create a new stream frame.
Create a new stream frame .
/* This is not how stream frame looks in the packet: we have no
     * header.  In our test case it does not matter, as we only care
     * about stream frame.
     */