summaryrefslogtreecommitdiffhomepage
path: root/dhcpv4/option_root_path.go
blob: 84e392e59e018cc9759456e35687ca423f01193e (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
package dhcpv4

import (
	"fmt"
)

// This option implements the root path option
// https://tools.ietf.org/html/rfc2132

// OptRootPath represents the path to the client's root disk.
type OptRootPath struct {
	Path string
}

// ParseOptRootPath constructs an OptRootPath struct from a sequence of  bytes
// and returns it, or an error.
func ParseOptRootPath(data []byte) (*OptRootPath, error) {
	return &OptRootPath{Path: string(data)}, nil
}

// Code returns the option code.
func (o *OptRootPath) Code() OptionCode {
	return OptionRootPath
}

// ToBytes returns a serialized stream of bytes for this option.
func (o *OptRootPath) ToBytes() []byte {
	return []byte(o.Path)
}

// String returns a human-readable string for this option.
func (o *OptRootPath) String() string {
	return fmt.Sprintf("Root Path -> %v", o.Path)
}