Permalink
Browse files

Move to examples and rename to lager_sniff

  • Loading branch information...
1 parent f4376c5 commit 84823145f9b60c7f164c98f419ebacf92b0725dd @DeadZen committed Dec 5, 2012
Showing with 23 additions and 6 deletions.
  1. +1 −1 Makefile
  2. +19 −0 README.md
  3. +2 −4 src/gsniff.erl → examples/lager_sniff.erl
  4. +0 −1 gsniff.sh
  5. +1 −0 sniffer.sh
View
@@ -23,4 +23,4 @@ deps: $(REBAR)
examples: eg
eg:
- @erlc -I deps -o ebin examples/*.erl
+ @erlc -I deps -pz deps/lager/ebin +'{parse_transform, lager_transform}' -o ebin examples/*.erl
View
@@ -32,6 +32,25 @@ epcap includes a small example program called sniff.
% To stop sniffing
sniff:stop().
+## STREAM PROCESSING EXAMPLES
+
+ ./sniffer.sh # uses sudo
+
+ lager:trace_console([{len, '>', 65}]).
+ This traces all packet lengths greater than 65
+
+ lager:trace_console([{source_address, "10.0.0.1"}]).
+ This traces packets equal to source address 10.0.0.1
+
+ lager:trace_console(lager_util:trace_all([{len, '>', 65}, {len, '<', 100}])).
+ This traces packet lengths greater than 65 AND less than 100
+
+ lager:trace_console(lager_util:trace_any([{len, '>', 65}, {len, '<', 100}])).
+ This traces packet lengths greater than 65 OR less than 100
+
+ lager:trace_console(lager_util:trace_any([{len, 66}, {len, '>', 100}])).
+ This traces any packet length equal to 66 OR greater than 100
+
## USAGE
@@ -28,10 +28,9 @@
%% LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
%% ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
%% POSSIBILITY OF SUCH DAMAGE.
--module(gsniff).
+-module(lager_sniff).
-behaviour(gen_fsm).
-include_lib("pkt/include/pkt.hrl").
--compile({parse_transform, lager_transform}).
% Interface
-export([start/0, start/1, stop/0]).
@@ -45,8 +44,7 @@
-define(is_print(C), C >= $ , C =< $~).
-record(state, {
- pid :: pid(),
- mod :: atom()
+ pid :: pid()
}).
View
@@ -1 +0,0 @@
-sudo ./start.sh -s epcap -s lager -s gsniff start_link -s gsniff
View
@@ -0,0 +1 @@
+sudo ./start.sh -s epcap -s lager -s lager_sniff start_link -s lager_sniff

0 comments on commit 8482314

Please sign in to comment.