- add sources.
[platform/framework/web/crosswalk.git] / src / net / quic / crypto / source_address_token.h
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 #ifndef NET_QUIC_CRYPTO_SOURCE_ADDRESS_TOKEN_H_
6 #define NET_QUIC_CRYPTO_SOURCE_ADDRESS_TOKEN_H_
7
8 #include <string>
9
10 #include "base/basictypes.h"
11 #include "base/strings/string_piece.h"
12
13 namespace net {
14
15 // TODO(rtenneti): sync with server more rationally.
16 class SourceAddressToken {
17  public:
18   SourceAddressToken();
19   ~SourceAddressToken();
20
21   std::string SerializeAsString() const;
22
23   bool ParseFromArray(const char* plaintext, size_t plaintext_length);
24
25   std::string ip() const {
26     return ip_;
27   }
28
29   int64 timestamp() const {
30     return timestamp_;
31   }
32
33   void set_ip(base::StringPiece ip) {
34     ip_ = ip.as_string();
35   }
36
37   void set_timestamp(int64 timestamp) {
38     timestamp_ = timestamp;
39   }
40
41  private:
42   std::string ip_;
43   int64 timestamp_;
44 };
45
46 }  // namespace net
47
48 #endif  // NET_QUIC_CRYPTO_SOURCE_ADDRESS_TOKEN_H_