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.
15 #include "net/base/net_export.h"
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.
37 // QuicAsyncStatus enumerates the possible results of an asynchronous
39 enum QuicAsyncStatus
{
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.
47 // TODO(wtc): see if WriteStatus can be replaced by QuicAsyncStatus.
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
);
62 int bytes_written
; // only valid when status is WRITE_STATUS_OK
63 int error_code
; // only valid when status is WRITE_STATUS_ERROR
69 #endif // NET_QUIC_QUIC_TYPES_H_