VOOZH about

URL: https://codereview.chromium.org/11125002/diff/11031/net/quic/crypto/crypto_framer.h

⇱ net/quic/crypto/crypto_framer.h - 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
(500)

Issues Search
    My Issues | Starred     Open | Closed | All

Side by Side Diff: net/quic/crypto/crypto_framer.h

👁 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
« no previous file with comments | « net/net.gyp ('k') | net/quic/crypto/crypto_framer.cc » ('j') | net/quic/crypto/crypto_framer.cc » ('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.
#ifndef NET_QUIC_CRYPTO_CRYPTO_FRAMER_H_
#define NET_QUIC_CRYPTO_CRYPTO_FRAMER_H_
#include <map>
#include <vector>
#include "base/basictypes.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "net/quic/quic_protocol.h"
#include "net/quic/crypto/crypto_protocol.h"
jar (doing other things) 2012/10/14 23:04:38 nit: alphabetize
Ryan Hamilton 2012/10/15 21:22:08 Done.
#include "base/string_piece.h"
namespace net {
class CryptoFramer;
class QuicDataReader;
class QuicData;
class CryptoFramerVisitorInterface {
public:
virtual ~CryptoFramerVisitorInterface() {}
// Called if an error is detected.
virtual void OnError(CryptoFramer* framer) = 0;
// Called when a complete handshake message has been parsed.
virtual void OnHandshakeMessage(const CryptoHandshakeMessage& message) = 0;
};
class CryptoFramer {
jar (doing other things) 2012/10/14 23:04:38 It might be helpful to have a class comment, indic
Ryan Hamilton 2012/10/15 21:22:08 Done.
public:
CryptoFramer();
virtual ~CryptoFramer();
// Set callbacks to be called from the framer. A visitor must be set, or
// else the framer will likely crash. It is acceptable for the visitor
// to do nothing. If this is called multiple times, only the last visitor
// will be used.
void set_visitor(CryptoFramerVisitorInterface* visitor) {
visitor_ = visitor;
jar (doing other things) 2012/10/14 23:04:38 Perhaps it is worth a comment that the ownership o
Ryan Hamilton 2012/10/15 21:22:08 Done.
Ryan Hamilton 2012/10/15 21:22:08 Done.
}
QuicErrorCode error() const {
return error_;
}
// Processes input data, which must be delievered in order. Returns
// false if there was an error, and true otherwise.
bool ProcessInput(base::StringPiece input);
// Serializes |message| into |packet|. Returns fase if there was an
jar (doing other things) 2012/10/14 23:04:38 nit: fase-->false
Ryan Hamilton 2012/10/15 21:22:08 Done.
// error, and true otherwise.
bool ConstructHandshakeMessage(const CryptoHandshakeMessage& message,
QuicData** packet);
private:
// Clears per-message state. Does not clear the visitor.
void Clear();
void set_error(QuicErrorCode error) {
error_ = error;
}
enum CryptoFramerState {
STATE_READING_TAG,
STATE_READING_NUM_ENTRIES,
STATE_READING_KEY_TAGS,
STATE_READING_LENGTHS,
STATE_READING_VALUES
};
// Reader for parsing data.
scoped_ptr<QuicDataReader> reader_;
// Visitor to send invoke when messages are parsed.
CryptoFramerVisitorInterface* visitor_;
// Last error.
QuicErrorCode error_;
// Remaining unparsed data.
std::string buffer_;
// Current state of the parsing.
CryptoFramerState state_;
// Tag of the message currently being parsed.
CryptoTag message_tag_;
// Number of entires in the message currently being parsed.
uint16 num_entries_;
// Vector of tags in the message currently being parsed.
std::vector<CryptoTag> tags_;
// Length of the data associated with each tag in the message currently
// being parsed.
std::map<CryptoTag, size_t> tag_length_map_;
// Length of the data associated with each tag in the message currently
jar (doing other things) 2012/10/14 23:04:38 This says "Length" just like line 94, but it looks
Ryan Hamilton 2012/10/15 21:22:08 Will be fixed when the changes from cl/35411506 ar
// being parsed.
CryptoTagValueMap tag_value_map_;
// Cumulative length of all values in the message currently being parsed.
size_t values_len_;
};
} // namespace net
#endif // NET_QUIC_CRYPTO_CRYPTO_FRAMER_H_
OLDNEW
« no previous file with comments | « net/net.gyp ('k') | net/quic/crypto/crypto_framer.cc » ('j') | net/quic/crypto/crypto_framer.cc » ('J')
👁 Powered by Google App Engine
This is Rietveld 408576698