190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)// Copyright (c) 2013 The Chromium Authors. All rights reserved.
290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)// found in the LICENSE file.
490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#ifndef NET_SPDY_SPDY_SESSION_KEY_H_
690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#define NET_SPDY_SPDY_SESSION_KEY_H_
790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#include "net/base/privacy_mode.h"
990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#include "net/proxy/proxy_server.h"
1090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
1190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)namespace net {
1290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
1390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)// SpdySessionKey is used as unique index for SpdySessionPool.
1490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)class NET_EXPORT_PRIVATE SpdySessionKey {
1590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) public:
1690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  SpdySessionKey();
1790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  SpdySessionKey(const HostPortPair& host_port_pair,
1890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)                 const ProxyServer& proxy_server,
1990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)                 PrivacyMode privacy_mode);
2090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
2190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // Temporary hack for implicit copy constructor
2290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  SpdySessionKey(const HostPortProxyPair& host_port_proxy_pair,
2390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)                 PrivacyMode privacy_mode);
2490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
2590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  ~SpdySessionKey();
2690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
2790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // Comparator function so this can be placed in a std::map.
2890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  bool operator<(const SpdySessionKey& other) const;
2990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
3090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // Equality test of contents. (Probably another violation of style guide).
3190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  bool Equals(const SpdySessionKey& other) const;
3290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
3390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  const HostPortProxyPair& host_port_proxy_pair() const {
3490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)    return host_port_proxy_pair_;
3590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  }
3690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
3790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  const HostPortPair& host_port_pair() const {
3890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)    return host_port_proxy_pair_.first;
3990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  }
4090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
4190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  const ProxyServer& proxy_server() const {
4290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)    return host_port_proxy_pair_.second;
4390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  }
4490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
4590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  PrivacyMode privacy_mode() const {
4690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)    return privacy_mode_;
4790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  }
4890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
4990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) private:
5090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  HostPortProxyPair host_port_proxy_pair_;
5190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // If enabled, then session cannot be tracked by the server.
5290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  PrivacyMode privacy_mode_;
5390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)};
5490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
5590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)}  // namespace net
5690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
5790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#endif  // NET_SPDY_SPDY_SESSION_KEY_H_
5890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
59