dhcp4opts

package
v0.0.0-...-03363dc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 6, 2019 License: BSD-3-Clause Imports: 5 Imported by: 18

Documentation

Overview

Package dhcp4opts implements Options parsing for DHCPv4 options as described in RFC 2132.

Not all options are currently implemented.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDomainName

func GetDomainName(o dhcp4.Options) string

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

func GetExtensionsPath(o dhcp4.Options) string

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

func GetHostName(o dhcp4.Options) string

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

func GetIPAddressLeaseTime(o dhcp4.Options) (time.Duration, error)

GetIPAddressLeaseTime returns the proposed lease time.

The IP address lease time message is defined by RFC 2132, Section 9.2.

func GetMaximumDHCPMessageSize

func GetMaximumDHCPMessageSize(o dhcp4.Options) (uint16, error)

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

func GetMeritDumpFile(o dhcp4.Options) string

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

func GetRootPath(o dhcp4.Options) string

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.

func GetString

func GetString(code dhcp4.OptionCode, o dhcp4.Options) string

GetString returns the string encoded in the `code` option of `o`.

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

type IP net.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

func GetBroadcastAddress(o dhcp4.Options) IP

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

func GetRequestedIPAddress(o dhcp4.Options) IP

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

func GetRouterSolicitationAddress(o dhcp4.Options) IP

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

func GetServerIdentifier(o dhcp4.Options) IP

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

func GetSwapServer(o dhcp4.Options) IP

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

func (i IP) MarshalBinary() ([]byte, error)

MarshalBinary writes the IP address to binary.

func (*IP) UnmarshalBinary

func (i *IP) UnmarshalBinary(p []byte) error

UnmarshalBinary reads the IP address from binary.

type IPs

type IPs []net.IP

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

func GetCookieServers(o dhcp4.Options) IPs

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

func GetDomainNameServers(o dhcp4.Options) IPs

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

func GetImpressServers(o dhcp4.Options) IPs

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

func GetLPRServers(o dhcp4.Options) IPs

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

func GetLogServers(o dhcp4.Options) IPs

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

func GetNBDDServer(o dhcp4.Options) IPs

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

func GetNBNServer(o dhcp4.Options) IPs

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

func GetNameServers(o dhcp4.Options) IPs

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

func GetNetworkInformationServers(o dhcp4.Options) IPs

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

func GetNetworkTimeProtocolServers(o dhcp4.Options) IPs

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

func GetResourceLocationServers(o dhcp4.Options) IPs

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

func GetRouters(o dhcp4.Options) IPs

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

func GetTimeServers(o dhcp4.Options) IPs

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

func GetXWindowSystemDisplayManager(o dhcp4.Options) IPs

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

func GetXWindowSystemFontServer(o dhcp4.Options) IPs

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

func (i IPs) MarshalBinary() ([]byte, error)

MarshalBinary writes the list of IPs to binary.

func (*IPs) UnmarshalBinary

func (i *IPs) UnmarshalBinary(p []byte) error

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

func (s String) MarshalBinary() ([]byte, error)

MarshalBinary writes the string to binary.

type SubnetMask

type SubnetMask net.IPMask

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

func (u Uint16) MarshalBinary() ([]byte, error)

MarshalBinary writes the uint16 to binary.

func (*Uint16) UnmarshalBinary

func (u *Uint16) UnmarshalBinary(p []byte) error

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

func (u Uint32) MarshalBinary() ([]byte, error)

MarshalBinary writes the uint32 to binary.

func (*Uint32) UnmarshalBinary

func (u *Uint32) UnmarshalBinary(p []byte) error

UnmarshalBinary reads the uint32 from binary.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL