| 1 |
// SPDX-FileCopyrightText: 2026 The Pion community <https://pion.ly> |
| 2 |
// SPDX-License-Identifier: MIT |
| 3 |
|
| 4 |
package sctp |
| 5 |
|
| 6 |
type paramSupportedExtensions struct { |
| 7 |
paramHeader |
| 8 |
ChunkTypes []chunkType |
| 9 |
} |
| 10 |
|
| 11 |
func (s *paramSupportedExtensions) marshal() ([]byte, error) { |
| 12 |
s.typ = supportedExt |
| 13 |
s.raw = make([]byte, len(s.ChunkTypes)) |
| 14 |
for i, c := range s.ChunkTypes { |
| 15 |
s.raw[i] = byte(c) |
| 16 |
} |
| 17 |
|
| 18 |
return s.paramHeader.marshal() |
| 19 |
} |
| 20 |
|
| 21 |
func (s *paramSupportedExtensions) unmarshal(raw []byte) (param, error) { |
| 22 |
err := s.paramHeader.unmarshal(raw) |
| 23 |
if err != nil { |
| 24 |
return nil, err |
| 25 |
} |
| 26 |
|
| 27 |
for _, t := range s.raw { |
| 28 |
s.ChunkTypes = append(s.ChunkTypes, chunkType(t)) |
| 29 |
} |
| 30 |
|
| 31 |
return s, nil |
| 32 |
} |