blob: 0cbb1f0d8a34396c0c2bb20dfe76e740ab23f1f0 (
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
|
// Copyright (c) 2016 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 "quic/test_tools/simulator/packet_filter.h"
namespace quic {
namespace simulator {
PacketFilter::PacketFilter(Simulator* simulator,
std::string name,
Endpoint* input)
: Endpoint(simulator, name), input_(input) {
input_->SetTxPort(this);
}
PacketFilter::~PacketFilter() {}
void PacketFilter::AcceptPacket(std::unique_ptr<Packet> packet) {
if (FilterPacket(*packet)) {
output_tx_port_->AcceptPacket(std::move(packet));
}
}
QuicTime::Delta PacketFilter::TimeUntilAvailable() {
return output_tx_port_->TimeUntilAvailable();
}
void PacketFilter::Act() {}
UnconstrainedPortInterface* PacketFilter::GetRxPort() {
return input_->GetRxPort();
}
void PacketFilter::SetTxPort(ConstrainedPortInterface* port) {
output_tx_port_ = port;
}
} // namespace simulator
} // namespace quic
|