Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(296)

Unified Diff: net/quic/crypto/crypto_protocol.h

Issue 11125002: Add QuicFramer and friends. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix final comments. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/crypto/crypto_framer_test.cc ('k') | net/quic/crypto/crypto_protocol.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/crypto/crypto_protocol.h
diff --git a/net/quic/crypto/crypto_protocol.h b/net/quic/crypto/crypto_protocol.h
new file mode 100644
index 0000000000000000000000000000000000000000..a9c7083694bb420e910968405d300a489ad5f031
--- /dev/null
+++ b/net/quic/crypto/crypto_protocol.h
@@ -0,0 +1,45 @@
+// 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_PROTOCOL_H_
+#define NET_QUIC_CRYPTO_CRYPTO_PROTOCOL_H_
+
+#include <map>
+
+#include "base/basictypes.h"
+#include "base/logging.h"
+#include "base/string_piece.h"
+#include "net/base/net_export.h"
+
+namespace net {
+
+typedef uint32 CryptoTag;
+typedef std::map<CryptoTag, base::StringPiece> CryptoTagValueMap;
+struct NET_EXPORT_PRIVATE CryptoHandshakeMessage {
+ CryptoHandshakeMessage();
+ ~CryptoHandshakeMessage();
+ CryptoTag tag;
+ CryptoTagValueMap tag_value_map;
+};
+
+// Crypto tags are written to the wire with a big-endian
+// representation of the name of the tag. For example
+// the client hello tag (CHLO) will be written as the
+// following 4 bytes: 'C' 'H' 'L' 'O'. Since it is
+// stored in memory as a little endian uint32, we need
+// to reverse the order of the bytes.
+#define MAKE_TAG(a,b,c,d) (d << 24) + (c << 16) + (b << 8) + a
+
+const CryptoTag kCHLO = MAKE_TAG('C', 'H', 'L', 'O'); // Client hello
+const CryptoTag kSHLO = MAKE_TAG('S', 'H', 'L', 'O'); // Server hello
+
+// AEAD algorithms
+const CryptoTag kNULL = MAKE_TAG('N', 'U', 'L', 'L'); // null algorithm
+const CryptoTag kAESH = MAKE_TAG('A', 'E', 'S', 'H'); // AES128 + SHA256
+
+const size_t kMaxEntries = 16; // Max number of entries in a message.
+
+} // namespace net
+
+#endif // NET_QUIC_CRYPTO_CRYPTO_PROTOCOL_H_
« no previous file with comments | « net/quic/crypto/crypto_framer_test.cc ('k') | net/quic/crypto/crypto_protocol.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698