lsquic_crt_compress.h revision a5fa05f9
1/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */ 2#ifndef __LSQUIC_CRT_COMPRESS_H__ 3#define __LSQUIC_CRT_COMPRESS_H__ 4 5#include <stdint.h> 6 7struct lsquic_str; 8 9#ifdef __cplusplus 10extern "C" { 11#endif 12 13 14enum entry_type { 15 END_OF_LIST = 0, 16 ENTRY_COMPRESSED = 1, 17 ENTRY_CACHED = 2, 18 ENTRY_COMMON = 3, 19}; 20 21typedef struct cert_entry_st { 22 enum entry_type type; 23 uint32_t index; 24 uint64_t hash; 25 uint64_t set_hash; 26} cert_entry_t; 27 28 29typedef struct common_cert_st 30{ 31 size_t num_certs; 32 const unsigned char* const* certs; 33 const size_t* lens; 34 uint64_t hash; 35} common_cert_t; 36 37struct lsquic_str * lsquic_get_common_certs_hash(); 38 39 40int lsquic_get_common_cert(uint64_t hash, uint32_t index, struct lsquic_str *buf); 41 42int lsquic_compress_certs(struct lsquic_str **certs, size_t certs_count, 43 struct lsquic_str *client_common_set_hashes, 44 struct lsquic_str *client_cached_cert_hashes, 45 struct lsquic_str *result); 46 47int lsquic_get_certs_count(struct lsquic_str *compressed_crt_buf); 48int lsquic_decompress_certs(const unsigned char *in, const unsigned char *in_end, 49 struct lsquic_str *cached_certs, size_t cached_certs_count, 50 struct lsquic_str **out_certs, 51 size_t *out_certs_count); 52 53void 54lsquic_crt_cleanup (void); 55 56 57#ifdef __cplusplus 58} 59#endif 60 61 62#endif //__LSQUIC_CRT_COMPRESS_H__ 63