OneDHCPD.Message (one_dhcpd v3.0.0)

Copy Markdown View Source

DHCP Message

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

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.

Types

t()

@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()
}

Functions

decode(arg1)

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

Decode the contents of a UDP packet

encode(message)

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

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

response(request)

@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.