1// Copyright (c) 2010 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_SPDY_SETTING_STORAGE_H_
6#define NET_SPDY_SPDY_SETTING_STORAGE_H_
7#pragma once
8
9#include <map>
10#include "base/basictypes.h"
11#include "net/base/host_port_pair.h"
12#include "net/spdy/spdy_framer.h"
13
14namespace net {
15
16// SpdySettingsStorage stores SpdySettings which have been transmitted between
17// endpoints for the SPDY SETTINGS frame.
18class SpdySettingsStorage {
19 public:
20  SpdySettingsStorage();
21  ~SpdySettingsStorage();
22
23  // Get a copy of the SpdySettings stored for a host.
24  // If no settings are stored, returns an empty set of settings.
25  const spdy::SpdySettings& Get(const HostPortPair& host_port_pair) const;
26
27  // Save settings for a host.
28  void Set(const HostPortPair& host_port_pair,
29           const spdy::SpdySettings& settings);
30
31 private:
32  typedef std::map<HostPortPair, spdy::SpdySettings> SettingsMap;
33
34  SettingsMap settings_map_;
35
36  DISALLOW_COPY_AND_ASSIGN(SpdySettingsStorage);
37};
38
39}  // namespace net
40
41#endif  // NET_SPDY_SPDY_SETTING_STORAGE_H_
42
43