summaryrefslogtreecommitdiffstats
path: root/net/quic/crypto/crypto_framer.h
diff options
context:
space:
mode:
Diffstat (limited to 'net/quic/crypto/crypto_framer.h')
-rw-r--r--net/quic/crypto/crypto_framer.h106
1 files changed, 0 insertions, 106 deletions
diff --git a/net/quic/crypto/crypto_framer.h b/net/quic/crypto/crypto_framer.h
deleted file mode 100644
index e52b264..0000000
--- a/net/quic/crypto/crypto_framer.h
+++ /dev/null
@@ -1,106 +0,0 @@
-// 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 "base/string_piece.h"
-#include "net/base/net_export.h"
-#include "net/quic/crypto/crypto_protocol.h"
-#include "net/quic/quic_protocol.h"
-
-namespace net {
-
-class CryptoFramer;
-class QuicDataReader;
-class QuicData;
-
-class NET_EXPORT_PRIVATE 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;
-};
-
-// A class for framing the crypto message that are exchanged in a QUIC session.
-class NET_EXPORT_PRIVATE CryptoFramer {
- 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. |visitor| will be owned by the framer.
- void set_visitor(CryptoFramerVisitorInterface* visitor) {
- visitor_ = visitor;
- }
-
- 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 false if there was an
- // 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
- };
-
- // 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
- // 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_