proxygen
SPDYConstants.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-present, Facebook, Inc.
3  * All rights reserved.
4  *
5  * This source code is licensed under the BSD-style license found in the
6  * LICENSE file in the root directory of this source tree. An additional grant
7  * of patent rights can be found in the PATENTS file in the same directory.
8  *
9  */
11 
12 namespace proxygen { namespace spdy {
13 
15  switch (code) {
16  case ErrorCode::NO_ERROR: return GOAWAY_OK;
19  case ErrorCode::PROTOCOL_ERROR: break;
20  case ErrorCode::SETTINGS_TIMEOUT: break;
21  case ErrorCode::STREAM_CLOSED: break;
22  case ErrorCode::FRAME_SIZE_ERROR: break;
23  case ErrorCode::REFUSED_STREAM: break;
24  case ErrorCode::CANCEL: break;
25  case ErrorCode::COMPRESSION_ERROR: break;
26  case ErrorCode::CONNECT_ERROR: break;
27  case ErrorCode::ENHANCE_YOUR_CALM: break;
29  case ErrorCode::HTTP_1_1_REQUIRED: break;
31  }
32  return GOAWAY_PROTOCOL_ERROR;
33 }
34 
36  switch (code) {
37  case ErrorCode::NO_ERROR: break;
41  case ErrorCode::SETTINGS_TIMEOUT: break;
45  case ErrorCode::CANCEL: return RST_CANCEL;
47  case ErrorCode::CONNECT_ERROR: break;
48  case ErrorCode::ENHANCE_YOUR_CALM: break;
50  case ErrorCode::HTTP_1_1_REQUIRED: break;
52  }
53  return RST_PROTOCOL_ERROR;
54 }
55 
57  switch (code) {
58  case GOAWAY_OK: return ErrorCode::NO_ERROR;
62  }
64 }
65 
67  switch (code) {
68  case RST_PROTOCOL_ERROR: break;
71  case RST_UNSUPPORTED_VERSION: break; // not used anyway
72  case RST_CANCEL: return ErrorCode::CANCEL;
79  }
81 }
82 
85  switch (id) {
86  // no mapping
91  return folly::none;
93  return folly::none;
105  return SETTINGS_CURRENT_CWND;
111  return folly::none;
114  return folly::none;
120  return folly::none;
121  }
122  return folly::none;
123 }
124 
127  switch (id) {
134  // These mappings are possible, but not needed right now
135  return folly::none;
140  }
141  return folly::none;
142 }
143 
144 const uint32_t kInitialWindow = 65536;
146 const uint32_t kMaxFrameLength = (1 << 24) - 1;
147 
148 const std::string kSessionProtoNameSPDY3("spdy/3");
149 
150 const std::string httpVersion("HTTP/1.1");
151 const std::string kNameVersionv2("version");
152 const std::string kNameVersionv3(":version");
153 const std::string kNameStatusv2("status");
154 const std::string kNameStatusv3(":status");
155 const std::string kNameMethodv2("method");
156 const std::string kNameMethodv3(":method");
157 const std::string kNamePathv2("url");
158 const std::string kNamePathv3(":path");
159 const std::string kNameSchemev2("scheme");
160 const std::string kNameSchemev3(":scheme");
161 const std::string kNameHostv3(":host"); // SPDY v3 only
162 
163 const std::string kVersionStrv2("spdy/2");
164 const std::string kVersionStrv3("spdy/3");
165 const std::string kVersionStrv31("spdy/3.1");
166 
167 // In the future, we may be shifting the SPDY wire priority
168 // by this much so we can easily use the lower bits to do our
169 // own priority queueing within the bands defined by the SPDY
170 // protocol...
171 //
172 // so far:
173 //
174 // lower 2 LSB: used to randomly approximate some fairness within
175 // priority bands, relying on the poisson events of extracting or
176 // appending a frame to gather "entropy".
177 const size_t SPDY_PRIO_SHIFT_FACTOR = 2; // up to 60
178 
179 }}
const std::string kVersionStrv3
const uint32_t kMaxFrameLength
const std::string kSessionProtoNameSPDY3
const size_t SPDY_PRIO_SHIFT_FACTOR
const std::string kNamePathv3
ResetStatusCode errorCodeToReset(ErrorCode code)
const std::string kVersionStrv31
const std::string kNameMethodv2
const std::string kNameStatusv2
ErrorCode goawayToErrorCode(GoawayStatusCode code)
const std::string kNameSchemev2
const std::string kNameMethodv3
folly::Optional< proxygen::SettingsId > spdyToHttpSettingsId(proxygen::spdy::SettingsId id)
const std::string kNameVersionv3
GoawayStatusCode errorCodeToGoaway(ErrorCode code)
const std::string kNameHostv3
const std::string httpVersion
const std::string kNamePathv2
const std::string kNameStatusv3
folly::Optional< proxygen::spdy::SettingsId > httpToSpdySettingsId(proxygen::SettingsId id)
const std::string kNameVersionv2
const char * string
Definition: Conv.cpp:212
const std::string kNameSchemev3
const uint32_t kMaxConcurrentStreams
ErrorCode rstToErrorCode(uint32_t code)
constexpr None none
Definition: Optional.h:87
const uint32_t kInitialWindow
const std::string kVersionStrv2