| Index: net/spdy/hpack_header_table.h
|
| diff --git a/net/spdy/hpack_header_table.h b/net/spdy/hpack_header_table.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..c40e9d026e28fb7680a4b7adb0f928c7aadee71d
|
| --- /dev/null
|
| +++ b/net/spdy/hpack_header_table.h
|
| @@ -0,0 +1,65 @@
|
| +#ifndef NET_SPDY_HPACK_HEADER_TABLE_H_
|
| +#define NET_SPDY_HPACK_HEADER_TABLE_H_
|
| +
|
| +#include <cstddef>
|
| +#include <deque>
|
| +#include <vector>
|
| +
|
| +#include "base/basictypes.h"
|
| +#include "base/macros.h"
|
| +#include "net/spdy/hpack_entry.h"
|
| +
|
| +namespace net {
|
| +
|
| +// All section references below are to
|
| +// http://tools.ietf.org/html/draft-ietf-httpbis-header-compression-04
|
| +// .
|
| +
|
| +// A data structure for both the header table (described in 3.1.2) and
|
| +// the reference set (3.1.3). This structure also keeps track of how
|
| +// many times a header has been 'touched', which is useful for both
|
| +// encoding and decoding.
|
| +class HpackHeaderTable {
|
| + public:
|
| + HpackHeaderTable();
|
| +
|
| + ~HpackHeaderTable();
|
| +
|
| + uint32 size() const { return size_; }
|
| + uint32 max_size() const { return max_size_; }
|
| +
|
| + // Returns the total number of entries.
|
| + uint32 GetEntryCount() const;
|
| +
|
| + // The given index must be >= 0 and < GetEntryCount().
|
| + const HpackEntry& GetEntry(uint32 index) const;
|
| +
|
| + // The given index must be >= 0 and < GetEntryCount().
|
| + HpackEntry* GetMutableEntry(uint32 index);
|
| +
|
| + // Sets the maximum size of the header table, evicting entries if
|
| + // necessary as described in 3.3.2.
|
| + void SetMaxSize(uint32 max_size);
|
| +
|
| + // The given entry must not be one from the header table, since it
|
| + // may get evicted. Tries to add the given entry to the header
|
| + // table, evicting entries if necessary as described in 3.3.3. index
|
| + // will be filled in with the index of the added entry, or -1 if the
|
| + // entry could not be added. removed_referenced_indices will be
|
| + // filled in with the indices of any removed entries that were in
|
| + // the reference set.
|
| + void TryAddEntry(const HpackEntry& entry,
|
| + int32* index,
|
| + std::vector<uint32>* removed_referenced_indices);
|
| +
|
| + private:
|
| + std::deque<HpackEntry> entries_;
|
| + uint32 size_;
|
| + uint32 max_size_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(HpackHeaderTable);
|
| +};
|
| +
|
| +} // namespace net
|
| +
|
| +#endif // NET_SPDY_HPACK_HEADER_TABLE_H_
|
|
|