proxygen
proxygen::spdy Namespace Reference

Enumerations

enum  FrameType {
  SYN_STREAM = 1, SYN_REPLY = 2, RST_STREAM = 3, SETTINGS = 4,
  NOOP = 5, PING = 6, GOAWAY = 7, HEADERS = 8,
  WINDOW_UPDATE = 9, CREDENTIAL = 10
}
 
enum  CtrlFlag { CTRL_FLAG_NONE = 0, CTRL_FLAG_FIN = 1, CTRL_FLAG_UNIDIRECTIONAL = 2 }
 
enum  SettingsFlag { FLAG_SETTINGS_NONE = 0, FLAG_SETTINGS_CLEAR_SETTINGS = 1 }
 
enum  SettingsIdFlag { ID_FLAG_SETTINGS_NONE = 0, ID_FLAG_SETTINGS_PERSIST_VALUE = 1, ID_FLAG_SETTINGS_PERSISTED = 2 }
 
enum  SettingsId {
  SETTINGS_UPLOAD_BANDWIDTH = 1, SETTINGS_DOWNLOAD_BANDWIDTH = 2, SETTINGS_ROUND_TRIP_TIME = 3, SETTINGS_MAX_CONCURRENT_STREAMS = 4,
  SETTINGS_CURRENT_CWND = 5, SETTINGS_DOWNLOAD_RETRANS_RATE = 6, SETTINGS_INITIAL_WINDOW_SIZE = 7, SETTINGS_CLIENT_CERTIFICATE_VECTOR_SIZE = 8
}
 
enum  ResetStatusCode {
  RST_PROTOCOL_ERROR = 1, RST_INVALID_STREAM = 2, RST_REFUSED_STREAM = 3, RST_UNSUPPORTED_VERSION = 4,
  RST_CANCEL = 5, RST_INTERNAL_ERROR = 6, RST_FLOW_CONTROL_ERROR = 7, RST_STREAM_IN_USE = 8,
  RST_STREAM_ALREADY_CLOSED = 9, RST_INVALID_CREDENTIALS = 10, RST_FRAME_TOO_LARGE = 11
}
 
enum  GoawayStatusCode { GOAWAY_OK = 0, GOAWAY_PROTOCOL_ERROR = 1, GOAWAY_INTERNAL_ERROR = 2, GOAWAY_FLOW_CONTROL_ERROR = 7 }
 

Functions

GoawayStatusCode errorCodeToGoaway (ErrorCode code)
 
ResetStatusCode errorCodeToReset (ErrorCode code)
 
ErrorCode goawayToErrorCode (GoawayStatusCode code)
 
ErrorCode rstToErrorCode (uint32_t code)
 
folly::Optional< proxygen::spdy::SettingsIdhttpToSpdySettingsId (proxygen::SettingsId id)
 
folly::Optional< proxygen::SettingsIdspdyToHttpSettingsId (proxygen::spdy::SettingsId id)
 
const std::string kSessionProtoNameSPDY3 ("spdy/3")
 
const std::string httpVersion ("HTTP/1.1")
 
const std::string kNameVersionv2 ("version")
 
const std::string kNameVersionv3 (":version")
 
const std::string kNameStatusv2 ("status")
 
const std::string kNameStatusv3 (":status")
 
const std::string kNameMethodv2 ("method")
 
const std::string kNameMethodv3 (":method")
 
const std::string kNamePathv2 ("url")
 
const std::string kNamePathv3 (":path")
 
const std::string kNameSchemev2 ("scheme")
 
const std::string kNameSchemev3 (":scheme")
 
const std::string kNameHostv3 (":host")
 
const std::string kVersionStrv2 ("spdy/2")
 
const std::string kVersionStrv3 ("spdy/3")
 
const std::string kVersionStrv31 ("spdy/3.1")
 

Variables

const uint32_t kInitialWindow = 65536
 
const uint32_t kMaxConcurrentStreams = 100
 
const uint32_t kMaxFrameLength = (1 << 24) - 1
 
const size_t SPDY_PRIO_SHIFT_FACTOR = 2
 
