anchor.diff:          _ -> not_tcp
       end;
   tcp_flow(_) -> not_tcp.
  -    
  +
  +-spec tcp_flow(S::ip_address(), SP::port_no(),
  +               D::ip_address(), DP::port_no()) ->
  +                      tcp_flow().
   tcp_flow(Srcaddr, Srcport, Dstaddr, Dstport) ->
       Src = {Srcaddr, Srcport},
       Dst = {Dstaddr, Dstport},
       {Src, Dst}.
   
   tcp_flow_sort(Data) ->
  -    {A,B} = tcp_flow(Data),
  -    {erlang:min(A, B), erlang:max(A, B)}.
  +    case tcp_flow(Data) of
  +        not_tcp -> not_tcp;
  +        {A,B} ->
  +            {erlang:min(A, B), erlang:max(A, B)}
  +    end.
   
   tcp_flow_fold(Idx, {_TS,Pkt}, FlowD) ->
       case tcp_flow_sort(Pkt) of
  
positive.code:           {element(1, B), read_tcp_stream(B, PacketArray)}}
       end || {Flow, Idxs} <- Flows ].
  
  tcp_packet_array(File) ->
      enet_pcap:file_foldl(File,
                           fun tcp_pa_fold/3,
                           {array:new(), 0}).
  
  tcp_pa_fold(#pcap_hdr{datalinktype=Link},
              #pcap_pkt{ts={S,US},data=P},
              {Array,Cnt}) ->
      Pkt = enet_codec:decode(Link, P, [null, ethernet, ipv4, ipv6, tcp]),
      TS = (S * 1000000) + US,
      {array:set(Cnt, {TS, Pkt}, Array), Cnt + 1}.
  
  %% Classifies based on src and dst hosts and ports only. Assumes that
  %% a flow isn't re-used within a capture.
  tcp_flows(PacketArray) ->
      D = array:foldl(fun tcp_flow_fold/3,
                      dict:new(),
                      PacketArray),
      dict:to_list(D).
  
  tcp_flow_parts(Flow = {A,B}, Flows, PacketArray) ->
      Idxs = proplists:get_value(Flow, Flows),
      tcp_flow_parts2(Flow, Idxs, PacketArray).
  
  tcp_flow_parts2(Flow = {A,B}, Idxs, PacketArray) ->
      { {{A,B},
         [ I || I <- Idxs,
                tcp_flow(element(2, array:get(I, PacketArray))) =:= {A,B} ]},
  
negative.code:               tcp_flow(element(2, array:get(I, PacketArray))) =:= {B,A} ]}
      }.
  
  -spec tcp_flow(packet()) -> tcp_flow() | 'not_tcp'.
  tcp_flow(#null{type = T, data = Pkt}) when T =:= ipv4;
                                             T =:= ipv6 ->
      tcp_flow(Pkt);
  