VOOZH about

URL: https://codereview.chromium.org/11125002/diff/11031/net/quic/quic_utils.cc

⇱ net/quic/quic_utils.cc - Issue 11125002: Add QuicFramer and friends. - Code Review


Side by Side Diff

Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Keyboard Shortcuts

File
u :up to issue
j / k :jump to file after / before current file
J / K :jump to next file with a comment after / before current file
Side-by-side diff
i :toggle intra-line diffs
e :expand all comments
c :collapse all comments
s :toggle showing all comments
n / p :next / previous diff chunk or comment
N / P :next / previous comment
<Up> / <Down> :next / previous line
Issue
u :up to list of issues
j / k :jump to patch after / before current patch
o / <Enter> :open current patch in side-by-side view
i :open current patch in unified diff view
Issue List
j / k :jump to issue after / before current issue
o / <Enter> :open current issue
👁 Image
Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Issues Search
    My Issues | Starred     Open | Closed | All

Side by Side Diff: net/quic/quic_utils.cc

👁 Image
Issue 11125002: Add QuicFramer and friends. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: narrowing in Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« net/quic/quic_utils.h ('K') | « net/quic/quic_utils.h ('k') | net/quic/test_tools/quic_test_utils.h » ('j') | net/quic/uint128.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
// 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_utils.h"
#include "base/logging.h"
namespace net {
// static
int QuicUtils::StreamFragmentPacketOverhead(int num_fragments) {
return kPacketHeaderSize +
1 + // fragment count
jar (doing other things) 2012/10/14 23:04:38 nit: much better would be some sizeof(names) here.
Ryan Hamilton 2012/10/15 21:22:08 added todo.
(1 + // 8 bit type
2 + // 16 bit length
kMinStreamFragmentLength) * num_fragments;
}
// The following two constants are defined as part of the hash algorithm.
// 309485009821345068724781371
static uint128 kPrime(16777216, 315);
jar (doing other things) 2012/10/14 23:04:38 nit: I like statics... but I think we're supposed
Ryan Hamilton 2012/10/15 21:22:08 added todo.
// 14406626329776981559649562966706236762
static uint128 kOffset(780984778246553632, 4400696054689967450);
uint128 QuicUtils::FNV1a_128_Hash(const char* data, int len) {
const uint8* octets = reinterpret_cast<const uint8*>(data);
uint128 hash = kOffset;
for (int i = 0; i < len; ++i) {
hash = hash ^ uint128(0, octets[i]);
hash = hash * kPrime;
}
return hash;
}
#define RETURN_STRING_LITERAL(x) \
case x: \
return #x;
const char* QuicUtils::ErrorToString(QuicErrorCode error) {
switch (error) {
RETURN_STRING_LITERAL(QUIC_NO_ERROR);
RETURN_STRING_LITERAL(QUIC_STREAM_DATA_AFTER_TERMINATION);
RETURN_STRING_LITERAL(QUIC_SERVER_ERROR_PROCESSING_STREAM);
RETURN_STRING_LITERAL(QUIC_MULTIPLE_TERMINATION_OFFSETS);
RETURN_STRING_LITERAL(QUIC_BAD_APPLICATION_PAYLOAD);
RETURN_STRING_LITERAL(QUIC_INVALID_PACKET_HEADER);
RETURN_STRING_LITERAL(QUIC_INVALID_FRAGMENT_DATA);
RETURN_STRING_LITERAL(QUIC_INVALID_FEC_DATA);
RETURN_STRING_LITERAL(QUIC_INVALID_RST_STREAM_DATA);
RETURN_STRING_LITERAL(QUIC_INVALID_CONNECTION_CLOSE_DATA);
RETURN_STRING_LITERAL(QUIC_INVALID_ACK_DATA);
RETURN_STRING_LITERAL(QUIC_DECRYPTION_FAILURE);
RETURN_STRING_LITERAL(QUIC_ENCRYPTION_FAILURE);
RETURN_STRING_LITERAL(QUIC_PACKET_TOO_LARGE);
RETURN_STRING_LITERAL(QUIC_PACKET_FOR_NONEXISTENT_STREAM);
RETURN_STRING_LITERAL(QUIC_CLIENT_GOING_AWAY);
RETURN_STRING_LITERAL(QUIC_SERVER_GOING_AWAY);
RETURN_STRING_LITERAL(QUIC_CRYPTO_TAGS_OUT_OF_ORDER);
RETURN_STRING_LITERAL(QUIC_CRYPTO_TOO_MANY_ENTRIES);
RETURN_STRING_LITERAL(QUIC_CRYPTO_INVALID_VALUE_LENGTH)
RETURN_STRING_LITERAL(QUIC_CRYPTO_MESSAGE_AFTER_HANDSHAKE_COMPLETE);
RETURN_STRING_LITERAL(QUIC_INVALID_CRYPTO_MESSAGE_TYPE);
RETURN_STRING_LITERAL(QUIC_INVALID_STREAM_ID);
RETURN_STRING_LITERAL(QUIC_TOO_MANY_OPEN_STREAMS);
RETURN_STRING_LITERAL(QUIC_CONNECTION_TIMED_OUT);
// Intentionally have no default case, so we'll break the build
// if we add errors and don't put them here.
}
return "";
}
} // namespace net
OLDNEW
« net/quic/quic_utils.h ('K') | « net/quic/quic_utils.h ('k') | net/quic/test_tools/quic_test_utils.h » ('j') | net/quic/uint128.h » ('J')
👁 Powered by Google App Engine
This is Rietveld 408576698