summaryrefslogtreecommitdiffstats
path: root/net/quic/quic_protocol.cc
blob: 0a2538b163316ff49dc3c151bb8745a97f088718 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "net/quic/quic_protocol.h"

using base::StringPiece;
using base::hash_set;
using std::ostream;

namespace net {

QuicStreamFrame::QuicStreamFrame() {}

QuicStreamFrame::QuicStreamFrame(QuicStreamId stream_id,
                                 bool fin,
                                 uint64 offset,
                                 StringPiece data)
    : stream_id(stream_id),
      fin(fin),
      offset(offset),
      data(data) {
}

ReceivedPacketInfo::ReceivedPacketInfo() {}

ReceivedPacketInfo::~ReceivedPacketInfo() {}

SentPacketInfo::SentPacketInfo() {}

SentPacketInfo::~SentPacketInfo() {}

ostream& operator<<(ostream& os, const QuicAckFrame& s) {
  os << "largest_received: " << s.received_info.largest_received
     << " time: " << s.received_info.time_received.ToMicroseconds()
     << " missing: ";
  for (hash_set<QuicPacketSequenceNumber>::const_iterator it =
           s.received_info.missing_packets.begin();
       it != s.received_info.missing_packets.end(); ++it) {
    os << *it << " ";
  }

  os << " least_waiting: " << s.sent_info.least_unacked
     << " no_retransmit: ";
  for (hash_set<QuicPacketSequenceNumber>::const_iterator it =
           s.sent_info.non_retransmiting.begin();
       it != s.sent_info.non_retransmiting.end(); ++it) {
    os << *it << " ";
  }
  os << "\n";
  return os;
}

QuicFecData::QuicFecData() {}

bool QuicFecData::operator==(const QuicFecData& other) const {
  if (fec_group != other.fec_group) {
    return false;
  }
  if (min_protected_packet_sequence_number !=
      other.min_protected_packet_sequence_number) {
    return false;
  }
  if (redundancy != other.redundancy) {
    return false;
  }
  return true;
}

QuicData::~QuicData() {
  if (owns_buffer_) {
    delete [] const_cast<char*>(buffer_);
  }
}

}  // namespace net