summaryrefslogtreecommitdiffstats
path: root/net/quic/quic_packet_generator_test.cc
Commit message (Collapse)AuthorAgeFilesLines
* Land Recent QUIC Changes.rtenneti@chromium.org2013-11-141-13/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixing a QUIC bug where public reset packets would only be sent for null encrypted packets. Merge internal change: 56125340 Implement TcpCubicSender::BandwidthEstimate to return CWND/SRTT, which will be used as the basis for pacing. Implements a currently unused method in the QUIC TCP implementation. Merge internal change: 56109841 Add bandwidth limits and maximum packet queue size to the PacketDroppingTestWriter for QUIC. Merge internal change: 56104313 Change QUIC's TCP implementation to not reduce the congestion window when multiple losses occur in a window. Merge internal change: 56097813 Add flexibility to SimpleClient by exposing epoll_server(), fd() and buffer_body() at the interface level. Affects tests only. I need this for ustreamer load testing. The requirements there (like slowing down the transfer) are divergent from internal server and it's easier to implement them by talking to epoll directly. Merge internal change: 56097002 Removing QUIC_VERSION_10 which had a longer NullEncryption hash length of 16 bytes vs the new 12 bytes. Merge internal change: 56033303 Change QUIC's minimum congestion window for TCP to 2*MSS, matching RFC2582. Merge internal change: 55999043 Request from avd@ in review of cl/55013562 Merge QuicConnection SendStreamData methods. Merge internal change: 55985552 Replacing StringPiece with IOVector in QUIC's read and write paths. QuicConnection on below, QUIC now trafficks in only IOVectors. QuicStreamFrame now holds frame data in an IOVector instead of a StringPiece. Merge internal change: 55838620 Change order of operations in QuicCryptoServerConfig::EvaluateClientHello so that: - Local, syncrhonous operations can happen first. - Validating the client nonce against the strike register only happens when uniqueness must be established using the client nonce. - Server nonce is always used if it is present. - A repeated server nonce triggers a replay protection failure even if the client nonce is unique. Resulting behavior is more correct: we used to allow handshakes that had both a server nonce and client nonce to be repeated twice. Merge internal change: 55930987 QUIC - Minor cleanup of the code to match the internal code. Merge internal change: 55929037 Increase the minimum CHLO size from 512 bytes to 1024 bytes. Pad an inchoate CHLO to fill up a packet. On the server side, enforce the old minimum CHLO size of 512 bytes so we can support old clients. Merge internal change: 55881305 R=rch@chromium.org Review URL: https://codereview.chromium.org/71143003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@235006 0039d316-1c4b-4281-b951-d872f2087c98
* Land Recent QUIC changes. rtenneti@chromium.org2013-10-311-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix a bug in the QuicFramer where the entropy genererator was not being consulted when truncated acks were sent, causing an incorrect entropy to be sent for truncated acks. Merge internal change: 55879563 Add an optional initial RTT to the negotiation parameters to allow the QUIC client to suggest an expected RTT to the server. Merge internal change: 55792505 Changing DCHECKs to LOG(DFATAL) so we'll notice if they're occurring in the running server/client. Merge internal change: 55790448 Added a blank line per the change in the following CL which deleted default-true flags. Merge internal change: 55738366 Allow a REJ message to be twice as large as a CHLO message that doesn't contain a valid source-address token. message that doesn't contain a valid source-address token could be twice as large as before. Merge internal change: 55736193 Log OpenSSL errors when QUIC encryption fails. Merge internal change: 55718465 Second version with improved tests and keeping the client and server packet sizes identical to ensure the truncated ack detection works correctly. Merge internal change: 55651642 Hidden bug that uses ack_frame instead of stream_frame. Merge internal change: 55648483 Move QuicCryptoServerConfig from crypto_server_config.{h,cc} to quic_crypto_server_config.{h,cc} and move QuicCryptoClientConfig from crypt_handshake.{h,cc} to quic_crypto_client_config.{h,cc} to be consistent. Merge internal change: 55644306 Ported IOVector unit tests (as part of porting the following CL). Makes GFE's IOVector class copy-able. I am working on using IOVector through QUIC's read and write paths, and it would be tremendously helpful to have value-semantics for an IOVector object. Making it copy-able was noted in joechan@'s TODO in the original IOVector code. Merge internal change: 55509822 Cancel all pending alarms when the QUIC connection is closed. Merge internal change: 55640997 Removed version 10 from supported versions. Adding QUIC_VERSION_12 to optimize the Quic ack framing format to reduce the size and better handle ranges of nacks, which should make truncated acks virtually impossible. Also adding an explicit flag for truncated acks and moving the ack outside of the connection close frame. Merge internal change: 55594574 R=rch@chromium.org Review URL: https://codereview.chromium.org/51313002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@232035 0039d316-1c4b-4281-b951-d872f2087c98
* Land Recent QUIC changes.rtenneti@chromium.org2013-10-281-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix a bug in the quic_client where disconnecting and re-connecting would re-use the same packet writer, and attempt to write to the same (now closed) socket. Merge internal change: 55509535 If the most significant byte of a QuicTag is 255 ('\xff'), print that byte as a space rather than printing the QuicTag as a decimal number. Add a unit test for QuicUtils::TagToString. as "CRT " instead of its decimal value "4283716163". Merge internal change: 55493160 Miscellaneous cleanup of the supported_versions CL. Remove QuicVersionArrayToString. Replace the only QuicVersionArrayToString call by QuicVersionVectorToString. Add a protected supported_versions() getter method to QuicDispatcher to allow access to supported_versions_ by derived classes of QuicDispatcher. Document the purpose of each combination of supported versions in gfe/quic/end_to_end_test.cc. "gfe2/quic_versions" and its value no longer has an extraneous comma at the end. For example, "QUIC_VERSION_11,QUIC_VERSION_10" as opposed to "QUIC_VERSION_11,QUIC_VERSION_10," Merge internal change: 55490062 Implement encoding and decoding of unsigned half precision floats in QUIC. Merge internal change: 55454508 Annotate QUIC streams as server/client in DLOG output. Merge internal change: 55419499 Expose methods for getting/setting the QUIC congestion manager's congestion window value. Merge internal change: 55416317 Return the unused server port once EndToEndTest has finished, to reduce the chance PickUnusedPortOrDie will fail in the future. Merge internal change: 55376533 This change hasn't been enabled in chromium. Fix quic prober to use new QuicClient constructor which takes QuicSupportedVersions as argument. Merge internal change: 55353942 Change all QuicConfig constructors to DefaultQuicConfig. Merge internal change: 55307326 Fixing TSAN warnings in the PacketDroppingTestWriter by adding a lock. Merge internal change: 55234723 Fixing potential bugs with write blocking in QuicConnection. Merge internal change: 55230366 Added back QuicVersionMax to fix borg TAP failures. This is a temporary fix until until CL 55170273 lands. Merge internal change: 55173927 Test server/client various combinations of supported versions. - Fix to handle if chrome were to send VERSION 11 and GFE supports version 10 and vice versa (fixes to setting of NULL decrypter). Fixed unit tests to handle different packet sizes between 11 and 10 because of changes to Null encrypter/decrypter. - Send version negotiation packet packet again (from server) if that packet is dropped. - Changed end_to_end_test.cc to configure the client to support multiple versions and configure the server to support only one version and vice versa. - Moved QuicVersionMax and QuicVersonMin to quic_test_utils.cc. Most of the bug fixes are from rch. re-transmitting that packet again. Fixed bugs with server supporting VERSION 10 and chrome negotiating down from 11 to 10. Added tests for version negotiation and testing of various combinations of server and client version negotiation. Merge internal change: 55168938 Don't cast a uint32 to int32 then to a uint64. Seen in test logs: I1018 11:55:44.626228 1775 packet_dropping_test_writer.cc:50] Seeding packet loss with -508765393 I1018 11:55:44.626275 1775 packet_dropping_test_writer.cc:50] Seeding packet loss with 631710332 Merge internal change: 55135280 R=rch@chromium.org Review URL: https://codereview.chromium.org/47283002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@231296 0039d316-1c4b-4281-b951-d872f2087c98
* Land Recent QUIC changes.rtenneti@chromium.org2013-10-141-1/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add an explicit FlushAllQueuedFrames method to QuicPacketGenerator. This differs from FinishBatchOperations in that it flushes *all* queued frames, even those which might not be currently sendable. This is necessary to ensure that crypto messages go out in their own packets, regardless of the current writability of the socket. Fixes a bug in which crypto messages might not be sent in dedicated packets. Merge internal change: 54521255 Fixes to make the following reverted QUIC CL's to work. https://codereview.chromium.org/26385004/ https://codereview.chromium.org/26739002/ - Changed "DCHECK(retransmission_alarm_->IsSet())" to if retransmission_alarm_->IsSet() then cancel the alarm. - Added call to OnPacketSent from QuicConnectionHelper::OnWriteComplete. - If QUIC version from client or server is version 10 and the other side supports version 11, then only set Encrypter/Decryter. - Disabled QuiConnectionHelper's WritePacketToWireAsync. Will be rewriting this code in the next merge CL. Remove unused IsWriteBlocked method from QuicConnectionHelperInterface. Merge internal change: 53803217 Add missing QUIC_VERSION_Q011 case in QuicVersionToString. Merge internal change: 53749976 QUIC: don't ignore SetKey and SetNoncePrefix return values. This change causes failures to set the AES-GCM key and nonce to bubble up and kill the connection. I don't think that we've had any failures, but you never know and it would be bad to, say, start transmitting plaintext or something because we didn't notice that we failed to set a key. (The OpenSSL AEAD API doesn't actually let that happen: it zeros the output buffer on any failure, but things might change in the future.) (This is a follow up from a previous CL which altered our AES-128-GCM implementation.) Merge internal change: 53742674 Reduce the length of the QUIC null encryption auth hash from 16 bytes to 12 bytes to match the length of the AES auth hash. Merge internal change: 53693995 Addressing comments in Jana's review of cr/52231261. Merge internal change: 53582401 QUIC: disable P-256 support on the server. The P-256 key generation is done with OpenSSL, which doesn't use the QuicRandom passed to DefaultConfig(). This is causing the generated server configs to be non-deterministic and breaking 0-RTT handshakes. Merge internal change: 53501783 Fix an LOG to use the correct condition in QuicReceivedPacketManager and change it to a DFATAL so in the future tests will prevent re-occurrence. Merge internal change: 53483753 Cleanup: Rename OnIncomingAck to OnPacketAcked, and remove unneeeded argument from SentPacketManager::OnIncomingAck. Merge internal change: 53483155 Fix a bug in QuicConnection/QuicConnectionHelper if the helper buffered the write (as is the case in chrome). In this case, the sent packet was not accounted for properly. Merge internal change: 53462749 Refactor to change WritePacket to return a WriteResult struct. Merge internal change: 53382221 Fixing a bug where the version negotiation packet would get dropped on the floor if the socket was write blocked at the time it was sent. The packet is now queued. Merge internal change: 53317846 Create a new QUIC_INVALID_CHANNEL_ID_SIGNATURE error to replace a usage of QUIC_INTERNAL_ERROR. Merge internal change: 53277933 Added a todo to merge internal CL 53267501 when chromium's version of OpenSSL has latest AEAD code. Didn't merge internal change: 53267501 R=rch@chromium.org Review URL: https://codereview.chromium.org/26930003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@228438 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 228145 "Land Recent QUIC changes."rtenneti@chromium.org2013-10-111-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > Land Recent QUIC changes. > > Remove unused IsWriteBlocked method from QuicConnectionHelperInterface. > > Merge internal change: 53803217 > > Add missing QUIC_VERSION_Q011 case in QuicVersionToString. > > Merge internal change: 53749976 > > QUIC: don't ignore SetKey and SetNoncePrefix return values. > > This change causes failures to set the AES-GCM key and nonce to bubble > up and kill the connection. I don't think that we've had any failures, > but you never know and it would be bad to, say, start transmitting > plaintext or something because we didn't notice that we failed to set > a key. > > (The OpenSSL AEAD API doesn't actually let that happen: it zeros the > output buffer on any failure, but things might change in the future.) > > (This is a follow up from a previous CL which altered our AES-128-GCM > implementation.) > > Merge internal change: 53742674 > > Reduce the length of the QUIC null encryption auth hash from 16 bytes to > 12 bytes to match the length of the AES auth hash. > > Merge internal change: 53693995 > > R=rch@chromium.org > > Review URL: https://codereview.chromium.org/26739002 TBR=rtenneti@chromium.org Review URL: https://codereview.chromium.org/27022003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@228206 0039d316-1c4b-4281-b951-d872f2087c98
* Land Recent QUIC changes.rtenneti@chromium.org2013-10-111-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove unused IsWriteBlocked method from QuicConnectionHelperInterface. Merge internal change: 53803217 Add missing QUIC_VERSION_Q011 case in QuicVersionToString. Merge internal change: 53749976 QUIC: don't ignore SetKey and SetNoncePrefix return values. This change causes failures to set the AES-GCM key and nonce to bubble up and kill the connection. I don't think that we've had any failures, but you never know and it would be bad to, say, start transmitting plaintext or something because we didn't notice that we failed to set a key. (The OpenSSL AEAD API doesn't actually let that happen: it zeros the output buffer on any failure, but things might change in the future.) (This is a follow up from a previous CL which altered our AES-128-GCM implementation.) Merge internal change: 53742674 Reduce the length of the QUIC null encryption auth hash from 16 bytes to 12 bytes to match the length of the AES auth hash. Merge internal change: 53693995 R=rch@chromium.org Review URL: https://codereview.chromium.org/26739002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@228145 0039d316-1c4b-4281-b951-d872f2087c98
* Land Recent QUIC changes.rtenneti@chromium.org2013-09-251-10/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change the QuicConnection/QuicPacketGenerator to serialize hadnshake messages immediately. This ensure that they are send out with the correct encryption level. Merge internal change: 52576456 Lazily serialize retransmissions only when we're not write blocked and the congestion manager indicates we'll be able to send, in order to avoid sending packets out of sequence number order. Merge internal change: 52544477 Pull out AckNotifier tracking into a QuicAckNotifierManager class. This is now the single point of contact that the QuicConnection has for ACK notification logic. Merge internal change: 52525978 More efficient AckNotifier. Keep a map of <sequence number, list<AckNotifier ptrs>> so we don't have to iterate over every AckNotifier when receiving an ACK. Merge internal change: 52524423 When an FEC packet is abandoned, attempt to write since the congestion window may have opened up. Merge internal change: 52520538 Refactor to remove MaybeStartFEC from the public QuicPacketCreator interface and let the packet creator open the FEC group when a frame is added. Merge internal change: 52457809 Add guid to some DLOG messages. Merge internal change: 52409285 Modified SendDelayedAckOnTimer test to use the newer and better Fire() method on the ack alarm instead of calling SendAck() directly. Merge internal change: 52392652 de-lint the comments (added missing periods). Bundle acks with outgoing packets when possible to reduce ack delay. If delayed ack timer is running and if we are about to transmit a packet (data, rst, goaway), then bundle an ack as well. Merge internal change: 52387431 R=rch@chromium.org NOTRY=true Review URL: https://chromiumcodereview.appspot.com/24352002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@225195 0039d316-1c4b-4281-b951-d872f2087c98
* Land Recent QUIC changes.rtenneti@chromium.org2013-09-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Flag protect (and default to off) the new QUIC retransmission history tracking. Merge internal change: 52291286 Do not send retransmissions of packets if a previous transmission has been acked. Merge internal change: 52261869 Send ACKs in response to every packet when a QUIC connection has missing packets from the peer. Merge internal change: 52247928 Rename CongestionWindow to SendWindow in several place in TcpCubicSender, in particular when we have taken a min(cwnd, rwin). Merge internal change: 52246424 Remove Q008 from the protocol. Merge internal change: 52231392 Also removed Q007 and the TODO with deleting the code when we delete version Q007 and Q008. Retransmit whatever the congestion manager tells us to, and use the correct RTO timeout when multiple sequential RTO's fire. Merge internal change: 52231261 Change Retransmission to TransmissionType and split IS_RETRANSMISSION into NACK_RETRANSMISSION and RTO_RETRANSMISSION so they can be differentiated by the congestion control. Merge internal change: 52187292 Track the retransmission history of a QUIC packet so that if a previous version of the packet is ack'd, the data is not re-sent. Merge internal change: 52125881 R=rch@chromium.org Review URL: https://chromiumcodereview.appspot.com/23514073 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@224863 0039d316-1c4b-4281-b951-d872f2087c98
* Land Recent QUIC changes.rtenneti@chromium.org2013-09-181-13/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added a DCHECK that ProcessRawData will not be called with zero data length. Merge internal change: 52068687 Removed reinterpret_cast<QuicFecBuilderInterface*>. Minor comment fix. Merge internal change: 52051673 Replace QuicConnectionVisitorInterface::OnPacket with OnStreamFrames Merge internal change: 52049491 Remove unused OnAck method from QuicConnectionVisitorInterface. This is a bit of an abstraction violation, since nothing above the Connection knows about packets. The AckNotifier interface provides the "right" abstraction. Merge internal change: 52027657 Add state to session to indicate that a crypto stream is blocked, so that we can properly set the IS_HANDSHAKE argument when asking the congestion manager if we CanWrite(). Merge internal change: 51983405 Break out the tracking of sent packet from QuicConnection to a new QuicSentPacketManager class. Merge internal change: 51969314 Delay the RTO every time an ack is received, per TCP RTO spec. Merge internal change: 51954312 Sending ConnectionClose frames via the PacketGenerator so they get properly queued if they cannot be sent immediately. Prevents multiple different connection close packets from being sent, a potential infinite loop, and from dropping connection close packets which can't be sent due to a write block from being dropped entirely. Merge internal change: 51890780 Increse the default max_tcp_congestion_window to 100 from 50, now that the RTO has been increased to the TCP standard of 60 seconds. Merge internal change: 51854728 Added large (1 Mb) POST tests. Verified that without the fix from cl/51829697 these tests timeout due to receiver cwnd dropping to zero after sending ACKs. Merge internal change: 51854636 Refactored and replaced SendStreamAndNotifyWhenAck() to work with SendvStreamData(). Merge internal change: 51848330 Remove unused client2 scoped_ptrs from end_to_end_tests Merge internal change: 51835589 R=rch@chromium.org Review URL: https://chromiumcodereview.appspot.com/23691073 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@223996 0039d316-1c4b-4281-b951-d872f2087c98
* Land Recent QUIC changes.rtenneti@chromium.org2013-09-181-0/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Pass HasRetransmittableData to the congestion manager and the send algorithm. This allows tcp_cubic_sender to not count ACK-only packets against the congestion window. Merge internal change: 51829697 If a previously zombie'd QUIC stream is closed and the headers have been decompressed, remove that entry from the zombie stream map. Merge internal change: 51697989 Change the value used to set the sequence number with to both correctly calculate the widest packet spread currently outstanding and fix a DCHECK failure in EndToEnd's Uber test when packets were transmitted sufficiently out of order that the packet being sent was less than the last packet the peer was awaiting. Merge internal change: 51644967 Fix a bug where frames are queued and not enough room for the next stream frame is available, but we attempt to create a STREAM frame anyway in ConsumeData. Merge internal change: 51604946 Changed Delayed Ack Timer to go off before the sender's retransmission timer goes off. Merge internal change: 51594956 Using the priorities sent by the client, including bounds checking, and bumping the priority of initial writes to avoid the HOL header blocking issue. Merge internal change: 51586426 Fix memory leak uncovered by https://codereview.chromium.org/23587004 Merge internal change: 51569066 Added logging of QUIC version negotiated. Export number of QUIC sessions and streams for each QUIC version. Merge internal change: 51540178 A refactor of QuicFdWrapper's writev to pass the iovec all the way to QuicConnection, allowing better packet packing. Merge internal change: 51530908 Enabled priorities in chrome quic streams. R=rch@chromium.org Review URL: https://chromiumcodereview.appspot.com/23597045 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@223880 0039d316-1c4b-4281-b951-d872f2087c98
* Land Recent QUIC changes.rtenneti@chromium.org2013-08-211-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add another empty packet check to QuicPacketCreator. Merge internal change: 51128171 Change a DCHECK into LOG(DFATAL) so that we can see if this is actually happening. Merge internal change: 51096918 Remove hard-coded version from QuicFramerTest Merge internal change: 51006687 Reserializing packets for retransmission now use the original sequence number length, as intended, and a test has been added to verify that. Also, re-calculating the packet's size anytime no frames have been added. Once they've been added, the header size will not change, as before. Merge internal change: 51153356 Lazily initialize QuicPacketCreator's packet_size to the header size, so the sequence_number_length and other overhead can be more accurately calculated. Merge internal change: 51071397 Enable variable length sequence numbers in the packet header by dynamically calculating the necessary length. Merge internal change: 50917379 R=rch@chromium.org Review URL: https://chromiumcodereview.appspot.com/23368002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@218781 0039d316-1c4b-4281-b951-d872f2087c98
* Land Recent QUIC changes.rtenneti@chromium.org2013-08-201-1/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Moving QUIC over to the new QUIC/SPDY write blocked list template. Fixing all QUIC streams to a single priority for now. Merge internal change: 50911466 Factoring out the spdy write blocked logic into a utility Spdy and Quic can share. Merge internal change: 50897578 Moving the quic dispatcher from using the WriteBlockedList to using a generic linked hash map, in preperation to adding priorities to the WriteBlockedList. Merge internal change: 50728003 QUIC dead code removal. Merge internal change: 50710912 Clarify batch mode in packet generator. Merge internal change: 50587122 Minor spacing/wording fixes to DLOG messages in quic_connection. Merge internal change: 50574131 Define kDefaultRetransmissionTime once in QuicConnectionTest. Merge internal change: 50571883 Deleted FramePackingAckResponse from chromium and will do the same on server side in another CL. Improve frame packing of acks and other frames when acks are received. Merge internal change: 50521649 Fix TODO in quic_connection.cc Merge internal change: 50515632 R=rch@chromium.org Review URL: https://chromiumcodereview.appspot.com/22801008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@218500 0039d316-1c4b-4281-b951-d872f2087c98
* Tell congestion manager when we are sending a CHLO, so it won't delay sending.jar@chromium.org2013-08-031-8/+9
| | | | | | | | | | | | Most critically, we need to ignore the congestion window when we're sending a CHLO. Such packets are notable as they are the only packets send with null encryption (other than perhaps ACKs, which are generally not restricted anyway). BUG=266647 Review URL: https://chromiumcodereview.appspot.com/21714002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@215455 0039d316-1c4b-4281-b951-d872f2087c98
* Land Recent QUIC changes.rtenneti@chromium.org2013-07-261-22/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implemented RTO calculation for TCP sender. Merge internal change: 49182038 Introduce a different proof-demand type for ECDSA certs. In cl/48309237, wtc enabled ECDSA certificates for QUIC. However, Windows XP can't cope with them so we mustn't return ECDSA certs to those clients. The value of ECDSA over RSA in QUIC is much less than in TLS because the server doesn't need to sign every connection. However, they are likely to be ~192 bytes smaller, which might be useful. This change disables ECDSA certificates for the <X509> tag and introduces a new <X59E> tag by which the client can advertise that it supports ECDSA certificates. Merge internal change: 49170028 Added whitespace. Merge internal change: 49130502 QUIC: check that encryption sequence numbers always increase. Since sequence number reuse is causes the end of the world, check that it never happens. This makes me feel more warm and fuzzy. Merge internal change: 49113162 QUIC: Send larger client hellos when hoping for certificates. With cl/49050453, larger client hellos can get larger rejection messages. This change causes the client to send larger client hellos when it's likely that we'll be getting certificates. In the event that the certificates fit in the larger space, but not the smaller one, this saves a round trip. Merge internal change: 49109243 QUIC: allow larger ClientHellos to get larger certificate chains. At the moment we hope that the certificate chain compression gets the certs down to under 400 bytes and then we feel ok about sending them in a reply to an unverified source address. But since we're switching to 2K certs that's basically hopeless: the leaf certificate will have two, uncompressable blobs in it: the public key and the signature and, for 2K, they are 256 bytes each. This change allows a client to send a client hello with more padding and get a larger reply to an unverified source address. What we don't want is to become a DDoS amplifier so we make the attacker work in order to get more from us. Merge internal change: 49050453 QUIC: Update the common certificate set with GIAG2. This doesn't break the protocol, but it does mean that clients with the old certificate set won't be able to elide any certificates. But since Chrome isn't working with QUIC HTTPS yet anyway, that's not a problem. Merge internal change: 49050091 Modify QuicStreamSequencer::OnStreamFrame to not call ProcessRawData with zero length data. Fixes http://crbug.com/257041 Merge internal change: 48912969 BUG=257041 Change ReliableQuicStream::OnStreamFrame to simply delegate fin handling to the QuicStreamSequencer. Merge internal change: 48900554 Spliting QuicPacketEntropyManager into QuicReceivedEntropyManager and QuicSentEntropyManager, in preparation for a larger refactor to create a ReceivedPacketManager. Merge internal change: 48860732 Add a test to recreate the invalid ack created when an Ack is sent immediately in response to a received ack, but the incoming ack's corresponding headers, and hence packet entropy, has not been processed. Merge internal change: 48848920 Aggregate ACK and Feedback frames properly. Existing code tried to pack acks with feedback info, and regulate transmission of control packets. There was a bug where it sometimes didn't pack together an ack with a feedback frame (specifically when we were blocked from sending non-retransmittable data). There was a second bug wherein a control frame might be prematurely serialized, when it could *not* be sent immediately. Specifically when the control frame was the first frame in a packet, and non-retransmittable data could be sent, the control frame could be errantly added. We now consistently aggregate ack frames with feedback frames in a single packet whenever the coalescing won't delay the sending of the just-in-time calculated frames. We now also avoid adding a control frame into a packet unless we are sure it can be sent immediately (so that we don't block or delay future ack and feedback transmission). The CL includes updates to tests so that they fail with the old code, but pass with the new code, as well as a bunch of additions to comments. This CL is based on the Chromium CL 17341005 (which is not landing until its merge time comes around), and resolves chromium bug 256116. FIXED=9502307 Merge internal change: 48841932 BUG=256116 Add logging to the QUIC write path. merge chromium CL: 17518002 Merge internal change: 48811324 Most of the changes were already in chromium except for comment change. Fix broken test (opt mode) in cl/48802264. Merge internal change: 48806857 Demote LOG(ERROR) to DLOG(INFO) when a client sends a packet with unsupported version. This should not be considered an ERROR server-side, as a client is free to send us whatever they like. We deal with it by sending a version negotiation packet and all is well. Updated tests, and added some comments. Merge internal change: 48802264 Added time_wait_list_manager helper method to QuicDispatcher. Merge internal change: 48787571 QUIC: encode the cluster in the first four bytes of the orbit value. In order to try and measure, in Chrome, when we might have saved a round-trip with a cluster-wide strike-register we need to know when we hit another server in the same cluster. We could do that by IP address somewhat, but it's a little complex and there's the /8 vs /5 between core and .... This change causes the first four bytes of the orbit to include a hash of the cluster (or ... rack name) so that we can easily track this in Chrome. Merge internal change: 48784059 Fix a bug in ReliableQuicStream::OnDecompressorAvailable where a decompression failure would result in an infinite loop. Merge internal change: 48696905 patch from issue 20054002 Enabling ChannelId for QUIC, and passing the ChannelId header to google backends if we're using it. Not flag protected as we're not doing secure-quic in prod yet. Merge internal change: 48645878 * Removed QuicTag kQuicVersion1 * Replaced this with enum QuicVersion, which currently has QUIC_VERSION_6 and QUIC_VERSION_7 * End to end tests are run with both versions * Framer tests are run with both versions * QuicConnection now takes a QuicVersion parameter * TimeWaitListManager now stores QuicVersion in the GUID map and sets the framer version appropriately using this before sending reset Merge internal change: 48634592 R=rch@chromium.org Review URL: https://chromiumcodereview.appspot.com/20227003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@213914 0039d316-1c4b-4281-b951-d872f2087c98
* Add logging to the QUIC write path.rch@chromium.org2013-06-221-1/+1
| | | | | | Review URL: https://chromiumcodereview.appspot.com/17518002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@208098 0039d316-1c4b-4281-b951-d872f2087c98
* Land Recent QUIC changes.rtenneti@chromium.org2013-05-301-20/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make the FEC group optional by adding a flag to the private headers. Merge internal change: 46979143 Merging changes from chromium CL - 15385004 Merge internal change: 46949614 Removing debug logging from RecordPacketReceived. Seems redundant to log both when we actually receive and when we record it. Merge internal change: 46934210 Logging crypto handshake as a DVLOG rather than DLOG as it hasn't recently been needed to debug test failures. Merge internal change: 46932247 Changing the quic test client to simply not return a stream if not connected. This will hopefully turn server test check-failures into server test failures. Merge internal change: 46932163 QUIC: redo server nonces. Previously, in order to cope with strike-register failures and client clock-sync issues, the server could issue a server nonce to a client. This meant that the server had to remember rejected handshakes so that the server nonce could be matched up. With this change, QUIC servers no longer need to keep track of rejected handshakes. Instead of issuing and remembering nonces, a server will now encrypt them and forget about them. When a server nonce is used to establish freshness for a connection, it will be stored in a per-GFE strike-register. (This strike-register is separate from the one used to process client nonces.) Merge internal change: 46889484 Remove FEC_ENTROPY_FLAG from private flags. Now, FEC packet's entropy flag contain the xor of entropies of the protected packets. Merge internal change: 46889094 Limit the number of times we'll fast-retransmit a given packet using taildrop. Merge internal change: 46754530 Added CommonCertSetsQUIC to anonymous namespace. QUIC: cleanups round two. * Make CommonCertSetsQUIC a Singleton to save on every Config having its own copy. * Rework server config expiry: previously it caused an error at client hello send time. Now it will cause an error at REJ processing time but, if the config expired after we cached it, we will act as if we didn't have a cached server config. * Invalidate the server config cache in the event of a client hello sending failure. This will prevent a bad server config from being cached and poisoning connection attempts for the lifetime of the cache. * Fix a bug in the test code which failed to parse hex chunks in debugging messages correctly. (Thanks to wtc for noticing.) Merge internal change: 46742937 Merging changes from chromium - CL 15074007 Merge internal change: 46710932 Fix a bug in QuicSession's header compression behavior which could lead to infinite loops. Merge internal change: 46694681 Getting 5% our CPU usage back by not calculating SentBandwidth for the tcp congestion control algorithm. Added a TODO to improve that function since it's pretty abysmal: the ToLargerUnits and Subtract overhead alone accounted for 4.5% of the cpu in initial loadtest runs. Merge internal change: 46608880 Adding support for truncated guids in QuicFramer. Merge internal change: 46575819 using our latched write_blocked status to spare us useless system calls. Merge internal change: 46573462 Fixing some crashing issues in the QUIC loadtest, where if a client ever disconnects it never recovers, either crashing trying to create a stream or crashing waiting for a response on a non-existant stream. I'm not sure if we have the same problem for the http/https simple clients but we definitely do for QUIC. Merge internal change: 46562890 Merging changes from chromium - CL 14614006 Merge internal change: 46460427 Merging cleanup changes from chromium CL - 14651009 Merge internal change: 46457093 Fixing a test framework bug for quic: we were munging headers to do https:// for insecure quic resulting in a 404 in the http-only service map. Then disalbing the test since we don't advertise secure SPDY on insecure QUIC. Merge internal change: 46408400 Move QuicConfig from ssl_global_data to quic_dispatcher.cc. Initialize using values from QuicConfigProto and use the max_time_before_crypto_handshake to set the overall connection timeout before crypto handshake finishes. Merge internal change: 46400649 QUIC: implement ChannelIDs. We'll need this for HTTPS. Merge internal change: 46396357 Deleted usage of scoped_ptr_openssl. Added TODO comments for porting ChannelIDSigner and Verifier. R=rch@chromium.org Review URL: https://chromiumcodereview.appspot.com/15937012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@203220 0039d316-1c4b-4281-b951-d872f2087c98
* Land Recent QUIC changes.rtenneti@chromium.org2013-05-231-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Blacklisting PCI domains for quic such that we won't even complete the crypto handshake for those domains on port 443. Merge internal change: 46392850 Dont retransmit packets which are NULL encrypted when encryption level is FORWARD_SECURE. This solves a bug when the client kept retrying to send a retransmitted CHLO which the server kept dropping. Merge internal change: 46380016 QUIC: various cleanups. * The AES code no longer does key expansion for every packet. * The CryptoFramer now actually calls Visitor::OnError. Merge internal change: 46227160 QUIC: add a CryptSecretBoxer object for server-internal needs Quic[En|De]crypter isn't actually thread-safe. I thought that it was because we were doing the key schedule every time, but it subtly isn't because the nonce is stored in the object, not on the stack. With cl/46095856 (not yet landed) I changed the AES-GCM encrypter/decrypter to really be non-thread-safe, which seemed fine because it wasn't previously either, but then I recalled that the server code was assuming otherwise. Initially I tried adding a thread-safe wrapper that could use thread-local storage on the server side and just locks in Chrome. That's done in cl/46136485 which is alternative to this CL. However, after writing it, it seemed that it might be easier just to have a thread-safe boxer, since this is internal to the server, and be done with it. At the same time we can also solve the short-nonce worry with the existing, AES-GCM based boxer. Merge internal change: 46226208 For chromimum: Used sha256 to compute the hash of nonce and plaintext and stored it at the end of Box message. In Unbox, verified the sha256 hash stored in the ciphertext, matches the sha256 hash of nonce and plaintext in the ciphertext. TODO: Use Aes128Gcm12[En|De]crypter instead of sha256. QUIC - updated the comment in NormalizeHostname to say "stopping at the first trailing dot." QUIC - moved destructor to out of line. Merging cleanup changes from chromium - CL 14718011 Merge internal change: 46099778 Adding infrastructure to blacklist domains for QUIC Merge internal change: 46093221 Changing to be aware of variable length guids, but not yet support reading, writing, or negotiating non-8 byte guids. Merge internal change: 46050640 QUIC: invalidate validity when server config changes. When writing cl/44509151 I started by altering SetServerConfig but changed my mind and split SetProof from SetServerConfig. I used git to revert the changes to SetProof to avoid diff noise, but failed to add back the important change: the validity flag needs to be cleared when the proof is set. I will be wearing a brown paper bag for the rest of the day. Merge internal change: 46050043 R=rch@chromium.org Review URL: https://chromiumcodereview.appspot.com/15910002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@201925 0039d316-1c4b-4281-b951-d872f2087c98
* Land Recent QUIC Changes rtenneti@chromium.org2013-05-031-5/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Alter the serialisation format of the crypto messages. This changes the format of the crypto messages so that: * We can cope with > 65K values in order to be robust to post-quantum algorithms in the future. * Rather than encoding lengths, we encode the offset one byte past the end of the value. This allows an implementation to binary search the header without having to do all the allocation and copying the we currently do. Merge internal change: 44699015 Automated rollback of changelist 44685914. Rollback: Bugfix infinite wait Merge internal change: 44693957 QUIC: retransmit packets with the correct encryption. This change does four things: * Splits the concept of a completed handshake in two: when encryption is established and when the server has confirmed the handshake. In order to do 0-RTT, we have to start sending after the first of those events. * Retransmits packets using the same encryption level as they were sent with. Without this, the loss of a client hello message is fatal to the connection because it will be retransmitted under encryption and the server will never be able to process it. * Makes decryption failures an ignored error. This is needed because, if a client hello message is lost, the subsequent packets will be encrypted and the server won't have the decrypter to process them. * Changes how decrypters are handled by the framer. A server now replaces its decrypter completely - thus removing the NullDecrypter. The client now has latching alternative decrypters which replace the primary decrypter when used. This doesn't completely close the hole: the connection still needs to worry about plaintext packets injected into the client. This change does not implement the correct fallback for the server rejecting a full client hello. It also doesn't implement a limit for the number of packets that we'll send without the server confirming the handshake. I'm hoping that rch can do that much more easily than I can! Merge internal change: 44690884 R=rch@chromium.org Review URL: https://chromiumcodereview.appspot.com/14718011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@198099 0039d316-1c4b-4281-b951-d872f2087c98
* Rewrite std::string("") to std::string(), Linux edition.dcheng@chromium.org2013-04-091-1/+1
| | | | | | | | | | | | | | | | | | | This patch was generated by running the empty_string clang tool across the Chromium Linux compilation database. Implicitly or explicitly constructing std::string() with a "" argument is inefficient as the caller needs to emit extra instructions to pass an argument, and the constructor needlessly copies a byte into internal storage. Rewriting these instances to simply call the default constructor appears to save ~14-18 kilobytes on an optimized release build. BUG=none Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=193020 Review URL: https://codereview.chromium.org/13145003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@193040 0039d316-1c4b-4281-b951-d872f2087c98
* Revert "Rewrite std::string("") to std::string(), Linux edition."dcheng@chromium.org2013-04-091-1/+1
| | | | | | | | | | | | | | This reverts commit e59558b78e8c6a1b0bd916a724724b638c3c91b6. Revert "Fix build after r193020." This reverts commit 558a35897f6b3ffbcaefde927c1f150b815d140a. Revert "Really fix build after r193020." This reverts commit e3748a79b523a8d365d4a33ef986eebb4186fa78. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@193030 0039d316-1c4b-4281-b951-d872f2087c98
* Rewrite std::string("") to std::string(), Linux edition.dcheng@chromium.org2013-04-091-1/+1
| | | | | | | | | | | | | | | | | This patch was generated by running the empty_string clang tool across the Chromium Linux compilation database. Implicitly or explicitly constructing std::string() with a "" argument is inefficient as the caller needs to emit extra instructions to pass an argument, and the constructor needlessly copies a byte into internal storage. Rewriting these instances to simply call the default constructor appears to save ~14-18 kilobytes on an optimized release build. BUG=none Review URL: https://codereview.chromium.org/13145003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@193020 0039d316-1c4b-4281-b951-d872f2087c98
* Add support for P-256 key exchange in crypto handshake.rtenneti@chromium.org2013-03-311-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Merge internal change: 44173744 Add default return to avoid crashing when we get an unknown error code from the peer. Merge internal change: 44160057 Fix incorrect DCHECK while serializing version negotiation packet. Merge internal change: 44156166 Reorder the addends in GetPacketHeaderSize to match the order of the public header fields. Merge internal change: 44153020 Changing retransmission and retransmittable data boolean flags to enums. Merge internal change: 44071662 Remove methods from QuicTime for converting to/from microseconds and milliseconds since the epoch for QuicTime is unspecified. (It wraps TimeTicks in Chromium). Merge internal change: 44069965 Change InterArrival feedback message to traffic in delta since the "start" of the connection instead of a delta since the epoch. One step closer to being able to remove QuicTime::To/FromMicroseconds since those methods don't "do the right thing". Merge internal change: 44037996 Changing kForce into an enum. Merge internal change: 44024887 Cleanups from landing P-256 key exchange in Chromium. Merge internal change: 44023801 Fix for std::vector in QuicPacketPublicHeader's memory corruption by memset. Merge internal change: 44022862 Merging cleanup changes from chromium. Merge internal change: 44009665 Plug in the new decrypter and encrypter after the new keys have been derived. This is a first cut, as some details on changing the encryption keys still need to be worked out. Our interim solution is permissive trial decryption, which allows the peer to encrypt with the wrong key, either using the new key too early or using the null key for too long. The latter will leak confidential information, so we err on the side of using the new key too early. WARNING: the interim solution protects against eavesdroppers, but is vulberable to active attackers. Merge internal change: 44006658 Start tracking server and client stream resets and export them via varz. Merge internal change: 43971847 Pull out RstStreamFrame error code from QuicErrorCode so that they don't appear in the tracked ConnectionClose error map. This will also help in tracking RstStream error codes separately. Merge internal change: 43968620 Adding Client/Server logging to all LOGS/DLOGs Not bothering with VLOGs/DVLOGS unless it's requested. Merge internal change: 43948596 crypto: step 5. This change implements source-address tokens at the server and has the client echo them. Source address tokens are opaque (to the client) bytestrings that prove ownership of an IP address. In order to prevent amplification attacks, the server demands that the client have a valid source address token for the IP address that it's claiming to come from and that the token is reasonably recent. Since we already have it implemented, this code uses AES-GCM to encrypt and authenticate the tokens with a fixed, dummy secret (for now). In the future, the secret will be derived from the primary, private key in the same way that SessionTicket keys used to be. The QuicEncrypter/Decrypter code was written to be quite specific to the task of encrypting and decrypting packets and, as part of this, it exposed only 64 bits of the AEAD nonce. Since all GFEs will share the same token secret, and they'll all create tokens with random nonces, that runs an unacceptably high risk of an attacker obtaining two tokens with the same nonce. Thus this change also reworks the QuicEncrypter/Decrypter so that the full nonce is exposed and thus we can use 96-bit nonces. That's still not completely wonderful but, at 10Mpps an attacker would still take a year to obtain a pair of nonces, so it's good enough for a while at least. Merge internal change: 43893806 R=rch@chromium.org Review URL: https://chromiumcodereview.appspot.com/13282004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@191569 0039d316-1c4b-4281-b951-d872f2087c98
* Land Recent QUIC Changesrtenneti@chromium.org2013-03-141-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Handle versioning by closing the connection on version mismatch for now. Merge internal change: 43606997 Number of cleanups from landing recent crypto changes. Merge internal change: 43606111 Added delta_time_largest_observed to ReceivedPacketInfo to calculate accurate RTT. Merge internal change: 43582099 Implement server-side QUIC key expansion. The derived keys are still not being used yet. TODO: Code is in crypto_test_utils needs to be enabled. Merge internal change: 43570937 Added AbandoningPacket to congestion control to avoid issue with FEC. Merge internal change: 43570099 Wait infinite (aka wait for next ack) is not handled correctly. Merge internal change: 43558636 Enable faster stats for QUIC. Merge internal change: 43557310 Implement QUIC key expansion on the client side. The keys are not being used yet. Merge internal change: 43515237 Add missing quic_stats files. Track some connection stats. Merge internal change: 43506869 Fix bug in WriteQueuedPackets Merge internal change: 43499600 Small comment change in crypto_handshake's ProcessServerHello method. Merge internal change: 43448804 R=rch@chromium.org BUG= Review URL: https://chromiumcodereview.appspot.com/12806002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@188096 0039d316-1c4b-4281-b951-d872f2087c98
* Land Recent QUIC Changesrch@chromium.org2013-03-031-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix a merging error in the previous checkin. visitor_ is now a scoped_ptr so the visitor_(NULL) initializer was removed. Merge internal change: 43199271 More cleanups that fell out of recent Chrome merges. Merge internal change: 43195667 Implement framing for version flag and field. Merge internal change: 43155434 Reduce the usage of magic numbers by moving most of them to quic_protocol.h Merge internal change: 43133922 Expose functions to calculate offsets and packet sizes from quic_protocol.h. Merge internal change: 43123088 Various cleanups from landing recent changes in Chrome. Merge internal change: 43060871 Moving the quic session's write blocked list over such that we won't add a given session multiple times. Merge internal change: 42920586 Factoring our blocked list out into a separate class. Merge internal change: 42919835 R=jar@chromium.org Review URL: https://chromiumcodereview.appspot.com/12374030 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@185797 0039d316-1c4b-4281-b951-d872f2087c98
* Land recent QUIC changes.rch@chromium.org2013-02-251-0/+508
Reviving entropy flag of missing packet. Merge internal change: 42912121 Fix bug in QuicConnection::OnCanWrite in which the packet generator never flushed the packets when the visitor did not write all bytes. Merge internal change: 42919513 Clarify the SendAlarm behavior of the TestHelper in QuicConnectionTests. In particular, it is important that if we set a send alarm for a delay of Zero, that IsSendAlarmSet() returns true. Merge internal change: 42908913 Fix bug in SimpleQuicFramerVisitor which did not make a copy of StreamFrame data. Merge internal change: 42880797 Use the QuicPacketGenerator in QuicConnection. Merge internal change: 42861764 Add new files Create a new QuicPacketGenerator class to encapsulate the write side operation of a QuicConnection. It provides methods for enqueing control frames, consuming stream data, and sending acks and feedback. It does just-in-time serialization. Also adds a new test-only simple framer which provides an easy mechanism for parsing packets to verify they contain correct contents. Merge internal change: 42813986 Add missing files Implementing logic for checking entropy of received packets and setting entropy on outgoing packets. Merge internal change: 42715914 Fixing a bug where when QuicPacketCreator queues a stream frame, the underlying string is not immediately owned, which can cause issues if SendStreamData doesn't always flush packets before exiting. Merge internal change: 42649091 Add the SetKey, SetNoncePrefix, GetKeySize, and GetNoncePrefixSize methods to the QuicEncrypter and QuicDecrypter interfaces. Specify the format of the nonce for AEAD algorithms. Add a |packet_sequence_number| argument to QuicEncrypter::Encrypt and QuicDecrypter::Decrypt. This requires passing the packet sequence number to QuicFramer::EncryptPacket and QuicFramer::DecryptPayload. Merge internal change: 42641062 Move all logic out of ReceivedInfo. Now it is just a plain struct that is used to represent the state of the received packets info. Also, fixes the following bug: i) Packet 7 8 get lost, largest observed packet is 6. ii) Packet 9 arrives with an AckFrame which has least unacked as 9. iii) We clear 7 8 from missing packets. iv) While adding packet 9 we reinsert 7 and 8 as missing packets since largest observed is 6. Merge internal change: 42556974 Make framer return SerializedPacket instead of QuicPacket. Merge internal change: 42551314 Add SendConnectionClosePacket method to QuicConnection Merge internal change: 42474257 Removing offset from the reset stream frame. Merge internal change: 42436913 Fix for when the end of a frame leave too few bytes for the next header Merge internal change: 42435044 Bug fix for packet loss in inter arrival. Added min drift threshold for inter arrival. Merge internal change: 42391696 Add missing file. Use linked_hash_map to store UnackedPackets: simplifies and optimizes the code. Merge internal change: 42381785 Bugfix "Flaky tests due to QuicTime not initialized" Removed DCHECK that due to timing was invalid Merge internal change: 42374053 Fix TSAN test failure. Merge internal change: 42371302 A simple tcp tail drop like implementation. Merge internal change: 42314912 Adding the GoAway Frame. Merge internal change: 42291652 Chromium review fixes. Merge internal change: 42290161 Implement framing for entropy in AckFrame. Merge internal change: 42286308 Make QuicPacketCreator return SerializedPacket struct. Merge internal change: 42240179 Fix for incoming duplicate packet. Avoids NACKing a duplicate. Merge internal change: 42150291 Remove QuicConnectionVisitorInterface::AckedPackets and use the existing SequenceSet typedef instead. Renamed SequenceSet to SequenceNumberSet to be more readable. Merge internal change: 42147690 Made ramp up bitrate in inter arrival aware of the current send rate. Merge internal change: 42118607 Style fix of full_packet. Merge internal change: 42057032 Packing multiple streams together in a single packet from OnCanWrite. Merge internal change: 42054845 Change the representation of public and private flags to explicts bools. Using enums turns out to be problematic because ENUM1 | ENUM2 can not be assigned to EnumType. I discovered this problem in attempting to implement version negotiation. Merge internal change: 42042022 Various small QUIC cleanups after merging to Chrome. Merge internal change: 42041347 Start using QuicClock Now where needed and sending it around instead of querying it multiple times. This CL also fixes the reports of incoming lost packets which had been lost. Merge internal change: 41944659 Fix mock clock. Adding Now function back to QuicClock but now as a more accurate now Merge internal change: 41909929 Rename of function Now to ApproximateNow to allow us to differentiate between the two in the future. Merge internal change: 41909178 TBR=jar@chromium.org R=jar@chromium.org BUG= Review URL: https://chromiumcodereview.appspot.com/12334063 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@184374 0039d316-1c4b-4281-b951-d872f2087c98