blob: aa184338cf6ea8b4f763845104399e4023242b15 (
plain)
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
|
package iana
// StatusCode represents a IANA status code for DHCPv6
type StatusCode uint16
// IANA status codes as defined by rfc 3315 par. 24..4
const (
StatusSuccess StatusCode = 0
StatusUnspecFail StatusCode = 1
StatusNoAddrsAvail StatusCode = 2
StatusNoBinding StatusCode = 3
StatusNotOnLink StatusCode = 4
StatusUseMulticast StatusCode = 5
StatusNoPrefixAvail StatusCode = 6
)
// StatusCodeToString returns a mnemonic name for a given status code
func StatusCodeToString(s StatusCode) string {
if sc := StatusCodeToStringMap[s]; sc != "" {
return sc
}
return "Unknown"
}
// StatusCodeToStringMap maps status codes to their names
var StatusCodeToStringMap = map[StatusCode]string{
StatusSuccess: "Success",
StatusUnspecFail: "UnspecFail",
StatusNoAddrsAvail: "NoAddrsAvail",
StatusNoBinding: "NoBinding",
StatusNotOnLink: "NotOnLink",
StatusUseMulticast: "UseMulticast",
StatusNoPrefixAvail: "NoPrefixAvail",
}
|