blob: 52c638d1595b4011674ed59860c4b7957c2531a2 (
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
|
package dhcpv4
import (
"fmt"
)
// OptTFTPServerName implements the TFTP server name option described by RFC
// 2132, Section 9.4.
type OptTFTPServerName struct {
TFTPServerName string
}
// Code returns the option code
func (op *OptTFTPServerName) Code() OptionCode {
return OptionTFTPServerName
}
// ToBytes serializes the option and returns it as a sequence of bytes
func (op *OptTFTPServerName) ToBytes() []byte {
return []byte(op.TFTPServerName)
}
func (op *OptTFTPServerName) String() string {
return fmt.Sprintf("TFTP Server Name -> %s", op.TFTPServerName)
}
// ParseOptTFTPServerName returns a new OptTFTPServerName from a byte stream or error if any
func ParseOptTFTPServerName(data []byte) (*OptTFTPServerName, error) {
return &OptTFTPServerName{TFTPServerName: string(data)}, nil
}
|