summaryrefslogtreecommitdiffhomepage
path: root/dhcpv6/option_archtype.go
blob: a5514cd89638feaa8eb80f96b56a4da07e1d966e (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
package dhcpv6

import (
	"fmt"

	"github.com/insomniacslk/dhcp/iana"
)

// OptClientArchType represents an option CLIENT_ARCH_TYPE.
//
// This module defines the OptClientArchType structure.
// https://www.ietf.org/rfc/rfc5970.txt
func OptClientArchType(a ...iana.Arch) Option {
	return &optClientArchType{Archs: a}
}

type optClientArchType struct {
	iana.Archs
}

func (op *optClientArchType) Code() OptionCode {
	return OptionClientArchType
}

func (op optClientArchType) String() string {
	return fmt.Sprintf("%s: %s", op.Code(), op.Archs)
}

// parseOptClientArchType builds an OptClientArchType structure from
// a sequence of bytes The input data does not include option code and
// length bytes.
func parseOptClientArchType(data []byte) (*optClientArchType, error) {
	var opt optClientArchType
	return &opt, opt.FromBytes(data)
}