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

Side by Side Diff: net/spdy/spdy_alt_svc_wire_format.h

Issue 1535363003: Switch to standard integer types in net/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: stddef Created 5 years 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
« no previous file with comments | « net/spdy/priority_write_scheduler.h ('k') | net/spdy/spdy_alt_svc_wire_format.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This file contains data structures and utility functions used for serializing 5 // This file contains data structures and utility functions used for serializing
6 // and parsing alternative service header values, common to HTTP/1.1 header 6 // and parsing alternative service header values, common to HTTP/1.1 header
7 // fields and HTTP/2 and QUIC ALTSVC frames. See specification at 7 // fields and HTTP/2 and QUIC ALTSVC frames. See specification at
8 // https://httpwg.github.io/http-extensions/alt-svc.html. 8 // https://httpwg.github.io/http-extensions/alt-svc.html.
9 9
10 #ifndef NET_SPDY_SPDY_ALT_SVC_WIRE_FORMAT_H_ 10 #ifndef NET_SPDY_SPDY_ALT_SVC_WIRE_FORMAT_H_
11 #define NET_SPDY_SPDY_ALT_SVC_WIRE_FORMAT_H_ 11 #define NET_SPDY_SPDY_ALT_SVC_WIRE_FORMAT_H_
12 12
13 #include <stdint.h>
14
13 #include <vector> 15 #include <vector>
14 16
15 #include "base/basictypes.h"
16 #include "base/strings/string_piece.h" 17 #include "base/strings/string_piece.h"
17 #include "net/base/net_export.h" 18 #include "net/base/net_export.h"
18 19
19 namespace net { 20 namespace net {
20 21
21 namespace test { 22 namespace test {
22 class SpdyAltSvcWireFormatPeer; 23 class SpdyAltSvcWireFormatPeer;
23 } // namespace test 24 } // namespace test
24 25
25 class NET_EXPORT_PRIVATE SpdyAltSvcWireFormat { 26 class NET_EXPORT_PRIVATE SpdyAltSvcWireFormat {
26 public: 27 public:
27 using VersionVector = std::vector<uint16>; 28 using VersionVector = std::vector<uint16_t>;
28 29
29 struct NET_EXPORT_PRIVATE AlternativeService { 30 struct NET_EXPORT_PRIVATE AlternativeService {
30 std::string protocol_id; 31 std::string protocol_id;
31 std::string host; 32 std::string host;
32 33
33 // Default is 0: invalid port. 34 // Default is 0: invalid port.
34 uint16 port = 0; 35 uint16_t port = 0;
35 // Default is one day. 36 // Default is one day.
36 uint32 max_age = 86400; 37 uint32_t max_age = 86400;
37 // Default is always use. 38 // Default is always use.
38 double probability = 1.0; 39 double probability = 1.0;
39 // Default is empty: unspecified version. 40 // Default is empty: unspecified version.
40 VersionVector version; 41 VersionVector version;
41 42
42 AlternativeService(); 43 AlternativeService();
43 AlternativeService(const std::string& protocol_id, 44 AlternativeService(const std::string& protocol_id,
44 const std::string& host, 45 const std::string& host,
45 uint16 port, 46 uint16_t port,
46 uint32 max_age, 47 uint32_t max_age,
47 double probability, 48 double probability,
48 VersionVector version); 49 VersionVector version);
49 ~AlternativeService(); 50 ~AlternativeService();
50 51
51 bool operator==(const AlternativeService& other) const { 52 bool operator==(const AlternativeService& other) const {
52 return protocol_id == other.protocol_id && host == other.host && 53 return protocol_id == other.protocol_id && host == other.host &&
53 port == other.port && version == other.version && 54 port == other.port && version == other.version &&
54 max_age == other.max_age && probability == other.probability; 55 max_age == other.max_age && probability == other.probability;
55 } 56 }
56 }; 57 };
(...skipping 10 matching lines...) Expand all
67 68
68 private: 69 private:
69 static void SkipWhiteSpace(base::StringPiece::const_iterator* c, 70 static void SkipWhiteSpace(base::StringPiece::const_iterator* c,
70 base::StringPiece::const_iterator end); 71 base::StringPiece::const_iterator end);
71 static bool PercentDecode(base::StringPiece::const_iterator c, 72 static bool PercentDecode(base::StringPiece::const_iterator c,
72 base::StringPiece::const_iterator end, 73 base::StringPiece::const_iterator end,
73 std::string* output); 74 std::string* output);
74 static bool ParseAltAuthority(base::StringPiece::const_iterator c, 75 static bool ParseAltAuthority(base::StringPiece::const_iterator c,
75 base::StringPiece::const_iterator end, 76 base::StringPiece::const_iterator end,
76 std::string* host, 77 std::string* host,
77 uint16* port); 78 uint16_t* port);
78 static bool ParsePositiveInteger16(base::StringPiece::const_iterator c, 79 static bool ParsePositiveInteger16(base::StringPiece::const_iterator c,
79 base::StringPiece::const_iterator end, 80 base::StringPiece::const_iterator end,
80 uint16* value); 81 uint16_t* value);
81 static bool ParsePositiveInteger32(base::StringPiece::const_iterator c, 82 static bool ParsePositiveInteger32(base::StringPiece::const_iterator c,
82 base::StringPiece::const_iterator end, 83 base::StringPiece::const_iterator end,
83 uint32* value); 84 uint32_t* value);
84 static bool ParseProbability(base::StringPiece::const_iterator c, 85 static bool ParseProbability(base::StringPiece::const_iterator c,
85 base::StringPiece::const_iterator end, 86 base::StringPiece::const_iterator end,
86 double* probability); 87 double* probability);
87 }; 88 };
88 89
89 } // namespace net 90 } // namespace net
90 91
91 #endif // NET_SPDY_SPDY_ALT_SVC_WIRE_FORMAT_H_ 92 #endif // NET_SPDY_SPDY_ALT_SVC_WIRE_FORMAT_H_
OLDNEW
« no previous file with comments | « net/spdy/priority_write_scheduler.h ('k') | net/spdy/spdy_alt_svc_wire_format.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698