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
3 // found in the LICENSE file.
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
7 // fields and HTTP/2 and QUIC ALTSVC frames. See specification at
8 // https://tools.ietf.org/id/draft-ietf-httpbis-alt-svc-06.html
10 #ifndef NET_SPDY_SPDY_ALT_SVC_WIRE_FORMAT_H_
11 #define NET_SPDY_SPDY_ALT_SVC_WIRE_FORMAT_H_
13 #include "base/basictypes.h"
14 #include "base/strings/string_piece.h"
15 #include "net/base/net_export.h"
17 using base::StringPiece
;
22 class SpdyAltSvcWireFormatPeer
;
25 class NET_EXPORT_PRIVATE SpdyAltSvcWireFormat
{
27 friend class test::SpdyAltSvcWireFormatPeer
;
28 static bool ParseHeaderFieldValue(StringPiece value
,
29 std::string
* protocol_id
,
34 static std::string
SerializeHeaderFieldValue(const std::string
& protocol_id
,
35 const std::string
& host
,
41 static void SkipWhiteSpace(StringPiece::const_iterator
* c
,
42 StringPiece::const_iterator end
);
43 static bool PercentDecode(StringPiece::const_iterator c
,
44 StringPiece::const_iterator end
,
46 static bool ParseAltAuthority(StringPiece::const_iterator c
,
47 StringPiece::const_iterator end
,
50 static bool ParsePositiveInteger16(StringPiece::const_iterator c
,
51 StringPiece::const_iterator end
,
53 static bool ParsePositiveInteger32(StringPiece::const_iterator c
,
54 StringPiece::const_iterator end
,
56 static bool ParseProbability(StringPiece::const_iterator c
,
57 StringPiece::const_iterator end
,
63 #endif // NET_SPDY_SPDY_ALT_SVC_WIRE_FORMAT_H_