Current section
9 Versions
Jump to
Current section
9 Versions
Compare versions
7
files changed
+13
additions
-13
deletions
| @@ -10,10 +10,10 @@ | |
| 10 10 | |
| 11 11 | The package can be installed by adding `dhcp_ex` to your list of dependencies in `mix.exs`: |
| 12 12 | |
| 13 | - ```elixir |
| 13 | + ```elixir |
| 14 14 | def deps do |
| 15 15 | [ |
| 16 | - {:dhcp_ex, "~> 0.1.0"} |
| 16 | + {:dhcp_ex, "~> 0.3.0"} |
| 17 17 | ] |
| 18 18 | end |
| 19 19 | ``` |
| @@ -2,7 +2,7 @@ | |
| 2 2 | [{<<"Github">>,<<"https://github.com/gsmlg-dev/ex_dhcp">>}, |
| 3 3 | {<<"Changelog">>,<<"https://hexdocs.pm/dhcp_ex/changelog.html">>}]}. |
| 4 4 | {<<"name">>,<<"dhcp_ex">>}. |
| 5 | - {<<"version">>,<<"0.2.1">>}. |
| 5 | + {<<"version">>,<<"0.3.0">>}. |
| 6 6 | {<<"description">>,<<"DHCP resource definition in Pure Elixir">>}. |
| 7 7 | {<<"elixir">>,<<"~> 1.13">>}. |
| 8 8 | {<<"app">>,<<"dhcp_ex">>}. |
| @@ -18,7 +18,7 @@ defmodule DHCP do | |
| 18 18 | requesting initialization parameters from a DHCP server. |
| 19 19 | |
| 20 20 | """ |
| 21 | - def to_binary(value) do |
| 22 | - DHCP.Parameter.to_binary(value) |
| 21 | + def to_iodata(value) do |
| 22 | + DHCP.Parameter.to_iodata(value) |
| 23 23 | end |
| 24 24 | end |
| @@ -194,7 +194,7 @@ defmodule DHCP.Message do | |
| 194 194 | } |
| 195 195 | end |
| 196 196 | |
| 197 | - def from_binary( |
| 197 | + def from_iodata( |
| 198 198 | <<op::8, htype::8, hlen::8, hops::8, xid::32, secs::16, flags::16, ciaddr::32, yiaddr::32, |
| 199 199 | siaddr::32, giaddr::32, chaddr::binary-size(16), sname::binary-size(64), |
| 200 200 | file::binary-size(128), options::binary>> |
| @@ -224,7 +224,7 @@ defmodule DHCP.Message do | |
| 224 224 | |
| 225 225 | defimpl DHCP.Parameter, for: DHCP.Message do |
| 226 226 | @impl true |
| 227 | - def to_binary(%DHCP.Message{} = message) do |
| 227 | + def to_iodata(%DHCP.Message{} = message) do |
| 228 228 | <<message.op::8, message.htype::8, message.hlen::8, message.hops::8, message.xid::32, |
| 229 229 | message.secs::16, message.flags::16, message.ciaddr::32, message.yiaddr::32, |
| 230 230 | message.siaddr::32, message.giaddr::32, message.chaddr::binary-size(16), |
| @@ -1231,7 +1231,7 @@ defmodule DHCP.Message.Option do | |
| 1231 1231 | } |
| 1232 1232 | end |
| 1233 1233 | |
| 1234 | - def from_binary(<<type::8, length::8, value::binary-size(length)>>) do |
| 1234 | + def from_iodata(<<type::8, length::8, value::binary-size(length)>>) do |
| 1235 1235 | new(type, length, value) |
| 1236 1236 | end |
| 1237 1237 | |
| @@ -1256,7 +1256,7 @@ defmodule DHCP.Message.Option do | |
| 1256 1256 | |
| 1257 1257 | def to_dhcp_binary(options) do |
| 1258 1258 | options_binary = |
| 1259 | - options |> Enum.map(fn opt -> DHCP.to_binary(opt) end) |> Enum.join(<<>>) |
| 1259 | + options |> Enum.map(fn opt -> DHCP.to_iodata(opt) end) |> Enum.join(<<>>) |
| 1260 1260 | |
| 1261 1261 | <<@magic_cookie::binary, options_binary::binary, @end_option>> |
| 1262 1262 | end |
| @@ -1617,7 +1617,7 @@ defmodule DHCP.Message.Option do | |
| 1617 1617 | |
| 1618 1618 | defimpl DHCP.Parameter, for: Option do |
| 1619 1619 | @impl true |
| 1620 | - def to_binary(%Option{} = option) do |
| 1620 | + def to_iodata(%Option{} = option) do |
| 1621 1621 | <<option.type::8, option.length::8, option.value::binary-size(option.length)>> |
| 1622 1622 | end |
| 1623 1623 | end |
Loading more files…