mirror of
https://github.com/pion/webrtc.git
synced 2025-10-29 01:42:59 +08:00
34 lines
641 B
Go
34 lines
641 B
Go
package sctp
|
|
|
|
import (
|
|
"fmt"
|
|
)
|
|
|
|
type ParamSupportedExtensions struct {
|
|
ParamHeader
|
|
Raw []byte
|
|
ChunkTypes []ChunkType
|
|
}
|
|
|
|
func (s *ParamSupportedExtensions) Marshal() ([]byte, error) {
|
|
r := make([]byte, len(s.ChunkTypes))
|
|
for i, c := range s.ChunkTypes {
|
|
r[i] = byte(c)
|
|
}
|
|
|
|
return s.ParamHeader.Marshal(SupportedExt, r)
|
|
}
|
|
|
|
func (s *ParamSupportedExtensions) Unmarshal(raw []byte) (Param, error) {
|
|
s.ParamHeader.Unmarshal(raw)
|
|
|
|
for t := range s.raw {
|
|
s.ChunkTypes = append(s.ChunkTypes, ChunkType(t))
|
|
}
|
|
fmt.Print(s.ChunkTypes)
|
|
|
|
return s, nil
|
|
}
|
|
|
|
func (s *ParamSupportedExtensions) Types() []ChunkType { return s.Types() }
|