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/chunk/shutdown_ack_chunk.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/rfc4960#section-3.3.9 22 23 // 0 1 2 3 24 // 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 25 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 26 // | Type = 8 |Chunk Flags | Length = 4 | 27 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 28 constexpr int ShutdownAckChunk::kType; 29 Parse(rtc::ArrayView<const uint8_t> data)30absl::optional<ShutdownAckChunk> ShutdownAckChunk::Parse( 31 rtc::ArrayView<const uint8_t> data) { 32 if (!ParseTLV(data).has_value()) { 33 return absl::nullopt; 34 } 35 return ShutdownAckChunk(); 36 } 37 SerializeTo(std::vector<uint8_t> & out) const38void ShutdownAckChunk::SerializeTo(std::vector<uint8_t>& out) const { 39 AllocateTLV(out); 40 } 41 ToString() const42std::string ShutdownAckChunk::ToString() const { 43 return "SHUTDOWN-ACK"; 44 } 45 46 } // namespace dcsctp 47