| 1 |
// SPDX-FileCopyrightText: 2026 The Pion community <https://pion.ly> |
| 2 |
// SPDX-License-Identifier: MIT |
| 3 |
|
| 4 |
package sctp |
| 5 |
|
| 6 |
import ( |
| 7 |
"errors" |
| 8 |
"fmt" |
| 9 |
) |
| 10 |
|
| 11 |
/* |
| 12 |
chunkShutdownComplete represents an SCTP Chunk of type chunkShutdownComplete |
| 13 |
|
| 14 |
0 1 2 3 |
| 15 |
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 |
| 16 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 17 |
| Type = 14 |Reserved |T| Length = 4 | |
| 18 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+. |
| 19 |
*/ |
| 20 |
type chunkShutdownComplete struct { |
| 21 |
chunkHeader |
| 22 |
} |
| 23 |
|
| 24 |
// Shutdown complete chunk errors. |
| 25 |
var ( |
| 26 |
ErrChunkTypeNotShutdownComplete = errors.New("ChunkType is not of type SHUTDOWN-COMPLETE") |
| 27 |
) |
| 28 |
|
| 29 |
func (c *chunkShutdownComplete) unmarshal(raw []byte) error { |
| 30 |
if err := c.chunkHeader.unmarshal(raw); err != nil { |
| 31 |
return err |
| 32 |
} |
| 33 |
|
| 34 |
if c.typ != ctShutdownComplete { |
| 35 |
return fmt.Errorf("%w: actually is %s", ErrChunkTypeNotShutdownComplete, c.typ.String()) |
| 36 |
} |
| 37 |
|
| 38 |
return nil |
| 39 |
} |
| 40 |
|
| 41 |
func (c *chunkShutdownComplete) marshal() ([]byte, error) { |
| 42 |
c.typ = ctShutdownComplete |
| 43 |
|
| 44 |
return c.chunkHeader.marshal() |
| 45 |
} |
| 46 |
|
| 47 |
func (c *chunkShutdownComplete) check() (abort bool, err error) { |
| 48 |
return false, nil |
| 49 |
} |
| 50 |
|
| 51 |
// String makes chunkShutdownComplete printable. |
| 52 |
func (c *chunkShutdownComplete) String() string { |
| 53 |
return c.chunkHeader.String() |
| 54 |
} |