const std::string kSessionProtoNameSPDY2
 
const std::string kSessionProtoNameSPDY3
 
const std::string httpVersion
 
const std::string kNameVersionv2
 
const std::string kNameVersionv3
 
const std::string kNameStatusv2
 
const std::string kNameStatusv3
 
const std::string kNameMethodv2
 
const std::string kNameMethodv3
 
const std::string kNamePathv2
 
const std::string kNamePathv3
 
const std::string kNameSchemev2
 
const std::string kNameSchemev3
 
const std::string kNameHostv3
 
const std::string kVersionStrv2
 
const std::string kVersionStrv3
 
const std::string kVersionStrv31
 

Enumeration Type Documentation

Enumerator
CTRL_FLAG_NONE 
CTRL_FLAG_FIN 
CTRL_FLAG_UNIDIRECTIONAL 

Definition at line 33 of file SPDYConstants.h.

Enumerator
SYN_STREAM 
SYN_REPLY 
RST_STREAM 
SETTINGS 
NOOP 
PING 
GOAWAY 
HEADERS 
WINDOW_UPDATE 
CREDENTIAL 

Definition at line 19 of file SPDYConstants.h.

The status codes for the GOAWAY control frame.

Enumerator
GOAWAY_OK 
GOAWAY_PROTOCOL_ERROR 
GOAWAY_INTERNAL_ERROR 
GOAWAY_FLOW_CONTROL_ERROR 

Definition at line 83 of file SPDYConstants.h.

The status codes for the RST_STREAM control frame.

Enumerator
RST_PROTOCOL_ERROR 
RST_INVALID_STREAM 
RST_REFUSED_STREAM 
RST_UNSUPPORTED_VERSION 
RST_CANCEL 
RST_INTERNAL_ERROR 
RST_FLOW_CONTROL_ERROR 
RST_STREAM_IN_USE 
RST_STREAM_ALREADY_CLOSED 
RST_INVALID_CREDENTIALS 
RST_FRAME_TOO_LARGE 

Definition at line 64 of file SPDYConstants.h.

Enumerator
FLAG_SETTINGS_NONE 
FLAG_SETTINGS_CLEAR_SETTINGS 

Definition at line 39 of file SPDYConstants.h.

Enumerator
ID_FLAG_SETTINGS_NONE 
ID_FLAG_SETTINGS_PERSIST_VALUE 
ID_FLAG_SETTINGS_PERSISTED 

Definition at line 44 of file SPDYConstants.h.

Function Documentation

GoawayStatusCode proxygen::spdy::errorCodeToGoaway ( ErrorCode  code)

Definition at line 14 of file SPDYConstants.cpp.

References proxygen::_SPDY_INVALID_STREAM, proxygen::CANCEL, proxygen::COMPRESSION_ERROR, proxygen::CONNECT_ERROR, proxygen::ENHANCE_YOUR_CALM, proxygen::FLOW_CONTROL_ERROR, proxygen::FRAME_SIZE_ERROR, GOAWAY_FLOW_CONTROL_ERROR, GOAWAY_INTERNAL_ERROR, GOAWAY_OK, GOAWAY_PROTOCOL_ERROR, proxygen::HTTP_1_1_REQUIRED, proxygen::INADEQUATE_SECURITY, proxygen::INTERNAL_ERROR, proxygen::NO_ERROR, proxygen::PROTOCOL_ERROR, proxygen::REFUSED_STREAM, proxygen::SETTINGS_TIMEOUT, and proxygen::STREAM_CLOSED.

Referenced by proxygen::SPDYCodec::generateGoaway().

14  {
15  switch (code) {
16  case ErrorCode::NO_ERROR: return GOAWAY_OK;
17  case ErrorCode::INTERNAL_ERROR: return GOAWAY_INTERNAL_ERROR;
18  case ErrorCode::FLOW_CONTROL_ERROR: return GOAWAY_FLOW_CONTROL_ERROR;
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;
28  case ErrorCode::INADEQUATE_SECURITY: break;
29  case ErrorCode::HTTP_1_1_REQUIRED: break;
30  case ErrorCode::_SPDY_INVALID_STREAM: break;
31  }
32  return GOAWAY_PROTOCOL_ERROR;
33 }
ResetStatusCode proxygen::spdy::errorCodeToReset ( ErrorCode  code)

