aboutsummaryrefslogtreecommitdiffstats
path: root/libtransport/src/core/manifest_format.h
diff options
context:
space:
mode:
Diffstat (limited to 'libtransport/src/core/manifest_format.h')
-rw-r--r--libtransport/src/core/manifest_format.h107
1 files changed, 60 insertions, 47 deletions
diff --git a/libtransport/src/core/manifest_format.h b/libtransport/src/core/manifest_format.h
index caee210cd..89412316a 100644
--- a/libtransport/src/core/manifest_format.h
+++ b/libtransport/src/core/manifest_format.h
@@ -25,13 +25,8 @@
#include <unordered_map>
namespace transport {
-
namespace core {
-enum class ManifestVersion : uint8_t {
- VERSION_1 = 1,
-};
-
enum class ManifestType : uint8_t {
INLINE_MANIFEST = 1,
FINAL_CHUNK_NUMBER = 2,
@@ -83,14 +78,27 @@ class ManifestEncoder {
return static_cast<Implementation &>(*this).clearImpl();
}
+ bool isEncoded() const {
+ return static_cast<const Implementation &>(*this).isEncodedImpl();
+ }
+
ManifestEncoder &setType(ManifestType type) {
return static_cast<Implementation &>(*this).setTypeImpl(type);
}
+ ManifestEncoder &setMaxCapacity(uint8_t max_capacity) {
+ return static_cast<Implementation &>(*this).setMaxCapacityImpl(
+ max_capacity);
+ }
+
ManifestEncoder &setHashAlgorithm(auth::CryptoHashType hash) {
return static_cast<Implementation &>(*this).setHashAlgorithmImpl(hash);
}
+ ManifestEncoder &setIsLast(bool is_last) {
+ return static_cast<Implementation &>(*this).setIsLastImpl(is_last);
+ }
+
template <
typename T,
typename = std::enable_if_t<std::is_same<
@@ -99,45 +107,36 @@ class ManifestEncoder {
return static_cast<Implementation &>(*this).setBaseNameImpl(name);
}
- template <typename Hash>
- ManifestEncoder &addSuffixAndHash(uint32_t suffix, Hash &&hash) {
- return static_cast<Implementation &>(*this).addSuffixAndHashImpl(
- suffix, std::forward<Hash &&>(hash));
+ ManifestEncoder &setParamsBytestream(const ParamsBytestream &params) {
+ return static_cast<Implementation &>(*this).setParamsBytestreamImpl(params);
}
- ManifestEncoder &setIsLast(bool is_last) {
- return static_cast<Implementation &>(*this).setIsLastImpl(is_last);
+ ManifestEncoder &setParamsRTC(const ParamsRTC &params) {
+ return static_cast<Implementation &>(*this).setParamsRTCImpl(params);
}
- ManifestEncoder &setVersion(ManifestVersion version) {
- return static_cast<Implementation &>(*this).setVersionImpl(version);
+ template <typename Hash>
+ ManifestEncoder &addEntry(uint32_t suffix, Hash &&hash) {
+ return static_cast<Implementation &>(*this).addEntryImpl(
+ suffix, std::forward<Hash>(hash));
}
- std::size_t estimateSerializedLength(std::size_t number_of_entries) {
- return static_cast<Implementation &>(*this).estimateSerializedLengthImpl(
- number_of_entries);
+ ManifestEncoder &removeEntry(uint32_t suffix) {
+ return static_cast<Implementation &>(*this).removeEntryImpl(suffix);
}
- ManifestEncoder &update() {
- return static_cast<Implementation &>(*this).updateImpl();
+ std::size_t manifestHeaderSize() const {
+ return static_cast<const Implementation &>(*this).manifestHeaderSizeImpl();
}
- ManifestEncoder &setParamsBytestream(const ParamsBytestream &params) {
- return static_cast<Implementation &>(*this).setParamsBytestreamImpl(params);
+ std::size_t manifestPayloadSize(size_t additional_entries = 0) const {
+ return static_cast<const Implementation &>(*this).manifestPayloadSizeImpl(
+ additional_entries);
}
- ManifestEncoder &setParamsRTC(const ParamsRTC &params) {
- return static_cast<Implementation &>(*this).setParamsRTCImpl(params);
- }
-
- static std::size_t manifestHeaderSize(
- interface::ProductionProtocolAlgorithms transport_type =
- interface::ProductionProtocolAlgorithms::UNKNOWN) {
- return Implementation::manifestHeaderSizeImpl(transport_type);
- }
-
- static std::size_t manifestEntrySize() {
- return Implementation::manifestEntrySizeImpl();
+ std::size_t manifestSize(size_t additional_entries = 0) const {
+ return static_cast<const Implementation &>(*this).manifestSizeImpl(
+ additional_entries);
}
};
@@ -146,11 +145,17 @@ class ManifestDecoder {
public:
virtual ~ManifestDecoder() = default;
+ ManifestDecoder &decode() {
+ return static_cast<Implementation &>(*this).decodeImpl();
+ }
+
ManifestDecoder &clear() {
return static_cast<Implementation &>(*this).clearImpl();
}
- void decode() { static_cast<Implementation &>(*this).decodeImpl(); }
+ bool isDecoded() const {
+ return static_cast<const Implementation &>(*this).isDecodedImpl();
+ }
ManifestType getType() const {
return static_cast<const Implementation &>(*this).getTypeImpl();
@@ -160,40 +165,48 @@ class ManifestDecoder {
return static_cast<const Implementation &>(*this).getTransportTypeImpl();
}
+ uint8_t getMaxCapacity() const {
+ return static_cast<const Implementation &>(*this).getMaxCapacityImpl();
+ }
+
auth::CryptoHashType getHashAlgorithm() const {
return static_cast<const Implementation &>(*this).getHashAlgorithmImpl();
}
+ bool getIsLast() const {
+ return static_cast<const Implementation &>(*this).getIsLastImpl();
+ }
+
core::Name getBaseName() const {
return static_cast<const Implementation &>(*this).getBaseNameImpl();
}
- auto getSuffixHashList() {
- return static_cast<Implementation &>(*this).getSuffixHashListImpl();
+ ParamsBytestream getParamsBytestream() const {
+ return static_cast<const Implementation &>(*this).getParamsBytestreamImpl();
}
- bool getIsLast() const {
- return static_cast<const Implementation &>(*this).getIsLastImpl();
+ ParamsRTC getParamsRTC() const {
+ return static_cast<const Implementation &>(*this).getParamsRTCImpl();
}
- ManifestVersion getVersion() const {
- return static_cast<const Implementation &>(*this).getVersionImpl();
+ auto getEntries() const {
+ return static_cast<const Implementation &>(*this).getEntriesImpl();
}
- std::size_t estimateSerializedLength(std::size_t number_of_entries) const {
- return static_cast<const Implementation &>(*this)
- .estimateSerializedLengthImpl(number_of_entries);
+ std::size_t manifestHeaderSize() const {
+ return static_cast<const Implementation &>(*this).manifestHeaderSizeImpl();
}
- ParamsBytestream getParamsBytestream() const {
- return static_cast<const Implementation &>(*this).getParamsBytestreamImpl();
+ std::size_t manifestPayloadSize(size_t additional_entries = 0) const {
+ return static_cast<const Implementation &>(*this).manifestPayloadSizeImpl(
+ additional_entries);
}
- ParamsRTC getParamsRTC() const {
- return static_cast<const Implementation &>(*this).getParamsRTCImpl();
+ std::size_t manifestSize(size_t additional_entries = 0) const {
+ return static_cast<const Implementation &>(*this).manifestSizeImpl(
+ additional_entries);
}
};
} // namespace core
-
} // namespace transport