Packages
hackney
3.0.0
4.7.2
4.7.1
4.7.0
4.6.1
4.6.0
4.5.2
4.5.1
4.5.0
4.4.5
4.4.3
4.4.2
4.4.1
4.4.0
4.3.0
4.2.3
4.2.2
4.2.1
4.2.0
4.1.0
4.0.3
4.0.2
4.0.1
4.0.0
3.2.1
3.2.0
3.1.2
3.1.1
3.1.0
3.0.3
3.0.2
3.0.1
3.0.0
retired
2.0.1
2.0.0
2.0.0-beta.1
1.25.0
1.24.1
1.24.0
1.23.0
1.22.0
1.21.0
1.20.1
1.20.0
1.19.1
1.19.0
1.18.2
1.18.1
1.18.0
1.17.4
1.17.3
1.17.2
1.17.1
1.17.0
1.16.0
1.15.2
1.15.1
1.15.0
1.14.3
1.14.2
1.14.0
1.13.0
1.12.1
1.12.0
1.11.0
1.10.1
1.10.0
1.9.0
1.8.6
1.8.5
1.8.4
1.8.3
1.8.2
1.8.0
1.7.1
1.7.0
1.6.6
retired
1.6.5
1.6.4
retired
1.6.3
1.6.2
1.6.1
1.6.0
1.5.7
1.5.6
1.5.5
1.5.4
1.5.3
1.5.2
1.5.1
1.5.0
1.4.10
1.4.8
1.4.7
1.4.6
1.4.5
1.4.4
1.4.3
1.4.2
1.4.1
1.4.0
1.3.2
1.3.1
1.3.0
1.2.0
1.1.0
1.0.6
1.0.5
1.0.2
1.0.1
0.15.2
0.15.0
0.14.3
0.14.2
0.14.1
0.14.0
0.13.1
Simple HTTP client with HTTP/1.1, HTTP/2, and HTTP/3 support
Retired package: Release invalid - Use 3.0.1 instead
Security advisory:
This version has known vulnerabilities.
View advisories
Current section
Files
Jump to
Current section
Files
c_src/lsquic/src/liblsquic/lsquic_mini_conn.h
/* Copyright (c) 2017 - 2022 LiteSpeed Technologies Inc. See LICENSE. */
/*
* lsquic_mini_conn.h -- Mini-connection
*
* Before a connection is established, the server keeps a "mini" connection
* object where it keeps track of stream 1 offsets and so on.
*/
#ifndef LSQUIC_MINI_CONN_H
#define LSQUIC_MINI_CONN_H
#include <stdint.h>
#include <sys/queue.h>
#define MAX_MINI_CONN_LIFESPAN_IN_USEC \
((1 << (sizeof(((struct mini_conn *) 0)->mc_largest_recv) * 8)) - 1)
struct lsquic_packet_in;
struct lsquic_packet_out;
struct lsquic_engine_public;
#ifndef LSQUIC_KEEP_MINICONN_HISTORY
# if !defined(NDEBUG) && !defined(_MSC_VER)
# define LSQUIC_KEEP_MINICONN_HISTORY 1
# else
# define LSQUIC_KEEP_MINICONN_HISTORY 0
# endif
#endif
#if LSQUIC_KEEP_MINICONN_HISTORY
#define MCHIST_BITS 4
#define MCHIST_MASK ((1 << MCHIST_BITS) - 1)
typedef unsigned char mchist_idx_t;
enum miniconn_history_event
{
MCHE_EMPTY = '\0',
MCHE_PLUS = '+',
MCHE_HANDLE_1RTT = '1',
MCHE_HANDLE_SREJ = '2',
MCHE_PACKET2LARGE_IN = 'a',
MCHE_CONN_CLOSE = 'c',
MCHE_CREATED = 'C',
MCHE_2HSK_1STREAM = 'd',
MCHE_DUP_HSK = 'D',
MCHE_HANDLE_ERROR = 'e',
MCHE_EFRAME = 'f',
MCHE_UNDECR_DEFER = 'F',
MCHE_HANDLE_NOT_ENOUGH = 'g',
MCHE_NEW_HSK = 'H',
MCHE_INVALID_FRAME = 'I',
MCHE_DECRYPTED = 'K',
MCHE_PACKET_LOST = 'L',
MCHE_HELLO_TOO_MUCH = 'm',
MCHE_ENOMEM = 'M',
MCHE_NEW_PACKET_OUT = 'N',
MCHE_HELLO_HOLE = 'o',
MCHE_PACKET_DUP_IN = 'p',
MCHE_UNDECR_DROP = 'P',
MCHE_PRST_IN = 'R',
MCHE_HANDLE_SHLO = 's',
MCHE_NEW_ENC_SESS = 'S',
MCHE_PACKET_SENT = 'T',
MCHE_HAHDLE_UNKNOWN = 'u',
MCHE_UNSENT_ACKED = 'U',
MCHE_HANDLE_DELAYED = 'y',
MCHE_PACKET_DELAYED = 'Y',
MCHE_PACKET0_IN = 'z',
MCHE_OUT_OF_PACKNOS = '#',
};
#endif
#ifndef LSQUIC_RECORD_INORD_HIST
# if __GNUC__
# define LSQUIC_RECORD_INORD_HIST 1
# else
# define LSQUIC_RECORD_INORD_HIST 0
# endif
#endif
typedef uint64_t mconn_packno_set_t;
#define MINICONN_MAX_PACKETS (sizeof(mconn_packno_set_t) * 8)
TAILQ_HEAD(head_packet_in, lsquic_packet_in);
struct mini_conn {
struct lsquic_conn mc_conn;
struct conn_cid_elem mc_cces[1];
struct head_packet_in mc_deferred,
mc_packets_in;
TAILQ_HEAD(, lsquic_packet_out)
mc_packets_out;
struct lsquic_engine_public
*mc_enpub;
lsquic_time_t mc_created;
struct lsquic_rtt_stats
mc_rtt_stats;
mconn_packno_set_t mc_received_packnos,
mc_sent_packnos,
mc_deferred_packnos, /* Informational */
mc_dropped_packnos, /* Informational */
mc_lost_packnos, /* Packets that were deemed lost */ /* Informational */
mc_acked_packnos;
#if LSQUIC_RECORD_INORD_HIST
unsigned long long mc_inord_hist[2]; /* Informational */
#endif
uint32_t mc_error_code; /* From CONNECTION_CLOSE frame */ /* Informational */
unsigned short mc_n_ticks; /* Number of times mini conn ticked. */ /* Informational */
unsigned short mc_read_off, /* Read offset for stream 1 */
mc_write_off;/* Write offset for stream 1 */
unsigned char mc_max_ack_packno,
mc_cutoff,
mc_cur_packno;
unsigned char mc_hsk_count;
#define MINI_CONN_MAX_DEFERRED 10
unsigned char mc_n_deferred;
#if LSQUIC_RECORD_INORD_HIST
unsigned char mc_inord_idx;
#endif
/* mc_largest_recv is the timestamp of when packet with the largest
* number was received; it is necessary to generate ACK frames. 24
* bits holds about 16.5 seconds worth of microseconds, which is
* larger than the maximum amount of time a mini connection object
* is allowed to live. To get the timestamp, add this value to
* mc_created.
*/
unsigned char mc_largest_recv[3];
enum {
MC_HAVE_NEW_HSK = (1 << 0),
MC_PROMOTE = (1 << 1),
MC_HAVE_SHLO = (1 << 2),
MC_WR_OFF_RESET = (1 << 3),
MC_ERROR = (1 << 4),
MC_UNSENT_ACK = (1 << 5),
MC_GEN_ACK = (1 << 6),
MC_HSK_ERR = (1 << 7),
MC_OO_PACKNOS = (1 << 8),
MC_STOP_WAIT_ON = (1 << 9),
} mc_flags:16;
struct network_path mc_path;
#if LSQUIC_KEEP_MINICONN_HISTORY
mchist_idx_t mc_hist_idx;
unsigned char mc_hist_buf[1 << MCHIST_BITS];
#endif
};
lsquic_conn_t *
lsquic_mini_conn_new (struct lsquic_engine_public *,
const struct lsquic_packet_in *, enum lsquic_version version);
/* Packet numbers start with 1. By subtracting 1, we can utilize the full
* length of the bitmask.
*/
#define MCONN_PACKET_MASK(packno) (1ULL << (packno - 1))
#endif