Definition at line 35 of file SPDYConstants.cpp.

References proxygen::_SPDY_INVALID_STREAM, proxygen::CANCEL, proxygen::COMPRESSION_ERROR, proxygen::CONNECT_ERROR, proxygen::ENHANCE_YOUR_CALM, proxygen::FLOW_CONTROL_ERROR, proxygen::FRAME_SIZE_ERROR, proxygen::HTTP_1_1_REQUIRED, proxygen::INADEQUATE_SECURITY, proxygen::INTERNAL_ERROR, proxygen::NO_ERROR, proxygen::PROTOCOL_ERROR, proxygen::REFUSED_STREAM, RST_CANCEL, RST_FLOW_CONTROL_ERROR, RST_FRAME_TOO_LARGE, RST_INTERNAL_ERROR, RST_INVALID_CREDENTIALS, RST_INVALID_STREAM, RST_PROTOCOL_ERROR, RST_REFUSED_STREAM, RST_STREAM_ALREADY_CLOSED, proxygen::SETTINGS_TIMEOUT, and proxygen::STREAM_CLOSED.

Referenced by proxygen::SPDYCodec::generateRstStream().

35  {
36  switch (code) {
37  case ErrorCode::NO_ERROR: break;
38  case ErrorCode::INTERNAL_ERROR: return RST_INTERNAL_ERROR;
39  case ErrorCode::FLOW_CONTROL_ERROR: return RST_FLOW_CONTROL_ERROR;
40  case ErrorCode::PROTOCOL_ERROR: return RST_PROTOCOL_ERROR;
41  case ErrorCode::SETTINGS_TIMEOUT: break;
42  case ErrorCode::STREAM_CLOSED: return RST_STREAM_ALREADY_CLOSED;
43  case ErrorCode::FRAME_SIZE_ERROR: return RST_FRAME_TOO_LARGE;
44  case ErrorCode::REFUSED_STREAM: return RST_REFUSED_STREAM;
45  case ErrorCode::CANCEL: return RST_CANCEL;
46  case ErrorCode::COMPRESSION_ERROR: return RST_INTERNAL_ERROR;
47  case ErrorCode::CONNECT_ERROR: break;
48  case ErrorCode::ENHANCE_YOUR_CALM: break;
49  case ErrorCode::INADEQUATE_SECURITY: return RST_INVALID_CREDENTIALS;
50  case ErrorCode::HTTP_1_1_REQUIRED: break;
51  case ErrorCode::_SPDY_INVALID_STREAM: return RST_INVALID_STREAM;
52  }
53  return RST_PROTOCOL_ERROR;
54 }
ErrorCode proxygen::spdy::goawayToErrorCode ( GoawayStatusCode  code)

Definition at line 56 of file SPDYConstants.cpp.

References proxygen::FLOW_CONTROL_ERROR, GOAWAY_FLOW_CONTROL_ERROR, GOAWAY_INTERNAL_ERROR, GOAWAY_OK, GOAWAY_PROTOCOL_ERROR, proxygen::INTERNAL_ERROR, proxygen::NO_ERROR, and proxygen::PROTOCOL_ERROR.

Referenced by proxygen::SPDYCodec::failSession(), and proxygen::SPDYCodec::onGoaway().

56  {
57  switch (code) {
58  case GOAWAY_OK: return ErrorCode::NO_ERROR;
59  case GOAWAY_PROTOCOL_ERROR: return ErrorCode::PROTOCOL_ERROR;
60  case GOAWAY_INTERNAL_ERROR: return ErrorCode::INTERNAL_ERROR;
61  case GOAWAY_FLOW_CONTROL_ERROR: return ErrorCode::FLOW_CONTROL_ERROR;
62  }
63  return ErrorCode::PROTOCOL_ERROR;
64 }
folly::Optional< proxygen::spdy::SettingsId > proxygen::spdy::httpToSpdySettingsId ( proxygen::SettingsId  id)

