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

Side by Side Diff: net/quic/crypto/source_address_token.cc

Issue 14411004: Land Recent QUIC Changes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use CONFIG_VERSION insteaf of VERSION Created 7 years, 8 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/quic/crypto/source_address_token.h ('k') | net/quic/quic_config.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "net/quic/crypto/source_address_token.h"
6
7 #include <vector>
8
9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/string_split.h"
11
12 using std::string;
13 using std::vector;
14
15 namespace net {
16
17 SourceAddressToken::SourceAddressToken() {
Nico 2015/03/08 02:41:40 This doesn't set timestamp_. Is that intentional?
ramant (doing other things) 2015/03/08 23:26:53 Good point. Will upload a change asap. thanks ram
ramant (doing other things) 2015/03/09 00:01:46 Uploaded https://codereview.chromium.org/985383003
18 }
19
20 SourceAddressToken::~SourceAddressToken() {
21 }
22
23 string SourceAddressToken::SerializeAsString() const {
24 return ip_ + " " + base::Int64ToString(timestamp_);
25 }
26
27 bool SourceAddressToken::ParseFromArray(unsigned char* plaintext,
28 size_t plaintext_length) {
29 string data(reinterpret_cast<const char*>(plaintext), plaintext_length);
30 vector<string> results;
31 base::SplitString(data, ' ', &results);
32 if (results.size() < 2) {
33 return false;
34 }
35
36 int64 timestamp;
37 if (!base::StringToInt64(results[1], &timestamp)) {
38 return false;
39 }
40
41 ip_ = results[0];
42 timestamp_ = timestamp;
43 return true;
44 }
45
46 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/crypto/source_address_token.h ('k') | net/quic/quic_config.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698