The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Net::DHCP::Packet::Attributes - Attribute methods for Net::DHCP::Packet

VERSION

version 0.7

SYNOPSIS

   use Net::DHCP::Packet::Attributes qw( :all );

DESCRIPTION

Provides attribute methods for Net::DHCP::Packet.

This module is not particularly useful on its own.

METHODS

comment( [STRING] )

Sets or gets the comment attribute (object meta-data only)

op( [BYTE] )

Sets/gets the BOOTP opcode.

Normal values are:

  BOOTREQUEST()
  BOOTREPLY()
htype( [BYTE] )

Sets/gets the hardware address type.

Common value is: HTYPE_ETHER() (1) = ethernet

hlen ( [BYTE] )

Sets/gets the hardware address length. Value must be between 0 and 16.

For most NIC's, the MAC address has 6 bytes.

hops ( [BYTE] )

Sets/gets the number of hops.

This field is incremented by each encountered DHCP relay agent.

xid ( [INTEGER] )

Sets/gets the 32 bits transaction id.

This field should be a random value set by the DHCP client.

secs ( [SHORT] )

Sets/gets the 16 bits elapsed boot time in seconds.

flags ( [SHORT] )

Sets/gets the 16 bits flags.

  0x8000 = Broadcast reply requested.
ciaddr ( [STRING] )

Sets/gets the client IP address.

IP address is only accepted as a string like '10.24.50.3'.

Note: IP address is internally stored as a 4 bytes binary string. See "Special methods" below.

yiaddr ( [STRING] )

Sets/gets the your IP address.

IP address is only accepted as a string like '10.24.50.3'.

Note: IP address is internally stored as a 4 bytes binary string. See "Special methods" below.

siaddr ( [STRING] )

Sets/gets the next server IP address.

IP address is only accepted as a string like '10.24.50.3'.

Note: IP address is internally stored as a 4 bytes binary string. See "Special methods" below.

giaddr ( [STRING] )

Sets/gets the relay agent IP address.

IP address is only accepted as a string like '10.24.50.3'.

Note: IP address is internally stored as a 4 bytes binary string. See "Special methods" below.

chaddr ( [STRING] )

Sets/gets the client hardware address. Its length is given by the hlen attribute.

Value is formatted as an Hexadecimal string representation.

  Example: "0010A706DFFF" for 6 bytes mac address.

Note : internal format is packed bytes string. See "Special methods" below.

sname ( [STRING] )

Sets/gets the "server host name". Maximum size is 63 bytes. If greater a warning is issued.

file ( [STRING] )

Sets/gets the "boot file name". Maximum size is 127 bytes. If greater a warning is issued.

isDhcp ( [BOOLEAN] )

Sets/gets the DHCP cookie. Returns whether the cookie is valid or not, hence whether the packet is DHCP or BOOTP.

Default value is 1, valid DHCP cookie.

padding ( [BYTES] )

Sets/gets the optional padding at the end of the DHCP packet, i.e. after DHCP options.

Convert to hex with: unpack( 'H*', $obj->padding() )

SPECIAL METHODS

These methods are provided for performance tuning only. They give access to internal data representation , thus avoiding unnecessary type conversion.

ciaddrRaw ( [STRING])

Sets/gets the client IP address in packed 4 characters binary strings.

yiaddrRaw ( [STRING] )

Sets/gets the your IP address in packed 4 characters binary strings.

siaddrRaw ( [STRING] )

Sets/gets the next server IP address in packed 4 characters binary strings.

giaddrRaw ( [STRING] )

Sets/gets the relay agent IP address in packed 4 characters binary strings.

chaddrRaw ( [STRING] )

Sets/gets the client hardware address in packed binary string. Its length is given by the hlen attribute.

SEE ALSO

Net::DHCP, Net::DHCP::Packet, Net::DHCP::Constants.

AUTHOR

Dean Hamstead <dean@fragfest.com.au>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2022 by Dean Hamstead.

This is free software, licensed under:

  The MIT (X11) License