Definition at line 83 of file SPDYConstants.cpp.

References proxygen::_HQ_HEADER_TABLE_SIZE, proxygen::_HQ_MAX_HEADER_LIST_SIZE, proxygen::_HQ_NUM_PLACEHOLDERS, proxygen::_HQ_QPACK_BLOCKED_STREAMS, proxygen::_SPDY_CLIENT_CERTIFICATE_VECTOR_SIZE, proxygen::_SPDY_CURRENT_CWND, proxygen::_SPDY_DOWNLOAD_BANDWIDTH, proxygen::_SPDY_DOWNLOAD_RETRANS_RATE, proxygen::_SPDY_ROUND_TRIP_TIME, proxygen::_SPDY_UPLOAD_BANDWIDTH, proxygen::ENABLE_CONNECT_PROTOCOL, proxygen::ENABLE_EX_HEADERS, proxygen::ENABLE_PUSH, proxygen::HEADER_TABLE_SIZE, proxygen::INITIAL_WINDOW_SIZE, proxygen::MAX_CONCURRENT_STREAMS, proxygen::MAX_FRAME_SIZE, proxygen::MAX_HEADER_LIST_SIZE, folly::none, SETTINGS_CLIENT_CERTIFICATE_VECTOR_SIZE, SETTINGS_CURRENT_CWND, SETTINGS_DOWNLOAD_BANDWIDTH, SETTINGS_DOWNLOAD_RETRANS_RATE, proxygen::SETTINGS_HTTP_CERT_AUTH, SETTINGS_INITIAL_WINDOW_SIZE, SETTINGS_MAX_CONCURRENT_STREAMS, SETTINGS_ROUND_TRIP_TIME, SETTINGS_UPLOAD_BANDWIDTH, proxygen::THRIFT_CHANNEL_ID, and proxygen::THRIFT_CHANNEL_ID_DEPRECATED.

Referenced by proxygen::SPDYCodec::generateSettings().

84  {
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 }
constexpr None none
Definition: Optional.h:87
const std::string proxygen::spdy::httpVersion ( "HTTP/1.1"  )
const std::string proxygen::spdy::kNameHostv3 ( ":host"  )
const std::string proxygen::spdy::kNameMethodv2 ( "method"  )
const std::string proxygen::spdy::kNameMethodv3 ( ":method"  )
const std::string proxygen::spdy::kNamePathv2 ( "url"  )
const std::string proxygen::spdy::kNamePathv3 ( ":path"  )
const std::string proxygen::spdy::kNameSchemev2 ( "scheme"  )
const std::string proxygen::spdy::kNameSchemev3 ( ":scheme"  )
const std::string proxygen::spdy::kNameStatusv2 ( "status"  )
const std::string proxygen::spdy::kNameStatusv3 ( ":status"  )
const std::string proxygen::spdy::kNameVersionv2 ( "version"  )
const std::string proxygen::spdy::kNameVersionv3 ( ":version"  )
const std::string proxygen::spdy::kSessionProtoNameSPDY3 ( "spdy/3"  )
const std::string proxygen::spdy::kVersionStrv2 ( "spdy/2"  )
const std::string proxygen::spdy::kVersionStrv3 ( "spdy/3"  )
const std::string proxygen::spdy::kVersionStrv31 ( "spdy/3.1"  )
ErrorCode proxygen::spdy::rstToErrorCode ( uint32_t  code)

Definition at line 66 of file SPDYConstants.cpp.

References proxygen::_SPDY_INVALID_STREAM, proxygen::CANCEL, proxygen::FLOW_CONTROL_ERROR, proxygen::FRAME_SIZE_ERROR, proxygen::INADEQUATE_SECURITY, proxygen::INTERNAL_ERROR, proxygen::PROTOCOL_ERROR, proxygen::REFUSED_STREAM, RST_CANCEL, RST_FLOW_CONTROL_ERROR, RST_FRAME_TOO_LARGE, RST_INTERNAL_ERROR, RST_INVALID_CREDENTIALS, RST_INVALID_STREAM, RST_PROTOCOL_ERROR, RST_REFUSED_STREAM, RST_STREAM_ALREADY_CLOSED, RST_STREAM_IN_USE, RST_UNSUPPORTED_VERSION, and proxygen::STREAM_CLOSED.

