| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_TYPES_H_ | 5 #ifndef NET_QUIC_QUIC_TYPES_H_ |
| 6 #define NET_QUIC_QUIC_TYPES_H_ | 6 #define NET_QUIC_QUIC_TYPES_H_ |
| 7 | 7 |
| 8 // This header defines some basic types that don't depend on quic_protocol.h, | 8 // This header defines some basic types that don't depend on quic_protocol.h, |
| 9 // so that classes not directly related to the protocol wire format can avoid | 9 // so that classes not directly related to the protocol wire format can avoid |
| 10 // including quic_protocol.h. | 10 // including quic_protocol.h. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 QUIC_PENDING = 2, | 44 QUIC_PENDING = 2, |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 // TODO(wtc): see if WriteStatus can be replaced by QuicAsyncStatus. | 47 // TODO(wtc): see if WriteStatus can be replaced by QuicAsyncStatus. |
| 48 enum WriteStatus { | 48 enum WriteStatus { |
| 49 WRITE_STATUS_OK, | 49 WRITE_STATUS_OK, |
| 50 WRITE_STATUS_BLOCKED, | 50 WRITE_STATUS_BLOCKED, |
| 51 WRITE_STATUS_ERROR, | 51 WRITE_STATUS_ERROR, |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 // Reasons we may disable QUIC, that is under certain pathological |
| 55 // connection errors. Note: these values must be kept in sync with |
| 56 // the corresponding values of QuicDisabledReason in: |
| 57 // tools/metrics/histograms/histograms.xml |
| 58 enum QuicDisabledReason { |
| 59 QUIC_DISABLED_NOT = 0, // default, not disabled |
| 60 QUIC_DISABLED_PUBLIC_RESET_POST_HANDSHAKE = 1, |
| 61 QUIC_DISABLED_TIMEOUT_WITH_OPEN_STREAMS = 2, |
| 62 QUIC_DISABLED_BAD_PACKET_LOSS_RATE = 3, |
| 63 QUIC_DISABLED_MAX = 4, |
| 64 }; |
| 65 |
| 54 // A struct used to return the result of write calls including either the number | 66 // A struct used to return the result of write calls including either the number |
| 55 // of bytes written or the error code, depending upon the status. | 67 // of bytes written or the error code, depending upon the status. |
| 56 struct NET_EXPORT_PRIVATE WriteResult { | 68 struct NET_EXPORT_PRIVATE WriteResult { |
| 57 WriteResult(WriteStatus status, int bytes_written_or_error_code); | 69 WriteResult(WriteStatus status, int bytes_written_or_error_code); |
| 58 WriteResult(); | 70 WriteResult(); |
| 59 | 71 |
| 60 WriteStatus status; | 72 WriteStatus status; |
| 61 union { | 73 union { |
| 62 int bytes_written; // only valid when status is WRITE_STATUS_OK | 74 int bytes_written; // only valid when status is WRITE_STATUS_OK |
| 63 int error_code; // only valid when status is WRITE_STATUS_ERROR | 75 int error_code; // only valid when status is WRITE_STATUS_ERROR |
| 64 }; | 76 }; |
| 65 }; | 77 }; |
| 66 | 78 |
| 67 } // namespace net | 79 } // namespace net |
| 68 | 80 |
| 69 #endif // NET_QUIC_QUIC_TYPES_H_ | 81 #endif // NET_QUIC_QUIC_TYPES_H_ |
| OLD | NEW |