blob: 5ed2fbac4c4851f34f4529f219760fa8d71471c6 (
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
|
package dhcpv6
import (
"fmt"
)
// OptInterfaceId implements the interface-id option as defined by RFC 3315,
// Section 22.18.
//
// This module defines the OptInterfaceId structure.
// https://www.ietf.org/rfc/rfc3315.txt
type OptInterfaceId struct {
interfaceId []byte
}
func (op *OptInterfaceId) Code() OptionCode {
return OptionInterfaceID
}
func (op *OptInterfaceId) ToBytes() []byte {
return op.interfaceId
}
func (op *OptInterfaceId) InterfaceID() []byte {
return op.interfaceId
}
func (op *OptInterfaceId) SetInterfaceID(interfaceId []byte) {
op.interfaceId = append([]byte(nil), interfaceId...)
}
func (op *OptInterfaceId) String() string {
return fmt.Sprintf("OptInterfaceId{interfaceid=%v}", op.interfaceId)
}
// build an OptInterfaceId structure from a sequence of bytes.
// The input data does not include option code and length bytes.
func ParseOptInterfaceId(data []byte) (*OptInterfaceId, error) {
var opt OptInterfaceId
opt.interfaceId = append([]byte(nil), data...)
return &opt, nil
}
|