blob: fbb50b1028e5b809cd61abf0c46f7d12c4bf92f2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
// Copyright (c) 2013 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_SOURCE_ADDRESS_TOKEN_H_
#define NET_QUIC_CRYPTO_SOURCE_ADDRESS_TOKEN_H_
#include <string>
#include "base/basictypes.h"
#include "base/strings/string_piece.h"
namespace net {
// TODO(rtenneti): sync with server more rationally.
class SourceAddressToken {
public:
SourceAddressToken();
~SourceAddressToken();
std::string SerializeAsString() const;
bool ParseFromArray(const char* plaintext, size_t plaintext_length);
std::string ip() const {
return ip_;
}
int64 timestamp() const {
return timestamp_;
}
void set_ip(base::StringPiece ip) {
ip_ = ip.as_string();
}
void set_timestamp(int64 timestamp) {
timestamp_ = timestamp;
}
private:
std::string ip_;
int64 timestamp_;
DISALLOW_COPY_AND_ASSIGN(SourceAddressToken);
};
} // namespace net
#endif // NET_QUIC_CRYPTO_SOURCE_ADDRESS_TOKEN_H_
|