Permalink
Browse files

sniff: represent flags as a list of atoms

  • Loading branch information...
1 parent 407ef30 commit 4e8c510982ee8d66fc20e2b00886aba0525aa051 @msantos committed Mar 9, 2011
Showing with 12 additions and 4 deletions.
  1. +12 −4 src/sniff.erl
View
@@ -184,11 +184,19 @@ to_ascii(_) -> $..
ether_addr(B) when is_binary(B) ->
ether_addr(binary_to_list(B));
- ether_addr(L) when is_list(L) ->
- [ hd(io_lib:format("~.16B", [N])) || N <- L ].
+ether_addr(L) when is_list(L) ->
+ [ hd(io_lib:format("~.16B", [N])) || N <- L ].
tcp_flags(#tcp{cwr = CWR, ece = ECE, urg = URG, ack = ACK,
psh = PSH, rst = RST, syn = SYN, fin = FIN}) ->
- [ atom_to_list(F) || {F,V} <-
- [{cwr,CWR}, {ece,ECE}, {urg,URG}, {ack,ACK}, {psh,PSH}, {rst,RST}, {syn,SYN}, {fin,FIN}], V =:= 1 ].
+ [ F || {F,V} <- [
+ {cwr, CWR},
+ {ece, ECE},
+ {urg, URG},
+ {ack, ACK},
+ {psh, PSH},
+ {rst, RST},
+ {syn, SYN},
+ {fin, FIN}
+ ], V =:= 1 ].

0 comments on commit 4e8c510

Please sign in to comment.