Home | History | Annotate | Download | only in spdy
      1 // Copyright 2014 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #ifndef NET_SPDY_HPACK_STATIC_TABLE_H_
      6 #define NET_SPDY_HPACK_STATIC_TABLE_H_
      7 
      8 #include "net/spdy/hpack_header_table.h"
      9 
     10 namespace net {
     11 
     12 struct HpackStaticEntry;
     13 
     14 // HpackStaticTable provides |static_entries_| and |static_index_| for HPACK
     15 // encoding and decoding contexts.  Once initialized, an instance is read only
     16 // and may be accessed only through its const interface.  Such an instance may
     17 // be shared accross multiple HPACK contexts.
     18 class NET_EXPORT_PRIVATE HpackStaticTable {
     19  public:
     20   HpackStaticTable();
     21   ~HpackStaticTable();
     22 
     23   // Prepares HpackStaticTable by filling up static_entries_ and static_index_
     24   // from an array of struct HpackStaticEntry.  Must be called exactly once.
     25   void Initialize(const HpackStaticEntry* static_entry_table,
     26                   size_t static_entry_count);
     27 
     28   // Returns whether Initialize() has been called.
     29   bool IsInitialized() const;
     30 
     31   // Accessors.
     32   const HpackHeaderTable::EntryTable& GetStaticEntries() const {
     33     return static_entries_;
     34   }
     35   const HpackHeaderTable::OrderedEntrySet& GetStaticIndex() const {
     36     return static_index_;
     37   }
     38 
     39  private:
     40   HpackHeaderTable::EntryTable static_entries_;
     41   HpackHeaderTable::OrderedEntrySet static_index_;
     42 };
     43 
     44 }  // namespace net
     45 
     46 #endif  // NET_SPDY_HPACK_STATIC_TABLE_H_
     47