|
7 | 7 | #ifndef QUICHE_QUIC_MOQT_MOQT_MESSAGES_H_ |
8 | 8 | #define QUICHE_QUIC_MOQT_MOQT_MESSAGES_H_ |
9 | 9 |
|
10 | | -#include <algorithm> |
11 | | -#include <bit> |
12 | 10 | #include <cstddef> |
13 | 11 | #include <cstdint> |
14 | 12 | #include <initializer_list> |
15 | 13 | #include <optional> |
16 | 14 | #include <string> |
17 | | -#include <utility> |
18 | 15 | #include <variant> |
19 | | -#include <vector> |
20 | 16 |
|
21 | | -#include "absl/strings/string_view.h" |
22 | 17 | #include "quiche/quic/core/quic_time.h" |
23 | | -#include "quiche/quic/core/quic_types.h" |
24 | 18 | #include "quiche/quic/core/quic_versions.h" |
25 | 19 | #include "quiche/quic/moqt/moqt_error.h" |
26 | 20 | #include "quiche/quic/moqt/moqt_key_value_pair.h" |
|
29 | 23 | #include "quiche/quic/moqt/moqt_priority.h" |
30 | 24 | #include "quiche/quic/moqt/moqt_types.h" |
31 | 25 | #include "quiche/common/platform/api/quiche_export.h" |
32 | | -#include "quiche/common/quiche_endian.h" |
33 | 26 |
|
34 | 27 | namespace moqt { |
35 | 28 |
|
36 | 29 | inline constexpr quic::ParsedQuicVersionVector GetMoqtSupportedQuicVersions() { |
37 | 30 | return quic::ParsedQuicVersionVector{quic::ParsedQuicVersion::RFCv1()}; |
38 | 31 | } |
39 | 32 |
|
40 | | -inline constexpr absl::string_view kDraft16 = "moqt-16"; |
41 | | -inline constexpr absl::string_view kDefaultMoqtVersion = kDraft16; |
42 | | -inline constexpr absl::string_view kUnrecognizedVersionForTests = "moqt-15"; |
43 | | - |
44 | | -inline constexpr absl::string_view kImplementationName = |
45 | | - "Google QUICHE MOQT draft 16"; |
46 | | -inline constexpr uint64_t kDefaultInitialMaxRequestId = 100; |
47 | | -struct QUICHE_EXPORT MoqtSessionParameters { |
48 | | - // TODO: support multiple versions. |
49 | | - MoqtSessionParameters() = default; |
50 | | - explicit MoqtSessionParameters(quic::Perspective perspective) |
51 | | - : perspective(perspective), using_webtrans(true) {} |
52 | | - MoqtSessionParameters(quic::Perspective perspective, std::string path, |
53 | | - std::string authority) |
54 | | - : perspective(perspective), |
55 | | - using_webtrans(false), |
56 | | - path(std::move(path)), |
57 | | - authority(std::move(authority)) {} |
58 | | - MoqtSessionParameters(quic::Perspective perspective, std::string path, |
59 | | - std::string authority, uint64_t max_request_id) |
60 | | - : perspective(perspective), |
61 | | - using_webtrans(true), |
62 | | - path(std::move(path)), |
63 | | - max_request_id(max_request_id), |
64 | | - authority(std::move(authority)) {} |
65 | | - MoqtSessionParameters(quic::Perspective perspective, uint64_t max_request_id) |
66 | | - : perspective(perspective), max_request_id(max_request_id) {} |
67 | | - bool operator==(const MoqtSessionParameters& other) const = default; |
68 | | - |
69 | | - std::string version = std::string(kDefaultMoqtVersion); |
70 | | - bool deliver_partial_objects = false; |
71 | | - quic::Perspective perspective = quic::Perspective::IS_SERVER; |
72 | | - bool using_webtrans = true; |
73 | | - std::string path; |
74 | | - uint64_t max_request_id = kDefaultInitialMaxRequestId; |
75 | | - uint64_t max_auth_token_cache_size = kDefaultMaxAuthTokenCacheSize; |
76 | | - bool support_object_acks = false; |
77 | | - // TODO(martinduke): Turn authorization_token into structured data. |
78 | | - std::vector<AuthToken> authorization_token; |
79 | | - std::string authority; |
80 | | - std::string moqt_implementation; |
81 | | - |
82 | | - // Takes the relevant fields from this object and populates |out| if not the |
83 | | - // protocol default value. |
84 | | - void ToSetupParameters(SetupParameters& out) const; |
85 | | -}; |
86 | | - |
87 | 33 | // The maximum length of a message, excluding any OBJECT payload. This prevents |
88 | 34 | // DoS attack via forcing the parser to buffer a large message (OBJECT payloads |
89 | 35 | // are not buffered by the parser). |
@@ -279,25 +225,6 @@ enum class QUICHE_EXPORT MoqtMessageType : uint64_t { |
279 | 225 | kObjectAck = 0x3184, |
280 | 226 | }; |
281 | 227 |
|
282 | | -// A tuple uniquely identifying a WebTransport data stream associated with a |
283 | | -// subscription. By convention, if a DataStreamIndex is necessary for a datagram |
284 | | -// track, `subgroup` is set to zero. |
285 | | -struct DataStreamIndex { |
286 | | - uint64_t group = 0; |
287 | | - uint64_t subgroup = 0; |
288 | | - |
289 | | - DataStreamIndex() = default; |
290 | | - DataStreamIndex(uint64_t group, uint64_t subgroup) |
291 | | - : group(group), subgroup(subgroup) {} |
292 | | - |
293 | | - auto operator<=>(const DataStreamIndex&) const = default; |
294 | | - |
295 | | - template <typename H> |
296 | | - friend H AbslHashValue(H h, const DataStreamIndex& index) { |
297 | | - return H::combine(std::move(h), index.group, index.subgroup); |
298 | | - } |
299 | | -}; |
300 | | - |
301 | 228 | struct SubgroupPriority { |
302 | 229 | uint8_t publisher_priority = 0xf0; |
303 | 230 | uint64_t subgroup_id = 0; |
@@ -506,13 +433,6 @@ struct QUICHE_EXPORT MoqtGoAway { |
506 | 433 | std::string new_session_uri; |
507 | 434 | }; |
508 | 435 |
|
509 | | -enum class QUICHE_EXPORT SubscribeNamespaceOption : uint64_t { |
510 | | - kPublish = 0x00, |
511 | | - kNamespace = 0x01, |
512 | | - kBoth = 0x02, |
513 | | -}; |
514 | | -static constexpr uint64_t kMaxSubscribeOption = 0x02; |
515 | | - |
516 | 436 | struct QUICHE_EXPORT MoqtSubscribeNamespace { |
517 | 437 | uint64_t request_id; |
518 | 438 | TrackNamespace track_namespace_prefix; |
|
0 commit comments