diff options
author | insomniac <insomniacslk@users.noreply.github.com> | 2018-03-05 23:18:29 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-05 23:18:29 +0000 |
commit | eed1649adf6d25016f0551cac65a06102085cc8c (patch) | |
tree | 0de605d9df238a604272afa31e1831fc1cc7eee2 /dhcpv4/bsdp/types.go | |
parent | ac949192ce781902de712ea495b04fc84709ac2e (diff) | |
parent | 6491fc7ec777dbdfdfe05365c85878bb6e4d691d (diff) |
Merge pull request #3 from get9/bsdp
Add BSDP client support to DHCPv4
Diffstat (limited to 'dhcpv4/bsdp/types.go')
-rw-r--r-- | dhcpv4/bsdp/types.go | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/dhcpv4/bsdp/types.go b/dhcpv4/bsdp/types.go new file mode 100644 index 0000000..54f38e2 --- /dev/null +++ b/dhcpv4/bsdp/types.go @@ -0,0 +1,68 @@ +package bsdp + +import "github.com/insomniacslk/dhcp/dhcpv4" + +// Options (occur as sub-options of DHCP option 43). +const ( + OptionMessageType dhcpv4.OptionCode = iota + 1 + OptionVersion + OptionServerIdentifier + OptionServerPriority + OptionReplyPort + OptionBootImageListPath // Not used + OptionDefaultBootImageID + OptionSelectedBootImageID + OptionBootImageList + OptionNetboot1_0Firmware + OptionBootImageAttributesFilterList + OptionShadowMountPath dhcpv4.OptionCode = 128 + OptionShadowFilePath dhcpv4.OptionCode = 129 + OptionMachineName dhcpv4.OptionCode = 130 +) + +// Versions +var ( + Version1_0 = []byte{1, 0} + Version1_1 = []byte{1, 1} +) + +// MessageType represents the different BSDP message types. +type MessageType byte + +// BSDP Message types - e.g. LIST, SELECT, FAILED +const ( + MessageTypeList MessageType = iota + 1 + MessageTypeSelect + MessageTypeFailed +) + +// BootImageType represents the different BSDP boot image types. +type BootImageType byte + +// Different types of BootImages - e.g. for different flavors of macOS. +const ( + BootImageTypeMacOS9 BootImageType = iota + BootImageTypeMacOSX + BootImageTypeMacOSXServer + BootImageTypeHardwareDiagnostics + // 0x4 - 0x7f are reserved for future use. +) + +// OptionCodeToString maps BSDP OptionCodes to human-readable strings +// describing what they are. +var OptionCodeToString = map[dhcpv4.OptionCode]string{ + OptionMessageType: " Message Type", + OptionVersion: " Version", + OptionServerIdentifier: " Server Identifier", + OptionServerPriority: " Server Priority", + OptionReplyPort: " Reply Port", + OptionBootImageListPath: "", // Not used + OptionDefaultBootImageID: " Default Boot Image ID", + OptionSelectedBootImageID: " Selected Boot Image ID", + OptionBootImageList: " Boot Image List", + OptionNetboot1_0Firmware: " Netboot 1.0 Firmware", + OptionBootImageAttributesFilterList: " Boot Image Attributes Filter List", + OptionShadowMountPath: " Shadow Mount Path", + OptionShadowFilePath: " Shadow File Path", + OptionMachineName: " Machine Name", +} |