/* * Copyright 2019 The Chromium Authors. All rights reserved. * Copyright (c) 2021 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ #ifndef NET_DCSCTP_PUBLIC_TYPES_H_ #define NET_DCSCTP_PUBLIC_TYPES_H_ #include <cstdint> #include <limits> #include "api/units/time_delta.h" #include "rtc_base/strong_alias.h" namespace dcsctp { // Stream Identifier StreamID; // Payload Protocol Identifier (PPID) PPID; // Timeout Identifier TimeoutID; // Indicates if a message is allowed to be received out-of-order compared to // other messages on the same stream. IsUnordered; // Stream priority, where higher values indicate higher priority. The meaning of // this value and how it's used depends on the stream scheduler. StreamPriority; // Duration, as milliseconds. Overflows after 24 days. class DurationMs : public webrtc::StrongAlias<class DurationMsTag, int32_t> { … }; constexpr inline DurationMs operator+(DurationMs lhs, DurationMs rhs) { … } constexpr inline DurationMs operator-(DurationMs lhs, DurationMs rhs) { … } template <typename T> constexpr inline DurationMs operator*(DurationMs lhs, T rhs) { … } template <typename T> constexpr inline DurationMs operator*(T lhs, DurationMs rhs) { … } constexpr inline int32_t operator/(DurationMs lhs, DurationMs rhs) { … } // Represents time, in milliseconds since a client-defined epoch. class TimeMs : public webrtc::StrongAlias<class TimeMsTag, int64_t> { … }; constexpr inline TimeMs operator+(TimeMs lhs, DurationMs rhs) { … } constexpr inline TimeMs operator+(DurationMs lhs, TimeMs rhs) { … } constexpr inline TimeMs operator-(TimeMs lhs, DurationMs rhs) { … } constexpr inline DurationMs operator-(TimeMs lhs, TimeMs rhs) { … } // The maximum number of times the socket should attempt to retransmit a // message which fails the first time in unreliable mode. class MaxRetransmits : public webrtc::StrongAlias<class MaxRetransmitsTag, uint16_t> { … }; // An identifier that can be set on sent messages, and picked by the sending // client. If different from `::NotSet()`, lifecycle events will be generated, // and eventually `DcSctpSocketCallbacks::OnLifecycleEnd` will be called to // indicate that the lifecycle isn't tracked any longer. The value zero (0) is // not a valid lifecycle identifier, and will be interpreted as not having it // set. class LifecycleId : public webrtc::StrongAlias<class LifecycleIdTag, uint64_t> { … }; // To enable zero checksum feature, both peers must agree on which alternate // error detection method that is used. See // https://www.ietf.org/archive/id/draft-ietf-tsvwg-sctp-zero-checksum-06.html. class ZeroChecksumAlternateErrorDetectionMethod : public webrtc::StrongAlias< class ZeroChecksumAlternateErrorDetectionMethodTag, uint32_t> { … }; } // namespace dcsctp #endif // NET_DCSCTP_PUBLIC_TYPES_H_