Debian Codegraph @

chunktype.go

raw
1 // SPDX-FileCopyrightText: 2026 The Pion community <https://pion.ly>
2 // SPDX-License-Identifier: MIT
3
4 package sctp
5
6 import "fmt"
7
8 // chunkType is an enum for SCTP Chunk Type field
9 // This field identifies the type of information contained in the
10 // Chunk Value field.
11 type chunkType uint8
12
13 // List of known chunkType enums.
14 const (
15 ctPayloadData chunkType = 0
16 ctIData chunkType = 64
17 ctInit chunkType = 1
18 ctInitAck chunkType = 2
19 ctSack chunkType = 3
20 ctHeartbeat chunkType = 4
21 ctHeartbeatAck chunkType = 5
22 ctAbort chunkType = 6
23 ctShutdown chunkType = 7
24 ctShutdownAck chunkType = 8
25 ctError chunkType = 9
26 ctCookieEcho chunkType = 10
27 ctCookieAck chunkType = 11
28 ctCWR chunkType = 13
29 ctShutdownComplete chunkType = 14
30 ctReconfig chunkType = 130
31 ctForwardTSN chunkType = 192
32 ctIForwardTSN chunkType = 194
33 )
34
35 func (c chunkType) String() string { //nolint:cyclop
36 switch c {
37 case ctPayloadData:
38 return "DATA"
39 case ctIData:
40 return "I-DATA"
41 case ctInit:
42 return "INIT"
43 case ctInitAck:
44 return "INIT-ACK"
45 case ctSack:
46 return "SACK"
47 case ctHeartbeat:
48 return "HEARTBEAT"
49 case ctHeartbeatAck:
50 return "HEARTBEAT-ACK"
51 case ctAbort:
52 return "ABORT"
53 case ctShutdown:
54 return "SHUTDOWN"
55 case ctShutdownAck:
56 return "SHUTDOWN-ACK"
57 case ctError:
58 return "ERROR"
59 case ctCookieEcho:
60 return "COOKIE-ECHO"
61 case ctCookieAck:
62 return "COOKIE-ACK"
63 case ctCWR:
64 return "ECNE" // Explicit Congestion Notification Echo
65 case ctShutdownComplete:
66 return "SHUTDOWN-COMPLETE"
67 case ctReconfig:
68 return "RECONFIG" // Re-configuration
69 case ctForwardTSN:
70 return "FORWARD-TSN"
71 case ctIForwardTSN:
72 return "I-FORWARD-TSN"
73 default:
74 return fmt.Sprintf("Unknown ChunkType: %d", c)
75 }
76 }