1a74702c6SGeorge Wang/* Copyright (c) 2017 - 2022 LiteSpeed Technologies Inc.  See LICENSE. */
250aadb33SDmitri Tikhonov#ifndef LSQUIC_VER_NEG_H
350aadb33SDmitri Tikhonov#define LSQUIC_VER_NEG_H
450aadb33SDmitri Tikhonov
550aadb33SDmitri Tikhonov/* Client engages in version negotiation, going from highest supported
650aadb33SDmitri Tikhonov * version to lowest.
750aadb33SDmitri Tikhonov */
850aadb33SDmitri Tikhonovstruct ver_neg {
950aadb33SDmitri Tikhonov    unsigned            vn_supp;    /* Remaining options, including `vn_ver' */
1033291708SDmitri Tikhonov    enum lsquic_version vn_ver;     /* If client, current version sent to server
117483dee0SDmitri Tikhonov                                     * (sess_resume version or highest supported);
1250aadb33SDmitri Tikhonov                                     * if server, this is set to negotiated version.
1350aadb33SDmitri Tikhonov                                     */
1450aadb33SDmitri Tikhonov    enum ver_neg_state {
1550aadb33SDmitri Tikhonov        VN_START,                   /* Have not received ver-nego packet */
1650aadb33SDmitri Tikhonov        VN_IN_PROGRESS,             /* Received ver-nego packet */
1750aadb33SDmitri Tikhonov        VN_END,                     /* Received packet using supported version */
1850aadb33SDmitri Tikhonov    }                   vn_state;
1950aadb33SDmitri Tikhonov    lsquic_ver_tag_t    vn_buf;     /* Buffer to store version tag */
2050aadb33SDmitri Tikhonov    lsquic_ver_tag_t   *vn_tag;     /* Pointer to version tag.  Set to NULL if
2150aadb33SDmitri Tikhonov                                     * version negotiation is done in the client;
2250aadb33SDmitri Tikhonov                                     * always set to NULL in server.
2350aadb33SDmitri Tikhonov                                     */
2450aadb33SDmitri Tikhonov};
2550aadb33SDmitri Tikhonov
2650aadb33SDmitri Tikhonov#endif
27