lsquic_ver_neg.h revision 06b2a236
1/* Copyright (c) 2017 - 2021 LiteSpeed Technologies Inc.  See LICENSE. */
2#ifndef LSQUIC_VER_NEG_H
3#define LSQUIC_VER_NEG_H
4
5/* Client engages in version negotiation, going from highest supported
6 * version to lowest.
7 */
8struct ver_neg {
9    unsigned            vn_supp;    /* Remaining options, including `vn_ver' */
10    enum lsquic_version vn_ver;     /* If client, current version sent to server
11                                     * (sess_resume version or highest supported);
12                                     * if server, this is set to negotiated version.
13                                     */
14    enum ver_neg_state {
15        VN_START,                   /* Have not received ver-nego packet */
16        VN_IN_PROGRESS,             /* Received ver-nego packet */
17        VN_END,                     /* Received packet using supported version */
18    }                   vn_state;
19    lsquic_ver_tag_t    vn_buf;     /* Buffer to store version tag */
20    lsquic_ver_tag_t   *vn_tag;     /* Pointer to version tag.  Set to NULL if
21                                     * version negotiation is done in the client;
22                                     * always set to NULL in server.
23                                     */
24};
25
26#endif
27