// SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>// SPDX-License-Identifier: MITpackage sctp // nolint:duplimport ()/*Operation Error (ERROR) (9)An endpoint sends this chunk to its peer endpoint to notify it ofcertain error conditions. It contains one or more error causes. AnOperation Error is not considered fatal in and of itself, but may beused with an ERROR chunk to report a fatal condition. It has thefollowing parameters: 0 1 2 3 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 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type = 9 | Chunk Flags | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ \ \ / one or more Error Causes / \ \ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+Chunk Flags: 8 bits Set to 0 on transmit and ignored on receipt.Length: 16 bits (unsigned integer) Set to the size of the chunk in bytes, including the chunk header and all the Error Cause fields present.*/type chunkError struct {chunkHeader errorCauses []errorCause}// Error chunk errors.var (ErrChunkTypeNotCtError = errors.New("ChunkType is not of type ctError")ErrBuildErrorChunkFailed = errors.New("failed build Error Chunk"))func ( *chunkError) ( []byte) error {if := .chunkHeader.unmarshal(); != nil {return }if .typ != ctError {returnfmt.Errorf("%w, actually is %s", ErrChunkTypeNotCtError, .typ.String()) } := chunkHeaderSizefor {iflen()- < 4 {break } , := buildErrorCause([:])if != nil {returnfmt.Errorf("%w: %v", ErrBuildErrorChunkFailed, ) //nolint:errorlint } += int(.length()) .errorCauses = append(.errorCauses, ) }returnnil}func ( *chunkError) () ([]byte, error) { .chunkHeader.typ = ctError .flags = 0x00 .raw = []byte{}for , := range .errorCauses { , := .marshal()if != nil {returnnil, } .raw = append(.raw, ...) }return .chunkHeader.marshal()}func ( *chunkError) () ( bool, error) {returnfalse, nil}// String makes chunkError printable.func ( *chunkError) () string { := .chunkHeader.String()for , := range .errorCauses { += fmt.Sprintf("\n - %s", ) }return}
The pages are generated with Goldsv0.8.2. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds.