forked from bronze1man/radius
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPacketCode.go
52 lines (46 loc) · 1.38 KB
/
PacketCode.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
50
51
52
package radius
import (
"strconv"
)
type PacketCode uint8
const (
AccessRequest PacketCode = 1
AccessAccept PacketCode = 2
AccessReject PacketCode = 3
AccountingRequest PacketCode = 4
AccountingResponse PacketCode = 5
AccessChallenge PacketCode = 11
StatusServer PacketCode = 12 //(experimental)
StatusClient PacketCode = 13 //(experimental)
DisconnectRequest PacketCode = 40
DisconnectAccept PacketCode = 41
DisconnectReject PacketCode = 42
CoARequest PacketCode = 43
CoAAccept PacketCode = 44
CoaReject PacketCode = 45
Reserved PacketCode = 255
)
var packetCodeName = map[PacketCode]string{
AccessRequest: "AccessRequest",
AccessAccept: "AccessAccept",
AccessReject: "AccessReject",
AccountingRequest: "AccountingRequest",
AccountingResponse: "AccountingResponse",
AccessChallenge: "AccessChallenge",
StatusServer: "StatusServer",
StatusClient: "StatusClient",
DisconnectRequest: "DisconnectRequest",
DisconnectAccept: "DisconnectAccept",
DisconnectReject: "DisconnectReject",
CoARequest: "CoARequest",
CoAAccept: "CoAAccept",
CoaReject: "CoaReject",
Reserved: "Reserved",
}
func (p PacketCode) String() string {
name, ok := packetCodeName[p]
if ok {
return name
}
return "unknown packet code " + strconv.Itoa(int(p))
}