2024-06-05 20:10:03 +00:00
|
|
|
// SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>
|
|
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
|
2022-03-10 09:44:48 +00:00
|
|
|
package sctp
|
|
|
|
|
|
|
|
type paramSupportedExtensions struct {
|
|
|
|
paramHeader
|
|
|
|
ChunkTypes []chunkType
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *paramSupportedExtensions) marshal() ([]byte, error) {
|
|
|
|
s.typ = supportedExt
|
|
|
|
s.raw = make([]byte, len(s.ChunkTypes))
|
|
|
|
for i, c := range s.ChunkTypes {
|
|
|
|
s.raw[i] = byte(c)
|
|
|
|
}
|
|
|
|
|
|
|
|
return s.paramHeader.marshal()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *paramSupportedExtensions) unmarshal(raw []byte) (param, error) {
|
|
|
|
err := s.paramHeader.unmarshal(raw)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, t := range s.raw {
|
|
|
|
s.ChunkTypes = append(s.ChunkTypes, chunkType(t))
|
|
|
|
}
|
|
|
|
|
|
|
|
return s, nil
|
|
|
|
}
|