Skip to content

Commit

Permalink
Rename dlt_atom to link_type and export
Browse files Browse the repository at this point in the history
Use the name link_type like pcap-linktype(7) and export the function.
The underscore was added to make it similar to ether_type.
  • Loading branch information
msantos committed Mar 9, 2011
1 parent c7c7ec4 commit dc5e739
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/pkt.erl
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
valid/1,
ether/1,
ether_type/1,
link_type/1,
arp/1,
icmp/1,
ipv4/1,
Expand All @@ -61,7 +62,7 @@ decapsulate(Data) ->
decapsulate({ether, Data}, []).

decapsulate_dlt(Dlt, Data) ->
decapsulate({dlt_atom(Dlt), Data}, []).
decapsulate({link_type(Dlt), Data}, []).

decapsulate(stop, Packet) ->
lists:reverse(Packet);
Expand Down Expand Up @@ -102,8 +103,8 @@ ether_type(?ETH_P_IPV6) -> ipv6;
ether_type(?ETH_P_ARP) -> arp;
ether_type(_) -> unsupported.

dlt_atom(?DLT_EN10MB) -> ether;
dlt_atom(?DLT_LINUX_SLL) -> linux_cooked.
link_type(?DLT_EN10MB) -> ether;
link_type(?DLT_LINUX_SLL) -> linux_cooked.


proto(?IPPROTO_ICMP) -> icmp;
Expand Down

0 comments on commit dc5e739

Please sign in to comment.