Permalink
Browse files

Suggestions from tidier.

  • Loading branch information...
1 parent 1cc6df6 commit 499d00fbdab2cf39234728e39fc1a3807227c490 @msantos committed Feb 2, 2010
Showing with 10 additions and 13 deletions.
  1. +1 −4 src/epcap_net.erl
  2. +9 −9 src/sniff.erl
View
@@ -115,10 +115,7 @@ ipv4(
Payload/binary>> = Raw
) ->
<<Hdr:160/bitstring, _/binary>> = Raw,
- Valid = case makesum(Hdr) of
- 0 -> true;
- _ -> false
- end,
+ Valid = makesum(Hdr) =:= 0,
{#ipv4{
valid = Valid,
View
@@ -121,16 +121,16 @@ iso_8601_fmt(DateTime) ->
lists:flatten(io_lib:format("~4.10.0B-~2.10.0B-~2.10.0B ~2.10.0B:~2.10.0B:~2.10.0B",
[Year, Month, Day, Hour, Min, Sec])).
-header(#tcp{} = Hdr) ->
+header(#tcp{ackno = Ackno, seqno = Seqno, win = Win} = Hdr) ->
[{flags, epcap_net:tcp_flags(Hdr)},
- {seq, Hdr#tcp.seqno},
- {ack, Hdr#tcp.ackno},
- {win, Hdr#tcp.win}];
-header(#udp{} = Hdr) ->
- [{ulen, Hdr#udp.ulen}];
-header(#icmp{} = Hdr) ->
- [{type, Hdr#icmp.type},
- {code, Hdr#icmp.code}];
+ {seq, Seqno},
+ {ack, Ackno},
+ {win, Win}];
+header(#udp{ulen = Ulen} = Hdr) ->
+ [{ulen, Ulen}];
+header(#icmp{code = Code, type = Type} = Hdr) ->
+ [{type, Type},
+ {code, Code}];
header(Packet) ->
Packet.

0 comments on commit 499d00f

Please sign in to comment.