Skip to content

Commit

Permalink
Adds typespecs to enet_pcap:
Browse files Browse the repository at this point in the history
file_foldl and forech_file_packets
  • Loading branch information
archaelus committed Sep 13, 2011
1 parent 0c99493 commit 8aad6ea
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/enet_pcap.erl
Expand Up @@ -89,7 +89,10 @@ read_file(FileName, Opts) ->
read_file(FileName)
end.


-spec file_foldl(FileName::string(),
fun ((#pcap_hdr{}, #pcap_pkt{}, Acc) -> Acc),
Acc) ->
Acc.
file_foldl(FileName, FoldFun, Acc0)
when is_function(FoldFun, 3) ->
{ok, File} = file:open(FileName, [binary, read, raw]),
Expand All @@ -108,6 +111,9 @@ file_foldl(Header, File, FoldFun, Acc0)
file_foldl(Header, File, FoldFun, Acc)
end.

-spec foreach_file_packets(Filename::string(),
fun ( (#pcap_hdr{}, #pcap_pkt{}) -> any())) ->
any().
foreach_file_packets(Filename, Fun) when is_function(Fun) ->
{ok, File} = file:open(Filename, [binary, read, raw]),
{ok, Hdr} = file:read(File, ?PCAP_HDR_SIZE),
Expand Down

0 comments on commit 8aad6ea

Please sign in to comment.