summaryrefslogtreecommitdiffhomepage
path: root/dhcpv6/types.go
blob: 795a28473b1634b54c2a58c9401a8550a57c3ac1 (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
54
package dhcpv6

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

type MessageType uint8

const (
	// MSGTYPE_NONE is used internally and is not part of the RFC
	MSGTYPE_NONE        MessageType = 0
	SOLICIT             MessageType = 1
	ADVERTISE           MessageType = 2
	REQUEST             MessageType = 3
	CONFIRM             MessageType = 4
	RENEW               MessageType = 5
	REBIND              MessageType = 6
	REPLY               MessageType = 7
	RELEASE             MessageType = 8
	DECLINE             MessageType = 9
	RECONFIGURE         MessageType = 10
	INFORMATION_REQUEST MessageType = 11
	RELAY_FORW          MessageType = 12
	RELAY_REPL          MessageType = 13
	LEASEQUERY          MessageType = 14
	LEASEQUERY_REPLY    MessageType = 15
	LEASEQUERY_DONE     MessageType = 16
	LEASEQUERY_DATA     MessageType = 17
)

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",
}