1 // Copyright 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_QUIC_HTTP_UTILS_H_
6 #define NET_QUIC_QUIC_HTTP_UTILS_H_
7 
8 #include "base/values.h"
9 #include "net/base/net_export.h"
10 #include "net/base/request_priority.h"
11 #include "net/log/net_log_capture_mode.h"
12 #include "net/third_party/quiche/src/quic/core/quic_packets.h"
13 #include "net/third_party/quiche/src/spdy/core/spdy_header_block.h"
14 #include "net/third_party/quiche/src/spdy/core/spdy_protocol.h"
15 
16 namespace net {
17 
18 // TODO(crbug/988608): Convert to SpdyStreamPrecedence directly instead of to
19 // SpdyPriority which will go away eventually.
20 NET_EXPORT_PRIVATE spdy::SpdyPriority ConvertRequestPriorityToQuicPriority(
21     RequestPriority priority);
22 
23 NET_EXPORT_PRIVATE RequestPriority
24 ConvertQuicPriorityToRequestPriority(spdy::SpdyPriority priority);
25 
26 // Converts a spdy::Http2HeaderBlock, stream_id and priority into NetLog event
27 // parameters.
28 NET_EXPORT base::Value QuicRequestNetLogParams(
29     quic::QuicStreamId stream_id,
30     const spdy::Http2HeaderBlock* headers,
31     spdy::SpdyPriority priority,
32     NetLogCaptureMode capture_mode);
33 
34 // Converts a spdy::Http2HeaderBlock and stream into NetLog event parameters.
35 NET_EXPORT base::Value QuicResponseNetLogParams(
36     quic::QuicStreamId stream_id,
37     bool fin_received,
38     const spdy::Http2HeaderBlock* headers,
39     NetLogCaptureMode capture_mode);
40 
41 // Parses |alt_svc_versions| into a quic::ParsedQuicVersionVector and removes
42 // all entries that aren't found in |supported_versions|.
43 NET_EXPORT quic::ParsedQuicVersionVector FilterSupportedAltSvcVersions(
44     const spdy::SpdyAltSvcWireFormat::AlternativeService& quic_alt_svc,
45     const quic::ParsedQuicVersionVector& supported_versions);
46 
47 }  // namespace net
48 
49 #endif  // NET_QUIC_QUIC_HTTP_UTILS_H_
50