File: option_archtype.go

package info (click to toggle)
golang-github-insomniacslk-dhcp 0.0~git20200621.d74cd86-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,132 kB
  • sloc: makefile: 9
file content (35 lines) | stat: -rw-r--r-- 849 bytes parent folder | download | duplicates (2)
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("ClientArchType: %s", op.Archs.String())
}

// 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)
}