-
Notifications
You must be signed in to change notification settings - Fork 79
/
error_cause_user_initiated_abort.go
49 lines (41 loc) · 1.58 KB
/
error_cause_user_initiated_abort.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>
// SPDX-License-Identifier: MIT
package sctp
import (
"fmt"
)
/*
This error cause MAY be included in ABORT chunks that are sent
because of an upper-layer request. The upper layer can specify an
Upper Layer Abort Reason that is transported by SCTP transparently
and MAY be delivered to the upper-layer protocol at the peer.
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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Cause Code=12 | Cause Length=Variable |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
/ Upper Layer Abort Reason /
\ \
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
type errorCauseUserInitiatedAbort struct {
errorCauseHeader
upperLayerAbortReason []byte
}
func (e *errorCauseUserInitiatedAbort) marshal() ([]byte, error) {
e.code = userInitiatedAbort
e.errorCauseHeader.raw = e.upperLayerAbortReason
return e.errorCauseHeader.marshal()
}
func (e *errorCauseUserInitiatedAbort) unmarshal(raw []byte) error {
err := e.errorCauseHeader.unmarshal(raw)
if err != nil {
return err
}
e.upperLayerAbortReason = e.errorCauseHeader.raw
return nil
}
// String makes errorCauseUserInitiatedAbort printable
func (e *errorCauseUserInitiatedAbort) String() string {
return fmt.Sprintf("%s: %s", e.errorCauseHeader.String(), e.upperLayerAbortReason)
}