Permalink
Browse files

Rename dlt_atom to link_type and export

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...
1 parent 89c2264 commit 407ef302cab2d003916acfc9a1faf10510268c07 @msantos committed Mar 9, 2011
Showing with 5 additions and 4 deletions.
  1. +4 −3 src/epcap_net.erl
  2. +1 −1 src/sniff.erl
View
@@ -52,6 +52,7 @@
ether/1,
ether_addr/1,
ether_type/1,
+ link_type/1,
arp/1,
icmp/1,
ipv4/1,
@@ -70,7 +71,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);
@@ -111,8 +112,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;
View
@@ -89,7 +89,7 @@ handle_info([
{time, timestamp(Time)},
{caplen, CapLen},
{len, Len},
- {datalink, DLT},
+ {datalink, pkt:link_type(DLT)},
% Source
{source_macaddr, string:join(ether_addr(Ether#ether.shost), ":")},

0 comments on commit 407ef30

Please sign in to comment.