lsquic_ver_neg.h revision 229fce07
1229fce07SDmitri Tikhonov/* Copyright (c) 2017 - 2019 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' */
1050aadb33SDmitri Tikhonov    enum lsquic_version vn_ver;     /* If client, current version sent to server;
1150aadb33SDmitri Tikhonov                                     * if server, this is set to negotiated version.
1250aadb33SDmitri Tikhonov                                     */
1350aadb33SDmitri Tikhonov    enum ver_neg_state {
1450aadb33SDmitri Tikhonov        VN_START,                   /* Have not received ver-nego packet */
1550aadb33SDmitri Tikhonov        VN_IN_PROGRESS,             /* Received ver-nego packet */
1650aadb33SDmitri Tikhonov        VN_END,                     /* Received packet using supported version */
1750aadb33SDmitri Tikhonov    }                   vn_state;
1850aadb33SDmitri Tikhonov    lsquic_ver_tag_t    vn_buf;     /* Buffer to store version tag */
1950aadb33SDmitri Tikhonov    lsquic_ver_tag_t   *vn_tag;     /* Pointer to version tag.  Set to NULL if
2050aadb33SDmitri Tikhonov                                     * version negotiation is done in the client;
2150aadb33SDmitri Tikhonov                                     * always set to NULL in server.
2250aadb33SDmitri Tikhonov                                     */
2350aadb33SDmitri Tikhonov};
2450aadb33SDmitri Tikhonov
2550aadb33SDmitri Tikhonov#endif
26