
ngtcp2_conn_write_aggregate_pkt
===============================

Synopsis
--------

*#include <ngtcp2/ngtcp2.h>*

.. function:: ngtcp2_ssize ngtcp2_conn_write_aggregate_pkt( ngtcp2_conn *conn, ngtcp2_path *path, ngtcp2_pkt_info *pi, uint8_t *buf, size_t buflen, size_t *pgsolen, ngtcp2_write_pkt write_pkt, ngtcp2_tstamp ts)

    
    `ngtcp2_conn_write_aggregate_pkt` is a helper function to write
    multiple packets in the provided buffer, which is suitable to be
    sent at once in GSO.  This function returns the number of bytes
    written to the buffer pointed by *buf* of length *buflen*.
    *buflen* must be at least
    `ngtcp2_conn_get_path_max_tx_udp_payload_size(conn)
    <ngtcp2_conn_get_path_max_tx_udp_payload_size>` bytes long.  It is
    recommended to pass the buffer at least
    `ngtcp2_conn_get_max_tx_udp_payload_size(conn)
    <ngtcp2_conn_get_max_tx_udp_payload_size>` bytes in order to send a
    PMTUD packet.  This function only writes multiple packets if the
    first packet is `ngtcp2_conn_get_path_max_tx_udp_payload_size(conn)
    <ngtcp2_conn_get_path_max_tx_udp_payload_size>` bytes long.  The
    application can adjust the length of the buffer to limit the number
    of packets to aggregate (or use `ngtcp2_conn_write_aggregate_pkt2`
    to control the number of packets to write directly).  If this
    function returns positive integer, all packets share the same
    :type:`ngtcp2_path` and :type:`ngtcp2_pkt_info` values, and they
    are assigned to the objects pointed by *path* and *pi*
    respectively.  The length of all packets other than the last packet
    is assigned to *\*pgsolen*.  The length of last packet is equal to
    or less than *\*pgsolen*.  *write_pkt* must write a single packet.
    After all packets are written, this function calls
    `ngtcp2_conn_update_pkt_tx_time`.
    
    This function is equivalent to call
    `ngtcp2_conn_write_aggregate_pkt2` with *buflen* = min(*buflen*,
    `ngtcp2_conn_get_send_quantum(conn)
    <ngtcp2_conn_get_send_quantum>`) and *num_pkts* = 0 followed by
    `ngtcp2_conn_update_pkt_tx_time(conn)
    <ngtcp2_conn_update_pkt_tx_time>`.
    
    This function returns the number of bytes written to the buffer, or
    a negative error code returned by *write_pkt*.
    
    This function has been available since v1.15.0.
