lsquic_crt_compress.h revision 50aadb33
1/* Copyright (c) 2017 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
13enum entry_type {
14    END_OF_LIST = 0,
15    ENTRY_COMPRESSED = 1,
16    ENTRY_CACHED = 2,
17    ENTRY_COMMON = 3,
18};
19
20typedef struct cert_entry_st {
21    enum entry_type type;
22    uint32_t index;
23    uint64_t hash;
24    uint64_t set_hash;
25} cert_entry_t;
26
27typedef struct common_cert_st
28{
29    size_t num_certs;
30    const unsigned char* const* certs;
31    const size_t* lens;
32    uint64_t hash;
33} common_cert_t;
34
35struct lsquic_str * get_common_certs_hash();
36
37int get_certs_count(struct lsquic_str *compressed_crt_buf);
38int decompress_certs(const unsigned char *in, const unsigned char *in_end,
39                     struct lsquic_str *cached_certs, size_t cached_certs_count,
40                     struct lsquic_str **out_certs,
41                     size_t *out_certs_count);
42
43void
44lsquic_crt_cleanup (void);
45
46#ifdef __cplusplus
47}
48#endif
49
50#endif //__LSQUIC_CRT_COMPRESS_H__
51