blob: 3b5f8657eb2ecf1352e2164266e664ed1fe9052f (
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
|
package dhcpv6
// This module defines the OptRelayMsg structure.
// https://www.ietf.org/rfc/rfc3315.txt
import (
"fmt"
)
type OptRelayMsg struct {
relayMessage DHCPv6
}
func (op *OptRelayMsg) Code() OptionCode {
return OPTION_RELAY_MSG
}
func (op *OptRelayMsg) ToBytes() []byte {
return op.relayMessage.ToBytes()
}
func (op *OptRelayMsg) RelayMessage() DHCPv6 {
return op.relayMessage
}
func (op *OptRelayMsg) SetRelayMessage(relayMessage DHCPv6) {
op.relayMessage = relayMessage
}
func (op *OptRelayMsg) Length() int {
return op.relayMessage.Length()
}
func (op *OptRelayMsg) String() string {
return fmt.Sprintf("OptRelayMsg{relaymsg=%v}", op.relayMessage)
}
// build an OptRelayMsg structure from a sequence of bytes.
// The input data does not include option code and length bytes.
func ParseOptRelayMsg(data []byte) (*OptRelayMsg, error) {
var err error
opt := OptRelayMsg{}
opt.relayMessage, err = FromBytes(data)
if err != nil {
return nil, err
}
return &opt, nil
}
|