Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Switch to pkt from epcap_net

  • Loading branch information...
commit d8ab9a85353ace433c35eaf196f47633a4bbd707 1 parent 80b75e0
Michael Santos authored

Showing 2 changed files with 7 additions and 6 deletions. Show diff stats Hide diff stats

  1. +3 2 rebar.config
  2. +4 4 src/herp.erl
5 rebar.config
... ... @@ -1,5 +1,6 @@
1 1 {deps, [
2   - {epcap, ".*", {git, "git://github.com/msantos/epcap.git", "master"}},
  2 + {pkt, ".*", {git, "git://github.com/msantos/pkt.git", "master"}},
3 3 {procket, ".*", {git, "git://github.com/msantos/procket.git", "master"}}
4 4 ]}.
5   -{erl_opts, [{i, "deps/epcap/include"}]}.
  5 +
  6 +{erl_opts, [{i, "deps/pkt/include"}]}.
8 src/herp.erl
@@ -33,7 +33,7 @@
33 33
34 34 -define(SERVER, ?MODULE).
35 35
36   --include("epcap_net.hrl").
  36 +-include("pkt.hrl").
37 37
38 38 -export([start/0, start/1, stop/0, bridge/2]).
39 39 -export([start_link/1]).
@@ -99,7 +99,7 @@ handle_call({packet, DstMAC, Packet}, _From, #state{
99 99 s = Socket,
100 100 i = Ifindex} = State) ->
101 101
102   - Ether = epcap_net:ether(#ether{
  102 + Ether = pkt:ether(#ether{
103 103 dhost = DstMAC,
104 104 shost = MAC,
105 105 type = ?ETH_P_IP
@@ -137,7 +137,7 @@ sniff(Socket, State) ->
137 137 timer:sleep(10),
138 138 sniff(Socket, State);
139 139 {ok, Data} ->
140   - {#ether{} = Ether, Packet} = epcap_net:ether(Data),
  140 + {#ether{} = Ether, Packet} = pkt:ether(Data),
141 141 filter(Ether, Packet, State),
142 142 sniff(Socket, State);
143 143 Error ->
@@ -147,7 +147,7 @@ sniff(Socket, State) ->
147 147 filter(#ether{shost = MAC}, _, #state{mac = MAC}) ->
148 148 ok;
149 149 filter(#ether{type = ?ETH_P_IP}, Packet, State) ->
150   - {#ipv4{daddr = DA}, _} = epcap_net:ipv4(Packet),
  150 + {#ipv4{daddr = DA}, _} = pkt:ipv4(Packet),
151 151 filter1(DA, Packet, State);
152 152 filter(_, _, _) ->
153 153 ok.

0 comments on commit d8ab9a8

Please sign in to comment.
Something went wrong with that request. Please try again.