Debian Codegraph @

param_chunk_list.go

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