Browse files

Switch to pkt from epcap_net

  • Loading branch information...
1 parent 80b75e0 commit d8ab9a85353ace433c35eaf196f47633a4bbd707 @msantos committed Dec 28, 2010
Showing with 7 additions and 6 deletions.
  1. +3 −2 rebar.config
  2. +4 −4 src/herp.erl
View
5 rebar.config
@@ -1,5 +1,6 @@
{deps, [
- {epcap, ".*", {git, "git://github.com/msantos/epcap.git", "master"}},
+ {pkt, ".*", {git, "git://github.com/msantos/pkt.git", "master"}},
{procket, ".*", {git, "git://github.com/msantos/procket.git", "master"}}
]}.
-{erl_opts, [{i, "deps/epcap/include"}]}.
+
+{erl_opts, [{i, "deps/pkt/include"}]}.
View
8 src/herp.erl
@@ -33,7 +33,7 @@
-define(SERVER, ?MODULE).
--include("epcap_net.hrl").
+-include("pkt.hrl").
-export([start/0, start/1, stop/0, bridge/2]).
-export([start_link/1]).
@@ -99,7 +99,7 @@ handle_call({packet, DstMAC, Packet}, _From, #state{
s = Socket,
i = Ifindex} = State) ->
- Ether = epcap_net:ether(#ether{
+ Ether = pkt:ether(#ether{
dhost = DstMAC,
shost = MAC,
type = ?ETH_P_IP
@@ -137,7 +137,7 @@ sniff(Socket, State) ->
timer:sleep(10),
sniff(Socket, State);
{ok, Data} ->
- {#ether{} = Ether, Packet} = epcap_net:ether(Data),
+ {#ether{} = Ether, Packet} = pkt:ether(Data),
filter(Ether, Packet, State),
sniff(Socket, State);
Error ->
@@ -147,7 +147,7 @@ sniff(Socket, State) ->
filter(#ether{shost = MAC}, _, #state{mac = MAC}) ->
ok;
filter(#ether{type = ?ETH_P_IP}, Packet, State) ->
- {#ipv4{daddr = DA}, _} = epcap_net:ipv4(Packet),
+ {#ipv4{daddr = DA}, _} = pkt:ipv4(Packet),
filter1(DA, Packet, State);
filter(_, _, _) ->
ok.

0 comments on commit d8ab9a8

Please sign in to comment.