tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

shared_dictionary_internal.h (2409B)


      1 /* Copyright 2017 Google Inc. All Rights Reserved.
      2 
      3   Distributed under MIT license.
      4   See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
      5 */
      6 
      7 /* (Transparent) Shared Dictionary definition. */
      8 
      9 #ifndef BROTLI_COMMON_SHARED_DICTIONARY_INTERNAL_H_
     10 #define BROTLI_COMMON_SHARED_DICTIONARY_INTERNAL_H_
     11 
     12 #include <brotli/shared_dictionary.h>
     13 
     14 #include "dictionary.h"
     15 #include "platform.h"
     16 #include "transform.h"
     17 
     18 #if defined(__cplusplus) || defined(c_plusplus)
     19 extern "C" {
     20 #endif
     21 
     22 struct BrotliSharedDictionaryStruct {
     23  /* LZ77 prefixes (compound dictionary). */
     24  uint32_t num_prefix;  /* max SHARED_BROTLI_MAX_COMPOUND_DICTS */
     25  size_t prefix_size[SHARED_BROTLI_MAX_COMPOUND_DICTS];
     26  const uint8_t* prefix[SHARED_BROTLI_MAX_COMPOUND_DICTS];
     27 
     28  /* If set, the context map is used to select word and transform list from 64
     29     contexts, if not set, the context map is not used and only words[0] and
     30     transforms[0] are to be used. */
     31  BROTLI_BOOL context_based;
     32 
     33  uint8_t context_map[SHARED_BROTLI_NUM_DICTIONARY_CONTEXTS];
     34 
     35  /* Amount of word_list+transform_list combinations. */
     36  uint8_t num_dictionaries;
     37 
     38  /* Must use num_dictionaries values. */
     39  const BrotliDictionary* words[SHARED_BROTLI_NUM_DICTIONARY_CONTEXTS];
     40 
     41  /* Must use num_dictionaries values. */
     42  const BrotliTransforms* transforms[SHARED_BROTLI_NUM_DICTIONARY_CONTEXTS];
     43 
     44  /* Amount of custom word lists. May be 0 if only Brotli's built-in is used */
     45  uint8_t num_word_lists;
     46 
     47  /* Contents of the custom words lists. Must be NULL if num_word_lists is 0. */
     48  BrotliDictionary* words_instances;
     49 
     50  /* Amount of custom transform lists. May be 0 if only Brotli's built-in is
     51     used */
     52  uint8_t num_transform_lists;
     53 
     54  /* Contents of the custom transform lists. Must be NULL if num_transform_lists
     55     is 0. */
     56  BrotliTransforms* transforms_instances;
     57 
     58  /* Concatenated prefix_suffix_maps of the custom transform lists. Must be NULL
     59     if num_transform_lists is 0. */
     60  uint16_t* prefix_suffix_maps;
     61 
     62  /* Memory management */
     63  brotli_alloc_func alloc_func;
     64  brotli_free_func free_func;
     65  void* memory_manager_opaque;
     66 };
     67 
     68 typedef struct BrotliSharedDictionaryStruct BrotliSharedDictionaryInternal;
     69 #define BrotliSharedDictionary BrotliSharedDictionaryInternal
     70 
     71 #if defined(__cplusplus) || defined(c_plusplus)
     72 }  /* extern "C" */
     73 #endif
     74 
     75 #endif  /* BROTLI_COMMON_SHARED_DICTIONARY_INTERNAL_H_ */