Switch global error menu icon to vectorized MD asset
[chromium-blink-merge.git] / net / quic / test_tools / quic_framer_peer.cc
bloba8f43abae92572f196c18ae3d91b7688d2f44e66
1 // Copyright (c) 2013 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 #include "net/quic/test_tools/quic_framer_peer.h"
7 #include "net/quic/quic_framer.h"
8 #include "net/quic/quic_protocol.h"
10 namespace net {
11 namespace test {
13 // static
14 QuicPacketNumber QuicFramerPeer::CalculatePacketNumberFromWire(
15 QuicFramer* framer,
16 QuicPacketNumberLength packet_number_length,
17 QuicPacketNumber packet_packet_number) {
18 return framer->CalculatePacketNumberFromWire(packet_number_length,
19 packet_packet_number);
22 // static
23 void QuicFramerPeer::SetLastSerializedConnectionId(
24 QuicFramer* framer, QuicConnectionId connection_id) {
25 framer->last_serialized_connection_id_ = connection_id;
28 // static
29 void QuicFramerPeer::SetLastPacketNumber(
30 QuicFramer* framer,
31 QuicPacketNumber packet_packet_number) {
32 framer->last_packet_number_ = packet_packet_number;
35 // static
36 void QuicFramerPeer::SetPerspective(QuicFramer* framer,
37 Perspective perspective) {
38 framer->perspective_ = perspective;
41 // static
42 void QuicFramerPeer::SwapCrypters(QuicFramer* framer1, QuicFramer* framer2) {
43 for (int i = ENCRYPTION_NONE; i < NUM_ENCRYPTION_LEVELS; i++) {
44 framer1->encrypter_[i].swap(framer2->encrypter_[i]);
46 framer1->decrypter_.swap(framer2->decrypter_);
47 framer1->alternative_decrypter_.swap(framer2->alternative_decrypter_);
49 EncryptionLevel framer2_level = framer2->decrypter_level_;
50 framer2->decrypter_level_ = framer1->decrypter_level_;
51 framer1->decrypter_level_ = framer2_level;
52 framer2_level = framer2->alternative_decrypter_level_;
53 framer2->alternative_decrypter_level_ =
54 framer1->alternative_decrypter_level_;
55 framer1->alternative_decrypter_level_ = framer2_level;
57 const bool framer2_latch = framer2->alternative_decrypter_latch_;
58 framer2->alternative_decrypter_latch_ =
59 framer1->alternative_decrypter_latch_;
60 framer1->alternative_decrypter_latch_ = framer2_latch;
63 // static
64 QuicEncrypter* QuicFramerPeer::GetEncrypter(QuicFramer* framer,
65 EncryptionLevel level) {
66 return framer->encrypter_[level].get();
69 } // namespace test
70 } // namespace net