~alinuxninja/nginx-edge/trunk

« back to all changes in this revision

Viewing changes to debian/modules/ngx_pagespeed/psol/include/third_party/mod_spdy/src/mod_spdy/apache/master_connection_context.h

  • Committer: Vivian
  • Date: 2015-12-04 18:20:11 UTC
  • Revision ID: git-v1:a36f2bc32e884f7473b3a47040e5411306144d7d
* Do not extract psol.tar.gz

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// Copyright 2010 Google Inc.
2
 
//
3
 
// Licensed under the Apache License, Version 2.0 (the "License");
4
 
// you may not use this file except in compliance with the License.
5
 
// You may obtain a copy of the License at
6
 
//
7
 
//      http://www.apache.org/licenses/LICENSE-2.0
8
 
//
9
 
// Unless required by applicable law or agreed to in writing, software
10
 
// distributed under the License is distributed on an "AS IS" BASIS,
11
 
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
 
// See the License for the specific language governing permissions and
13
 
// limitations under the License.
14
 
 
15
 
#ifndef MOD_SPDY_APACHE_MASTER_CONNECTION_CONTEXT_H_
16
 
#define MOD_SPDY_APACHE_MASTER_CONNECTION_CONTEXT_H_
17
 
 
18
 
#include <string>
19
 
 
20
 
#include "base/basictypes.h"
21
 
#include "base/memory/scoped_ptr.h"
22
 
 
23
 
namespace mod_spdy {
24
 
 
25
 
class SpdyStream;
26
 
 
27
 
// Shared context object for a SPDY connection to the outside world.
28
 
class MasterConnectionContext {
29
 
 public:
30
 
  // Create a context object for a master connection (one to the outside world,
31
 
  // not for talking to Apache).
32
 
  explicit MasterConnectionContext(bool using_ssl);
33
 
  ~MasterConnectionContext();
34
 
 
35
 
  // Return true if the connection to the user is over SSL.  This is almost
36
 
  // always true, but may be false if we've been set to use SPDY for non-SSL
37
 
  // connections (for debugging).
38
 
  bool is_using_ssl() const { return using_ssl_; }
39
 
 
40
 
  // Return true if we are using SPDY for this connection, which is the case if
41
 
  // either 1) SPDY was chosen by NPN, or 2) we are assuming SPDY regardless of
42
 
  // NPN.
43
 
  bool is_using_spdy() const;
44
 
 
45
 
  enum NpnState {
46
 
    // NOT_DONE_YET: NPN has not yet completed.
47
 
    NOT_DONE_YET,
48
 
    // USING_SPDY: We have agreed with the client to use SPDY for this
49
 
    // connection.
50
 
    USING_SPDY,
51
 
    // NOT_USING_SPDY: We have decided not to use SPDY for this connection.
52
 
    NOT_USING_SPDY
53
 
  };
54
 
 
55
 
  // Get the NPN state of this connection.  Unless you actually care about NPN
56
 
  // itself, you probably don't want to use this method to check if SPDY is
57
 
  // being used; instead, use is_using_spdy().
58
 
  NpnState npn_state() const;
59
 
 
60
 
  // Set the NPN state of this connection.
61
 
  void set_npn_state(NpnState state);
62
 
 
63
 
  // If true, we are simply _assuming_ SPDY, regardless of the outcome of NPN.
64
 
  bool is_assuming_spdy() const;
65
 
 
66
 
  // Set whether we are assuming SPDY for this connection (regardless of NPN).
67
 
  void set_assume_spdy(bool assume);
68
 
 
69
 
  // Return the SPDY version number we will be using.  Requires that
70
 
  // is_using_spdy() is true and that the version number has already been set.
71
 
  int spdy_version() const;
72
 
 
73
 
  // Set the SPDY version number we will be using.  Requires that
74
 
  // is_using_spdy() is true, and set_spdy_version hasn't already been called.
75
 
  void set_spdy_version(int spdy_version);
76
 
 
77
 
 private:
78
 
  const bool using_ssl_;
79
 
  NpnState npn_state_;
80
 
  bool assume_spdy_;
81
 
  int spdy_version_;
82
 
 
83
 
  DISALLOW_COPY_AND_ASSIGN(MasterConnectionContext);
84
 
};
85
 
 
86
 
}  // namespace mod_spdy
87
 
 
88
 
#endif  // MOD_SPDY_APACHE_MASTER_CONNECTION_CONTEXT_H_