summaryrefslogtreecommitdiffhomepage
path: root/dhcpv6/types.go
blob: e0ea6f0cd4f74f25b2c5a3f1a458ea0758f52230 (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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package dhcpv6

// from http://www.networksorcery.com/enp/protocol/dhcpv6.htm

type MessageType uint8

const (
	_ MessageType = iota // skip 0
	SOLICIT
	ADVERTISE
	REQUEST
	CONFIRM
	RENEW
	REBIND
	REPLY
	RELEASE
	DECLINE
	RECONFIGURE
	INFORMATION_REQUEST
	RELAY_FORW
	RELAY_REPL
	LEASEQUERY
	LEASEQUERY_REPLY
	LEASEQUERY_DONE
	LEASEQUERY_DATA
)

func MessageTypeToString(t MessageType) string {
	if m := MessageTypeToStringMap[t]; m != "" {
		return m
	}
	return "Unknown"
}

var MessageTypeToStringMap = map[MessageType]string{
	SOLICIT:             "SOLICIT",
	ADVERTISE:           "ADVERTISE",
	REQUEST:             "REQUEST",
	CONFIRM:             "CONFIRM",
	RENEW:               "RENEW",
	REBIND:              "REBIND",
	REPLY:               "REPLY",
	RELEASE:             "RELEASE",
	DECLINE:             "DECLINE",
	RECONFIGURE:         "RECONFIGURE",
	INFORMATION_REQUEST: "INFORMATION-REQUEST",
	RELAY_FORW:          "RELAY-FORW",
	RELAY_REPL:          "RELAY-REPL",
	LEASEQUERY:          "LEASEQUERY",
	LEASEQUERY_REPLY:    "LEASEQUERY-REPLY",
	LEASEQUERY_DONE:     "LEASEQUERY-DONE",
	LEASEQUERY_DATA:     "LEASEQUERY-DATA",
}