summaryrefslogtreecommitdiffstats
path: root/net/http/http_pipelined_connection.h
blob: 59e61d6a48b75f68d0c3fff0e7a5b98a26932f9e (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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// Copyright (c) 2011 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_HTTP_HTTP_PIPELINED_CONNECTION_H_
#define NET_HTTP_HTTP_PIPELINED_CONNECTION_H_
#pragma once

#include "net/base/net_export.h"
#include "net/base/net_log.h"

namespace net {

class BoundNetLog;
class ClientSocketHandle;
class HttpPipelinedStream;
class ProxyInfo;
struct SSLConfig;

class NET_EXPORT_PRIVATE HttpPipelinedConnection {
 public:
  class Delegate {
   public:
    // Called when a pipeline has newly available capacity. This may be because
    // the first request has been sent and the pipeline is now active. Or, it
    // may be because a request successfully completed.
    virtual void OnPipelineHasCapacity(HttpPipelinedConnection* pipeline) = 0;
  };

  class Factory {
   public:
    virtual ~Factory() {}

    virtual HttpPipelinedConnection* CreateNewPipeline(
        ClientSocketHandle* connection,
        Delegate* delegate,
        const SSLConfig& used_ssl_config,
        const ProxyInfo& used_proxy_info,
        const BoundNetLog& net_log,
        bool was_npn_negotiated) = 0;
  };

  virtual ~HttpPipelinedConnection() {}

  // Returns a new stream that uses this pipeline.
  virtual HttpPipelinedStream* CreateNewStream() = 0;

  // The number of streams currently associated with this pipeline.
  virtual int depth() const = 0;

  // True if this pipeline can accept new HTTP requests. False if a fatal error
  // has occurred.
  virtual bool usable() const = 0;

  // True if this pipeline has bound one request and is ready for additional
  // requests.
  virtual bool active() const = 0;

  // The SSLConfig used to establish this connection.
  virtual const SSLConfig& used_ssl_config() const = 0;

  // The ProxyInfo used to establish this connection.
  virtual const ProxyInfo& used_proxy_info() const = 0;

  // The source of this pipelined connection.
  virtual const NetLog::Source& source() const = 0;

  // True if this connection was NPN negotiated.
  virtual bool was_npn_negotiated() const = 0;
};

}  // namespace net

#endif  // NET_HTTP_HTTP_PIPELINED_CONNECTION_H_