param_random.go 373 B

123456789101112131415161718192021
  1. package sctp
  2. type paramRandom struct {
  3. paramHeader
  4. randomData []byte
  5. }
  6. func (r *paramRandom) marshal() ([]byte, error) {
  7. r.typ = random
  8. r.raw = r.randomData
  9. return r.paramHeader.marshal()
  10. }
  11. func (r *paramRandom) unmarshal(raw []byte) (param, error) {
  12. err := r.paramHeader.unmarshal(raw)
  13. if err != nil {
  14. return nil, err
  15. }
  16. r.randomData = r.raw
  17. return r, nil
  18. }