Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef NET_QUIC_QUIC_PROTOCOL_H_ | 5 #ifndef NET_QUIC_QUIC_PROTOCOL_H_ |
| 6 #define NET_QUIC_QUIC_PROTOCOL_H_ | 6 #define NET_QUIC_QUIC_PROTOCOL_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <limits> | 9 #include <limits> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 165 NET_EXPORT_PRIVATE size_t GetStartOfFecProtectedData( | 165 NET_EXPORT_PRIVATE size_t GetStartOfFecProtectedData( |
| 166 QuicGuidLength guid_length, | 166 QuicGuidLength guid_length, |
| 167 bool include_version, | 167 bool include_version, |
| 168 QuicSequenceNumberLength sequence_number_length); | 168 QuicSequenceNumberLength sequence_number_length); |
| 169 // Index of the first byte in a QUIC packet of encrypted data. | 169 // Index of the first byte in a QUIC packet of encrypted data. |
| 170 NET_EXPORT_PRIVATE size_t GetStartOfEncryptedData( | 170 NET_EXPORT_PRIVATE size_t GetStartOfEncryptedData( |
| 171 QuicGuidLength guid_length, | 171 QuicGuidLength guid_length, |
| 172 bool include_version, | 172 bool include_version, |
| 173 QuicSequenceNumberLength sequence_number_length); | 173 QuicSequenceNumberLength sequence_number_length); |
| 174 | 174 |
| 175 enum QuicRstStreamErrorCode { | 175 enum QuicRstStreamErrorCode { |
|
eroman
2013/06/17 23:18:19
I dont know this code, but would it make sense for
Ryan Hamilton
2013/06/18 19:23:57
The code started out like this, but it became clea
| |
| 176 QUIC_STREAM_NO_ERROR = 0, | 176 #define QUIC_RST_STREAM_ERROR(error) QUIC_ ## error, |
| 177 | 177 #include "net/quic/quic_rst_stream_error_list.h" |
| 178 // There was some server error which halted stream processing. | 178 #undef QUIC_RST_STREAM_ERROR |
| 179 QUIC_SERVER_ERROR_PROCESSING_STREAM, | |
| 180 // We got two fin or reset offsets which did not match. | |
| 181 QUIC_MULTIPLE_TERMINATION_OFFSETS, | |
| 182 // We got bad payload and can not respond to it at the protocol level. | |
| 183 QUIC_BAD_APPLICATION_PAYLOAD, | |
| 184 // Stream closed due to connection error. No reset frame is sent when this | |
| 185 // happens. | |
| 186 QUIC_STREAM_CONNECTION_ERROR, | |
| 187 // GoAway frame sent. No more stream can be created. | |
| 188 QUIC_STREAM_PEER_GOING_AWAY, | |
| 189 | |
| 190 // No error. Used as bound while iterating. | |
| 191 QUIC_STREAM_LAST_ERROR, | |
| 192 }; | 179 }; |
| 193 | 180 |
| 194 enum QuicErrorCode { | 181 enum QuicErrorCode { |
| 195 QUIC_NO_ERROR = 0, | 182 #define QUIC_ERROR(error) QUIC_ ## error, |
| 196 | 183 #include "net/quic/quic_error_list.h" |
| 197 // Connection has reached an invalid state. | 184 #undef QUIC_ERROR |
| 198 QUIC_INTERNAL_ERROR, | |
| 199 // There were data frames after the a fin or reset. | |
| 200 QUIC_STREAM_DATA_AFTER_TERMINATION, | |
| 201 // Control frame is malformed. | |
| 202 QUIC_INVALID_PACKET_HEADER, | |
| 203 // Frame data is malformed. | |
| 204 QUIC_INVALID_FRAME_DATA, | |
| 205 // FEC data is malformed. | |
| 206 QUIC_INVALID_FEC_DATA, | |
| 207 // Stream rst data is malformed | |
| 208 QUIC_INVALID_RST_STREAM_DATA, | |
| 209 // Connection close data is malformed. | |
| 210 QUIC_INVALID_CONNECTION_CLOSE_DATA, | |
| 211 // GoAway data is malformed. | |
| 212 QUIC_INVALID_GOAWAY_DATA, | |
| 213 // Ack data is malformed. | |
| 214 QUIC_INVALID_ACK_DATA, | |
| 215 // Version negotiation packet is malformed. | |
| 216 QUIC_INVALID_VERSION_NEGOTIATION_PACKET, | |
| 217 // Public RST packet is malformed. | |
| 218 QUIC_INVALID_PUBLIC_RST_PACKET, | |
| 219 // There was an error decrypting. | |
| 220 QUIC_DECRYPTION_FAILURE, | |
| 221 // There was an error encrypting. | |
| 222 QUIC_ENCRYPTION_FAILURE, | |
| 223 // The packet exceeded kMaxPacketSize. | |
| 224 QUIC_PACKET_TOO_LARGE, | |
| 225 // Data was sent for a stream which did not exist. | |
| 226 QUIC_PACKET_FOR_NONEXISTENT_STREAM, | |
| 227 // The peer is going away. May be a client or server. | |
| 228 QUIC_PEER_GOING_AWAY, | |
| 229 // A stream ID was invalid. | |
| 230 QUIC_INVALID_STREAM_ID, | |
| 231 // Too many streams already open. | |
| 232 QUIC_TOO_MANY_OPEN_STREAMS, | |
| 233 // Received public reset for this connection. | |
| 234 QUIC_PUBLIC_RESET, | |
| 235 // Invalid protocol version. | |
| 236 QUIC_INVALID_VERSION, | |
| 237 // Stream reset before headers decompressed. | |
| 238 QUIC_STREAM_RST_BEFORE_HEADERS_DECOMPRESSED, | |
| 239 // The Header ID for a stream was too far from the previous. | |
| 240 QUIC_INVALID_HEADER_ID, | |
| 241 // Negotiable parameter received during handshake had invalid value. | |
| 242 QUIC_INVALID_NEGOTIATED_VALUE, | |
| 243 // There was an error decompressing data. | |
| 244 QUIC_DECOMPRESSION_FAILURE, | |
| 245 // We hit our prenegotiated (or default) timeout | |
| 246 QUIC_CONNECTION_TIMED_OUT, | |
| 247 // There was an error encountered migrating addresses | |
| 248 QUIC_ERROR_MIGRATING_ADDRESS, | |
| 249 // There was an error while writing the packet. | |
| 250 QUIC_PACKET_WRITE_ERROR, | |
| 251 | |
| 252 | |
| 253 // Crypto errors. | |
| 254 | |
| 255 // Hanshake failed. | |
| 256 QUIC_HANDSHAKE_FAILED, | |
| 257 // Handshake message contained out of order tags. | |
| 258 QUIC_CRYPTO_TAGS_OUT_OF_ORDER, | |
| 259 // Handshake message contained too many entries. | |
| 260 QUIC_CRYPTO_TOO_MANY_ENTRIES, | |
| 261 // Handshake message contained an invalid value length. | |
| 262 QUIC_CRYPTO_INVALID_VALUE_LENGTH, | |
| 263 // A crypto message was received after the handshake was complete. | |
| 264 QUIC_CRYPTO_MESSAGE_AFTER_HANDSHAKE_COMPLETE, | |
| 265 // A crypto message was received with an illegal message tag. | |
| 266 QUIC_INVALID_CRYPTO_MESSAGE_TYPE, | |
| 267 // A crypto message was received with an illegal parameter. | |
| 268 QUIC_INVALID_CRYPTO_MESSAGE_PARAMETER, | |
| 269 // A crypto message was received with a mandatory parameter missing. | |
| 270 QUIC_CRYPTO_MESSAGE_PARAMETER_NOT_FOUND, | |
| 271 // A crypto message was received with a parameter that has no overlap | |
| 272 // with the local parameter. | |
| 273 QUIC_CRYPTO_MESSAGE_PARAMETER_NO_OVERLAP, | |
| 274 // A crypto message was received that contained a parameter with too few | |
| 275 // values. | |
| 276 QUIC_CRYPTO_MESSAGE_INDEX_NOT_FOUND, | |
| 277 // An internal error occured in crypto processing. | |
| 278 QUIC_CRYPTO_INTERNAL_ERROR, | |
| 279 // A crypto handshake message specified an unsupported version. | |
| 280 QUIC_CRYPTO_VERSION_NOT_SUPPORTED, | |
| 281 // There was no intersection between the crypto primitives supported by the | |
| 282 // peer and ourselves. | |
| 283 QUIC_CRYPTO_NO_SUPPORT, | |
| 284 // The server rejected our client hello messages too many times. | |
| 285 QUIC_CRYPTO_TOO_MANY_REJECTS, | |
| 286 // The client rejected the server's certificate chain or signature. | |
| 287 QUIC_PROOF_INVALID, | |
| 288 // A crypto message was received with a duplicate tag. | |
| 289 QUIC_CRYPTO_DUPLICATE_TAG, | |
| 290 // A crypto message was received with the wrong encryption level (i.e. it | |
| 291 // should have been encrypted but was not.) | |
| 292 QUIC_CRYPTO_ENCRYPTION_LEVEL_INCORRECT, | |
| 293 // The server config for a server has expired. | |
| 294 QUIC_CRYPTO_SERVER_CONFIG_EXPIRED, | |
| 295 | |
| 296 // No error. Used as bound while iterating. | |
| 297 QUIC_LAST_ERROR, | |
| 298 }; | 185 }; |
| 299 | 186 |
| 300 // Version and Crypto tags are written to the wire with a big-endian | 187 // Version and Crypto tags are written to the wire with a big-endian |
| 301 // representation of the name of the tag. For example | 188 // representation of the name of the tag. For example |
| 302 // the client hello tag (CHLO) will be written as the | 189 // the client hello tag (CHLO) will be written as the |
| 303 // following 4 bytes: 'C' 'H' 'L' 'O'. Since it is | 190 // following 4 bytes: 'C' 'H' 'L' 'O'. Since it is |
| 304 // stored in memory as a little endian uint32, we need | 191 // stored in memory as a little endian uint32, we need |
| 305 // to reverse the order of the bytes. | 192 // to reverse the order of the bytes. |
| 306 // | 193 // |
| 307 // The TAG macro is used in header files to ensure that we don't create static | 194 // The TAG macro is used in header files to ensure that we don't create static |
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 770 NET_EXPORT_PRIVATE friend std::ostream& operator<<( | 657 NET_EXPORT_PRIVATE friend std::ostream& operator<<( |
| 771 std::ostream& os, const QuicConsumedData& s); | 658 std::ostream& os, const QuicConsumedData& s); |
| 772 | 659 |
| 773 size_t bytes_consumed; | 660 size_t bytes_consumed; |
| 774 bool fin_consumed; | 661 bool fin_consumed; |
| 775 }; | 662 }; |
| 776 | 663 |
| 777 } // namespace net | 664 } // namespace net |
| 778 | 665 |
| 779 #endif // NET_QUIC_QUIC_PROTOCOL_H_ | 666 #endif // NET_QUIC_QUIC_PROTOCOL_H_ |
| OLD | NEW |