summaryrefslogtreecommitdiffhomepage
path: root/dhcpv6/option_bootfileurl.go
blob: 695f164351eabee5c5e1e14283b5246274772474 (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
package dhcpv6

import (
	"fmt"
)

// OptBootFileURL returns a OptionBootfileURL as defined by RFC 5970.
func OptBootFileURL(url string) Option {
	return optBootFileURL(url)
}

type optBootFileURL string

// Code returns the option code
func (op optBootFileURL) Code() OptionCode {
	return OptionBootfileURL
}

// ToBytes serializes the option and returns it as a sequence of bytes
func (op optBootFileURL) ToBytes() []byte {
	return []byte(op)
}

func (op optBootFileURL) String() string {
	return fmt.Sprintf("BootFileURL: %s", string(op))
}

// parseOptBootFileURL builds an optBootFileURL structure from a sequence
// of bytes. The input data does not include option code and length bytes.
func parseOptBootFileURL(data []byte) (optBootFileURL, error) {
	return optBootFileURL(string(data)), nil
}