View Source OneDHCPD.Message (one_dhcpd v2.0.2)

DHCP Message

See RFC2131 and associated docs for details. This implementation is only intended to be complete enough to support the OneDHCPD use case.

Link to this section Summary

Functions

Decode the contents of a UDP packet

Encode a message so that it can be put in a UDP packet

Create a response to a request with some fields filled in.

Link to this section Types

@type t() :: %OneDHCPD.Message{
  broadcast_flag: integer(),
  chaddr: [byte()],
  ciaddr: :inet.ip4_address(),
  giaddr: :inet.ip4_address(),
  hops: integer(),
  htype: integer(),
  op: integer(),
  options: Keyword.t(),
  secs: integer(),
  siaddr: :inet.ip4_address(),
  xid: integer(),
  yiaddr: :inet.ip4_address()
}

Link to this section Functions

@spec decode(binary()) :: {:error, any()} | t()

Decode the contents of a UDP packet

@spec encode(t()) :: binary()

Encode a message so that it can be put in a UDP packet

@spec response(t()) :: t()

Create a response to a request with some fields filled in.

See RFC 2131 Table 3 for requirements. The caller is responsible for most of the fields.