Referenced by proxygen::SPDYCodec::failStream(), proxygen::SPDYCodec::onRstStream(), and TEST().

66  {
67  switch (code) {
68  case RST_PROTOCOL_ERROR: break;
69  case RST_INVALID_STREAM: return ErrorCode::_SPDY_INVALID_STREAM;
70  case RST_REFUSED_STREAM: return ErrorCode::REFUSED_STREAM;
71  case RST_UNSUPPORTED_VERSION: break; // not used anyway
72  case RST_CANCEL: return ErrorCode::CANCEL;
73  case RST_INTERNAL_ERROR: return ErrorCode::INTERNAL_ERROR;
74  case RST_FLOW_CONTROL_ERROR: return ErrorCode::FLOW_CONTROL_ERROR;
75  case RST_STREAM_IN_USE: return ErrorCode::FLOW_CONTROL_ERROR;
76  case RST_STREAM_ALREADY_CLOSED: return ErrorCode::STREAM_CLOSED;
77  case RST_INVALID_CREDENTIALS: return ErrorCode::INADEQUATE_SECURITY;
78  case RST_FRAME_TOO_LARGE: return ErrorCode::FRAME_SIZE_ERROR;
79  }
80  return ErrorCode::PROTOCOL_ERROR;
81 }
folly::Optional< proxygen::SettingsId > proxygen::spdy::spdyToHttpSettingsId ( proxygen::spdy::SettingsId  id)

Definition at line 125 of file SPDYConstants.cpp.

References proxygen::INITIAL_WINDOW_SIZE, proxygen::MAX_CONCURRENT_STREAMS, folly::none, SETTINGS_CLIENT_CERTIFICATE_VECTOR_SIZE, SETTINGS_CURRENT_CWND, SETTINGS_DOWNLOAD_BANDWIDTH, SETTINGS_DOWNLOAD_RETRANS_RATE, SETTINGS_INITIAL_WINDOW_SIZE, SETTINGS_MAX_CONCURRENT_STREAMS, SETTINGS_ROUND_TRIP_TIME, and SETTINGS_UPLOAD_BANDWIDTH.

Referenced by proxygen::SPDYCodec::onSettings().

Variable Documentation

const std::string proxygen::spdy::httpVersion
const uint32_t proxygen::spdy::kInitialWindow = 65536

Definition at line 144 of file SPDYConstants.cpp.

Referenced by TEST_F().

const uint32_t proxygen::spdy::kMaxConcurrentStreams = 100

Definition at line 145 of file SPDYConstants.cpp.

Referenced by proxygen::SPDYCodec::onSynStream(), and TEST().

const uint32_t proxygen::spdy::kMaxFrameLength = (1 << 24) - 1

Definition at line 146 of file SPDYConstants.cpp.

const std::string proxygen::spdy::kNameHostv3
const std::string proxygen::spdy::kNameMethodv2
const std::string proxygen::spdy::kNameMethodv3
const std::string proxygen::spdy::kNamePathv2
const std::string proxygen::spdy::kNamePathv3
const std::string proxygen::spdy::kNameSchemev2
const std::string proxygen::spdy::kNameSchemev3
const std::string proxygen::spdy::kNameStatusv2
const std::string proxygen::spdy::kNameStatusv3
const std::string proxygen::spdy::kNameVersionv2
const std::string proxygen::spdy::kNameVersionv3
const std::string proxygen::spdy::kSessionProtoNameSPDY2
const std::string proxygen::spdy::kSessionProtoNameSPDY3
const std::string proxygen::spdy::kVersionStrv2
const std::string proxygen::spdy::kVersionStrv3
const std::string proxygen::spdy::kVersionStrv31
const size_t proxygen::spdy::SPDY_PRIO_SHIFT_FACTOR = 2

Definition at line 177 of file SPDYConstants.cpp.