diff options
Diffstat (limited to 'dhcpv4/bsdp/bsdp_option_boot_image_list.go')
-rw-r--r-- | dhcpv4/bsdp/bsdp_option_boot_image_list.go | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/dhcpv4/bsdp/bsdp_option_boot_image_list.go b/dhcpv4/bsdp/bsdp_option_boot_image_list.go deleted file mode 100644 index ed70243..0000000 --- a/dhcpv4/bsdp/bsdp_option_boot_image_list.go +++ /dev/null @@ -1,53 +0,0 @@ -package bsdp - -import ( - "strings" - - "github.com/insomniacslk/dhcp/dhcpv4" - "github.com/u-root/uio/uio" -) - -// BootImageList contains a list of boot images presented by a netboot server. -// -// Implements the BSDP option listing the boot images. -type BootImageList []BootImage - -// FromBytes deserializes data into bil. -func (bil *BootImageList) FromBytes(data []byte) error { - buf := uio.NewBigEndianBuffer(data) - - for buf.Has(5) { - var image BootImage - if err := image.Unmarshal(buf); err != nil { - return err - } - *bil = append(*bil, image) - } - return nil -} - -// ToBytes returns a serialized stream of bytes for this option. -func (bil BootImageList) ToBytes() []byte { - buf := uio.NewBigEndianBuffer(nil) - for _, image := range bil { - image.Marshal(buf) - } - return buf.Data() -} - -// String returns a human-readable string for this option. -func (bil BootImageList) String() string { - s := make([]string, 0, len(bil)) - for _, image := range bil { - s = append(s, image.String()) - } - return strings.Join(s, ", ") -} - -// OptBootImageList returns a new BSDP boot image list. -func OptBootImageList(b ...BootImage) dhcpv4.Option { - return dhcpv4.Option{ - Code: OptionBootImageList, - Value: BootImageList(b), - } -} |