blob: 2935524cae51a08eb5d49d2523a66a142bc7ae5d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
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
}
|