1
// Copyright 2010 Google Inc.
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
7
// http://www.apache.org/licenses/LICENSE-2.0
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.
15
#ifndef MOD_SPDY_APACHE_MASTER_CONNECTION_CONTEXT_H_
16
#define MOD_SPDY_APACHE_MASTER_CONNECTION_CONTEXT_H_
20
#include "base/basictypes.h"
21
#include "base/memory/scoped_ptr.h"
27
// Shared context object for a SPDY connection to the outside world.
28
class MasterConnectionContext {
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();
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_; }
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
43
bool is_using_spdy() const;
46
// NOT_DONE_YET: NPN has not yet completed.
48
// USING_SPDY: We have agreed with the client to use SPDY for this
51
// NOT_USING_SPDY: We have decided not to use SPDY for this connection.
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;
60
// Set the NPN state of this connection.
61
void set_npn_state(NpnState state);
63
// If true, we are simply _assuming_ SPDY, regardless of the outcome of NPN.
64
bool is_assuming_spdy() const;
66
// Set whether we are assuming SPDY for this connection (regardless of NPN).
67
void set_assume_spdy(bool assume);
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;
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);
78
const bool using_ssl_;
83
DISALLOW_COPY_AND_ASSIGN(MasterConnectionContext);
86
} // namespace mod_spdy
88
#endif // MOD_SPDY_APACHE_MASTER_CONNECTION_CONTEXT_H_