xref: /aosp_15_r20/external/webrtc/net/dcsctp/packet/parameter/forward_tsn_supported_parameter.cc (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1 /*
2  *  Copyright (c) 2021 The WebRTC project authors. All Rights Reserved.
3  *
4  *  Use of this source code is governed by a BSD-style license
5  *  that can be found in the LICENSE file in the root of the source
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 #include "net/dcsctp/packet/parameter/forward_tsn_supported_parameter.h"
11 
12 #include <stdint.h>
13 
14 #include <vector>
15 
16 #include "absl/types/optional.h"
17 #include "api/array_view.h"
18 
19 namespace dcsctp {
20 
21 // https://tools.ietf.org/html/rfc3758#section-3.1
22 
23 //   0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
24 //  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
25 //  |    Parameter Type = 49152     |  Parameter Length = 4         |
26 //  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
27 constexpr int ForwardTsnSupportedParameter::kType;
28 
29 absl::optional<ForwardTsnSupportedParameter>
Parse(rtc::ArrayView<const uint8_t> data)30 ForwardTsnSupportedParameter::Parse(rtc::ArrayView<const uint8_t> data) {
31   if (!ParseTLV(data).has_value()) {
32     return absl::nullopt;
33   }
34   return ForwardTsnSupportedParameter();
35 }
36 
SerializeTo(std::vector<uint8_t> & out) const37 void ForwardTsnSupportedParameter::SerializeTo(
38     std::vector<uint8_t>& out) const {
39   AllocateTLV(out);
40 }
41 
ToString() const42 std::string ForwardTsnSupportedParameter::ToString() const {
43   return "Forward TSN Supported";
44 }
45 }  // namespace dcsctp
46