OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/quic/test_tools/quic_framer_peer.h" | 5 #include "net/quic/test_tools/quic_framer_peer.h" |
6 | 6 |
7 #include "net/quic/quic_framer.h" | 7 #include "net/quic/quic_framer.h" |
8 #include "net/quic/quic_protocol.h" | 8 #include "net/quic/quic_protocol.h" |
9 | 9 |
10 namespace net { | 10 namespace net { |
(...skipping 13 matching lines...) Expand all Loading... |
24 QuicFramer* framer, QuicConnectionId connection_id) { | 24 QuicFramer* framer, QuicConnectionId connection_id) { |
25 framer->last_serialized_connection_id_ = connection_id; | 25 framer->last_serialized_connection_id_ = connection_id; |
26 } | 26 } |
27 | 27 |
28 void QuicFramerPeer::SetLastSequenceNumber( | 28 void QuicFramerPeer::SetLastSequenceNumber( |
29 QuicFramer* framer, | 29 QuicFramer* framer, |
30 QuicPacketSequenceNumber packet_sequence_number) { | 30 QuicPacketSequenceNumber packet_sequence_number) { |
31 framer->last_sequence_number_ = packet_sequence_number; | 31 framer->last_sequence_number_ = packet_sequence_number; |
32 } | 32 } |
33 | 33 |
34 void QuicFramerPeer::SetIsServer(QuicFramer* framer, bool is_server) { | 34 void QuicFramerPeer::SetPerspective(QuicFramer* framer, |
35 framer->is_server_ = is_server; | 35 Perspective perspective) { |
| 36 framer->perspective_ = perspective; |
36 } | 37 } |
37 | 38 |
38 void QuicFramerPeer::SwapCrypters(QuicFramer* framer1, QuicFramer* framer2) { | 39 void QuicFramerPeer::SwapCrypters(QuicFramer* framer1, QuicFramer* framer2) { |
39 for (int i = ENCRYPTION_NONE; i < NUM_ENCRYPTION_LEVELS; i++) { | 40 for (int i = ENCRYPTION_NONE; i < NUM_ENCRYPTION_LEVELS; i++) { |
40 framer1->encrypter_[i].swap(framer2->encrypter_[i]); | 41 framer1->encrypter_[i].swap(framer2->encrypter_[i]); |
41 } | 42 } |
42 framer1->decrypter_.swap(framer2->decrypter_); | 43 framer1->decrypter_.swap(framer2->decrypter_); |
43 framer1->alternative_decrypter_.swap(framer2->alternative_decrypter_); | 44 framer1->alternative_decrypter_.swap(framer2->alternative_decrypter_); |
44 | 45 |
45 EncryptionLevel framer2_level = framer2->decrypter_level_; | 46 EncryptionLevel framer2_level = framer2->decrypter_level_; |
46 framer2->decrypter_level_ = framer1->decrypter_level_; | 47 framer2->decrypter_level_ = framer1->decrypter_level_; |
47 framer1->decrypter_level_ = framer2_level; | 48 framer1->decrypter_level_ = framer2_level; |
48 framer2_level = framer2->alternative_decrypter_level_; | 49 framer2_level = framer2->alternative_decrypter_level_; |
49 framer2->alternative_decrypter_level_ = | 50 framer2->alternative_decrypter_level_ = |
50 framer1->alternative_decrypter_level_; | 51 framer1->alternative_decrypter_level_; |
51 framer1->alternative_decrypter_level_ = framer2_level; | 52 framer1->alternative_decrypter_level_ = framer2_level; |
52 | 53 |
53 const bool framer2_latch = framer2->alternative_decrypter_latch_; | 54 const bool framer2_latch = framer2->alternative_decrypter_latch_; |
54 framer2->alternative_decrypter_latch_ = | 55 framer2->alternative_decrypter_latch_ = |
55 framer1->alternative_decrypter_latch_; | 56 framer1->alternative_decrypter_latch_; |
56 framer1->alternative_decrypter_latch_ = framer2_latch; | 57 framer1->alternative_decrypter_latch_ = framer2_latch; |
57 } | 58 } |
58 | 59 |
59 } // namespace test | 60 } // namespace test |
60 } // namespace net | 61 } // namespace net |
OLD | NEW |