lsquic_enc_sess_common.c revision 7d09751d
1/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */ 2#include <stddef.h> 3#include <stdint.h> 4#include <string.h> 5 6#include "lsquic.h" 7#include "lsquic_types.h" 8#include "lsquic_int_types.h" 9#include "lsquic_enc_sess.h" 10#include "lsquic_version.h" 11 12 13const char *const lsquic_enclev2str[] = 14{ 15 [ENC_LEV_EARLY] = "early", 16 [ENC_LEV_CLEAR] = "clear", 17 [ENC_LEV_INIT] = "initial", 18 [ENC_LEV_FORW] = "forw-secure", 19}; 20 21 22enum lsquic_version 23lsquic_zero_rtt_version (const unsigned char *buf, size_t bufsz) 24{ 25 lsquic_ver_tag_t tag; 26 27 if (bufsz >= sizeof(tag)) 28 { 29 memcpy(&tag, buf, sizeof(tag)); 30 return lsquic_tag2ver(tag); 31 } 32 else 33 return N_LSQVER; 34} 35