diff options
author | Pablo Mazzini <pmazzini@gmail.com> | 2023-12-04 10:33:34 +0000 |
---|---|---|
committer | insomniac <insomniacslk@users.noreply.github.com> | 2023-12-06 07:48:09 +0100 |
commit | 8c70d406f6d24a17219a5f543174c1f3f3ad9e35 (patch) | |
tree | 7f9acc8e465b9b354dea197f1d77698370e648ab /dhcpv4/bsdp/bsdp_option_boot_image_list.go | |
parent | b0416c0f187a65a350b32d34fc31ea30f06c12ce (diff) |
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), - } -} |