summaryrefslogtreecommitdiffstats
path: root/net/spdy/hpack_encoder.h
blob: ea15cc6b0f952f3ac174913cfa35df1a680b5135 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef NET_SPDY_HPACK_ENCODER_H_
#define NET_SPDY_HPACK_ENCODER_H_

#include <map>
#include <string>

#include "base/basictypes.h"
#include "base/macros.h"
#include "net/base/net_export.h"
#include "net/spdy/hpack_encoding_context.h"

namespace net {

// An HpackEncoder encodes header sets as outlined in
// http://tools.ietf.org/html/draft-ietf-httpbis-header-compression-05
// .
class NET_EXPORT_PRIVATE HpackEncoder {
 public:
  explicit HpackEncoder(uint32 max_string_literal_size);
  ~HpackEncoder();

  // Encodes the given header set into the given string. Returns
  // whether or not the encoding was successful.
  bool EncodeHeaderSet(const std::map<std::string, std::string>& header_set,
                       std::string* output);

 private:
  const uint32 max_string_literal_size_;
  HpackEncodingContext context_;

  DISALLOW_COPY_AND_ASSIGN(HpackEncoder);
};

}  // namespace net

#endif  // NET_SPDY_HPACK_ENCODER_H_