Land Recent QUIC Changes.
[chromium-blink-merge.git] / net / quic / quic_spdy_compressor.h
blob6efb73c74bda11aa6836be59aef49f231118f658
1 // Copyright (c) 2013 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.
5 #ifndef NET_QUIC_QUIC_SPDY_COMPRESSOR_H_
6 #define NET_QUIC_QUIC_SPDY_COMPRESSOR_H_
8 #include <string>
10 #include "net/base/net_export.h"
11 #include "net/quic/quic_protocol.h"
12 #include "net/spdy/spdy_framer.h"
14 namespace net {
16 // Handles the compression of request/response headers blocks. The
17 // serialized format is:
18 // uint32 - Priority
19 // uint32 - Header ID
20 // uint32 - Compressed header length
21 // ... - Compressed data
23 class NET_EXPORT_PRIVATE QuicSpdyCompressor {
24 public:
25 QuicSpdyCompressor();
26 ~QuicSpdyCompressor();
28 // Returns a string comprised of [header_sequence_id, compressed_headers].
29 std::string CompressHeaders(const SpdyHeaderBlock& headers);
31 // Returns a string comprised of
32 // [priority, header_sequence_id, compressed_headers]
33 std::string CompressHeadersWithPriority(QuicPriority priority,
34 const SpdyHeaderBlock& headers);
36 private:
37 std::string CompressHeadersInternal(QuicPriority priority,
38 const SpdyHeaderBlock& headers,
39 bool write_priority);
41 SpdyFramer spdy_framer_;
42 QuicHeaderId header_sequence_id_;
44 DISALLOW_COPY_AND_ASSIGN(QuicSpdyCompressor);
47 } // namespace net
49 #endif // NET_QUIC_QUIC_SPDY_COMPRESSOR_H_