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 #ifndef NET_DCSCTP_PACKET_PARAMETER_SSN_TSN_RESET_REQUEST_PARAMETER_H_ 11 #define NET_DCSCTP_PACKET_PARAMETER_SSN_TSN_RESET_REQUEST_PARAMETER_H_ 12 #include <stddef.h> 13 #include <stdint.h> 14 15 #include <string> 16 #include <vector> 17 18 #include "absl/strings/string_view.h" 19 #include "api/array_view.h" 20 #include "net/dcsctp/common/internal_types.h" 21 #include "net/dcsctp/packet/parameter/parameter.h" 22 #include "net/dcsctp/packet/tlv_trait.h" 23 24 namespace dcsctp { 25 26 // https://tools.ietf.org/html/rfc6525#section-4.3 27 struct SSNTSNResetRequestParameterConfig : ParameterConfig { 28 static constexpr int kType = 15; 29 static constexpr size_t kHeaderSize = 8; 30 static constexpr size_t kVariableLengthAlignment = 0; 31 }; 32 33 class SSNTSNResetRequestParameter 34 : public Parameter, 35 public TLVTrait<SSNTSNResetRequestParameterConfig> { 36 public: 37 static constexpr int kType = SSNTSNResetRequestParameterConfig::kType; 38 SSNTSNResetRequestParameter(ReconfigRequestSN request_sequence_number)39 explicit SSNTSNResetRequestParameter( 40 ReconfigRequestSN request_sequence_number) 41 : request_sequence_number_(request_sequence_number) {} 42 43 static absl::optional<SSNTSNResetRequestParameter> Parse( 44 rtc::ArrayView<const uint8_t> data); 45 46 void SerializeTo(std::vector<uint8_t>& out) const override; 47 std::string ToString() const override; 48 request_sequence_number()49 ReconfigRequestSN request_sequence_number() const { 50 return request_sequence_number_; 51 } 52 53 private: 54 ReconfigRequestSN request_sequence_number_; 55 }; 56 57 } // namespace dcsctp 58 59 #endif // NET_DCSCTP_PACKET_PARAMETER_SSN_TSN_RESET_REQUEST_PARAMETER_H_ 60