Documentation ¶
Overview ¶
Package dhcp4opts implements Options parsing for DHCPv4 options as described in RFC 2132.
Not all options are currently implemented.
Index ¶
- func GetDomainName(o dhcp4.Options) string
- func GetExtensionsPath(o dhcp4.Options) string
- func GetHostName(o dhcp4.Options) string
- func GetIPAddressLeaseTime(o dhcp4.Options) (time.Duration, error)
- func GetMaximumDHCPMessageSize(o dhcp4.Options) (uint16, error)
- func GetMeritDumpFile(o dhcp4.Options) string
- func GetRootPath(o dhcp4.Options) string
- func GetString(code dhcp4.OptionCode, o dhcp4.Options) string
- type DHCPMessageType
- type IP
- type IPs
- func GetCookieServers(o dhcp4.Options) IPs
- func GetDomainNameServers(o dhcp4.Options) IPs
- func GetIPs(code dhcp4.OptionCode, o dhcp4.Options) IPs
- func GetImpressServers(o dhcp4.Options) IPs
- func GetLPRServers(o dhcp4.Options) IPs
- func GetLogServers(o dhcp4.Options) IPs
- func GetNBDDServer(o dhcp4.Options) IPs
- func GetNBNServer(o dhcp4.Options) IPs
- func GetNameServers(o dhcp4.Options) IPs
- func GetNetworkInformationServers(o dhcp4.Options) IPs
- func GetNetworkTimeProtocolServers(o dhcp4.Options) IPs
- func GetResourceLocationServers(o dhcp4.Options) IPs
- func GetRouters(o dhcp4.Options) IPs
- func GetTimeServers(o dhcp4.Options) IPs
- func GetXWindowSystemDisplayManager(o dhcp4.Options) IPs
- func GetXWindowSystemFontServer(o dhcp4.Options) IPs
- type OptionCodes
- type String
- type SubnetMask
- type Uint16
- type Uint32
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetDomainName ¶
GetDomainName returns the domain name that should be used with DNS resolvers in `o`.
This returns empty string if the option is not present or did not contain a valid value.
The domain name option is defined by RFC 2132, Section 3.17.
func GetExtensionsPath ¶
GetExtensionsPath returns the extension path name in `o`.
This returns empty string if the option is not present or did not contain a valid value.
The extension path option is defined by RFC 2132, Section 3.20.
func GetHostName ¶
GetHostName returns the host name in `o`.
This returns empty string if the option is not present or did not contain a valid value.
The host name option is defined by RFC 2132, Section 3.14.
func GetIPAddressLeaseTime ¶
GetIPAddressLeaseTime returns the proposed lease time.
The IP address lease time message is defined by RFC 2132, Section 9.2.
func GetMaximumDHCPMessageSize ¶
GetMaximumDHCPMessageSize returns the maximum DHCP message size of `o`.
The maximum DHCP message size option is defined by RFC 2132, Section 9.10.
func GetMeritDumpFile ¶
GetMeritDumpFile returns the path name to be used for client crash's core dumps.
This returns empty string if the option is not present or did not contain a valid value.
The merit dump file is defined by RFC 2132, Section 3.16.
func GetRootPath ¶
GetRootPath returns the disk's root path name in `o`.
This returns empty string if the option is not present or did not contain a valid value.
The root path option is defined by RFC 2132, Section 3.19.
Types ¶
type DHCPMessageType ¶
type DHCPMessageType uint8
DHCPMessageType implements encoding.BinaryMarshaler and encapsulates binary encoding and decoding methods for DHCP message types as specified by RFC 2132, Section 9.6.
const ( DHCPDiscover DHCPMessageType = 1 DHCPOffer DHCPMessageType = 2 DHCPRequest DHCPMessageType = 3 DHCPDecline DHCPMessageType = 4 DHCPACK DHCPMessageType = 5 DHCPNAK DHCPMessageType = 6 DHCPRelease DHCPMessageType = 7 DHCPInform DHCPMessageType = 8 )
Legal values of DHCP message types as per RFC 2132, Section 9.6.
func GetDHCPMessageType ¶
func GetDHCPMessageType(o dhcp4.Options) DHCPMessageType
GetDHCPMessageType returns the DHCP message type of `o`.
This returns 0 if the option is not present or did not contain a valid value.
The DHCP message type option is defined by RFC 2132, Section 9.6.
func (DHCPMessageType) MarshalBinary ¶
func (d DHCPMessageType) MarshalBinary() ([]byte, error)
MarshalBinary marshals the DHCP message type option to binary.
func (*DHCPMessageType) UnmarshalBinary ¶
func (d *DHCPMessageType) UnmarshalBinary(p []byte) error
UnmarshalBinary unmarshals the DHCP message type option from binary.
type IP ¶
IP implements encoding.BinaryMarshaler and encapsulates binary encoding and decoding for an IPv4 IP as defined by RFC 2132 for the options in Sections 3.18, 5.3, 5.7, 9.1, and 9.5.
func GetBroadcastAddress ¶
GetBroadcastAddress returns the client's subnet broadcast address of `o`.
This returns nil if the option is not present or did not contain a valid value.
The broadcast address option is defined by RFC 2132, Section 5.3.
func GetIP ¶
func GetIP(code dhcp4.OptionCode, o dhcp4.Options) IP
GetIP returns the IP encoded in `code` option of `o`, if there is one.
func GetRequestedIPAddress ¶
GetRequestedIPAddress returns the client's requested IP in `o`.
This returns nil if the option is not present or did not contain a valid value.
The requested IP address option is defined by RFC 2132, Section 9.1.
func GetRouterSolicitationAddress ¶
GetRouterSolicitationAddress returns the router solicitation IP of `o`.
This returns nil if the option is not present or did not contain a valid value.
The router solicitation address option is defined by RFC 2132, Section 5.7.
func GetServerIdentifier ¶
GetServerIdentifier returns the server's identifier IP in `o`.
This returns nil if the option is not present or did not contain a valid value.
The server identifier option is defined by RFC 2132, Section 9.5.
func GetSwapServer ¶
GetSwapServer returns the swap server IP of `o`.
This returns nil if the option is not present or did not contain a valid value.
The swap server option is defined by RFC 2132, Section 3.18.
func (IP) MarshalBinary ¶
MarshalBinary writes the IP address to binary.
func (*IP) UnmarshalBinary ¶
UnmarshalBinary reads the IP address from binary.
type IPs ¶
IPs implements encoding.BinaryMarshaler and encapsulates binary encoding and decoding methods for a list of IPs as used by RFC 2132 for options in Sections 3.5 through 3.13, 8.2, 8.3, 8.5, 8.6, 8.9, and 8.10.
func GetCookieServers ¶
GetCookieServers returns the list of RFC 865 cookie server IPs in `o`.
This returns nil if the option is not present or did not contain a valid value.
The cookie server option is defined by RFC 2132, Section 3.10.
func GetDomainNameServers ¶
GetDomainNameServers returns the list of DNS server IPs in `o`.
This returns nil if the option is not present or did not contain a valid value.
The domain name server option is defined by RFC 2132, Section 3.8.
func GetIPs ¶
func GetIPs(code dhcp4.OptionCode, o dhcp4.Options) IPs
GetIPs returns the list of IPs encoded in `code` option of `o`.
func GetImpressServers ¶
GetImpressServers returns the list of Imagen Impress server IPs in `o`.
This returns nil if the option is not present or did not contain a valid value.
The impress server option is defined by RFC 2132, Section 3.12.
func GetLPRServers ¶
GetLPRServers returns the list of RFC 1179 line printer server IPs in `o`.
This returns nil if the option is not present or did not contain a valid value.
The LPR server option is defined by RFC 2132, Section 3.11.
func GetLogServers ¶
GetLogServers returns the list of MIT-LCS UDP log server IPs in `o`.
This returns nil if the option is not present or did not contain a valid value.
The log server option is defined by RFC 2132, Section 3.9.
func GetNBDDServer ¶
GetNBDDServer returns the list of NetBIOS over TCP/IP Datagram Distribution server IPs in `o`.
This returns nil if the option is not present or did not contain a valid value.
The NetBIOS over TCP/IP Datagram Distribution Server option is defined by RFC 2132, Section 8.6.
func GetNBNServer ¶
GetNBNServer returns the list of NetBIOS over TCP/IP name server IPs in `o`.
This returns nil if the option is not present or did not contain a valid value.
The NetBIOS over TCP/IP name server option is defined by RFC 2132, Section 8.5.
func GetNameServers ¶
GetNameServers returns the list of IEN 116 name server IPs in `o`.
This returns nil if the option is not present or did not contain a valid value.
The name server option is defined by RFC 2132, Section 3.7.
func GetNetworkInformationServers ¶
GetNetworkInformationServers returns the list of NI server IPs in `o`.
This returns nil if the option is not present or did not contain a valid value.
The network information server option is defined by RFC 2132, Section 8.2.
func GetNetworkTimeProtocolServers ¶
GetNetworkTimeProtocolServers returns the list of NTP server IPs in `o`.
This returns nil if the option is not present or did not contain a valid value.
The network time protocol server option is defined by RFC 2132, Section 8.3.
func GetResourceLocationServers ¶
GetResourceLocationServers returns the list of RFC 887 Resource Location server IPs in `o`.
This returns nil if the option is not present or did not contain a valid value.
The resource location server option is defined by RFC 2132, Section 3.13.
func GetRouters ¶
GetRouters returns the list of router IPs in `o`.
This returns nil if the option is not present or did not contain a valid value.
The router option is defined by RFC 2132, Section 3.5.
func GetTimeServers ¶
GetTimeServers returns the list of time server IPs in `o`.
This returns nil if the option is not present or did not contain a valid value.
The time server option is defined by RFC 2132, Section 3.6.
func GetXWindowSystemDisplayManager ¶
GetXWindowSystemDisplayManager returns the list of X window system display manager server IPs in `o`.
This returns nil if the option is not present or did not contain a valid value.
The X window system display manager option is defined by RFC 2132, Section 8.10.
func GetXWindowSystemFontServer ¶
GetXWindowSystemFontServer returns the list of X window system font server IPs in `o`.
This returns nil if the option is not present or did not contain a valid value.
The X window system font server option is defined by RFC 2132, Section 8.9.
func (IPs) MarshalBinary ¶
MarshalBinary writes the list of IPs to binary.
func (*IPs) UnmarshalBinary ¶
UnmarshalBinary reads a list of IPs from binary.
type OptionCodes ¶
type OptionCodes []dhcp4.OptionCode
OptionCodes implements encoding.BinaryMarshaler and encapsulates binary encoding and decoding methods of DHCP option codes as specified in RFC 2132 Section 9.8.
func GetParameterRequestList ¶
func GetParameterRequestList(o dhcp4.Options) OptionCodes
GetParameterRequestList returns the list of requested DHCP option codes in `o`.
This returns nil if the option is not present or did not contain a valid value.
The parameter request list option is defined by RFC 2132, Section 9.8.
func (OptionCodes) MarshalBinary ¶
func (o OptionCodes) MarshalBinary() ([]byte, error)
MarshalBinary writes the option code list to binary.
func (*OptionCodes) UnmarshalBinary ¶
func (o *OptionCodes) UnmarshalBinary(p []byte) error
UnmarshalBinary reads the option code list from binary.
type String ¶
type String string
String implements encoding.BinaryMarshaler and encapsulates binary encoding and decoding of strings as specified by RFC 2132 in Sections 3.14, 3.16, 3.17, 3.19, and 3.20.
func (String) MarshalBinary ¶
MarshalBinary writes the string to binary.
type SubnetMask ¶
SubnetMask implements encoding.BinaryMarshaler and encapsulates binary encoding and decoding methods for a subnet mask as specified by RFC 2132, Section 3.3.
func GetSubnetMask ¶
func GetSubnetMask(o dhcp4.Options) SubnetMask
GetSubnetMask returns the subnet mask of `o`.
This returns nil if the option is not present or did not contain a valid value.
The subnet mask option is defined by RFC 2132, Section 3.3.
func (SubnetMask) MarshalBinary ¶
func (s SubnetMask) MarshalBinary() ([]byte, error)
MarshalBinary writes the subnet mask option to binary.
func (*SubnetMask) UnmarshalBinary ¶
func (s *SubnetMask) UnmarshalBinary(p []byte) error
UnmarshalBinary reads the subnet mask option from binary.
type Uint16 ¶
type Uint16 uint16
Uint16 implements encoding.BinaryMarshaler and encapsulates binary encoding and decoding methods of uint16s as defined by RFC 2132 Section 9.10.
func (Uint16) MarshalBinary ¶
MarshalBinary writes the uint16 to binary.
func (*Uint16) UnmarshalBinary ¶
UnmarshalBinary reads the uint16 from binary.
type Uint32 ¶
type Uint32 uint32
Uint32 implements encoding.BinaryMarshaler and encapsulates binary encoding and decoding methods of uint32s as defined by RFC 2132 Section 9.2.
func (Uint32) MarshalBinary ¶
MarshalBinary writes the uint32 to binary.
func (*Uint32) UnmarshalBinary ¶
UnmarshalBinary reads the uint32 from binary.