Switch global error menu icon to vectorized MD asset
[chromium-blink-merge.git] / net / quic / quic_types.h
blob01415bc3607b9fee2516c02a71a84cb780c5ba3e
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
3 // found in the LICENSE file.
5 #ifndef NET_QUIC_QUIC_TYPES_H_
6 #define NET_QUIC_QUIC_TYPES_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
10 // including quic_protocol.h.
12 #include <stddef.h>
13 #include <ostream>
15 #include "net/base/net_export.h"
17 namespace net {
19 // A struct for functions which consume data payloads and fins.
20 struct NET_EXPORT_PRIVATE QuicConsumedData {
21 QuicConsumedData(size_t bytes_consumed, bool fin_consumed);
23 // By default, gtest prints the raw bytes of an object. The bool data
24 // member causes this object to have padding bytes, which causes the
25 // default gtest object printer to read uninitialize memory. So we need
26 // to teach gtest how to print this object.
27 NET_EXPORT_PRIVATE friend std::ostream& operator<<(
28 std::ostream& os, const QuicConsumedData& s);
30 // How many bytes were consumed.
31 size_t bytes_consumed;
33 // True if an incoming fin was consumed.
34 bool fin_consumed;
37 // QuicAsyncStatus enumerates the possible results of an asynchronous
38 // operation.
39 enum QuicAsyncStatus {
40 QUIC_SUCCESS = 0,
41 QUIC_FAILURE = 1,
42 // QUIC_PENDING results from an operation that will occur asynchonously. When
43 // the operation is complete, a callback's |Run| method will be called.
44 QUIC_PENDING = 2,
47 // TODO(wtc): see if WriteStatus can be replaced by QuicAsyncStatus.
48 enum WriteStatus {
49 WRITE_STATUS_OK,
50 WRITE_STATUS_BLOCKED,
51 WRITE_STATUS_ERROR,
54 // 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.
56 struct NET_EXPORT_PRIVATE WriteResult {
57 WriteResult(WriteStatus status, int bytes_written_or_error_code);
58 WriteResult();
60 WriteStatus status;
61 union {
62 int bytes_written; // only valid when status is WRITE_STATUS_OK
63 int error_code; // only valid when status is WRITE_STATUS_ERROR
67 } // namespace net
69 #endif // NET_QUIC_QUIC_TYPES_H_