| 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 |
chunkShutdownAck represents an SCTP Chunk of type chunkShutdownAck |
| 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 = 8 | Chunk Flags | Length = 4 | |
| 18 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+. |
| 19 |
*/ |
| 20 |
type chunkShutdownAck struct { |
| 21 |
chunkHeader |
| 22 |
} |
| 23 |
|
| 24 |
// Shutdown ack chunk errors. |
| 25 |
var ( |
| 26 |
ErrChunkTypeNotShutdownAck = errors.New("ChunkType is not of type SHUTDOWN-ACK") |
| 27 |
) |
| 28 |
|
| 29 |
func (c *chunkShutdownAck) unmarshal(raw []byte) error { |
| 30 |
if err := c.chunkHeader.unmarshal(raw); err != nil { |
| 31 |
return err |
| 32 |
} |
| 33 |
|
| 34 |
if c.typ != ctShutdownAck { |
| 35 |
return fmt.Errorf("%w: actually is %s", ErrChunkTypeNotShutdownAck, c.typ.String()) |
| 36 |
} |
| 37 |
|
| 38 |
return nil |
| 39 |
} |
| 40 |
|
| 41 |
func (c *chunkShutdownAck) marshal() ([]byte, error) { |
| 42 |
c.typ = ctShutdownAck |
| 43 |
|
| 44 |
return c.chunkHeader.marshal() |
| 45 |
} |
| 46 |
|
| 47 |
func (c *chunkShutdownAck) check() (abort bool, err error) { |
| 48 |
return false, nil |
| 49 |
} |
| 50 |
|
| 51 |
// String makes chunkShutdownAck printable. |
| 52 |
func (c *chunkShutdownAck) String() string { |
| 53 |
return c.chunkHeader.String() |
| 54 |
} |